Skip to content

Commit

Permalink
Release 11.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benm071 committed Oct 7, 2021
1 parent 7f730af commit bca8c92
Show file tree
Hide file tree
Showing 29 changed files with 292 additions and 93 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @oracle/ojet-cli 11.0.0
# @oracle/ojet-cli 11.1.0

## About the module
This module contains a command line interface for Oracle JET web and hybrid mobile application development.
Expand Down Expand Up @@ -64,7 +64,7 @@ Or view help on adding a plugin:
ojet help add plugin
```

For more information on the Oracle JET CLI, refer to the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1100&id=homepage).
For more information on the Oracle JET CLI, refer to the [Oracle JET Developers Guide](http://www.oracle.com/pls/topic/lookup?ctx=jet1110&id=homepage).

## [Contributing](https://github.com/oracle/ojet-cli/blob/master/CONTRIBUTING.md)
Oracle JET is an open source project. Pull Requests are currently not being accepted. See [CONTRIBUTING](https://github.com/oracle/ojet-cli/blob/master/CONTRIBUTING.md) for details.
Expand Down
4 changes: 4 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Release Notes for ojet-cli ##

### 11.1.0

* ojs/ojcss is supported as a name for the ojcss plugin

### 11.0.0

* Support for es5 code for IE11 has been removed. There will no longer be a "main_es5.js" or "batch_es5.js" generated in builds. Therefore, release builds will now directly load the bundle.js after bundling and minifying all code from main.js and the application into it. Previous versions attempted to modify portions of the main.js to refer to the bundled and minified bundle.js for release builds.
Expand Down
2 changes: 1 addition & 1 deletion common/template/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const CONSTANTS = require('../../lib/utils.constants');
const _HYBRID = 'hybrid';
const _WEB = 'web';

const _TEMPLATES_NPM_URL = '@oracle/oraclejet-templates@~11.0.0';
const _TEMPLATES_NPM_URL = '@oracle/oraclejet-templates@~11.1.0';

module.exports =
{
Expand Down
82 changes: 38 additions & 44 deletions common/template/npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,50 +78,44 @@ function _copyNpmTemplate(generator, templateSpec, destination) {
const filePathFromTemplateRoot = filePath.split(templateSegment).pop();
const isPathMappingJson = path.basename(filePath) === 'path_mapping.json';
const isIndexHtml = path.basename(filePath) === 'index.html';
if (isVDOMTemplate) {
if (isPathMappingJson) {
const pathMappingJson = fs.readJSONSync(filePath);
// baseUrl will be set from javascript location in oraclejetconfig.json
delete pathMappingJson.baseUrl;
// write to root of the app and not /src
filePathDest = path.join(destination, '../path_mapping.json');
fs.writeJSONSync(filePathDest, pathMappingJson, { spaces: 2 });
} else if (isIndexHtml) {
// remove content between injector:theme and injector:scripts tokens,
// they will be added during the build
let indexHTML = fs.readFileSync(filePath, { encoding: 'utf-8' });
const scriptsInjector = injectorUtils.scriptsInjector;
const themeInjector = injectorUtils.themeInjector;
// remove content between injector:scripts token
indexHTML = injectorUtils.removeInjectorTokensContent({
content: indexHTML,
pattern: injectorUtils.getInjectorTagsRegExp(
scriptsInjector.startTag,
scriptsInjector.endTag
),
eol: injectorUtils.getLineEnding(indexHTML),
startTag: `\t\t${scriptsInjector.startTag}`,
endTag: `\t\t${scriptsInjector.endTag}`
});
// remove content between injector:theme token
indexHTML = injectorUtils.removeInjectorTokensContent({
content: indexHTML,
pattern: injectorUtils.getInjectorTagsRegExp(
themeInjector.startTag,
themeInjector.endTag
),
eol: injectorUtils.getLineEnding(indexHTML),
startTag: `\t\t${themeInjector.startTag}`,
endTag: `\t\t${themeInjector.endTag}`
});
// write to /src
filePathDest = path.join(destination, '..', filePathFromTemplateRoot);
fs.outputFileSync(filePathDest, indexHTML, { encoding: 'utf-8' });
} else {
// copy to /src
filePathDest = path.join(destination, '..', filePathFromTemplateRoot);
fs.copySync(filePath, filePathDest);
}
if (isVDOMTemplate && isPathMappingJson) {
const pathMappingJson = fs.readJSONSync(filePath);
// baseUrl will be set from javascript location in oraclejetconfig.json
delete pathMappingJson.baseUrl;
// write to root of the app and not /src
filePathDest = path.join(destination, '../path_mapping.json');
fs.writeJSONSync(filePathDest, pathMappingJson, { spaces: 2 });
} else if (isIndexHtml) {
// remove content between injector:theme and injector:scripts tokens,
// they will be added during the build
let indexHTML = fs.readFileSync(filePath, { encoding: 'utf-8' });
const scriptsInjector = injectorUtils.scriptsInjector;
const themeInjector = injectorUtils.themeInjector;
// remove content between injector:scripts token
indexHTML = injectorUtils.removeInjectorTokensContent({
content: indexHTML,
pattern: injectorUtils.getInjectorTagsRegExp(
scriptsInjector.startTag,
scriptsInjector.endTag
),
eol: injectorUtils.getLineEnding(indexHTML),
startTag: `\t\t${scriptsInjector.startTag}`,
endTag: `\t\t${scriptsInjector.endTag}`
});
// remove content between injector:theme token
indexHTML = injectorUtils.removeInjectorTokensContent({
content: indexHTML,
pattern: injectorUtils.getInjectorTagsRegExp(
themeInjector.startTag,
themeInjector.endTag
),
eol: injectorUtils.getLineEnding(indexHTML),
startTag: `\t\t${themeInjector.startTag}`,
endTag: `\t\t${themeInjector.endTag}`
});
// write to /src
filePathDest = path.join(destination, '..', filePathFromTemplateRoot);
fs.outputFileSync(filePathDest, indexHTML, { encoding: 'utf-8' });
} else {
// copy to /src
filePathDest = path.join(destination, '..', filePathFromTemplateRoot);
Expand Down
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ const config = {
'ojet serve --cssvars=enabled',
'ojet serve ios --no-livereload --emulator="iPad-Air, 10.2"',
'ojet serve --device --release',
'ojet serve windows --no-sass --livereload-port=357230',
'ojet serve windows --no-sass --livereload-port=35723',
'ojet serve android --browser',
'ojet serve --browser=edge',
'ojet serve ios --device --build-config ./buildConfig.json --theme myCustomTheme',
Expand Down
26 changes: 12 additions & 14 deletions generators/add-pcss-theme/templates/mytheme/web/mytheme.scss
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@

// Note that the order in the aggregating file is important
//
// 1. custom variables file: Due to the way sass default works,
// the custom variable file must be imported before the platform theme
// aggregating file (where the platform variable file will be imported).
// 2. platform theme aggregating file

// In theme.json the generatedFileType defaults to 'add-on', therefore only the
// import "_<%= themename %>.cssvars.settings.scss" is uncommented here by default.
// If you uncomment other imports please set generatedFileType to 'combined' in theme.json.
// Please see the developer guide link below for more information
// http://www.oracle.com/pls/topic/lookup?ctx=jetlatest&id=GUID-12A65AC0-4784-46FE-AC8C-09FA509737E4

// import SASS custom variable overrides
@import "_<%= themename %>.sass.settings.scss";

// @import "_<%= themename %>.sass.settings.scss";
// Imports all jet components styles
@import "<%= importcomponents %>";

// @import "<%= importcomponents %>";
// To optimize performance, consider commenting out the above oj-all-components
// import and uncomment _<%= themename %>.components.scss below.
// Then in _<%= themename %>.components.scss uncomment only the component
// imports that your application needs.

// @import "_<%= themename %>.optimize-components.scss";

// import CSS Custom properties
@import "_<%= themename %>.cssvars.settings.scss";
4 changes: 2 additions & 2 deletions generators/app/templates/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "1.0.0",
"description": "An Oracle JavaScript Extension Toolkit(JET) web app",
"dependencies": {
"@oracle/oraclejet": "~11.0.0"
"@oracle/oraclejet": "~11.1.0"
},
"devDependencies": {
"fs-extra": "^8.1.0",
"glob": "^7.1.1",
"underscore": "^1.10.2",
"@oracle/oraclejet-tooling": "~11.0.0"
"@oracle/oraclejet-tooling": "~11.1.0"
},
"engines": {
"node": ">=12.21.0"
Expand Down
4 changes: 2 additions & 2 deletions generators/hybrid/templates/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
"version": "1.0.0",
"description": "An Oracle JavaScript Extension Toolkit (JET) mobile app",
"dependencies": {
"@oracle/oraclejet": "~11.0.0"
"@oracle/oraclejet": "~11.1.0"
},
"devDependencies": {
"fs-extra": "^8.1.0",
"glob": "^7.1.1",
"underscore": "^1.10.2",
"@oracle/oraclejet-tooling": "~11.0.0"
"@oracle/oraclejet-tooling": "~11.1.0"
},
"engines": {
"node": ">=12.21.0"
Expand Down
5 changes: 3 additions & 2 deletions ojet.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@ class Ojet {
* @param {Object} options.options options to execute the task with
* @returns {Promise<undefined>}
*/
async execute({ task, scope, parameters = [], options }) {
async execute({ task, scope, parameters = [], options = {} }) {
this._setOptions();
let result;
// eslint-disable-next-line prefer-rest-params
this._logExecuteSummary(arguments[0]);
try {
result = await tasks([task, scope, ...parameters], options);
const tasksList = [task, ...(scope ? [scope, ...parameters] : parameters)];
result = await tasks(tasksList, options);
} catch (error) {
result = Promise.reject(error);
} finally {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@oracle/ojet-cli",
"version": "11.0.0",
"version": "11.1.0",
"description": "Oracle JET Command Line Interface",
"license": "UPL-1.0",
"homepage": "http://oraclejet.org",
"homepage": "http://www.oracle.com/jet",
"bin": {
"ojet": "bin/ojet"
},
Expand All @@ -14,7 +14,7 @@
"inquirer": "~6.2.2",
"minimist": "^1.2.0",
"xmldom": "0.5.0",
"@oracle/oraclejet-tooling": "~11.0.0"
"@oracle/oraclejet-tooling": "~11.1.0"
},
"engines": {
"node": ">=12.21.0"
Expand Down
2 changes: 1 addition & 1 deletion template/component/js/component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@component-name@",
"version": "1.0.0",
"jetVersion": "^11.0.0",
"jetVersion": "^11.1.0",
"displayName": "A user friendly, translatable name of the component.",
"description": "A translatable high-level description for the component.",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion template/component/js/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
as shown at https://oss.oracle.com/licenses/upl/
*/
define(['ojs/ojcomposite', 'text!./@component-name@-view.html', './@component-name@-viewModel', 'text!./component.json', 'css!./@component-name@-styles'],
define(['ojs/ojcomposite', 'text!./@component-name@-view.html', './@component-name@-viewModel', 'text!./component.json', 'css!./@component-name@-styles.css'],
function(Composite, view, viewModel, metadata) {
Composite.register('@full-component-name@', {
view: view,
Expand Down
2 changes: 1 addition & 1 deletion template/component/ts/component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@component-name@",
"version": "1.0.0",
"jetVersion": "^11.0.0",
"jetVersion": "^11.1.0",
"displayName": "A user friendly, translatable name of the component.",
"description": "A translatable high-level description for the component.",
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion template/component/ts/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Composite = require("ojs/ojcomposite");
import * as view from "text!./@component-name@-view.html";
import viewModel from "./@component-name@-viewModel";
import * as metadata from "text!./component.json";
import "css!./@component-name@-styles";
import "css!./@component-name@-styles.css";

Composite.register("@full-component-name@", {
view: view,
Expand Down
2 changes: 1 addition & 1 deletion template/component/tsx/@component@.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { customElement, ExtendGlobalProps } from "ojs/ojvcomponent";
import { h, Component, ComponentChild } from "preact";
import componentStrings = require("ojL10n!./resources/nls/@component-name@-strings");
import "css!./@component-name@-styles";
import "css!./@component-name@-styles.css";

type Props = {
message?: string;
Expand Down
2 changes: 1 addition & 1 deletion test/componentTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ function buildTsComponentAppWithDeclarationFalse({ appName }) {

function omitComponentVerstionTest({ appName }) {
describe(`Build ${appName} with --${util.OMIT_COMPONENT_VERSION_FLAG}`, () => {
const components = [COMPONENT_NAME, COMPONENT_NAME_COMPOSITE, COMPONENT_NAME_DEMO, VCOMPONENT_NAME];
const components = [COMPONENT_NAME, COMPONENT_NAME_COMPOSITE, COMPONENT_NAME_DEMO, VCOMPONENT_NAME, EXCHANGE_COMPONENT_PACK];
if (!util.noBuild()) {
it(`should build ${appName} with --${util.OMIT_COMPONENT_VERSION_FLAG}`, async () => {
const command = `${util.OJET_APP_COMMAND} build --${util.OMIT_COMPONENT_VERSION_FLAG}`;
Expand Down
74 changes: 74 additions & 0 deletions test/jetpackTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const PACK_NAME = 'pack-1';
const DEFAULT_PACK_VERSION = '1.0.0';
const COMPONENT_NAME = 'comp-1';
const VCOMPONENT_NAME = 'vcomp-1';
const RESOURCE_COMPONENT_NAME = 'resources';
const EXCHANGE_PACK = 'oj-gbu-app';
const EXCHANGE_PACK_VERSION = '3.0.0';
const EXCHANGE_PACK_BUNDLE = 'shell-bundle';
Expand Down Expand Up @@ -229,6 +230,71 @@ function createVComponentInPackTest({ appName, scriptsFolder, pack, component })
});
}

function createResourceComponentInPackTest({ appName, pack, scriptsFolder, resourceComponent, component }) {
if (!util.noScaffold()) {
before(() => {
// Create resource component
const { pathToApp, sourceFolder, componentsFolder } = util.getAppPathData({ appName });
const resourceComponentTemplatePath = path.join(util.getTemplatesDir(), 'resource-component');
const packComponentPath = path.join(pathToApp, sourceFolder, scriptsFolder, componentsFolder, pack);
const resourceComponentPath = path.join(packComponentPath, resourceComponent);
fs.ensureDirSync(resourceComponentPath);
// Copy script agnostic files e.g component.json, *.css
fs
.readdirSync(resourceComponentTemplatePath, { withFileTypes: true })
.filter((dirEntry) => {
// TODO: support nested, script agnotic files
return dirEntry.isFile();
})
.forEach((dirEntry) => {
const file = dirEntry.name;
const srcPath = path.join(resourceComponentTemplatePath, file);
const destPath = path.join(resourceComponentPath, file);
if (path.basename(srcPath) == 'component.json') {
// Set pack and create dependencies
const componentJson = fs.readJsonSync(srcPath);
componentJson.name = resourceComponent;
componentJson.pack = pack;
componentJson.dependencies = {
[`${pack}-${component}`]: '1.0.0'
};
fs.writeJsonSync(destPath, componentJson, { spaces: 2 });
} else {
fs.copyFileSync(srcPath, destPath);
}
});
// Copy script files based on scriptsFolder
const scriptFilePath = path.join(resourceComponentTemplatePath, scriptsFolder)
fs
.readdirSync(scriptFilePath)
.forEach((file) => {
const srcPath = path.join(scriptFilePath, file);
const destPath = path.join(resourceComponentPath, file);
fs.copyFileSync(srcPath, destPath);
});
// No need to add resource component to pack's dependencies list
});
}
it('should check that resource component is in pack', () => {
const { pathToApp, sourceFolder, componentsFolder } = util.getAppPathData({ appName });
const packComponentPath = path.join(pathToApp, sourceFolder, scriptsFolder, componentsFolder, pack);
const resourceComponentPath = path.join(packComponentPath, resourceComponent);
assert.ok(fs.existsSync(resourceComponentPath), `${resourceComponent} not found in ${pack}`);
});
it(`should check that resource component has correct component.json`, () => {
const { pathToApp, sourceFolder, componentsFolder } = util.getAppPathData({ appName });
const packComponentPath = path.join(pathToApp, sourceFolder, scriptsFolder, componentsFolder, pack);
const resourceComponentPath = path.join(packComponentPath, resourceComponent);
if (fs.existsSync(resourceComponentPath)) {
const componentJson = fs.readJsonSync(path.join(resourceComponentPath, 'component.json'));
assert.strictEqual(componentJson.name, resourceComponent, `${resourceComponent}'s name is not ${resourceComponent} in component.json`);
assert.strictEqual(componentJson.pack, pack, `${resourceComponent}'s pack is not ${pack} in component.json`);
assert.strictEqual(componentJson.type, 'resource', `${resourceComponent}'s type is not resource in component.json}`);
assert.ok(componentJson.dependencies, `${resourceComponent}'s component.json does not have dependencies`);
}
});
}

function createComponentInPackFailureTest({ appName, pack, component }) {
describe('check create component in pack failure', () => {
it('should fail with "Invalid pack name:"', async () => {
Expand Down Expand Up @@ -527,6 +593,14 @@ describe('JET Pack Tests', () => {
component: VCOMPONENT_NAME
});
});
describe('create resource component', () => {
util.runComponentTestInAllTestApps({
test: createResourceComponentInPackTest,
pack: PACK_NAME,
component: COMPONENT_NAME,
resourceComponent: RESOURCE_COMPONENT_NAME
});
});
describe('ojet add pack', () => {
util.runComponentTestInAllTestApps({ test: addPackTest, pack: EXCHANGE_PACK, version: EXCHANGE_PACK_VERSION });
})
Expand Down
Loading

0 comments on commit bca8c92

Please sign in to comment.