diff --git a/LICENSE.txt b/LICENSE.txt index 618584b..9b47cfb 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,35 +1,35 @@ -Copyright (c) 2024 Oracle and/or its affiliates. - -The Universal Permissive License (UPL), Version 1.0 - -Subject to the condition set forth below, permission is hereby granted to any -person obtaining a copy of this software, associated documentation and/or data -(collectively the "Software"), free of charge and under any and all copyright -rights in the Software, and any and all patent rights owned or freely -licensable by each licensor hereunder covering either (i) the unmodified -Software as contributed to or provided by such licensor, or (ii) the Larger -Works (as defined below), to deal in both - -(a) the Software, and -(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if -one is included with the Software (each a "Larger Work" to which the Software -is contributed by such licensors), - -without restriction, including without limitation the rights to copy, create -derivative works of, display, perform, and distribute the Software and make, -use, sell, offer for sale, import, export, have made, and have sold the -Software and the Larger Work(s), and to sublicense the foregoing rights on -either these or other terms. - -This license is subject to the following condition: -The above copyright notice and either this complete permission notice or at -a minimum a reference to the UPL must be included in all copies or -substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +Copyright (c) 2024 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index 77d1a5f..9b9b836 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# @oracle/oraclejet-tooling 17.0.0 +# @oracle/oraclejet-tooling 17.1.0 ## About the tooling API This tooling API contains methods to build and serve Oracle JET web apps. It is intended to be used with task running tools such as grunt or gulp. The APIs can also be invoked directly. @@ -6,7 +6,7 @@ This tooling API contains methods to build and serve Oracle JET web apps. It is This is an open source project maintained by Oracle Corp. ## Installation -This module will be automatically installed when you scaffold a web app following the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1700&id=homepage). +This module will be automatically installed when you scaffold a web app following the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1710&id=homepage). ## Contributing This project is not accepting external contributions at this time. For bugs or enhancement requests, please file a GitHub issue unless it’s security related. When filing a bug remember that the better written the bug is, the more likely it is to be fixed. If you think you’ve found a security vulnerability, do not raise a GitHub issue and follow the instructions in our [security policy](./SECURITY.md). diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 3c638ac..838cb0a 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,6 +1,6 @@ ## Release Notes for oraclejet-tooling ## -### 17.0.0 +### 17.1.0 ### 11.0.0 * oraclejet-tooling now requires node 12.21 or later diff --git a/lib/buildCommon/compileTypescript.js b/lib/buildCommon/compileTypescript.js index ec05b82..43dcbd4 100644 --- a/lib/buildCommon/compileTypescript.js +++ b/lib/buildCommon/compileTypescript.js @@ -248,8 +248,6 @@ function compileApplicationTypescript(context) { () => hookRunner('before_app_typescript', context), // rename the index files in vcomponents in mono-packs () => _generateStubFile({ context }), - // remove the pre-existing type folders if exists - () => _removePreExistingTypesFoldersInWeb({ context }), // compile app typescript () => _runTypescriptCompilation({ context }), // copy runtime sources to /js @@ -1511,22 +1509,38 @@ function verifyOtherContentsInMonoPack({ context, packComponentJson, packContent * @param {object} context */ function _removePreExistingTypesFoldersInWeb({ context }) { - const compositeComponents = context.opts.component ? [context.opts.component] : - util.getLocalCompositeComponents(); - compositeComponents.forEach((compositeComponent) => { - const componentJson = util.getComponentJson({ component: compositeComponent }); - const pathToComponentTypesFolder = path.join( - context.opts.stagingPath, - util.isVDOMApplication() ? '' : 'ts', - context.paths.components, - compositeComponent, + let pathToComponentTypesFolder; + const { pack, component } = (context.opts && context.opts.typescript) ? + context.opts.typescript : {}; + const pathToComponentsFolder = path.join( + context.opts.stagingPath, + util.isVDOMApplication() ? '' : 'ts', + context.paths.components + ); + + if (pack && component) { + const componentJson = util.getComponentJson({ component: pack }); + pathToComponentTypesFolder = path.join( + pathToComponentsFolder, + pack, + util.useUnversionedStructure(context) ? '' : componentJson.version, + 'types', + component + ); + } else if (component) { + const componentJson = util.getComponentJson({ component }); + pathToComponentTypesFolder = path.join( + pathToComponentsFolder, + component, util.useUnversionedStructure(context) ? '' : componentJson.version, 'types' ); - if (fs.existsSync(pathToComponentTypesFolder)) { - fs.removeSync(pathToComponentTypesFolder); - } - }); + } + + if (fs.existsSync(pathToComponentTypesFolder)) { + fs.removeSync(pathToComponentTypesFolder); + } + return Promise.resolve(context); } diff --git a/lib/constants.js b/lib/constants.js index 6d7465d..a419338 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -22,7 +22,7 @@ module.exports = { DEFAULT_STABLE_THEME: 'stable', DEFAULT_BROWSER: 'chrome', DEFAULT_INSTALLER: 'npm', - SASS_VER: '8.0.0', + SASS_VER: '9.0.0', COMMON_THEME_DIRECTORY: 'common', JET_COMPOSITE_DIRECTORY: 'jet-composites', JET_COMPONENTS_DIRECTORY: 'jet_components', diff --git a/lib/mainJsInjector.js b/lib/mainJsInjector.js index fde3702..9784961 100644 --- a/lib/mainJsInjector.js +++ b/lib/mainJsInjector.js @@ -100,7 +100,7 @@ function _replaceReleasePath(context, buildType, config, platform, injectedFile) const baseUrlValue = util.readPathMappingJson().baseUrl; let newBaseUrl; - if (baseUrlValue) { + if (baseUrlValue && baseUrlInjectorPatternResult) { newBaseUrl = `${indentStr}baseUrl: ${stringChar}${baseUrlValue}${stringChar},`; } else { newBaseUrl = baseUrlResult[0]; @@ -405,7 +405,7 @@ function _addComponentsIntoTestMainFile(pathToMainTestFile, pathsObj) { function _addComponentsIntoJestTestConfig(pathToJestConfigFile, pathsObj) { const updatedModuleNameMapper = {}; const configPaths = util.getConfiguredPaths(); - const regex = /moduleNameMapper:\s*(?.*)},/gms; + const regex = /moduleNameMapper:\s*{(?.*)},/gms; const jestConfigFileContent = fs.readFileSync(pathToJestConfigFile, { encoding: 'utf-8' }); const pathToComponentsInSrc = path.join( util.destPath(), @@ -427,14 +427,25 @@ function _addComponentsIntoJestTestConfig(pathToJestConfigFile, pathsObj) { }); if (Object.getOwnPropertyNames(updatedModuleNameMapper).length !== 0) { - fs.writeFileSync( - pathToJestConfigFile, - jestConfigFileContent.replace( - regex.exec(jestConfigFileContent).groups.extractedModuleNameMapper, - JSON.stringify(updatedModuleNameMapper) - .replaceAll('}', '') - ) - ); + const executedRegex = regex.exec(jestConfigFileContent); + const extractedGroups = executedRegex && executedRegex.groups; + const extractedNameMapper = extractedGroups && extractedGroups.extractedModuleNameMapper; + if (extractedNameMapper) { + fs.writeFileSync( + pathToJestConfigFile, + jestConfigFileContent.replace( + extractedNameMapper, + JSON.stringify({ + ...JSON.parse(`{${extractedNameMapper}}`), + ...updatedModuleNameMapper + }, + false, + 6 + ).replaceAll('{', '') + .replaceAll('}', '') + ) + ); + } } } diff --git a/lib/templates/pack/component.json b/lib/templates/pack/component.json index 7560c2b..b043c36 100644 --- a/lib/templates/pack/component.json +++ b/lib/templates/pack/component.json @@ -1,7 +1,7 @@ { "name": "@pack@", "version": "1.0.0", - "jetVersion": "17.0.0", + "jetVersion": "17.1.0", "type": "pack", "displayName": "A user friendly, translatable name of the pack.", "description": "A translatable high-level description for the pack.", diff --git a/lib/webpack/webpack.common.js b/lib/webpack/webpack.common.js index 3c9f24c..3db5e0a 100644 --- a/lib/webpack/webpack.common.js +++ b/lib/webpack/webpack.common.js @@ -162,9 +162,6 @@ module.exports = { replacement: webpackUtils.getStyleLinkTags() } ]), - new MiniCssExtractPlugin({ - filename: `${configPaths.src.styles}/[name].[fullhash].css` - }), // This plugin sets options for the ojL10n-loader (in this case, just the locale name) new webpack.LoaderOptionsPlugin({ options: { diff --git a/lib/webpack/webpack.development.js b/lib/webpack/webpack.development.js index e948fc7..16c9748 100644 --- a/lib/webpack/webpack.development.js +++ b/lib/webpack/webpack.development.js @@ -11,6 +11,7 @@ const PreactRefreshPlugin = ojetUtils.requireLocalFirst('@prefresh/webpack'); const { merge } = ojetUtils.requireLocalFirst('webpack-merge'); +const MiniCssExtractPlugin = ojetUtils.requireLocalFirst('mini-css-extract-plugin'); const configPaths = ojetUtils.getConfiguredPaths(); module.exports = merge(common, { @@ -32,9 +33,12 @@ module.exports = merge(common, { compress: true, port: 8000, open: true, - hot: true, + hot: true }, plugins: [ - new PreactRefreshPlugin() + new PreactRefreshPlugin(), + new MiniCssExtractPlugin({ + filename: `${configPaths.src.styles}/[name].css` + }) ], }); diff --git a/lib/webpack/webpack.production.js b/lib/webpack/webpack.production.js index 600db73..f849420 100644 --- a/lib/webpack/webpack.production.js +++ b/lib/webpack/webpack.production.js @@ -18,13 +18,14 @@ const configPaths = ojetUtils.getConfiguredPaths(); const { CleanWebpackPlugin } = ojetUtils.requireLocalFirst('clean-webpack-plugin'); +const MiniCssExtractPlugin = ojetUtils.requireLocalFirst('mini-css-extract-plugin'); module.exports = merge(common, { mode: 'production', devtool: 'source-map', output: { - filename: 'js/[name].[fullhash].js', - chunkFilename: 'js/[name].[fullhash].js', + filename: 'js/[name].[chunkhash].js', + chunkFilename: 'js/[name].[chunkhash].js', path: path.resolve(configPaths.staging.web), clean: true }, @@ -43,6 +44,9 @@ module.exports = merge(common, { deleteOriginalAssets: false, }), new webpack.optimize.ModuleConcatenationPlugin(), - new CleanWebpackPlugin() + new CleanWebpackPlugin(), + new MiniCssExtractPlugin({ + filename: `${configPaths.src.styles}/[name].[contenthash].css` + }) ], }); diff --git a/package.json b/package.json index c57cad2..215d589 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oracle/oraclejet-tooling", - "version": "17.0.0", + "version": "17.1.0", "license": "UPL-1.0", "description": "Programmatic API to build and serve Oracle JET web and mobile applications", "keywords": [ @@ -32,10 +32,10 @@ "requirejs": "~2.3.6", "terser": "~5.19.2", "gaze": "~1.1.2", - "express": "4.19.2", + "express": "4.21.0", "connect-livereload": "~0.6.0", "tiny-lr": "2.0.0", - "serve-static": "~1.13.0", + "serve-static": "1.16.2", "serve-index": "~1.9.1", "open": "6.4.0", "svgo": "~2.7.0",