Skip to content

Commit 7f3a891

Browse files
committed
Release 11.0.0
1 parent 34fdc6c commit 7f3a891

39 files changed

+2260
-1103
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 10.1.0
1+
# @oracle/oraclejet-tooling 11.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=jet1010&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=jet1100&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

RELEASENOTES.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Release Notes for oraclejet-tooling ##
22

3-
### 10.1.0
4-
* No changes
3+
### 11.0.0
4+
* oraclejet-tooling now requires node 12.21 or later
55

66
### 5.2.0
77
* No changes

lib/addpwa.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
const fs = require('fs-extra');
1616
const path = require('path');
17+
const util = require('./util');
1718
const CONSTANTS = require('./constants');
1819
/**
1920
* #addpwa
@@ -29,7 +30,8 @@ module.exports = function () {
2930
const appNameRegex = new RegExp('@AppName@', 'g');
3031
const pathToApp = path.join('src');
3132
const pathToIndexHtml = path.join(pathToApp, 'index.html');
32-
const pathToServiceWorkerTemplates = CONSTANTS.PATH_TO_PWA_TEMPLATES;
33+
const pathToServiceWorkerTemplates = path.join(util.getToolingPath(),
34+
CONSTANTS.PATH_TO_PWA_TEMPLATES);
3335
// 1. read index.html
3436
const indexHtmlString = fs.readFileSync(
3537
pathToIndexHtml,

lib/addtypescript.js

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,41 @@ function _injectFileIntoApplication({ name, src, dest }) {
9696
function injectTypescriptConfig() {
9797
return _injectFileIntoApplication({
9898
name: CONSTANTS.TSCONFIG,
99-
src: CONSTANTS.PATH_TO_TSCONFIG_TEMPLATE,
99+
src: path.join(util.getToolingPath(), CONSTANTS.PATH_TO_TSCONFIG_TEMPLATE),
100100
dest: CONSTANTS.TSCONFIG
101101
});
102102
}
103103

104+
/**
105+
* ## updateTypescriptConfig
106+
*
107+
* Update the injected tsconfig.json
108+
*
109+
* @public
110+
* @returns {Promise}
111+
*/
112+
function updateTypescriptConfig() {
113+
try {
114+
const configPaths = util.getConfiguredPaths();
115+
const tsconfigJson = util.readJsonAndReturnObject(CONSTANTS.TSCONFIG);
116+
// set tsconfig "include" option to refernce typescript folder based
117+
// on values in oraclejetconfig.json
118+
tsconfigJson.include = [
119+
util.pathJoin(
120+
'.',
121+
configPaths.src.common,
122+
configPaths.src.typescript,
123+
'**',
124+
'*'
125+
)
126+
];
127+
fs.writeJSONSync(CONSTANTS.TSCONFIG, tsconfigJson, { spaces: 2 });
128+
return Promise.resolve();
129+
} catch (error) {
130+
return Promise.reject(error);
131+
}
132+
}
133+
104134
/**
105135
* ## addTypescript
106136
*
@@ -112,5 +142,6 @@ function injectTypescriptConfig() {
112142
module.exports = function () {
113143
return installTypescipt()
114144
.then(injectTypescriptConfig)
145+
.then(updateTypescriptConfig)
115146
.catch(util.log.error);
116147
};

lib/addwebpack.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/**
2+
Copyright (c) 2015, 2021, Oracle and/or its affiliates.
3+
Licensed under The Universal Permissive License (UPL), Version 1.0
4+
as shown at https://oss.oracle.com/licenses/upl/
5+
6+
*/
7+
const CONSTANTS = require('./constants');
8+
const util = require('./util');
9+
const exec = require('child_process').exec;
10+
11+
/**
12+
* Add "bundle" and "bundleName" properties to application's
13+
* oraclejetconfig.json file
14+
* @returns
15+
*/
16+
function updateOraclejetConfig() {
17+
return new Promise((resolve) => {
18+
util.log('Adding bundler and bundlerName properties to oraclejetconfig.json');
19+
const oraclejetConfigJson = util.readJsonAndReturnObject(CONSTANTS.ORACLE_JET_CONFIG_JSON);
20+
oraclejetConfigJson.bundler = 'webpack';
21+
oraclejetConfigJson.bundleName = CONSTANTS.DEFAULT_BUNDLE_NAME;
22+
util.writeObjectAsJsonFile(CONSTANTS.ORACLE_JET_CONFIG_JSON, oraclejetConfigJson);
23+
resolve();
24+
});
25+
}
26+
27+
/**
28+
* Install webpack and required loaders from NPM
29+
* @returns
30+
*/
31+
function installWebpack() {
32+
return new Promise((resolve) => {
33+
util.log('Installing webpack and required loaders');
34+
exec('npm i -D webpack text-loader style-loader css-loader', {
35+
env: {
36+
...process.env,
37+
// speed up npm install when on vpn
38+
NO_UPDATE_NOTIFIER: true
39+
}
40+
}, (error) => {
41+
if (error) {
42+
util.log.error(error);
43+
} else {
44+
resolve();
45+
}
46+
});
47+
});
48+
}
49+
50+
module.exports = function () {
51+
return Promise.resolve()
52+
.then(updateOraclejetConfig)
53+
.then(installWebpack);
54+
};

lib/build.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ module.exports = function build(platform, options) {
4646
// Force component builds
4747
config.set('platform', 'web');
4848
}
49+
if (options.buildType === 'release' && util.bundleWithWebpack()) {
50+
// when building in release mode with webpack as the bundler,
51+
// we need to run a debug build so that webpack can bundle and optimize
52+
// debug files (and not minified files)
53+
// eslint-disable-next-line no-param-reassign
54+
options.buildType = 'debug';
55+
// eslint-disable-next-line no-param-reassign
56+
options.release = false;
57+
// eslint-disable-next-line no-param-reassign
58+
options.bundler = 'webpack';
59+
}
4960
const validPlatform = valid.platform(platformOption);
5061
const validOptions = valid.buildOptions(options, validPlatform);
5162
const validBuildType = valid.buildType(validOptions);

0 commit comments

Comments
 (0)