Skip to content

Commit 3345ab2

Browse files
committed
17.0.0
1 parent e144b23 commit 3345ab2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+435
-212
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# @oracle/oraclejet-tooling 16.1.0
1+
# @oracle/oraclejet-tooling 17.0.0
22

33
## About the tooling API
44
This tooling API contains methods to build and serve Oracle JET web apps. It is intended to be used with task running tools such as grunt or gulp. The APIs can also be invoked directly.
55

66
This is an open source project maintained by Oracle Corp.
77

88
## Installation
9-
This module will be automatically installed when you scaffold a web app following the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1610&id=homepage).
9+
This module will be automatically installed when you scaffold a web app following the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1700&id=homepage).
1010

1111
## Contributing
1212
This project is not accepting external contributions at this time. For bugs or enhancement requests, please file a GitHub issue unless it’s security related. When filing a bug remember that the better written the bug is, the more likely it is to be fixed. If you think you’ve found a security vulnerability, do not raise a GitHub issue and follow the instructions in our [security policy](./SECURITY.md).

RELEASENOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Release Notes for oraclejet-tooling ##
22

3-
### 16.1.0
3+
### 17.0.0
44

55
### 11.0.0
66
* oraclejet-tooling now requires node 12.21 or later

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ sufficiently hardened for production use.
3535
[1]: mailto:secalert_us@oracle.com
3636
[2]: https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html
3737
[3]: https://www.oracle.com/security-alerts/encryptionkey.html
38-
[4]: https://www.oracle.com/security-alerts/
38+
[4]: https://www.oracle.com/security-alerts/

