Skip to content

Commit b62b02c

Browse files
committed
Release 14.1.0
1 parent b6f7f93 commit b62b02c

17 files changed

+212
-178
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 14.0.0
1+
# @oracle/oraclejet-tooling 14.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=jet1400&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=jet1410&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-
### 14.0.0
3+
### 14.1.0
44

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

lib/buildCommon.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ function _copyFileToStaging(fileList) {
3636
const destDir = fileList[i].dest;
3737
const srcDir = fileList[i].src;
3838
if (_isSvgFile(srcDir)) {
39-
fs.copySync(srcDir, destDir, { overwrite: false, errorOnExist: false });
39+
fs.copySync(srcDir, destDir, { overwrite: false, errorOnExist: false, dereference: true });
4040
} else {
41-
fs.copySync(srcDir, destDir, { overwrite: true });
41+
fs.copySync(srcDir, destDir, { overwrite: true, dereference: true });
4242
}
4343
}
4444
return Promise.resolve();
@@ -94,7 +94,7 @@ function _copyThemeCommonToStaging(theme, stagingPath) {
9494
resolve();
9595
} else {
9696
try {
97-
fs.copySync(src, dest);
97+
fs.copySync(src, dest, { dereference: true });
9898
resolve();
9999
} catch (error) {
100100
reject(error);
@@ -117,10 +117,10 @@ function _copyDefaultResourcesToStaging(theme, stagingPath, themeName) {
117117
if (config('defaultTheme') === CONSTANTS.DEFAULT_THEME && themeName !== CONSTANTS.DEFAULT_PCSS_THEME && themeName !== CONSTANTS.DEFAULT_STABLE_THEME) {
118118
const commonSrc = path.join(srcBase, CONSTANTS.COMMON_THEME_DIRECTORY);
119119
const commonDest = path.join(destBase, CONSTANTS.COMMON_THEME_DIRECTORY);
120-
fs.copySync(commonSrc, commonDest);
120+
fs.copySync(commonSrc, commonDest, { dereference: true });
121121
}
122-
fs.copySync(defaultFontsSrc, defaultFontsDest);
123-
fs.copySync(defaultImagesSrc, defaultImagesDest);
122+
fs.copySync(defaultFontsSrc, defaultFontsDest, { dereference: true });
123+
fs.copySync(defaultImagesSrc, defaultImagesDest, { dereference: true });
124124
}
125125

126126
function _copyExchangeComponentsToStaging({ context, componentsSource }) {
@@ -148,7 +148,7 @@ function _copyExchangeComponentsToStaging({ context, componentsSource }) {
148148
root: context.opts.stagingPath,
149149
scripts: configPaths.src.javascript
150150
});
151-
fs.copySync(componentDirPath, destPath);
151+
fs.copySync(componentDirPath, destPath, { dereference: true });
152152
}
153153
return Promise.resolve();
154154
}
@@ -176,7 +176,7 @@ function _copyFilesExcludeScss(srcBase, destBase) {
176176
const fileStat = fs.statSync(path.join(srcBase, file));
177177
// if file is not scss file, copy to themes
178178
if (fileStat.isDirectory() || !/scss/.test(path.extname(file))) {
179-
fs.copySync(path.join(srcBase, file), path.join(destBase, file));
179+
fs.copySync(path.join(srcBase, file), path.join(destBase, file), { dereference: true });
180180
}
181181
});
182182
}
@@ -212,13 +212,13 @@ function _copyMultiThemesToStaging(opts, stagingPath, livereload) {
212212

213213
const src = path.join(srcBase, singleTheme.name, themePlatform);
214214
const dest = util.destPath(path.join(stagingPath, config('paths').src.styles, singleTheme.name, singleTheme.version, themePlatform, '/'));
215-
fs.copySync(src, dest);
215+
fs.copySync(src, dest, { dereference: true });
216216

217217
// copy common dir
218218
const commonSrc = `${srcBase}/${singleTheme.name}/${CONSTANTS.COMMON_THEME_DIRECTORY}`;
219219
const commonDest = util.destPath(path.join(stagingPath, config('paths').src.styles, singleTheme.name, singleTheme.version, CONSTANTS.COMMON_THEME_DIRECTORY));
220220
if (util.fsExistsSync(commonSrc)) {
221-
fs.copySync(commonSrc, commonDest);
221+
fs.copySync(commonSrc, commonDest, { dereference: true });
222222
}
223223
});
224224
}
@@ -248,15 +248,15 @@ function _copyThemesToStaging(context) {
248248
if ((opts.theme.cssGeneratedType === 'add-on' && opts.theme.basetheme === CONSTANTS.DEFAULT_PCSS_THEME) || (opts.themes && opts.themes.length > 1)) {
249249
const rwsrc = _getThemeSrcPath(rwood, ext, livereload);
250250
const rwdest = _getThemeDestPath(rwood, stgPath, ext, livereload, platform, opts.destination);
251-
fs.copySync(rwsrc, rwdest);
251+
fs.copySync(rwsrc, rwdest, { dereference: true });
252252
}
253253

254254
const stable = Object.assign({},
255255
{ name: 'stable', platform: 'web', compile: false, version: util.getJETVersion() });
256256
if ((opts.theme.cssGeneratedType === 'add-on' && opts.theme.basetheme === CONSTANTS.DEFAULT_STABLE_THEME) || (opts.themes && opts.themes.length > 1)) {
257257
const stsrc = _getThemeSrcPath(stable, ext, livereload);
258258
const stdest = _getThemeDestPath(stable, stgPath, ext, livereload, platform, opts.destination);
259-
fs.copySync(stsrc, stdest);
259+
fs.copySync(stsrc, stdest, { dereference: true });
260260
}
261261
// copy to themes
262262
if ((theme.name !== CONSTANTS.DEFAULT_THEME || theme.name !== CONSTANTS.DEFAULT_PCSS_THEME ||
@@ -291,10 +291,10 @@ function _copyThemesToStaging(context) {
291291
fs.copySync(src, dest);
292292
// Copy preact theme if present
293293
if (fs.existsSync(preactSrc)) {
294-
fs.copySync(preactSrc, preactDest);
294+
fs.copySync(preactSrc, preactDest, { dereference: true });
295295
if (buildType === 'release') {
296296
// Preact images need to be a peer of the code bundle.js
297-
fs.copySync(path.join(preactSrc, 'images'), path.join(stgPath, 'images'));
297+
fs.copySync(path.join(preactSrc, 'images'), path.join(stgPath, 'images'), { dereference: true });
298298
}
299299
}
300300

@@ -310,7 +310,7 @@ function _renameNlsDirs() {
310310
match.forEach((file) => {
311311
const src = path.join(srcBase, file);
312312
const dest = path.join(srcBase, `locale_${file}`);
313-
fs.copySync(src, dest, { overwrite: true });
313+
fs.copySync(src, dest, { overwrite: true, dereference: true });
314314
fs.removeSync(src);
315315
});
316316
}
@@ -702,7 +702,7 @@ module.exports = {
702702
});
703703
if (paths.length) {
704704
paths.forEach(([src, dest]) => {
705-
fs.copySync(src, dest);
705+
fs.copySync(src, dest, { dereference: true });
706706
});
707707
util.log('Copied local resource components');
708708
}
@@ -852,9 +852,9 @@ module.exports = {
852852
const destNpmpckgDirPath = `${destBasePath}/${npmPckgName}/${npmPckgInitFileName}`;
853853

854854
if (util.fsExistsSync(npmPckgSrcPath)) {
855-
fs.copySync(npmPckgSrcPath, destNpmpckgDirPath);
855+
fs.copySync(npmPckgSrcPath, destNpmpckgDirPath, { dereference: true });
856856
} else if (util.fsExistsSync(npmPckgSrcPath.concat('.js'))) {
857-
fs.copySync(npmPckgSrcPath.concat('.js'), destNpmpckgDirPath.concat('.js'));
857+
fs.copySync(npmPckgSrcPath.concat('.js'), destNpmpckgDirPath.concat('.js'), { dereference: true });
858858
}
859859
}
860860
}

lib/buildCommon/compileTypescript.js

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,10 +413,11 @@ function _runTypescriptCompilation({ context, pack, component }) {
413413
}
414414
// For component(s) in a pack, the version number is between the pack and component:
415415
if (apiDocDir && !context.opts[CONSTANTS.OMIT_COMPONENT_VERSION_FLAG]) {
416-
const componentVersion = util.getComponentVersion({ pack, component });
417416
if (component && pack) {
418-
apiDocDir = path.join(components, pack, componentVersion, component);
417+
const packVersion = util.getComponentVersion({ component: pack });
418+
apiDocDir = path.join(components, pack, packVersion, component);
419419
} else if (component) {
420+
const componentVersion = util.getComponentVersion({ component });
420421
apiDocDir = path.join(apiDocDir, componentVersion);
421422
}
422423
}
@@ -517,9 +518,11 @@ function _copyTypescriptComponentFilesToJSFolder({ context, pack, component }) {
517518
files.forEach((file) => {
518519
fs.copySync(
519520
path.join(componentSrc, file),
520-
path.join(componentDest, file)
521+
path.join(componentDest, file),
522+
{ dereference: true }
521523
);
522524
});
525+
_ensureMonoPackInfoDefaultIntoCCAComponent(files, componentDest);
523526
util.log(`Copied ${componentName} runtime resources from ${componentSrc} to ${componentDest}`);
524527
}
525528
}
@@ -560,15 +563,43 @@ function _copyTypescriptApplicationFilesToJSFolder({ context }) {
560563
files.forEach((file) => {
561564
fs.copySync(
562565
path.join(applicationSrc, file),
563-
path.join(applicationDest, file)
566+
path.join(applicationDest, file),
567+
{ dereference: true }
564568
);
565569
});
570+
_ensureMonoPackInfoDefaultIntoCCAComponent(files, applicationDest);
566571
util.log(`Copied runtime resources from /${typescriptFolder} to /${javascriptFolder}`);
567572
}
568573
}
569574
return Promise.resolve(context);
570575
}
571576

