Skip to content

Commit 526edb2

Browse files
authored
Merge pull request #567 from oracle/merge-for-release
Merge changes in dev branch to release
2 parents 8e427a4 + b225ca6 commit 526edb2

File tree

6 files changed

+57
-22
lines changed

6 files changed

+57
-22
lines changed

packages/node-cli/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ Since CLI for Node.js is a development tool, use a global instance to install it
3434
```
3535
npm install -g @oracle/suitecloud-cli
3636
```
37-
When installing the SuiteCloud CLI for Node.js via script, for instance in a CI environment, you can skip the license prompt presented during the normal installation process by adding the --supressSuiteCloudSDKLicensePrompt flag to the install script as shown below. Note that by adding the mentioned flag to the script, you confirm that you have read and accepted the Oracle Free Use Terms and Conditions license. See the [License](#license) section for details.
37+
When installing the SuiteCloud CLI for Node.js via script, for instance in a CI environment, you can skip showing the license presented during the normal installation process by adding the --acceptSuiteCloudSDKLicense flag to the install script as shown below. Note that by adding the mentioned flag to the script, you confirm that you have read and accepted the Oracle Free Use Terms and Conditions license. See the [License](#license) section for details.
3838

3939
```
40-
npm install -g --supressSuiteCloudSDKLicensePrompt @oracle/suitecloud-cli
40+
npm install -g --acceptSuiteCloudSDKLicense @oracle/suitecloud-cli
4141
```
4242

4343

@@ -61,7 +61,7 @@ suitecloud <command> <option> <argument>
6161
|[`file:upload`](https://system.netsuite.com/app/help/helpcenter.nl?fid=section_159066070687.html)|Uploads files from your project to an account.|
6262
|[`object:import`](https://system.netsuite.com/app/help/helpcenter.nl?fid=section_156042181820.html)|Imports custom objects from an account to your SuiteCloud project.|
6363
|[`object:list`](https://system.netsuite.com/app/help/helpcenter.nl?fid=section_156043303237.html)|Lists the custom objects deployed in an account.|
64-
|[`object:update`](https://system.netsuite.com/app/help/helpcenter.nl?fid=section_156050566547.html)|Overwrite the custom objects in the project with the custom objects in an account.|
64+
|[`object:update`](https://system.netsuite.com/app/help/helpcenter.nl?fid=section_156050566547.html)|Overwrites the custom objects in the project with the custom objects from an account.|
6565
|[`project:adddependencies`](https://system.netsuite.com/app/help/helpcenter.nl?fid=section_155981452469.html)| Adds missing dependencies to the manifest file.|
6666
|[`project:create`](https://system.netsuite.com/app/help/helpcenter.nl?fid=section_156041348327.html)|Creates a SuiteCloud project, either a SuiteApp or an account customization project (ACP).|
6767
|[`project:deploy`](https://system.netsuite.com/app/help/helpcenter.nl?fid=section_156044636320.html)|Deploys the folder containing the project.|

packages/node-cli/messages.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,9 @@
266266

267267
"NO": "No",
268268

269-
"SDK_DOWNLOAD_SERVICE_DOWNLOADING": "Downloading SuiteCloud SDK dependency...",
270269
"SDK_DOWNLOAD_SERVICE_ERROR": "There was an error when downloading SuiteCloud SDK dependency from {0}\n{1}",
271270
"SDK_DOWNLOAD_SERVICE_FILE_NOT_AVAILABLE_ERROR": "The JAR file is not available from this URL.",
272271
"SDK_DOWNLOAD_SERVICE_GET_TIMEOUT": "GET request timeout.",
273-
"SDK_DOWNLOAD_SERVICE_SUCCESS": "SuiteCloud SDK dependency downloaded successfully.",
274272
"SDK_DOWNLOAD_SERVICE_WRONG_DOWNLOAD_URL_PROTOCOL": "Invalid SDK jar file download url protocol. Only http: or https: are allowed.",
275273

276274
"UNIT_TEST_TEST_FAILED": "The tests failed.",

packages/node-cli/src/core/sdksetup/SdkDownloadService.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,15 @@ const HOME_PATH = require('os').homedir();
1818

1919
const { FOLDERS } = require('../../ApplicationConstants');
2020

21-
const NodeConsoleLogger = require('../../loggers/NodeConsoleLogger');
2221
const unwrapExceptionMessage = require('../../utils/ExceptionUtils').unwrapExceptionMessage;
2322

2423
const NodeTranslationService = require('../../services/NodeTranslationService');
2524
const FileSystemService = require('../../services/FileSystemService');
26-
const { executeWithSpinner } = require('../../ui/CliSpinner');
2725

2826
const { SDK_DOWNLOAD_SERVICE } = require('../../services/TranslationKeys');
2927

3028
const VALID_JAR_CONTENT_TYPES = ['application/java-archive', 'application/x-java-archive', 'application/x-jar'];
29+
const ERROR_CODE = -1;
3130

3231
class SdkDownloadService {
3332
constructor() {
@@ -46,13 +45,10 @@ class SdkDownloadService {
4645
const skipProxy = SdkProperties.configFileExists();
4746

4847
try {
49-
await executeWithSpinner({
50-
action: this._downloadJarFilePromise(fullURL, destinationFilePath, proxy, skipProxy),
51-
message: NodeTranslationService.getMessage(SDK_DOWNLOAD_SERVICE.DOWNLOADING, fullURL),
52-
});
53-
NodeConsoleLogger.info(NodeTranslationService.getMessage(SDK_DOWNLOAD_SERVICE.SUCCESS));
48+
await this._downloadJarFilePromise(fullURL, destinationFilePath, proxy, skipProxy);
5449
} catch (error) {
55-
NodeConsoleLogger.error(NodeTranslationService.getMessage(SDK_DOWNLOAD_SERVICE.ERROR, fullURL, unwrapExceptionMessage(error)));
50+
console.error(NodeTranslationService.getMessage(SDK_DOWNLOAD_SERVICE.ERROR, fullURL, unwrapExceptionMessage(error)));
51+
process.exit(ERROR_CODE);
5652
}
5753
}
5854

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
'use strict';
2+
const os = require('os');
3+
const path = require('path');
4+
const { spawnSync } = require('child_process');
5+
6+
const LICENSE_PATH = path.normalize('./resources/FUTC-LICENSE.txt');
7+
const WINDOWS_PLATFORM = 'win32';
8+
const LINUX_PLATFORM = 'linux';
9+
const OSX_PLATFORM = 'darwin';
10+
const WINDOWS_CMD = 'start';
11+
const LINUX_CMD = 'xdg-open';
12+
const OSX_CMD = 'open';
13+
const ERROR_MESSAGE = 'Something went wrong.';
14+
const LICENSE_MESSAGE = 'Use the --acceptsuitecloudsdklicense flag to accept the FUTC license:' +
15+
' https://www.oracle.com/downloads/licenses/oracle-free-license.html';
16+
const supportedPlatformsCommands = {
17+
[WINDOWS_PLATFORM]: WINDOWS_CMD,
18+
[LINUX_PLATFORM]: LINUX_CMD,
19+
[OSX_PLATFORM]: OSX_CMD,
20+
};
21+
22+
class SdkLicense {
23+
24+
show() {
25+
if (process.env.npm_config_acceptsuitecloudsdklicense || process.env.npm_config_acceptSuiteCloudSDKLicense) {
26+
return;
27+
}
28+
const currentPlatform = os.platform();
29+
const command = supportedPlatformsCommands[currentPlatform];
30+
const execution = spawnSync(command, [LICENSE_PATH], { stdio: 'ignore', detached: true, shell: true });
31+
if (execution.error || execution.status !== 0) {
32+
console.error(ERROR_MESSAGE);
33+
console.error(LICENSE_MESSAGE);
34+
return process.exit(execution.error?.errno || execution.status);
35+
}
36+
}
37+
}
38+
39+
module.exports = new SdkLicense();

packages/node-cli/src/services/TranslationKeys.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,7 @@ module.exports = {
416416
},
417417
NO: 'NO',
418418
SDK_DOWNLOAD_SERVICE: {
419-
DOWNLOADING: 'SDK_DOWNLOAD_SERVICE_DOWNLOADING',
420-
SUCCESS: 'SDK_DOWNLOAD_SERVICE_SUCCESS',
419+
GET_TIMEOUT: 'SDK_DOWNLOAD_SERVICE_GET_TIMEOUT',
421420
ERROR: 'SDK_DOWNLOAD_SERVICE_ERROR',
422421
FILE_NOT_AVAILABLE_ERROR: 'SDK_DOWNLOAD_SERVICE_FILE_NOT_AVAILABLE_ERROR',
423422
WRONG_DOWNLOAD_URL_PROTOCOL: 'SDK_DOWNLOAD_SERVICE_WRONG_DOWNLOAD_URL_PROTOCOL'

packages/node-cli/src/utils/http/ProxyAgent.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ class ProxyAgent {
1818
}
1919

2020
initProxyURL() {
21-
// throws error if proxyString is invalid
22-
const proxy = new URL(this.proxyString);
23-
24-
proxy.host = proxy.hostname || proxy.host;
25-
proxy.port = +proxy.port || (proxy.protocol.toLowerCase() === PROTOCOL.HTTPS ? 443 : 80);
26-
this.proxyURL = proxy;
21+
try {
22+
const proxy = new URL(this.proxyString);
23+
proxy.host = proxy.hostname || proxy.host;
24+
proxy.port = +proxy.port || (proxy.protocol.toLowerCase() === PROTOCOL.HTTPS ? 443 : 80);
25+
this.proxyURL = proxy;
26+
} catch (err) {
27+
throw new ProxyAgentError(`${err.input} ${ERROR_MESSAGES.BAD_PROXY}`);
28+
}
2729
}
2830

2931
addRequest(req, options) {
@@ -101,7 +103,8 @@ class ProxyAgentError extends Error {
101103

102104
const ERROR_MESSAGES = {
103105
CONNECT_TIMEOUT: 'CONNECT request timeout.',
104-
SERVER_CLOSE_EVENT: 'Tunnel failed. Socket closed prematurely.'
106+
SERVER_CLOSE_EVENT: 'Tunnel failed. Socket closed prematurely.',
107+
BAD_PROXY: 'is not a valid value for proxy.'
105108
}
106109

107110
module.exports = ProxyAgent;

0 commit comments

Comments
 (0)