Skip to content

Commit

Permalink
Release 5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benm071 committed Jun 15, 2018
1 parent 1db5726 commit 6f690a4
Show file tree
Hide file tree
Showing 17 changed files with 158 additions and 55 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 5.0.0
# @oracle/ojet-cli 5.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=jet500&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=jet510&id=homepage).

## [Contributing](https://github.com/oracle/ojet-cli/tree/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/tree/master/CONTRIBUTING.md) for details.
Expand Down
12 changes: 12 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
## Release Notes for ojet-cli ##

### 5.1.0
When using Cordova-Android 7.0.0+, users may encounter an error like:

ENOENT: no such file or directory, open ‘App\hybrid\platforms\android\res\xml\config.xml’

This is because Cordova changed the Android project file structure, and some third-party plugins/tools are not updated yet.
The error is harmless. Users can also choose to downgrade to Cordova-Android 6.4.0 to completely avoid the issue.

More information is in the Cordova-Android 7.0.0 release note:

https://cordova.apache.org/announcements/2017/12/04/cordova-android-7.0.0.html

### 5.0.0
* The main-release-paths.json file has been replaced by the path-mapping.json file in templates used to scaffold applications
* As a continued effort toward abstraction of direct library calls in the JET CLI, the direct use of yeoman and grunt will be removed in the JET v7.0.0 release. A new hooks API will be provided to allow for customization of tasks.
Expand Down
12 changes: 11 additions & 1 deletion lib/tasks/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,18 @@ module.exports = function (scope, parameters, options) {
case scopes.component.name:
utils.ensureParameters(parameters);
utils.ensureJetApp();
component.add(parameters);

// Keep this if only for the course of 5.X
// https://jira.oraclecorp.com/jira/browse/JET-21713
if (utils.isTooling50x()) {
component.add(parameters);
} else {
const tooling = utils.loadTooling();
tooling.add(scope, parameters);
}
break;
case scopes.hybrid.name:
utils.validateParametersCount(parameters, 0);
utils.ensureJetApp();
if (parameter) {
utils.log.error(utils.toNotSupportedMessage(`${task} ${scope} ${parameter}`));
Expand All @@ -55,6 +64,7 @@ module.exports = function (scope, parameters, options) {
break;
}
case scopes.sass.name:
utils.validateParametersCount(parameters, 0);
utils.ensureJetApp();
if (parameter) {
utils.log.error(utils.toNotSupportedMessage(`${task} ${scope} ${parameter}`));
Expand Down
6 changes: 4 additions & 2 deletions lib/tasks/build.serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ const CONSTANTS = require('../utils.constants');
* @public
* @param {string} task
* @param {string} [scope]
* @param {string} [parameter]
* @param {Array} [parameters]
* @param {Object} [options]
*/
module.exports = function (task, scope, parameter, options) {
module.exports = function (task, scope, parameters, options) {
utils.validateParametersCount(parameters, 1);
const parameter = parameters[0];
switch (scope) {
case config.tasks.build.scopes.app.name:
case config.tasks.serve.scopes.app.name:
Expand Down
10 changes: 7 additions & 3 deletions lib/tasks/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ const utils = require('../utils');
* # Invoked platform clean
*
* @public
* @param {string} platform
* @param {string} scope
* @param {Array} [parameters]
*/
module.exports = function (scope, parameter) {
module.exports = function (scope, parameters) {
utils.ensureJetApp();
utils.validateParametersCount(parameters, 1);
const parameter = parameters[0];
const toolingPath = path.join(process.cwd(), 'node_modules/@oracle/oraclejet-tooling');
// Oracle command libs
if (fs.existsSync(toolingPath)) {
Expand All @@ -37,7 +41,7 @@ module.exports = function (scope, parameter) {
if (CONSTANTS.SUPPORTED_PLATFORMS.indexOf(platform) > -1) {
tooling.clean.platform(platform);
} else {
utils.log.error(`Missing or invalid platform ${platform}`);
utils.log.error(`Invalid platform ${platform}`);
}
}
} else {
Expand Down
16 changes: 12 additions & 4 deletions lib/tasks/configure.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,24 @@ const utils = require('../utils');
*
* @public
* @param {string} task
* @param {Array} [parameters] - Passed in just to show warning if present
* @param {string} scope
*/
module.exports = function (task, scope, options) {
const opts = options;
module.exports = function (task, scope, parameters, options) {
utils.validateParametersCount(parameters, 0);
switch (scope) {
case config.tasks[task].scopes.app.name:
case undefined:
utils.ensureJetApp();
if (opts && utils.hasProperty(opts, 'catalog-url')) {
catalog.configureCatalogUrl(opts['catalog-url']);
if (options && utils.hasProperty(options, 'catalog-url')) {
// Keep this if only for the course of 5.X
// https://jira.oraclecorp.com/jira/browse/JET-21713
if (utils.isTooling50x()) {
catalog.configureCatalogUrl(options['catalog-url']);
} else {
const tooling = utils.loadTooling();
tooling.configure('catalog', options);
}
} else {
utils.log.error(utils.toError(`Please check 'ojet help ${task}' and provide valid configuration options.`));
}
Expand Down
7 changes: 4 additions & 3 deletions lib/tasks/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ const utils = require('../utils');
*
* @public
* @param {string} scope
* @param {string} [parameter]
* @param {Array} [parameters]
* @param {Object} [options]
*/
module.exports = function (scope, parameter, options) {
module.exports = function (scope, parameters, options) {
const scopes = config.tasks.create.scopes;

utils.validateParametersCount(parameters, 1);
const parameter = parameters[0];
switch (scope) {
case scopes.app.name:
app.create(parameter, options);
Expand Down
2 changes: 2 additions & 0 deletions lib/tasks/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ module.exports = function (commands) {
const task = commands[n];
const scope = commands[n + 1];

utils.validateParametersCount(commands.slice(2), 0);

if (task) {
_validateCommand(task, scope, helpTaskNameUsed);
// Print one task
Expand Down
21 changes: 13 additions & 8 deletions lib/tasks/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,31 @@ const utils = require('../utils');
*
* @public
* @param {string} scope
* @param {string} [parameter] - Passed in just to show error if present
* @param {Array} [parameters] - Passed in just to show warning if present
*/
module.exports = function (scope, parameter) {
module.exports = function (scope, parameters) {
const task = config.tasks.list.name;
const scopes = config.tasks.list.scopes;
utils.validateParametersCount(parameters, 0);

switch (scope) {
case scopes.component.name: {
utils.ensureJetApp();
component.list();

// Keep this if only for the course of 5.X
// https://jira.oraclecorp.com/jira/browse/JET-21713
if (utils.isTooling50x()) {
component.list();
} else {
const tooling = utils.loadTooling();
tooling.list(scope);
}
break;
}
case scopes.platform.name:
case scopes.plugin.name: {
utils.ensureJetHybridApp();
if (parameter) {
utils.log.error(utils.toNotSupportedMessage(`${task} ${scope} ${parameter}`));
} else {
platformAndPlugin(task, scope);
}
platformAndPlugin(task, scope);
break;
}
case undefined:
Expand Down
15 changes: 13 additions & 2 deletions lib/tasks/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,24 @@ const utils = require('../utils');
* @param {Array} parameters
* @param {Object} [options]
*/
module.exports = function (task, scope, parameter, options) {
module.exports = function (task, scope, parameters, options) {
utils.validateParametersCount(parameters, 1);
const parameter = parameters[0];

switch (scope) {
case config.tasks[task].scopes.component.name:
utils.ensureParameters(parameter);
utils.ensureJetApp();
utils.ensureCatalogUrl();
component.publish(parameter, options);

// Keep this if only for the course of 5.X
// https://jira.oraclecorp.com/jira/browse/JET-21713
if (utils.isTooling50x()) {
component.publish(parameter, options);
} else {
const tooling = utils.loadTooling();
tooling.publish(scope, parameter, options);
}
break;
case undefined:
utils.log.error(utils.toMissingInputMessage(`${task}`));
Expand Down
10 changes: 9 additions & 1 deletion lib/tasks/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ module.exports = function (scope, parameters) {
case scopes.component.name: {
utils.ensureJetApp();
utils.ensureParameters(parameters);
component.remove(parameters);

// Keep this if only for the course of 5.X
// https://jira.oraclecorp.com/jira/browse/JET-21713
if (utils.isTooling50x()) {
component.remove(parameters);
} else {
const tooling = utils.loadTooling();
tooling.remove(scope, parameters);
}
break;
}
case scopes.platform.name:
Expand Down
11 changes: 4 additions & 7 deletions lib/tasks/restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,15 @@ const utils = require('../utils');
* @public
* @param {string} task
* @param {string} [scope]
* @param {string} [parameter]
* @param {Array} [parameters] - Passed in just to show warning if present
*/
module.exports = function (task, scope, parameter) {
module.exports = function (task, scope, parameters) {
switch (scope) {
case undefined:
case config.tasks[task].scopes.app.name:
utils.validateParametersCount(parameters, 0);
utils.ensureJetApp();
if (parameter) {
utils.log.error(utils.toNotSupportedMessage(`${task} ${scope} ${parameter}`));
} else {
app.restore(task);
}
app.restore(task);
break;
default:
utils.log.error(utils.toNotSupportedMessage(`${task} ${scope}`));
Expand Down
16 changes: 13 additions & 3 deletions lib/tasks/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,25 @@ const utils = require('../utils');
* @public
* @param {string} task
* @param {string} scope
* @param {string} parameter
* @param {Array} parameters
*/
module.exports = function (task, scope, parameter) {
module.exports = function (task, scope, parameters) {
utils.validateParametersCount(parameters, 1);
const parameter = parameters[0];
switch (scope) {
case config.tasks[task].scopes.catalog.name:
utils.ensureParameters(parameter);
utils.ensureJetApp();
utils.ensureCatalogUrl();
catalog.search(parameter);

// Keep this if only for the course of 5.X
// https://jira.oraclecorp.com/jira/browse/JET-21713
if (utils.isTooling50x()) {
catalog.search(parameter);
} else {
const tooling = utils.loadTooling();
tooling.search(scope, parameter);
}
break;
case undefined:
utils.log.error(utils.toMissingInputMessage(`${task}`));
Expand Down
17 changes: 13 additions & 4 deletions lib/tasks/strip.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ const config = require('../../config');
* # Invoke 'strip' task
*
* @public
* @param {Array} [parameters] - Passed in just to show warning if present
*/
module.exports = function () {
const toolingPath = path.join(process.cwd(), 'node_modules/@oracle/oraclejet-tooling');
// Oracle command libs
module.exports = function (parameters) {
utils.validateParametersCount(parameters, 0);
utils.ensureJetApp();
const toolingPath = path.join(process.cwd(), 'node_modules/@oracle/oraclejet-tooling');
if (fs.existsSync(toolingPath)) {
const tooling = require(toolingPath); // eslint-disable-line
tooling.strip();
Expand All @@ -37,7 +38,15 @@ module.exports = function () {

function _removeRegisteredComponents() {
const names = _getComponentNames() || [];
component.remove(names, true);

// Keep this if only for the course of 5.X
// https://jira.oraclecorp.com/jira/browse/JET-21713
if (utils.isTooling50x()) {
component.remove(names, true);
} else {
const tooling = utils.loadTooling();
tooling.remove(config.tasks.remove.scopes.component.name, names, true);
}
}

function _getComponentNames() {
Expand Down
26 changes: 26 additions & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,21 @@ utils.validateOptions = (options, jobType) => {
return options;
};

/**
* ## validateParameters
*
* @public
* @param {Array} parameters
* @param {number} max - max allowed parameters
*/
utils.validateParametersCount = (parameters, max) => {
let params = parameters;
if (params && params.constructor === Array && params.length > max) {
params = params.slice(max, params.length);
utils.log.warning(`Invalid parameters: ${params.toString()}`);
}
};

utils.validatePlatform = (platform) => {
let validPlatform;
if (!platform) {
Expand Down Expand Up @@ -852,6 +867,17 @@ utils.validateServeOptions = (serveOptions, targetKey, platform) => {
return customOptions;
};

// For the course of 5.x keep CCA functionality in ojet-cli
// https://jira.oraclecorp.com/jira/browse/JET-21713
utils.isTooling50x = () => {
const toolingPckgPath = path.join(process.cwd(), 'node_modules/@oracle/oraclejet-tooling/package.json');
if (fs.existsSync(toolingPckgPath)) {
const toolingPckg = utils.readJsonAndReturnObject(toolingPckgPath);
return toolingPckg.version.substring(0, 3) === '5.0';
}
return false;
};

utils.loadTooling = () => {
const toolingPath = path.join(process.cwd(), 'node_modules/@oracle/oraclejet-tooling');
// Oracle command libs
Expand Down
Loading

0 comments on commit 6f690a4

Please sign in to comment.