577+
/**
578+
* ## _ensureMonoPackInfoDefaultIntoCCAComponent
579+
*
580+
* This method ensures that mono-pack version and jetVersion are properly
581+
* propagated to its CCA components. This is done so because on creating the
582+
* component in the pack, these details are left out.
583+
*
584+
* @private
585+
* @param {Array} files a list of files to copy to js folder
586+
* @param {string} destPath staging js path
587+
*/
588+
function _ensureMonoPackInfoDefaultIntoCCAComponent(files, destPath) {
589+
const jsonFiles = files.filter(file => file.endsWith('component.json'));
590+
jsonFiles.forEach((jsonFile) => {
591+
const json = fs.readJSONSync(path.join(destPath, jsonFile));
592+
if (json.pack) {
593+
const { componentJson } = util.getComponentsCache()[json.pack];
594+
if (componentJson.type === 'mono-pack') {
595+
json.version = componentJson.version;
596+
json.jetVersion = componentJson.jetVersion;
597+
fs.writeJSONSync(path.join(destPath, jsonFile), json);
598+
}
599+
}
600+
});
601+
}
602+
572603
/**
573604
* ## _copyVComponentComponentJsonToJs
574605
*

lib/buildCommon/stripLocalComponentJson.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ function isNeededSubAttribute(subAttribute) {
227227
'name',
228228
'default',
229229
'transform',
230-
'extension'
230+
'extension',
231+
'implicitBusyContext'
231232
]);
232233
if (requiredSubAttributes.has(subAttribute)) {
233234
return true;

lib/scopes/component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,8 @@ component.publish = function (componentName, options) {
925925
built: hadBeenBuiltBefore
926926
});
927927

928-
// Is it a component of a type 'pack'?
929-
if ((componentMetadata.type === 'pack' || componentMetadata.type === 'pack') &&
928+
// Is it a component of a type 'pack' or 'mono-pack'?
929+
if ((componentMetadata.type === CONSTANTS.PACK_TYPE.MONO_PACK || componentMetadata.type === 'pack') &&
930930
// Pack content is already known, avoid infinite loop. Loop explanation:
931931
// Under the hood packaging of a pack calls component.package() but with a known content.
932932
!util.hasProperty(opts, '_contentToArchive')

lib/serveWebFileChangeHandler.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ module.exports = function (filePath, buildContext) {
4343
let buildPromise = Promise.resolve(buildContext);
4444
/* Copies file over for the watch events */
4545
if (_isIndexHtml(filePath)) {
46-
fs.copySync(filePath, defaultDest);
46+
fs.copySync(filePath, defaultDest, { dereference: true });
4747
buildPromise = buildCommon.injectTheme(buildContext)
4848
.then(buildCommon.injectLocalhostCspRule)
4949
.then(buildCommon.injectScripts);
5050
} else if (_isMainJs(filePath)) {
51-
fs.copySync(filePath, defaultDest);
51+
fs.copySync(filePath, defaultDest, { dereference: true });
5252
buildPromise = buildCommon.injectPaths(buildContext);
5353
} else if (util.isPathCCA(path.join(pathComponents.mid, pathComponents.end))) {
5454
const { pack, component } = util.getComponentInformationFromFilePath({
@@ -76,7 +76,8 @@ module.exports = function (filePath, buildContext) {
7676
);
7777
fs.copySync(
7878
filePath,
79-
filePathDest
79+
filePathDest,
80+
{ dereference: true }
8081
);
8182
if (isTypescriptFile) {
8283
// is a typescript file so have to run the compiler
@@ -115,11 +116,12 @@ module.exports = function (filePath, buildContext) {
115116
);
116117
fs.copySync(
117118
filePath,
118-
filePathDestJs
119+
filePathDestJs,
120+
{ dereference: true }
119121
);
120122
}
121123
} else if (isTypescriptFile) {
122-
fs.copySync(filePath, defaultDest);
124+
fs.copySync(filePath, defaultDest, { dereference: true });
123125
// eslint-disable-next-line no-param-reassign
124126
buildContext.serving = true;
125127
// provide path to file so that we only compile the file that changed
@@ -131,7 +133,7 @@ module.exports = function (filePath, buildContext) {
131133
buildPromise = buildCommon.compileApplicationTypescript(buildContext);
132134
} else if (inTypescriptFolder) {
133135
// copy to web/ts to prevent override during post-typescript copy
134-
fs.copySync(filePath, defaultDest);
136+
fs.copySync(filePath, defaultDest, { dereference: true });
135137
// copy to web/js since post-typescript copy not run
136138
const relativePathToFile = path.relative(
137139
path.join(path.sep, configPaths.src.typescript),
@@ -145,10 +147,11 @@ module.exports = function (filePath, buildContext) {
145147
);
146148
fs.copySync(
147149
filePath,
148-
filePathDest
150+
filePathDest,
151+
{ dereference: true }
149152
);
150153
} else {
151-
fs.copySync(filePath, defaultDest);
154+
fs.copySync(filePath, defaultDest, { dereference: true });
152155
}
153156
buildPromise
154157
.then(resolve)

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": "14.0.0",
4+
"jetVersion": "14.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/templates/typescript/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"ojs/*": ["./node_modules/@oracle/oraclejet/dist/types/*"],
1515
"@oracle/oraclejet-preact/*": ["./node_modules/@oracle/oraclejet-preact/*"],
1616
"oj-c/*": ["./node_modules/@oracle/oraclejet-core-pack/oj-c/types/*"],
17-
"preact": ["./node_modules/@oracle/oraclejet/dist/js/libs/preact"]
17+
"preact": ["./node_modules/preact"]
1818
},
1919
"declaration": true,
2020
"noEmitOnError": true,

lib/utils.exchange.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ exchangeUtils.uploadToExchange = function (componentOrPackName, options) {
664664
return new Promise((resolve, reject) => {
665665
const opts = options || {};
666666

667-
createMultipartData(componentOrPackName)
667+
createMultipartData(componentOrPackName, opts)
668668
.then((data) => {
669669
util.log(`Uploading '${componentOrPackName}' into Exchange.`);
670670
return util.request({
@@ -676,7 +676,7 @@ exchangeUtils.uploadToExchange = function (componentOrPackName, options) {
676676
const response = responseData.response;
677677
return exchangeUtils.validateAuthenticationOfRequest(
678678
response,
679-
() => { return exchangeUtils.uploadToExchange(componentName, opts); }, // eslint-disable-line
679+
() => { return exchangeUtils.uploadToExchange(componentOrPackName, opts); }, // eslint-disable-line
680680
() => {
681681
util.checkForHttpErrors(response, responseData.responseBody, () => {
682682
if (!opts.path) {
@@ -714,8 +714,9 @@ function createMultipartData(componentOrPackName, options) {
714714
let i = 0;
715715
function fn() {
716716
if (i < archivesToPublish.length) {
717-
const readStream = fs.createReadStream(path.join(CONSTANTS.PUBLISH_TEMP_DIRECTORY,
718-
archivesToPublish[i]));
717+
const readStream = opts.path ? fs.createReadStream(opts.path) :
718+
fs.createReadStream(path.join(CONSTANTS.PUBLISH_TEMP_DIRECTORY,
719+
archivesToPublish[i]));
719720
readStream.on('open', () => {
720721
multipart.append('file', readStream);
721722
util.log(`'${archivesToPublish[i]}' file is ok.`);

0 commit comments

Comments
 (0)