lib/addpwa.js

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ module.exports = function () {
4949
'manifest.json',
5050
'components/',
5151
'libs/',
52-
'styles/'
52+
'styles/',
53+
'assets/'
5354
]`;
54-
const mvvmResourcesToCache = "['index.html', 'manifest.json', 'js/', 'css/']";
55+
const mvvmResourcesToCache = "['index.html', 'manifest.json', 'js/', 'css/', 'assets/']";
5556
swJsString = swJsString.replace(mvvmResourcesToCache, vdomResourcesToCache);
5657
} else {
5758
swJsString = fs.readFileSync(
@@ -80,23 +81,59 @@ module.exports = function () {
8081
manifestJsonString.replace(appNameRegex, appName)
8182
);
8283
// 4. copy swInit.txt and add it to end of body tag index.html, add <link>
83-
// to end of header tag in index.html and update
84+
// and other necessary to end of header tag in index.html and update
8485
const swInitString = fs.readFileSync(
8586
path.join(pathToServiceWorkerTemplates, 'swInit.txt'),
8687
{ encoding: 'utf-8' }
8788
);
89+
const additionalTagsForPWALighthouseCompliance = `
90+
<meta name="apple-mobile-web-app-title" content="Oracle JET" />
91+
<meta name="theme-color" content="#000000">
92+
93+
<!-- Splash screens -->
94+
<link rel="apple-touch-startup-image" href="assets/splashscreens/splash-640x1136.jpg" media="(device-width: 320px) and (device-height: 568px)">
95+
<link rel="apple-touch-startup-image" href="assets/splashscreens/splash-750x1334.jpg" media="(device-width: 375px) and (device-height: 667px)">
96+
<link rel="apple-touch-startup-image" href="assets/splashscreens/splash-1242x2208.jpg" media="(device-width: 414px) and (device-height: 736px)">
97+
<link rel="apple-touch-startup-image" href="assets/splashscreens/splash-1125x2436.jpg" media="(device-width: 375px) and (device-height: 812px)">
98+
<link rel="apple-touch-startup-image" href="assets/splashscreens/splash-828x1792.jpg" media="(device-width: 414px) and (device-height: 896px)">
99+
<link rel="apple-touch-startup-image" href="assets/splashscreens/splash-1242x2688.jpg" media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3)">
100+
<link rel="apple-touch-startup-image" href="assets/splashscreens/splash-1536x2048.jpg" media="(device-width: 768px) and (device-height: 1024px)">
101+
<link rel="apple-touch-startup-image" href="assets/splashscreens/splash-1668x2224.jpg" media="(device-width: 834px) and (device-height: 1112px)">
102+
<link rel="apple-touch-startup-image" href="assets/splashscreens/splash-1668x2388.jpg" media="(device-width: 834px) and (device-height: 1194px)">
103+
<link rel="apple-touch-startup-image" href="assets/splashscreens/splash-2048x2732.jpg" media="(device-width: 1024px) and (device-height: 1366px)">
104+
`;
88105
fs.outputFileSync(
89106
pathToIndexHtml,
90107
indexHtmlString.replace(
91108
new RegExp('</head>', 'g'),
92-
'<link rel="manifest" href="manifest.json">\n</head>'
109+
`${additionalTagsForPWALighthouseCompliance}\n<link rel="manifest" href="manifest.json">\n</head>`
93110
).replace(
94111
new RegExp('</body>', 'g'),
95112
`${swInitString.replace(appNameRegex, appName)}\n</body>`
96113
)
97114
);
98-
// Copy over swinit.js
115+
116+
// 5. Copy the assets into the /src folder: This will add the needed
117+
// icons and splashscreens, among others.
118+
fs.copySync(
119+
path.join(pathToServiceWorkerTemplates, 'assets'),
120+
path.join(pathToApp, 'assets')
121+
);
122+
123+
// 6. Copy over swinit.js
99124
fs.copyFileSync(path.join(pathToServiceWorkerTemplates, 'swinit._js'),
100125
path.join(pathToApp, 'swinit.js'));
126+
127+
// 7. Ensure that the app name token is replaced by the app name:
128+
fs.outputFileSync(
129+
path.join(pathToApp, 'swinit.js'),
130+
fs.readFileSync(
131+
path.join(pathToApp, 'swinit.js'), { encoding: 'utf-8' }
132+
).replace(
133+
appNameRegex,
134+
appName
135+
)
136+
);
137+
101138
return Promise.resolve();
102139
};

lib/buildCommon.js

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,11 @@ function _getThemeDestPath(theme, stagingPath, ext, cssonly, servePlatform, serv
7575
} else {
7676
base = path.resolve(stagingPath, '..', 'platforms', servePlatform, 'app/src/main/assets', 'www');
7777
}
78-
dest = util.destPath(path.join(base, stylePath, theme.name, theme.version, themePlatform, '/'));
78+
dest = util.destPath(path.join(base, stylePath, theme.name, theme.version,
79+
themePlatform, path.sep));
7980
} else {
80-
dest = util.destPath(path.join(stagingPath, stylePath, theme.name, theme.version, themePlatform, '/'));
81+
dest = util.destPath(path.join(stagingPath, stylePath, theme.name, theme.version,
82+
themePlatform, path.sep));
8183
}
8284
return dest;
8385
}
@@ -212,6 +214,8 @@ function _copyMultiThemesToStaging(opts, stagingPath, livereload) {
212214

213215
const src = path.join(srcBase, singleTheme.name, themePlatform);
214216
const dest = util.destPath(path.join(stagingPath, config('paths').src.styles, singleTheme.name, singleTheme.version, themePlatform, '/'));
217+
// Code not hit in tests
218+
215219
fs.copySync(src, dest, { dereference: true });
216220

217221
// copy common dir
@@ -235,8 +239,27 @@ function _copyThemesToStaging(context) {
235239
// copy the entire theme/platform folder during build
236240
const ext = util.getThemeCssExtention(buildType);
237241
const src = _getThemeSrcPath(theme, ext, livereload);
242+
let themePreactName;
243+
244+
if (theme.basetheme === CONSTANTS.DEFAULT_PCSS_THEME ||
245+
theme.basetheme === CONSTANTS.DEFAULT_STABLE_THEME) {
246+
themePreactName = `theme-${theme.basetheme}`;
247+
} else if (theme.name === CONSTANTS.DEFAULT_PCSS_THEME ||
248+
theme.name === CONSTANTS.DEFAULT_STABLE_THEME) {
249+
themePreactName = `theme-${theme.name}`;
250+
} else {
251+
// use default theme:
252+
themePreactName = `theme-${config('defaultTheme')}`;
253+
}
254+
238255
const themePreact = Object.assign({},
239-
{ name: `theme-${theme.name}`, platform: theme.platform, compile: false, version: util.getJETVersion() });
256+
{
257+
name: themePreactName,
258+
platform: theme.platform,
259+
compile: false,
260+
version: util.getJETVersion()
261+
}
262+
);
240263
const preactSrc = _getThemeSrcPath(themePreact, ext, livereload);
241264

242265
const dest = _getThemeDestPath(theme, stgPath, ext, livereload, platform, opts.destination);
@@ -507,6 +530,17 @@ module.exports = {
507530
.catch(err => Promise.reject(err));
508531
},
509532

533+
injectFont: function _injectFont(context) {
534+
util.log('Running font injection task.');
535+
536+
return indexHtmlInjector.injectFontPath(context)
537+
.then(() => {
538+
util.log('Task index.html font path injection finished.');
539+
return Promise.resolve(context);
540+
})
541+
.catch(err => Promise.reject(err));
542+
},
543+
510544
copyThemes: function _copyThemes(context) {
511545
util.log('Running theme copy task.');
512546
return _copyThemesToStaging(context)
@@ -580,6 +614,9 @@ module.exports = {
580614
if (context.opts.sassCompile === false && svg !== true) {
581615
util.log('Sass compile skipped.');
582616
resolve(context);
617+
} else if (!util.validateSassInstall()) {
618+
util.log.warning('Sass compile skipped: node-sass is not installed. To install it, run ojet add sass.');
619+
resolve(context);
583620
} else {
584621
// require sass here to avoid depency error if node-sass is not installed
585622
const sass = require('./sass'); // eslint-disable-line global-require
@@ -835,6 +872,8 @@ module.exports = {
835872
if (npmPckgInitFileRelativePath !== undefined && retObj.npm) {
836873
// Extract out the filename portion of the path.
837874
const npmPckgInitFileNameArray = npmPckgInitFileRelativePath.split('/');
875+
// code not hit in tests
876+
838877
const npmPckgInitFileName = npmPckgInitFileNameArray[npmPckgInitFileNameArray.length - 1]; // eslint-disable-line max-len
839878
const npmPckgSrcPath = `./${CONSTANTS.NODE_MODULES_DIRECTORY}/${npmPckgName}/${npmPckgInitFileRelativePath}`; // eslint-disable-line max-len
840879
//

0 commit comments

Comments
 (0)