Skip to content

Commit cfa6b66

Browse files
committed
Release 10.0.0
1 parent 84cee49 commit cfa6b66

Some content is hidden

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

69 files changed

+565
-369
lines changed

CONTRIBUTING.md

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

3-
*Copyright (c) 2014, 2020 Oracle and/or its affiliates
3+
*Copyright (c) 2014, 2021 Oracle and/or its affiliates
44
Licensed under The Universal Permissive License (UPL), Version 1.0
55
as shown at https://oss.oracle.com/licenses/upl/*
66

LICENSE

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

3-
Copyright (c) 2020 Oracle and/or its affiliates.
3+
Copyright (c) 2021 Oracle and/or its affiliates.
44

55
Licensed under The Universal Permissive License (UPL), Version 1.0
66
as shown at https://oss.oracle.com/licenses/upl/

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# @oracle/oraclejet-tooling 9.2.0
1+
# @oracle/oraclejet-tooling 10.0.0
22

33
## About the tooling API
44
This tooling API contains methods to build and serve Oracle JET web and hybrid mobile 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 or hybrid mobile app following the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet920&id=homepage).
9+
This module will be automatically installed when you scaffold a web or hybrid mobile app following the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1000&id=homepage).
1010

1111
## [Contributing](https://github.com/oracle/oraclejet-tooling/blob/master/CONTRIBUTING.md)
1212
Oracle JET is an open source project. Pull Requests are currently not being accepted. See
1313
[CONTRIBUTING](https://github.com/oracle/oraclejet-tooling/blob/master/CONTRIBUTING.md)
1414
for details.
1515

1616
## [License](https://github.com/oracle/oraclejet-tooling/blob/master/LICENSE)
17-
Copyright (c) 2020 Oracle and/or its affiliates and released under the
17+
Copyright (c) 2021 Oracle and/or its affiliates and released under the
1818
[Universal Permissive License (UPL)](https://oss.oracle.com/licenses/upl/), Version 1.0

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-
### 9.2.0
3+
### 10.0.0
44
* No changes
55

66
### 5.2.0

config/eslintcustom.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
Copyright (c) 2015, 2020, Oracle and/or its affiliates.
2+
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
33
Licensed under The Universal Permissive License (UPL), Version 1.0
44
as shown at https://oss.oracle.com/licenses/upl/
55

hooks/jetAfterPrepare.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
/**
3-
Copyright (c) 2015, 2020, Oracle and/or its affiliates.
3+
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
44
Licensed under The Universal Permissive License (UPL), Version 1.0
55
as shown at https://oss.oracle.com/licenses/upl/
66

hooks/jetInjector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
Copyright (c) 2015, 2020, Oracle and/or its affiliates.
2+
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
33
Licensed under The Universal Permissive License (UPL), Version 1.0
44
as shown at https://oss.oracle.com/licenses/upl/
55

lib/add.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /usr/bin/env node
22
/**
3-
Copyright (c) 2015, 2020, Oracle and/or its affiliates.
3+
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
44
Licensed under The Universal Permissive License (UPL), Version 1.0
55
as shown at https://oss.oracle.com/licenses/upl/
66

lib/addpcss.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /usr/bin/env node
22
/**
3-
Copyright (c) 2015, 2020, Oracle and/or its affiliates.
3+
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
44
Licensed under The Universal Permissive License (UPL), Version 1.0
55
as shown at https://oss.oracle.com/licenses/upl/
66
@@ -27,7 +27,6 @@ module.exports = function () {
2727

2828
return util.spawn('npm', ['install',
2929
`node-sass@${sassVer}`,
30-
3130
3231
3332
'--save-dev=true']);

lib/addpwa.js

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#! /usr/bin/env node
2+
/**
3+
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
4+
Licensed under The Universal Permissive License (UPL), Version 1.0
5+
as shown at https://oss.oracle.com/licenses/upl/
6+
7+
*/
8+
9+
'use strict';
10+
11+
/**
12+
* ## Dependencies
13+
*/
14+
15+
const fs = require('fs-extra');
16+
const path = require('path');
17+
const CONSTANTS = require('./constants');
18+
/**
19+
* #addpwa
20+
*
21+
* @public
22+
* @returns {Promise}
23+
*/
24+
25+
module.exports = function () {
26+
return new Promise((resolve) => {
27+
// eslint-disable-next-line global-require
28+
const appName = path.basename(process.cwd());
29+
const appNameRegex = new RegExp('@AppName@', 'g');
30+
const pathToApp = path.join('src');
31+
const pathToIndexHtml = path.join(pathToApp, 'index.html');
32+
const pathToServiceWorkerTemplates = CONSTANTS.PATH_TO_PWA_TEMPLATES;
33+
// 1. read index.html
34+
const indexHtmlString = fs.readFileSync(
35+
pathToIndexHtml,
36+
{ encoding: 'utf-8' }
37+
);
38+
// 2. read sw.txt, replace app name token, write to app as js file
39+
const swJsString = fs.readFileSync(
40+
path.join(pathToServiceWorkerTemplates, 'sw.txt'),
41+
{ encoding: 'utf-8' }
42+
);
43+
const pathToAppSw = path.join(pathToApp, 'sw.js');
44+
if (fs.pathExistsSync(pathToAppSw)) {
45+
fs.renameSync(pathToAppSw, path.join(pathToApp, 'sw_old.js'));
46+
}
47+
fs.outputFileSync(
48+
pathToAppSw,
49+
swJsString.replace(appNameRegex, appName)
50+
);
51+
// 3. read manifest.json, replace app name token, write to app
52+
const manifestJsonString = fs.readFileSync(
53+
path.join(pathToServiceWorkerTemplates, 'manifest.json'),
54+
{ encoding: 'utf-8' }
55+
);
56+
const pathToAppManifest = path.join(pathToApp, 'manifest.json');
57+
if (fs.pathExistsSync(pathToAppManifest)) {
58+
fs.renameSync(pathToAppManifest, path.join(pathToApp, 'manifest_old.json'));
59+
}
60+
fs.outputFileSync(
61+
path.join(pathToApp, 'manifest.json'),
62+
manifestJsonString.replace(appNameRegex, appName)
63+
);
64+
// 4. copy swInit.txt and add it to end of body tag index.html, add <link>
65+
// to end of header tag in index.html and update
66+
const swInitString = fs.readFileSync(
67+
path.join(pathToServiceWorkerTemplates, 'swInit.txt'),
68+
{ encoding: 'utf-8' }
69+
);
70+
fs.outputFileSync(
71+
pathToIndexHtml,
72+
indexHtmlString.replace(
73+
new RegExp('</head>', 'g'),
74+
'<link rel="manifest" href="manifest.json">\n</head>'
75+
).replace(
76+
new RegExp('</body>', 'g'),
77+
`${swInitString.replace(appNameRegex, appName)}\n</body>`
78+
)
79+
);
80+
resolve();
81+
});
82+
};

0 commit comments

Comments
 (0)