Skip to content

Commit

Permalink
Release 10.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benm071 committed Apr 25, 2021
1 parent cfa6b66 commit 34fdc6c
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 36 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# @oracle/oraclejet-tooling 10.0.0
# @oracle/oraclejet-tooling 10.1.0

## About the tooling API
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.

This is an open source project maintained by Oracle Corp.

## Installation
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=jet1000&id=homepage).
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=jet1010&id=homepage).

## [Contributing](https://github.com/oracle/oraclejet-tooling/blob/master/CONTRIBUTING.md)
Oracle JET is an open source project. Pull Requests are currently not being accepted. See
Expand Down
2 changes: 1 addition & 1 deletion RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Release Notes for oraclejet-tooling ##

### 10.0.0
### 10.1.0
* No changes

### 5.2.0
Expand Down
18 changes: 12 additions & 6 deletions lib/buildCommon/compileTypescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,12 +316,18 @@ function _runTypescriptCompilation(context) {
// eslint-disable-next-line no-param-reassign
context.opts.typescript.compilationFailed = true;
errors.forEach((error) => {
// only log the path starting from the staging folder i.e no need
// for the absolute path that includes the app name since the cwd
// is the app
const indexOfStagingFolder = error.indexOf(`/${context.opts.stagingPath}/`);
const formattedError = error.substring(indexOfStagingFolder + 1);
util.log(`Typescript Error: ${formattedError}`);
let errorMessage;
if (typeof error === 'string') {
// error is a Typescript error string. only log the path starting from the staging folder
// i.e no need for the absolute path that includes the app name since the cwd
// is the app
const indexOfStagingFolder = error.indexOf(`/${context.opts.stagingPath}/`);
errorMessage = error.substring(indexOfStagingFolder + 1);
} else {
// error is a TransformerError object
errorMessage = error.toString();
}
util.log(`Typescript Error: ${errorMessage}`);
});
}
resolve(context);
Expand Down
3 changes: 3 additions & 0 deletions lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ module.exports = function (scope, parameter, options) {
case (CONSTANTS.API_SCOPES.PACK):
return pack.publish(parameter, options);
default:
if (options && util.hasProperty(options, 'path')) {
return component.publish(parameter, options);
}
util.log.error(`Please specify ojet.${CONSTANTS.API_TASKS.PUBLISH}() 'scope' parameter.`);
return false;
}
Expand Down
32 changes: 25 additions & 7 deletions lib/scopes/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,17 +785,23 @@ function _getBuiltComponentPath(componentName, opts) {
*/
component.publish = function (componentName, options) {
return new Promise((resolve) => {
util.ensureParameters(componentName, CONSTANTS.API_TASKS.PUBLISH);

// The first level function stores user input for the session
process.env.options = JSON.stringify(options);

// If path provided, skip building and packaging. Publish directly.
if (!componentName && util.getOptionsProperty('path')) {
return _publishArchive(options);
}

util.ensureParameters(componentName, CONSTANTS.API_TASKS.PUBLISH);

const opts = options || {};

// We allow publishing of only a single component
// If multiple, it would be hard distinguish between
// single component and a single pack component
// User can script a loop if he wants to package multiple component
let componentPath = opts.path || _getBuiltComponentPath(componentName, opts);
let componentPath = _getBuiltComponentPath(componentName, opts);
const hadBeenBuiltBefore = !!componentPath;

// If pack name was used as the component name
Expand Down Expand Up @@ -846,10 +852,7 @@ component.publish = function (componentName, options) {
return util.loginIfCredentialsProvided();
})
.then(() => { // eslint-disable-line
if (!opts.path) {
return _packArchive(componentName, componentPath, opts);
}
return true;
return _packArchive(componentName, componentPath, opts);
})
.then(() => { // eslint-disable-line
return exchangeUtils.uploadToExchange(componentName, opts);
Expand All @@ -865,6 +868,21 @@ component.publish = function (componentName, options) {
});
};

function _publishArchive(options) {
return new Promise((resolve) => {
const archiveName = path.basename(options.path); // Name of the file e.g. demo-card.zip
return util.loginIfCredentialsProvided()
.then(() => exchangeUtils.uploadToExchange(archiveName, options))
.then(() => {
util.log.success(`Archive '${archiveName}' was published.`);
resolve();
})
.catch((error) => {
util.log.error(error, true);
});
});
}

/**
* ## _packArchive
* Archives component folder
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/pack/component.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@pack@",
"version": "1.0.0",
"jetVersion": "10.0.0",
"jetVersion": "10.1.0",
"type": "pack",
"displayName": "A user friendly, translatable name of the pack.",
"description": "A translatable high-level description for the pack.",
Expand Down
35 changes: 17 additions & 18 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1178,8 +1178,18 @@ util.request = function (options, body, multipartFormData) {
// https://nodejs.org/api/http.html#http_http_request_url_options_callback
// https://nodejs.org/api/https.html#https_https_request_options_callback

// Always add security option
opts.secure = util.getOptionsProperty('secure');
// Add 'secure' property if missing
if (util.hasProperty(opts, 'secure')) {
// Save for next request of this session
process.env.options = JSON.stringify(
// Merge current state with 'secure' option
Object.assing(JSON.parse(process.env.options), { secure: opts.secure })
);
} else {
// Create 'secure' property with cach
opts.secure = util.getOptionsProperty('secure');
}

// Automatically Add Authorization header
// Except of the token request
if (opts.path !== '/auth/token') {
Expand Down Expand Up @@ -1215,7 +1225,7 @@ util.request = function (options, body, multipartFormData) {
}
opts = Object.assign(defaults, opts);
}
const protocol = _validateProtocol(opts.protocol, opts.secure);
const protocol = _validateProtocol(opts);

if (util.isVerbose()) {
const optionsCopy = util.cloneObject(opts);
Expand Down Expand Up @@ -1332,21 +1342,10 @@ util.getOptionsProperty = (property) => {
* @returns {Object} | @throws - returns valid protocol or throws error
*/

function _validateProtocol(requestedProtocol, secure) { // eslint-disable-line
// Cache secure options for the current session
const env = process.env;
let secureCopy;
// Check cache
if (env.secure) {
secureCopy = env.secure === 'true'; // Convert to boolean
} else {
secureCopy = typeof secure === 'undefined' ? true : secure;
// Cache
env.secure = secure; // Convert to string
}

if (requestedProtocol === 'https:' || !secureCopy) {
return requestedProtocol === 'https:' ? https : http;
function _validateProtocol(options) { // eslint-disable-line
const protocol = options.protocol;
if (protocol === 'https:' || options.secure === false) {
return protocol === 'https:' ? https : http;
}
util.log.error('HTTP protocol is insecure. Please use HTTPS instead. At your own risk, you can force the HTTP protocol with the —secure=false or {secure: false} option.');
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oracle/oraclejet-tooling",
"version": "10.0.0",
"version": "10.1.0",
"license": "UPL-1.0",
"description": "Programmatic API to build and serve Oracle JET web and mobile applications",
"keywords": [
Expand Down

0 comments on commit 34fdc6c

Please sign in to comment.