Skip to content

Commit 8dc7e93

Browse files
committed
Release 12.1.0
1 parent fc13710 commit 8dc7e93

11 files changed

+63
-19
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 12.0.0
1+
# @oracle/oraclejet-tooling 12.1.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=jet1200&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=jet1210&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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Release Notes for oraclejet-tooling ##
22

3-
### 12.0.0
3+
### 12.1.0
44

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

lib/buildCommon/stripLocalComponentJson.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ function deleteAttributesRecursively(requiredAttributes, nonRequiredExtensionAtt
161161
if (typeof attributeObject !== 'object' || attributeObject === null) {
162162
return;
163163
}
164+
if (parentAttribute === 'value') {
165+
return;
166+
}
164167
deleteAttributes(requiredAttributes, nonRequiredExtensionAttributes,
165168
attributeObject, parentAttribute);
166169
const attributes = Object.getOwnPropertyNames(attributeObject);

lib/defaultconfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ module.exports = {
120120
cwd: paths.src.common,
121121
src: [
122122
'**',
123-
`!${paths.src.javascript}/**/*.js`,
123+
(paths.src.javascript === paths.src.typescript) ? `${paths.src.javascript}/**/*.js` : `!${paths.src.javascript}/**/*.js`,
124124
`${paths.src.javascript}/main.js`,
125125
`${paths.src.javascript}/libs/**`,
126126
`!${paths.src.javascript}/libs/**/*debug*`,

lib/rjsConfigGenerator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ function _getExchangeCcaPathMapping(context, buildType, masterJson, requirejs) {
267267
exchangeComponentPath = path.join(exchangeComponentPath, version);
268268
}
269269
if (buildType === 'release' && _isMinified(exchangeComponent, version)) {
270-
exchangeComponentPath = path.join(exchangeComponentPath, 'min');
270+
exchangeComponentPath = 'empty:';
271271
}
272272
}
273273
pathMappingObj[exchangeComponent] = requirejs ? exchangeComponentPath : `'${exchangeComponentPath}'`;

lib/scopes/component.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ component.add = function (componentNames, options) {
5959
.then(() => { // eslint-disable-line
6060
return exchangeUtils.resolve('add', componentNames, options);
6161
})
62-
.then(_executeSolutions)
62+
.then(result => _executeSolutions(result, options))
6363
.then(() => {
6464
util.log.success(`Component(s) '${componentNames}' added.`, options);
6565
resolve();
@@ -70,7 +70,7 @@ component.add = function (componentNames, options) {
7070
});
7171
};
7272

73-
function _executeSolutions(resolutionServiceResponse) {
73+
function _executeSolutions(resolutionServiceResponse, options) {
7474
return new Promise((resolve, reject) => {
7575
if (resolutionServiceResponse.solutions.length === 0) {
7676
if (resolutionServiceResponse.message) {
@@ -82,10 +82,10 @@ function _executeSolutions(resolutionServiceResponse) {
8282
util.log('Updating project components.');
8383
_applyEnvironmentChangesRemove(resolutionServiceResponse.solutions[0])
8484
.then((solution) => { // eslint-disable-line
85-
return _applyEnvironmentChangesAddOrUpdate(solution, 'add');
85+
return _applyEnvironmentChangesAddOrUpdate(solution, 'add', options);
8686
})
8787
.then((solution) => { // eslint-disable-line
88-
return _applyEnvironmentChangesAddOrUpdate(solution, 'update');
88+
return _applyEnvironmentChangesAddOrUpdate(solution, 'update', options);
8989
})
9090
.then(_applyConfigChanges)
9191
.then(() => {
@@ -158,7 +158,7 @@ function _applyEnvironmentChangesRemove(solution) {
158158
});
159159
}
160160

161-
function _applyEnvironmentChangesAddOrUpdate(solution, type) {
161+
function _applyEnvironmentChangesAddOrUpdate(solution, type, options) {
162162
return new Promise((resolve, reject) => {
163163
const changes = solution.environmentChanges;
164164
const componentsDirPath = util.getConfiguredPaths().exchangeComponents;
@@ -215,7 +215,7 @@ function _applyEnvironmentChangesAddOrUpdate(solution, type) {
215215
});
216216
}
217217
});
218-
_installComponents(componentDescriptors)
218+
_installComponents(componentDescriptors, options)
219219
.then(() => {
220220
if (componentDescriptors.length > 0) {
221221
util.log(`${counter} component(s) added to project.`);
@@ -314,9 +314,10 @@ function _mergeChanges(components, changes) {
314314
*
315315
* @public
316316
* @param {Array} componentDescriptors
317+
* @param {Object} options
317318
* @returns {Promise}
318319
*/
319-
function _installComponents(componentDescriptors) {
320+
function _installComponents(componentDescriptors, options) {
320321
const profiler = util.profilerFactory(measurementsMap);
321322

322323
return new Promise((resolve, reject) => {
@@ -329,7 +330,7 @@ function _installComponents(componentDescriptors) {
329330
profiler.profile(_fetchArchive, componentMetadata, 'fetchComponent')
330331
.then(compMetadata2 => profiler.profile(_unpackArchive, compMetadata2, 'unpackArchive'))
331332
.then(_enhanceComponentMetadata)
332-
.then(compMetadata3 => profiler.profile(_installReferenceComponent, compMetadata3, 'installReferences'))
333+
.then(compMetadata3 => profiler.profile(_installReferenceComponent, { metadata: compMetadata3, options }, 'installReferences'))
333334
.then(_shufflePackComponentResources)
334335
.then(_addToTsconfigPathMapping)
335336
.then(() => {
@@ -492,18 +493,21 @@ function _enhanceComponentMetadata(componentMetadata) {
492493
* ## _installReferenceComponent
493494
*
494495
* @private
495-
* @param {Object} componentMetadata
496+
* @param {Object} obj: componentMetadata, options
496497
* @returns {Promise}
497498
*/
498-
function _installReferenceComponent(componentMetadata) {
499+
function _installReferenceComponent(obj) {
499500
return new Promise((resolve, reject) => {
501+
const componentMetadata = obj.metadata;
502+
const options = obj.options;
500503
if (componentMetadata.type === 'reference') {
501504
// Call npm install <componentName>
502505
const npmPackageName = componentMetadata.component.package;
503506
const npmPackageVersion = componentMetadata.component.version;
504507
const npmPackage = `${npmPackageName}@${npmPackageVersion}`;
508+
const installer = util.getInstallerCommand({ options });
505509
util.log(`Installing npm package '${npmPackage}' referenced by '${componentMetadata.fullName}.'`);
506-
util.spawn('npm', ['install', npmPackage])
510+
util.spawn(installer.installer, [installer.verbs.install, npmPackage])
507511
.then(() => {
508512
util.log(`Npm package '${npmPackage}' was successfully installed.`);
509513
resolve(componentMetadata);

lib/templates/pack/component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@pack@",
33
"version": "1.0.0",
4-
"jetVersion": "12.0.0",
4+
"jetVersion": "12.1.0",
55
"type": "pack",
66
"displayName": "A user friendly, translatable name of the pack.",
77
"description": "A translatable high-level description for the pack.",

lib/webpack/build.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ module.exports = (options) => {
1010
const ojetUtils = require('../util');
1111
// eslint-disable-next-line global-require
1212
const setup = require('./setup');
13+
// eslint-disable-next-line global-require
14+
const webpackUtils = require('./utils');
1315
return new Promise((resolve, reject) => {
1416
ojetUtils.log('Building with Webpack');
1517
const { context, webpack, webpackConfig } = setup({ options, platform: 'web' });
@@ -21,6 +23,11 @@ module.exports = (options) => {
2123
}
2224
reject(err.details);
2325
}
26+
// In release mode, we inject the redwood files link directly into the index.html
27+
// in the src folder. This process removes the <!-- css: redwood --> tag, which we
28+
// need to restore and remove injected link that at this point will already be
29+
// reflected in web/index.html.
30+
webpackUtils.restoreRedwoodTag(options);
2431
console.log(stats.toString());
2532
resolve(context);
2633
});

lib/webpack/setup.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
const path = require('path');
88

99
const ojetUtils = require('../util');
10+
const webpackUtils = require('./utils');
1011
const config = require('../config');
1112
const valid = require('../validations');
1213
const generateComponentsCache = require('../buildCommon/generateComponentsCache');
@@ -29,6 +30,12 @@ module.exports = ({ options, platform }) => {
2930
config.set('componentsCache', generateComponentsCache({ context }));
3031
let webpackConfig;
3132
if (context.buildType === 'release') {
33+
// In the release mode, the ./src/index.html file is minified. This process
34+
// removes the <!-- css: redwood --> tag before the appropriate redwood css
35+
// files link is injected. No tag, no injecting the link in ./web/index.html.
36+
// So, we inject the link right before the minification process happens to ensure
37+
// that the link is present in ./web/index.html.
38+
webpackUtils.injectRedwoodThemeFileLink(context);
3239
// eslint-disable-next-line global-require
3340
webpackConfig = require('./webpack.production');
3441
} else {

lib/webpack/utils.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
*/
77
const path = require('path');
8+
const fs = require('fs-extra');
89
const ojetUtils = require('../util');
910

1011
const configPaths = ojetUtils.getConfiguredPaths();
@@ -17,6 +18,7 @@ const localComponentsPath = path.resolve(
1718
const oracleJetDistPath = path.join(ojetUtils.getOraclejetPath(), 'dist');
1819
const oracleJetDistCssPath = path.join(oracleJetDistPath, 'css');
1920
const oracleJetDistJsLibsPath = path.join(oracleJetDistPath, 'js/libs');
21+
const pathToSrcHTML = path.resolve(configPaths.src.common, 'index.html');
2022
// eslint-disable-next-line no-useless-escape
2123
const htmlTokenPattern = /(<!--\s*|@@)(css|js|img):([\w-\/]+)(\s*-->)?/g;
2224
const htmlTokenResources = {
@@ -51,6 +53,25 @@ function isWebComponent(resourcePath) {
5153
return component === undefined ? false : !!ojetUtils.getComponentsCache()[component];
5254
}
5355

56+
function injectRedwoodThemeFileLink(context) {
57+
if (context.opts.theme.name === 'redwood') {
58+
const htmlContent = fs.readFileSync(pathToSrcHTML, { encoding: 'utf8' });
59+
// eslint-disable-next-line no-useless-escape
60+
const regex = new RegExp(/(<!--\s*|@@)(css|js|img):([\w\/]+)(\s*-->)?/, 'g');
61+
const redwoodMinPath = htmlTokenReplacementFunction(undefined, undefined, 'css', 'redwood', '-->', undefined);
62+
fs.writeFileSync(pathToSrcHTML, htmlContent.replace(regex, redwoodMinPath));
63+
}
64+
}
65+
66+
function restoreRedwoodTag(context) {
67+
if (context.buildType === 'release') {
68+
// eslint-disable-next-line quotes
69+
const regex = new RegExp(/<link\s.*redwood-min.css">/, 'g');
70+
const htmlContent = fs.readFileSync(pathToSrcHTML, { encoding: 'utf8' });
71+
fs.writeFileSync(pathToSrcHTML, htmlContent.replace(regex, '<!-- css:redwood -->'));
72+
}
73+
}
74+
5475
module.exports = {
5576
isWebComponent,
5677
localComponentsPath,
@@ -59,5 +80,7 @@ module.exports = {
5980
oracleJetDistCssPath,
6081
oracleJetDistJsLibsPath,
6182
htmlTokenPattern,
62-
htmlTokenReplacementFunction
83+
htmlTokenReplacementFunction,
84+
injectRedwoodThemeFileLink,
85+
restoreRedwoodTag
6386
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@oracle/oraclejet-tooling",
3-
"version": "12.0.0",
3+
"version": "12.1.0",
44
"license": "UPL-1.0",
55
"description": "Programmatic API to build and serve Oracle JET web and mobile applications",
66
"keywords": [

0 commit comments

Comments
 (0)