Skip to content

Commit

Permalink
Release 12.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benm071 committed Feb 11, 2022
1 parent 62f2c20 commit fc13710
Show file tree
Hide file tree
Showing 83 changed files with 1,732 additions and 568 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing to oraclejet-tooling

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

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# oraclejet-tooling

Copyright (c) 2021 Oracle and/or its affiliates.
Copyright (c) 2022 Oracle and/or its affiliates.

Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# @oracle/oraclejet-tooling 11.1.0
# @oracle/oraclejet-tooling 12.0.0

## About the tooling API
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.

This is an open source project maintained by Oracle Corp.

## Installation
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=jet1110&id=homepage).
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=jet1200&id=homepage).

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

## [License](https://github.com/oracle/oraclejet-tooling/blob/master/LICENSE)
Copyright (c) 2021 Oracle and/or its affiliates and released under the
Copyright (c) 2022 Oracle and/or its affiliates and released under the
[Universal Permissive License (UPL)](https://oss.oracle.com/licenses/upl/), Version 1.0
4 changes: 3 additions & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Release Notes for oraclejet-tooling ##

### 11.1.0
### 12.0.0

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

### 5.2.0
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{"eslintDirs": ["../oraclejet-tooling/lib", "../oraclejet-tooling/hooks"],
"eslintFilter": ["!../oraclejet-tooling/**/parser/**"],
"eslintFilter": ["!../oraclejet-tooling/dist/**", "!../oraclejet-tooling/**/parser/**"],
"fixup": ["package.json"]}
2 changes: 1 addition & 1 deletion config/eslintcustom.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
Copyright (c) 2015, 2022, Oracle and/or its affiliates.
Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
Expand Down
2 changes: 1 addition & 1 deletion hooks/jetAfterPrepare.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
/**
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
Copyright (c) 2015, 2022, Oracle and/or its affiliates.
Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
Expand Down
2 changes: 1 addition & 1 deletion hooks/jetInjector.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
Copyright (c) 2015, 2022, Oracle and/or its affiliates.
Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
Expand Down
2 changes: 1 addition & 1 deletion lib/add.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env node
/**
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
Copyright (c) 2015, 2022, Oracle and/or its affiliates.
Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
Expand Down
10 changes: 6 additions & 4 deletions lib/addpcss.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env node
/**
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
Copyright (c) 2015, 2022, Oracle and/or its affiliates.
Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
Expand All @@ -18,14 +18,16 @@ const config = require('./config');
* # 'addPcss'
*
* @public
* @param {Object} options
* @returns {Promise}
*/
module.exports = function () {
util.log('Performing \'npm install\'');
module.exports = function (options) {
const installer = util.getInstallerCommand({ options });
util.log('Installing sass and pcss');
config.loadOraclejetConfig();
const sassVer = config.data.sassVer;

return util.spawn('npm', ['install',
return util.spawn(installer.installer, [installer.verbs.install,
`node-sass@${sassVer}`,
'postcss-calc@6.0.1',
'autoprefixer@9.1.5',
Expand Down
33 changes: 27 additions & 6 deletions lib/addpwa.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env node
/**
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
Copyright (c) 2015, 2022, Oracle and/or its affiliates.
Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
Expand Down Expand Up @@ -37,11 +37,29 @@ module.exports = function () {
pathToIndexHtml,
{ encoding: 'utf-8' }
);
// 2. read sw.txt, replace app name token, write to app as js file
const swJsString = fs.readFileSync(
path.join(pathToServiceWorkerTemplates, 'sw.txt'),
{ encoding: 'utf-8' }
);
// 2. read sw.txt, replace app name token and resources to cache
// according to the app's architecture, and then write to app as js file
let swJsString;
if (util.isVDOMApplication()) {
swJsString = fs.readFileSync(
path.join(pathToServiceWorkerTemplates, 'sw.txt'),
{ encoding: 'utf-8' });
const vdomResourcesToCache = `[
'index.js',
'index.html',
'bundle.js',
'manifest.json',
'components/',
'libs/',
'styles/'
]`;
const mvvmResourcesToCache = "['index.html', 'manifest.json', 'js/', 'css/']";
swJsString = swJsString.replace(mvvmResourcesToCache, vdomResourcesToCache);
} else {
swJsString = fs.readFileSync(
path.join(pathToServiceWorkerTemplates, 'sw.txt'),
{ encoding: 'utf-8' });
}
const pathToAppSw = path.join(pathToApp, 'sw.js');
if (fs.pathExistsSync(pathToAppSw)) {
fs.renameSync(pathToAppSw, path.join(pathToApp, 'sw_old.js'));
Expand Down Expand Up @@ -79,6 +97,9 @@ module.exports = function () {
`${swInitString.replace(appNameRegex, appName)}\n</body>`
)
);
// Copy over swinit.js
fs.copyFileSync(path.join(pathToServiceWorkerTemplates, 'swinit._js'),
path.join(pathToApp, 'swinit.js'));
resolve();
});
};
11 changes: 7 additions & 4 deletions lib/addsass.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env node
/**
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
Copyright (c) 2015, 2022, Oracle and/or its affiliates.
Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
Expand All @@ -18,11 +18,14 @@ const config = require('./config');
* # 'addSass'
*
* @public
* @param {Object} options
* @returns {Promise}
*/
module.exports = function () {
module.exports = function (options) {
config.loadOraclejetConfig();
const sassVer = config.data.sassVer;
util.log('Performing \'npm install node-sass\'');
return util.spawn('npm', ['install', `node-sass@${sassVer}`, '--save-dev=true']);
const installer = util.getInstallerCommand({ options });

util.log('Installing node-sass');
return util.spawn(installer.installer, [installer.verbs.install, `node-sass@${sassVer}`, '--save-dev=true']);
};
77 changes: 17 additions & 60 deletions lib/addtypescript.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /usr/bin/env node
/**
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
Copyright (c) 2015, 2022, Oracle and/or its affiliates.
Licensed under The Universal Permissive License (UPL), Version 1.0
as shown at https://oss.oracle.com/licenses/upl/
Expand All @@ -14,9 +14,8 @@

const util = require('./util');
const fs = require('fs-extra');
const exec = require('child_process').exec;
const CONSTANTS = require('./constants');
const path = require('path');
const CONSTANTS = require('./constants');

/**
* ## Helpers
Expand All @@ -29,60 +28,15 @@ const path = require('path');
* have a valid global version
*
* @private
* @param {Object} options
* @returns {Promise}
*/
function installTypescipt() {
return new Promise((resolve) => {
util.log('Installing Typescript');
exec(`npm install typescript@${CONSTANTS.TYPESCRIPT_VERSION} --save-dev --save-exact`, {
env: {
...process.env,
// speed up npm install when on vpn
NO_UPDATE_NOTIFIER: true
}
}, (error) => {
if (error) {
util.log.error(error);
} else {
resolve();
}
});
});
}
function installTypescipt(options) {
util.log('Installing Typescript');
const installer = util.getInstallerCommand({ options });

/**
* ## _injectFileIntoApplication
*
* Inject file into the application
*
* @private
* @param {string} options.name name of file
* @param {string} options.src path to file src
* @param {string} options.dest path to file dest
* @returns {Promise}
*/
function _injectFileIntoApplication({ name, src, dest }) {
util.log(`Adding ${dest}`);
return new Promise((resolve) => {
fs.pathExists(dest)
.then((exists) => {
if (!exists) {
fs.copy(src, dest)
.then(resolve)
.catch(util.log.error);
} else {
const ext = path.extname(name);
fs.rename(dest, dest.replace(ext, `_old${ext}`))
.then(() => {
fs.copy(src, dest)
.then(resolve)
.catch(util.log.error);
})
.catch(util.log.error);
}
})
.catch(util.log.error);
});
const command = `${installer.installer} ${installer.verbs.install} typescript@${CONSTANTS.TYPESCRIPT_VERSION} --save-dev --save-exact`;
return util.exec(command);
}

/**
Expand All @@ -94,7 +48,7 @@ function _injectFileIntoApplication({ name, src, dest }) {
* @returns {Promise}
*/
function injectTypescriptConfig() {
return _injectFileIntoApplication({
return util.injectFileIntoApplication({
name: CONSTANTS.TSCONFIG,
src: path.join(util.getToolingPath(), CONSTANTS.PATH_TO_TSCONFIG_TEMPLATE),
dest: CONSTANTS.TSCONFIG
Expand All @@ -111,15 +65,17 @@ function injectTypescriptConfig() {
*/
function updateTypescriptConfig() {
try {
const configPaths = util.getConfiguredPaths();
// Use oraclejetconfig.json for application paths since util.getConfiguredPaths might not
// be setup yet
const oraclejetJetConfigJson = util.readJsonAndReturnObject(CONSTANTS.ORACLE_JET_CONFIG_JSON);
const tsconfigJson = util.readJsonAndReturnObject(CONSTANTS.TSCONFIG);
// set tsconfig "include" option to refernce typescript folder based
// on values in oraclejetconfig.json
tsconfigJson.include = [
util.pathJoin(
'.',
configPaths.src.common,
configPaths.src.typescript,
oraclejetJetConfigJson.paths.source.common,
oraclejetJetConfigJson.paths.source.typescript,
'**',
'*'
)
Expand All @@ -137,10 +93,11 @@ function updateTypescriptConfig() {
* Add Typescript support to an application
*
* @public
* @param {Object} options
* @returns {Promise}
*/
module.exports = function () {
return installTypescipt()
module.exports = function (options) {
return installTypescipt(options)
.then(injectTypescriptConfig)
.then(updateTypescriptConfig)
.catch(util.log.error);
Expand Down
Loading

0 comments on commit fc13710

Please sign in to comment.