Skip to content

Commit 5988d95

Browse files
committed
Release 13.0.0
1 parent 8dc7e93 commit 5988d95

36 files changed

+834
-321
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.1.0
1+
# @oracle/oraclejet-tooling 13.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=jet1210&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=jet1300&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.1.0
3+
### 13.0.0
44

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

lib/addtypescript.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function installTypescipt(options) {
3535
util.log('Installing Typescript');
3636
const installer = util.getInstallerCommand({ options });
3737

38-
const command = `${installer.installer} ${installer.verbs.install} typescript@${CONSTANTS.TYPESCRIPT_VERSION} --save-dev --save-exact`;
38+
const command = `${installer.installer} ${installer.verbs.install} typescript@${CONSTANTS.TYPESCRIPT_VERSION} ts-creator@~1.2.5 yargs-parser@~13.1.2 --save-dev --save-exact`;
3939
return util.exec(command);
4040
}
4141

lib/addwebpack.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ function installWebpack(options) {
5050
webpack-merge
5151
compression-webpack-plugin
5252
mini-css-extract-plugin
53-
zlib
5453
--save-dev --save-exact
5554
`.replace(/\n/g, '').replace(/\s+/g, ' ');
5655
return util.exec(command);

lib/buildCommon.js

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,14 @@ function _copyThemesToStaging(context) {
235235
// copy the entire theme/platform folder during build
236236
const ext = util.getThemeCssExtention(buildType);
237237
const src = _getThemeSrcPath(theme, ext, livereload);
238+
const themePreact = Object.assign({},
239+
{ name: `theme-${theme.name}`, platform: theme.platform, compile: false, version: util.getJETVersion() });
240+
const preactSrc = _getThemeSrcPath(themePreact, ext, livereload);
238241

239242
const dest = _getThemeDestPath(theme, stgPath, ext, livereload, platform, opts.destination);
243+
const preactDest = _getThemeDestPath(themePreact, stgPath, ext, livereload, platform,
244+
opts.destination);
245+
240246
const rwood = Object.assign({},
241247
{ name: 'redwood', platform: 'web', compile: false, version: util.getJETVersion() });
242248
if ((opts.theme.cssGeneratedType === 'add-on' && opts.theme.basetheme === CONSTANTS.DEFAULT_PCSS_THEME) || (opts.themes && opts.themes.length > 1)) {
@@ -284,6 +290,14 @@ function _copyThemesToStaging(context) {
284290
// copy to staging
285291
// copy theme/platform to staging
286292
fs.copySync(src, dest);
293+
// Copy preact theme if present
294+
if (fs.existsSync(preactSrc)) {
295+
fs.copySync(preactSrc, preactDest);
296+
if (buildType === 'release') {
297+
// Preact images need to be a peer of the code bundle.js
298+
fs.copySync(path.join(preactSrc, 'images'), path.join(stgPath, 'images'));
299+
}
300+
}
287301

288302
// copy additional resources staged-themes/theme/common
289303
_copyThemeCommonToStaging(theme, stgPath)
@@ -297,7 +311,7 @@ function _copyThemesToStaging(context) {
297311

298312
// only runs when platform is windows, fixing locale Bug 26871715
299313
function _renameNlsDirs() {
300-
const srcBase = `${config('paths').staging.stagingPath}/${config('paths').src.javascript}/libs/oj/v${util.getJETVersion()}/resources/nls`;
314+
const srcBase = `${config('paths').staging.stagingPath}/${config('paths').src.javascript}/libs/oj/${util.getJETVersionV(util.getJETVersion())}/resources/nls`;
301315
const match = glob.sync('*', { cwd: srcBase, ignore: ['*.js', '*locale*'] });
302316
match.forEach((file) => {
303317
const src = path.join(srcBase, file);
@@ -463,6 +477,18 @@ module.exports = {
463477
});
464478
},
465479

480+
injectTs: function _injectTs(context) {
481+
util.log('Running typescript injection tasks.');
482+
return new Promise((resolve, reject) => {
483+
mainJsInjector.injectTs(context)
484+
.then(() => {
485+
util.log('Task typescript injection finished.');
486+
resolve(context);
487+
})
488+
.catch(err => reject(err));
489+
});
490+
},
491+
466492
injectLocalhostCspRule: function _injectLocalhostCspRule(context) {
467493
util.log('Running localhost csp rule injection task.');
468494

@@ -816,7 +842,7 @@ module.exports = {
816842
componentList.forEach((component) => {
817843
const componentDirPath = `./${configPaths.exchangeComponents}/${component}/${CONSTANTS.JET_COMPONENT_JSON}`;
818844
const componentJson = util.readJsonAndReturnObject(`${componentDirPath}`);
819-
if (componentJson.type === 'reference') {
845+
if (componentJson.type === CONSTANTS.COMPONENT_TYPE.REFERENCE) {
820846
const npmPckgName = componentJson.package;
821847
const retObj = util.getNpmPckgInitFileRelativePath(componentJson, context.buildType);
822848
const npmPckgInitFileRelativePath = retObj.npmPckgInitFileRelativePath;

lib/buildCommon/compileTypescript.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function _compileComponentTypescript({
107107
type: 'component',
108108
tsconfigJson: {
109109
include,
110-
exclude: CONSTANTS.JEST_TEST_FILE_GLOBS.map(testFileGlob => (
110+
exclude: CONSTANTS.JEST_TEST_FILE_AND_LIBS_GLOBS.map(testFileGlob => (
111111
`${componentTypescriptPath}/${testFileGlob}`
112112
)),
113113
compilerOptions: {
@@ -124,7 +124,7 @@ function _compileComponentTypescript({
124124
// run before_component_typescript hook
125125
() => hookRunner('before_component_typescript', context),
126126
// compile component typescript
127-
() => _runTypescriptCompilation(context),
127+
() => _runTypescriptCompilation({ context, pack, component }),
128128
// copy runtime resources to /js
129129
() => _runIfTypescriptCompilationSucceeded(
130130
context,
@@ -209,7 +209,7 @@ function compileApplicationTypescript(context) {
209209
type: 'application',
210210
tsconfigJson: {
211211
include,
212-
exclude: CONSTANTS.JEST_TEST_FILE_GLOBS.map(testFileGlob => (
212+
exclude: CONSTANTS.JEST_TEST_FILE_AND_LIBS_GLOBS.map(testFileGlob => (
213213
`${applicationTypescriptPath}/${testFileGlob}`
214214
)),
215215
compilerOptions: {
@@ -224,7 +224,7 @@ function compileApplicationTypescript(context) {
224224
// run before_app_typescript hook
225225
() => hookRunner('before_app_typescript', context),
226226
// compile app typescript
227-
() => _runTypescriptCompilation(context),
227+
() => _runTypescriptCompilation({ context }),
228228
// copy runtime sources to /js
229229
() => _runIfTypescriptCompilationSucceeded(
230230
context,
@@ -319,7 +319,7 @@ function _setupTypescriptCompilation(context) {
319319
* @private
320320
* @param {object} context - build context
321321
*/
322-
function _runTypescriptCompilation(context) {
322+
function _runTypescriptCompilation({ context, pack, component }) {
323323
return new Promise((resolve) => {
324324
const configPaths = util.getConfiguredPaths();
325325
const { tsconfigJson } = context.opts.typescript;
@@ -328,6 +328,26 @@ function _runTypescriptCompilation(context) {
328328
// eslint-disable-next-line max-len
329329
// eslint-disable-next-line global-require, import/newline-after-import, import/no-dynamic-require
330330
const CustomTypescriptCompiler = require(customCompiler);
331+
332+
let apiDocDir;
333+
const components = path.join(context.opts.stagingPath, configPaths.src.javascript,
334+
configPaths.components);
335+
if (component && pack) {
336+
apiDocDir = path.join(components, pack, component);
337+
} else if (component) {
338+
apiDocDir = path.join(components, component);
339+
} else {
340+
apiDocDir = null;
341+
}
342+
// For component(s) in a pack, the version number is between the pack and component:
343+
if (apiDocDir && !context.opts[CONSTANTS.OMIT_COMPONENT_VERSION_FLAG]) {
344+
const componentVersion = util.getComponentVersion({ pack, component });
345+
if (component && pack) {
346+
apiDocDir = path.join(components, pack, componentVersion, component);
347+
} else if (component) {
348+
apiDocDir = path.join(apiDocDir, componentVersion);
349+
}
350+
}
331351
const compileOptions = {
332352
// tsconfig JSON to use for compilation
333353
tsconfigJson,
@@ -339,6 +359,7 @@ function _runTypescriptCompilation(context) {
339359
buildOptions: {
340360
debug: !!context.opts.dbg,
341361
dtDir: `${context.opts.stagingPath}/${configPaths.src.typescript}/${CONSTANTS.COMPONENTS_DT}`,
362+
apiDocDir,
342363
version: '',
343364
jetVersion: '',
344365
templatePath: path.join(
@@ -350,6 +371,7 @@ function _runTypescriptCompilation(context) {
350371
typesDir: `${context.opts.stagingPath}/${configPaths.src.javascript}/${configPaths.components}`
351372
}
352373
};
374+
353375
const { errors, parsedTsconfigJson } = CustomTypescriptCompiler.compile(compileOptions);
354376
// Replace tsconfigJson with version used by custom-tsc. This is needed if the tsconfigJson
355377
// had inherited properties from other tsconfig.json files via the "extends" option.

lib/buildCommon/copyLocalComponent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class ResourceComponentStager extends PackComponentStager {
291291
*/
292292
function generateComponentStager({ context, componentJson, srcPath, destPath }) {
293293
if (componentJson.pack) {
294-
if (componentJson.type === 'resource') {
294+
if (componentJson.type === CONSTANTS.COMPONENT_TYPE.RESOURCE) {
295295
return new ResourceComponentStager({ context, srcPath, destPath, componentJson });
296296
}
297297
return new PackComponentStager({ context, srcPath, destPath, componentJson });

lib/buildCommon/generateComponentsCache.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function generateComponentsCache({ context }) {
5757
const componentPath = path.join(componentBasePath, component);
5858
const componentJson = util.getComponentJson({ context, component });
5959
const { name: componentName, type } = componentJson;
60-
if (!componentJson.jetVersion) {
60+
if (!componentJson.jetVersion && type !== CONSTANTS.COMPONENT_TYPE.REFERENCE) {
6161
componentJson.jetVersion = util.getJETVersion();
6262
}
6363
componentsCache[componentName] = generateComponentCache({
@@ -92,7 +92,8 @@ function generateComponentsCache({ context }) {
9292
if (util.hasMissingProperty(componentInPackComponentJson, 'version')) {
9393
componentInPackComponentJson.version = packCompJson.version;
9494
}
95-
if (util.hasMissingProperty(componentInPackComponentJson, 'jetVersion')) {
95+
if (util.hasMissingProperty(componentInPackComponentJson, 'jetVersion') &&
96+
componentInPackComponentJson.type !== CONSTANTS.COMPONENT_TYPE.REFERENCE) {
9697
componentInPackComponentJson.jetVersion = packCompJson.jetVersion;
9798
}
9899
if (util.hasMissingProperty(componentInPackComponentJson, 'pack')) {
@@ -222,7 +223,7 @@ function generateComponentCache({ context, componentJson, componentPath, pack })
222223
function generateComponentImportName({ context, componentJson, pack }) {
223224
const { name: componentName } = componentJson;
224225
let importName;
225-
if (componentJson.type === 'reference') {
226+
if (componentJson.type === CONSTANTS.COMPONENT_TYPE.REFERENCE) {
226227
const mapping = pathGenerator.getReferencePath(context.buildType, true, componentJson);
227228
importName = Object.keys(mapping).pop();
228229
} else {

lib/buildCommon/minifyComponent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ function minifyComponent({ context, componentJson, componentName, destBase }) {
391391
}).generateMinificationFunction());
392392
} else if (componentHasType && componentType === 'pack') {
393393
const packComponentJson = componentJson;
394-
const packVersion = packComponentJson.version;
394+
const packVersion = context.opts[CONSTANTS.OMIT_COMPONENT_VERSION_FLAG] ? '' : packComponentJson.version;
395395
const packName = util.hasProperty(packComponentJson, 'name') && packComponentJson.name;
396396
if (!packName) {
397397
util.log.error('Missing "name" property for pack.');
@@ -416,7 +416,7 @@ function minifyComponent({ context, componentJson, componentName, destBase }) {
416416
packComponentJson
417417
}).generateMinificationFunction());
418418
break;
419-
case 'resource':
419+
case CONSTANTS.COMPONENT_TYPE.RESOURCE:
420420
minificationFunctions.push(new ResourceComponentMinifier({
421421
context,
422422
componentJson: packMemberComponentJson,

lib/buildCommon/optimizeComponent.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,18 @@ function optimizeComponentInvoker({ context, rjsOptions, tempBundleFile }) {
131131
}
132132
resolve(context);
133133
} else {
134+
// Handle the case where the before_optimize trigger has updated
135+
// the configuration used by r.js to output a non-standard optimized
136+
// component file - something other than loader.js
137+
// (This code should be revisited when main support is added for components)
138+
const loaderSignature = `${path.sep}loader.js`;
139+
let minifyFile = rjsOptions.out;
140+
if (rjsOptions.out.endsWith(loaderSignature) &&
141+
!context.opts.componentRequireJs.out.endsWith(loaderSignature)) {
142+
minifyFile = context.opts.componentRequireJs.out;
143+
}
134144
util.minifyFiles({
135-
files: [{ dest: rjsOptions.out, src: rjsOptions.out }],
145+
files: [{ dest: minifyFile, src: minifyFile }],
136146
options: context.opts.terser.options,
137147
generateSourceMaps: true,
138148
minify: true

0 commit comments

Comments
 (0)