@salesforce/cli 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +5 -5
- package/bin/run +26 -3
- package/dist/cli.js +119 -0
- package/dist/help/sfCommandHelp.js +1 -1
- package/dist/help/sfHelp.js +1 -1
- package/dist/util/env.js +75 -0
- package/dist/versions.js +46 -0
- package/npm-shrinkwrap.json +21624 -28084
- package/oclif.manifest.json +1 -1
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.17.0](https://github.com/salesforcecli/cli/compare/v1.16.0...v1.17.0) (2022-03-02)
|
|
6
|
+
|
|
5
7
|
## [1.16.0](https://github.com/salesforcecli/cli/compare/v1.15.0...v1.16.0) (2022-02-23)
|
|
6
8
|
|
|
7
9
|
## [1.15.0](https://github.com/salesforcecli/cli/compare/v1.14.0...v1.15.0) (2022-02-16)
|
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ $ npm install -g @salesforce/cli
|
|
|
31
31
|
$ sf COMMAND
|
|
32
32
|
running command...
|
|
33
33
|
$ sf (--version|-v)
|
|
34
|
-
@salesforce/cli/1.
|
|
34
|
+
@salesforce/cli/1.17.0 linux-x64 node-v14.19.0
|
|
35
35
|
$ sf --help [COMMAND]
|
|
36
36
|
USAGE
|
|
37
37
|
$ sf COMMAND
|
|
@@ -322,7 +322,7 @@ EXAMPLES
|
|
|
322
322
|
$ sf deploy --interactive
|
|
323
323
|
```
|
|
324
324
|
|
|
325
|
-
_See code: [@salesforce/plugin-deploy-retrieve](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/v1.
|
|
325
|
+
_See code: [@salesforce/plugin-deploy-retrieve](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/v1.1.1/src/commands/deploy.ts)_
|
|
326
326
|
|
|
327
327
|
## `sf deploy functions`
|
|
328
328
|
|
|
@@ -1003,7 +1003,7 @@ DESCRIPTION
|
|
|
1003
1003
|
Display help for sf.
|
|
1004
1004
|
```
|
|
1005
1005
|
|
|
1006
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.
|
|
1006
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.11/src/commands/help.ts)_
|
|
1007
1007
|
|
|
1008
1008
|
## `sf info:releasenotes:display [-v <string>] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]`
|
|
1009
1009
|
|
|
@@ -1070,7 +1070,7 @@ EXAMPLES
|
|
|
1070
1070
|
$ sf login
|
|
1071
1071
|
```
|
|
1072
1072
|
|
|
1073
|
-
_See code: [@salesforce/plugin-login](https://github.com/salesforcecli/plugin-login/blob/v1.0.
|
|
1073
|
+
_See code: [@salesforce/plugin-login](https://github.com/salesforcecli/plugin-login/blob/v1.0.8/src/commands/login.ts)_
|
|
1074
1074
|
|
|
1075
1075
|
## `sf login functions`
|
|
1076
1076
|
|
|
@@ -1337,7 +1337,7 @@ EXAMPLES
|
|
|
1337
1337
|
$ sf logout --no-prompt
|
|
1338
1338
|
```
|
|
1339
1339
|
|
|
1340
|
-
_See code: [@salesforce/plugin-login](https://github.com/salesforcecli/plugin-login/blob/v1.0.
|
|
1340
|
+
_See code: [@salesforce/plugin-login](https://github.com/salesforcecli/plugin-login/blob/v1.0.8/src/commands/logout.ts)_
|
|
1341
1341
|
|
|
1342
1342
|
## `sf logout functions`
|
|
1343
1343
|
|
package/bin/run
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
/* tslint:disable:no-var-requires only-arrow-functions */
|
|
4
|
+
/* eslint-disable global-require, prefer-arrow-callback */
|
|
5
|
+
|
|
3
6
|
// Since the CLI is a single process, we can have a larger amount of max listeners since
|
|
4
7
|
// the process gets shut down. Don't set it to 0 (no limit) since we should still be aware
|
|
5
8
|
// of rouge event listeners
|
|
@@ -8,6 +11,26 @@ process.setMaxListeners(parseInt(process.env.SF_MAX_EVENT_LISTENERS, 10) || 1000
|
|
|
8
11
|
// Don't let other plugins override the CLI specified max listener count
|
|
9
12
|
process.setMaxListeners = () => {};
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
// Check node version before requiring additional packages
|
|
15
|
+
require('../dist/versions').checkNodeVersion();
|
|
16
|
+
|
|
17
|
+
const cli = require('../dist/cli');
|
|
18
|
+
const pjson = require('../package.json');
|
|
19
|
+
|
|
20
|
+
// OVERRIDES gets replaced with particular values for binary builds,
|
|
21
|
+
// but simply use defaults for npm and local invocations
|
|
22
|
+
const overrides = {
|
|
23
|
+
/* @OVERRIDES@ */
|
|
24
|
+
};
|
|
25
|
+
const version = overrides.version || pjson.version;
|
|
26
|
+
const channel = overrides.channel || 'stable';
|
|
27
|
+
|
|
28
|
+
cli
|
|
29
|
+
.create(version, channel)
|
|
30
|
+
.run()
|
|
31
|
+
.then(function (result) {
|
|
32
|
+
require('@oclif/core/flush')();
|
|
33
|
+
})
|
|
34
|
+
.catch(function (err) {
|
|
35
|
+
require('@oclif/core/handle')(err);
|
|
36
|
+
});
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
4
|
+
* All rights reserved.
|
|
5
|
+
* Licensed under the BSD 3-Clause license.
|
|
6
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.create = exports.configureAutoUpdate = exports.configureUpdateSites = exports.UPDATE_DISABLED_DEMO = exports.UPDATE_DISABLED_NPM = exports.UPDATE_DISABLED_INSTALLER = void 0;
|
|
10
|
+
const os = require("os");
|
|
11
|
+
const path = require("path");
|
|
12
|
+
const core_1 = require("@oclif/core");
|
|
13
|
+
const kit_1 = require("@salesforce/kit");
|
|
14
|
+
const ts_types_1 = require("@salesforce/ts-types");
|
|
15
|
+
const Debug = require("debug");
|
|
16
|
+
const env_1 = require("./util/env");
|
|
17
|
+
const debug = Debug('sf');
|
|
18
|
+
const envVars = [
|
|
19
|
+
...new Set([
|
|
20
|
+
...Object.keys(process.env).filter((e) => e.startsWith('SF_') || e.startsWith('SFDX_')),
|
|
21
|
+
'NODE_OPTIONS',
|
|
22
|
+
env_1.Env.SF_AUTOUPDATE_DISABLE,
|
|
23
|
+
'SF_BINPATH',
|
|
24
|
+
'SF_COMPILE_CACHE',
|
|
25
|
+
env_1.Env.SF_DISABLE_AUTOUPDATE,
|
|
26
|
+
env_1.Env.SF_ENV,
|
|
27
|
+
env_1.Env.SF_INSTALLER,
|
|
28
|
+
env_1.Env.SF_LAZY_LOAD_MODULES,
|
|
29
|
+
env_1.Env.SF_NPM_REGISTRY,
|
|
30
|
+
'SF_REDIRECTED',
|
|
31
|
+
env_1.Env.SF_S3_HOST,
|
|
32
|
+
env_1.Env.SF_UPDATE_INSTRUCTIONS,
|
|
33
|
+
]),
|
|
34
|
+
];
|
|
35
|
+
exports.UPDATE_DISABLED_INSTALLER = 'Manual and automatic CLI updates have been disabled by setting "SF_AUTOUPDATE_DISABLE=true". ' +
|
|
36
|
+
'To check for a new version, unset that environment variable.';
|
|
37
|
+
exports.UPDATE_DISABLED_NPM = 'Use "npm update --global @salesforce/cli" to update npm-based installations.';
|
|
38
|
+
exports.UPDATE_DISABLED_DEMO = 'Manual and automatic CLI updates have been disabled in DEMO mode. ' +
|
|
39
|
+
'To check for a new version, unset the environment variable SF_ENV.';
|
|
40
|
+
function configureUpdateSites(config, env = env_1.default) {
|
|
41
|
+
const s3Host = env.getS3HostOverride();
|
|
42
|
+
if (s3Host) {
|
|
43
|
+
// Override config value if set via envar
|
|
44
|
+
(0, kit_1.set)(config, 'pjson.oclif.update.s3.host', s3Host);
|
|
45
|
+
}
|
|
46
|
+
const npmRegistry = env.getNpmRegistryOverride();
|
|
47
|
+
if (npmRegistry) {
|
|
48
|
+
// Override config value if set via envar
|
|
49
|
+
(0, kit_1.set)(config, 'pjson.oclif.warn-if-update-available.registry', npmRegistry);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.configureUpdateSites = configureUpdateSites;
|
|
53
|
+
function configureAutoUpdate(envars) {
|
|
54
|
+
if (envars.isDemoMode()) {
|
|
55
|
+
// Disable autoupdates in demo mode
|
|
56
|
+
envars.setAutoupdateDisabled(true);
|
|
57
|
+
envars.setUpdateInstructions(exports.UPDATE_DISABLED_DEMO);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (envars.isInstaller()) {
|
|
61
|
+
envars.normalizeAutoupdateDisabled();
|
|
62
|
+
if (envars.isAutoupdateDisabled()) {
|
|
63
|
+
envars.setUpdateInstructions(exports.UPDATE_DISABLED_INSTALLER);
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// Not an installer, so this must be running from an npm installation
|
|
68
|
+
if (!envars.isAutoupdateDisabledSet()) {
|
|
69
|
+
// Disable autoupdates if run from an npm install or in local dev, if not explicitly set
|
|
70
|
+
envars.setAutoupdateDisabled(true);
|
|
71
|
+
}
|
|
72
|
+
if (envars.isAutoupdateDisabled()) {
|
|
73
|
+
envars.setUpdateInstructions(exports.UPDATE_DISABLED_NPM);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.configureAutoUpdate = configureAutoUpdate;
|
|
77
|
+
function debugCliInfo(version, channel, env, config) {
|
|
78
|
+
function debugSection(section, items) {
|
|
79
|
+
const pad = 25;
|
|
80
|
+
debug('%s:', section.padStart(pad));
|
|
81
|
+
items.forEach(([name, value]) => debug('%s: %s', name.padStart(pad), value));
|
|
82
|
+
}
|
|
83
|
+
debugSection('OS', [
|
|
84
|
+
['platform', os.platform()],
|
|
85
|
+
['architecture', os.arch()],
|
|
86
|
+
['release', os.release()],
|
|
87
|
+
['shell', config.shell],
|
|
88
|
+
]);
|
|
89
|
+
debugSection('NODE', [['version', process.versions.node]]);
|
|
90
|
+
debugSection('CLI', [
|
|
91
|
+
['version', version],
|
|
92
|
+
['channel', channel],
|
|
93
|
+
['bin', config.bin],
|
|
94
|
+
['data', config.dataDir],
|
|
95
|
+
['cache', config.cacheDir],
|
|
96
|
+
['config', config.configDir],
|
|
97
|
+
]);
|
|
98
|
+
debugSection('ENV', [...envVars].map((key) => [key, env.getString(key, '<not set>')]));
|
|
99
|
+
debugSection('ARGS', process.argv.map((arg, i) => [i.toString(), arg]));
|
|
100
|
+
}
|
|
101
|
+
function create(version, channel, run, env = env_1.default) {
|
|
102
|
+
const root = path.resolve(__dirname, '..');
|
|
103
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
104
|
+
const pjson = require(path.resolve(__dirname, '..', 'package.json'));
|
|
105
|
+
const args = process.argv.slice(2);
|
|
106
|
+
return {
|
|
107
|
+
async run() {
|
|
108
|
+
const config = new core_1.Config({ name: (0, ts_types_1.get)(pjson, 'oclif.bin'), root, version, channel });
|
|
109
|
+
await config.load();
|
|
110
|
+
configureUpdateSites(config, env);
|
|
111
|
+
configureAutoUpdate(env);
|
|
112
|
+
debugCliInfo(version, channel, env, config);
|
|
113
|
+
// Example of how run is used in a test https://github.com/salesforcecli/cli/pull/171/files#diff-1deee0a575599b2df117c280da319f7938aaf6fdb0c04bcdbde769dbf464be69R46
|
|
114
|
+
return run ? run(args, config) : await (0, core_1.run)(args, config);
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
exports.create = create;
|
|
119
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SfCommandHelp = void 0;
|
|
4
4
|
/*
|
|
5
|
-
* Copyright (c)
|
|
5
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
6
6
|
* All rights reserved.
|
|
7
7
|
* Licensed under the BSD 3-Clause license.
|
|
8
8
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
package/dist/help/sfHelp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/*
|
|
4
|
-
* Copyright (c)
|
|
4
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
5
5
|
* All rights reserved.
|
|
6
6
|
* Licensed under the BSD 3-Clause license.
|
|
7
7
|
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
package/dist/util/env.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Env = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
6
|
+
* All rights reserved.
|
|
7
|
+
* Licensed under the BSD 3-Clause license.
|
|
8
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
9
|
+
*/
|
|
10
|
+
const core_1 = require("@salesforce/core");
|
|
11
|
+
class Env extends core_1.EnvVars {
|
|
12
|
+
constructor(env = process.env) {
|
|
13
|
+
super(env);
|
|
14
|
+
}
|
|
15
|
+
isAutoupdateDisabled() {
|
|
16
|
+
return this.getBoolean(Env.SF_AUTOUPDATE_DISABLE) || this.getBoolean(Env.SF_DISABLE_AUTOUPDATE);
|
|
17
|
+
}
|
|
18
|
+
isAutoupdateDisabledSet() {
|
|
19
|
+
return !!this.getString(Env.SF_AUTOUPDATE_DISABLE) || !!this.getString(Env.SF_DISABLE_AUTOUPDATE);
|
|
20
|
+
}
|
|
21
|
+
setAutoupdateDisabled(value, updateInstructions) {
|
|
22
|
+
this.setBoolean(Env.SF_AUTOUPDATE_DISABLE, value);
|
|
23
|
+
this.setBoolean(Env.SF_DISABLE_AUTOUPDATE, value);
|
|
24
|
+
if (updateInstructions) {
|
|
25
|
+
this.setUpdateInstructions(updateInstructions);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
setUpdateInstructions(value) {
|
|
29
|
+
this.setString(Env.SF_UPDATE_INSTRUCTIONS, value);
|
|
30
|
+
}
|
|
31
|
+
isDemoMode() {
|
|
32
|
+
return (this.getString(Env.SF_ENV, 'production') || '').toLowerCase() === 'demo';
|
|
33
|
+
}
|
|
34
|
+
isInstaller() {
|
|
35
|
+
// Check SFDX_INSTALLER instead of SF_INSTALLER until such time sf has its own installers
|
|
36
|
+
return this.getBoolean(Env.SFDX_INSTALLER);
|
|
37
|
+
}
|
|
38
|
+
getS3HostOverride() {
|
|
39
|
+
return this.getString(Env.SF_S3_HOST);
|
|
40
|
+
}
|
|
41
|
+
setS3HostOverride(value) {
|
|
42
|
+
return this.setString(Env.SF_S3_HOST, value);
|
|
43
|
+
}
|
|
44
|
+
getNpmRegistryOverride() {
|
|
45
|
+
return this.getString(Env.SF_NPM_REGISTRY);
|
|
46
|
+
}
|
|
47
|
+
setNpmRegistryOverride(value) {
|
|
48
|
+
return this.setString(Env.SF_NPM_REGISTRY, value);
|
|
49
|
+
}
|
|
50
|
+
isLazyRequireEnabled() {
|
|
51
|
+
return this.getBoolean(Env.SF_LAZY_LOAD_MODULES);
|
|
52
|
+
}
|
|
53
|
+
normalizeAutoupdateDisabled() {
|
|
54
|
+
// Ensure that the legacy envar always causes the oclif counterpart to be set
|
|
55
|
+
// see https://github.com/oclif/plugin-update/blob/3946fb296a0a95544ab6364b36a1f7422c8aeddf/src/hooks/init.ts#L22
|
|
56
|
+
if (this.getBoolean(Env.SF_AUTOUPDATE_DISABLE)) {
|
|
57
|
+
this.setBoolean(Env.SF_DISABLE_AUTOUPDATE, true);
|
|
58
|
+
}
|
|
59
|
+
else if (this.getBoolean(Env.SF_DISABLE_AUTOUPDATE)) {
|
|
60
|
+
this.setBoolean(Env.SF_AUTOUPDATE_DISABLE, true);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.Env = Env;
|
|
65
|
+
Env.SF_AUTOUPDATE_DISABLE = 'SF_AUTOUPDATE_DISABLE';
|
|
66
|
+
Env.SF_DISABLE_AUTOUPDATE = 'SF_DISABLE_AUTOUPDATE';
|
|
67
|
+
Env.SF_ENV = 'SF_ENV';
|
|
68
|
+
Env.SF_INSTALLER = 'SF_INSTALLER';
|
|
69
|
+
Env.SFDX_INSTALLER = 'SFDX_INSTALLER';
|
|
70
|
+
Env.SF_LAZY_LOAD_MODULES = 'SF_LAZY_LOAD_MODULES';
|
|
71
|
+
Env.SF_NPM_REGISTRY = 'SF_NPM_REGISTRY';
|
|
72
|
+
Env.SF_S3_HOST = 'SF_S3_HOST';
|
|
73
|
+
Env.SF_UPDATE_INSTRUCTIONS = 'SF_UPDATE_INSTRUCTIONS';
|
|
74
|
+
exports.default = new Env();
|
|
75
|
+
//# sourceMappingURL=env.js.map
|
package/dist/versions.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2022, salesforce.com, inc.
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
* Licensed under the BSD 3-Clause license.
|
|
7
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.checkNodeVersion = exports.isVersion = void 0;
|
|
11
|
+
const semver = require("semver");
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
13
|
+
const pjson = require('../package.json');
|
|
14
|
+
/**
|
|
15
|
+
* Determines whether or not a tag string is a semantic version.
|
|
16
|
+
*
|
|
17
|
+
* @param {*} tag The possible version string
|
|
18
|
+
* @returns {boolean} True, if the string is recognized as a semantic version
|
|
19
|
+
*/
|
|
20
|
+
function isVersion(tag) {
|
|
21
|
+
if (!tag) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return !!semver.valid(tag) || false;
|
|
25
|
+
}
|
|
26
|
+
exports.isVersion = isVersion;
|
|
27
|
+
module.exports.isVersion = isVersion;
|
|
28
|
+
/**
|
|
29
|
+
* Checks the current Node version for compatibility before launching the CLI.
|
|
30
|
+
*/
|
|
31
|
+
function checkNodeVersion(preferThrow = false, currentVersion = process.versions.node, requiredVersion = pjson.engines.node.slice(2)) {
|
|
32
|
+
if (semver.compare(currentVersion, requiredVersion) < 0) {
|
|
33
|
+
const message = `Unsupported Node.js version ${currentVersion}, version ${requiredVersion} or later is required.`;
|
|
34
|
+
if (!preferThrow) {
|
|
35
|
+
// eslint-disable-next-line no-console
|
|
36
|
+
console.error(message);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw new Error(message);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.checkNodeVersion = checkNodeVersion;
|
|
45
|
+
module.exports.checkNodeVersion = checkNodeVersion;
|
|
46
|
+
//# sourceMappingURL=versions.js.map
|