@salesforce/plugin-release-management 2.13.1 → 3.0.1
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 +23 -0
- package/README.md +300 -321
- package/bin/dev +10 -4
- package/bin/run +3 -2
- package/lib/amazonS3.js +8 -8
- package/lib/amazonS3.js.map +1 -1
- package/lib/circleCiEnvvars.js +3 -3
- package/lib/circleCiEnvvars.js.map +1 -1
- package/lib/codeSigning/packAndSign.js +10 -17
- package/lib/codeSigning/packAndSign.js.map +1 -1
- package/lib/commands/channel/promote.js +9 -15
- package/lib/commands/channel/promote.js.map +1 -1
- package/lib/commands/circleci/envvar/create.js.map +1 -1
- package/lib/commands/circleci/envvar/update.js.map +1 -1
- package/lib/commands/cli/install/test.js +45 -36
- package/lib/commands/cli/install/test.js.map +1 -1
- package/lib/commands/cli/latestrc/build.d.ts +1 -0
- package/lib/commands/cli/latestrc/build.js +26 -12
- package/lib/commands/cli/latestrc/build.js.map +1 -1
- package/lib/commands/cli/releasenotes.js +6 -11
- package/lib/commands/cli/releasenotes.js.map +1 -1
- package/lib/commands/cli/schemas/collect.js +12 -7
- package/lib/commands/cli/schemas/collect.js.map +1 -1
- package/lib/commands/cli/schemas/compare.js +14 -7
- package/lib/commands/cli/schemas/compare.js.map +1 -1
- package/lib/commands/cli/tarballs/prepare.js +1 -1
- package/lib/commands/cli/tarballs/prepare.js.map +1 -1
- package/lib/commands/cli/tarballs/smoke.js +1 -1
- package/lib/commands/cli/tarballs/smoke.js.map +1 -1
- package/lib/commands/cli/tarballs/verify.js +44 -22
- package/lib/commands/cli/tarballs/verify.js.map +1 -1
- package/lib/commands/cli/versions/inspect.js +18 -7
- package/lib/commands/cli/versions/inspect.js.map +1 -1
- package/lib/commands/dependabot/automerge.js +3 -6
- package/lib/commands/dependabot/automerge.js.map +1 -1
- package/lib/commands/npm/dependencies/pin.js +4 -6
- package/lib/commands/npm/dependencies/pin.js.map +1 -1
- package/lib/commands/npm/package/promote.js +3 -7
- package/lib/commands/npm/package/promote.js.map +1 -1
- package/lib/commands/npm/package/release.js +4 -8
- package/lib/commands/npm/package/release.js.map +1 -1
- package/lib/commands/npm/release/validate.js +3 -5
- package/lib/commands/npm/release/validate.js.map +1 -1
- package/lib/commands/repositories/index.js +3 -3
- package/lib/commands/repositories/index.js.map +1 -1
- package/lib/commands/typescript/update.js +23 -26
- package/lib/commands/typescript/update.js.map +1 -1
- package/lib/dependabot.js +6 -4
- package/lib/dependabot.js.map +1 -1
- package/lib/dependencies.d.ts +1 -1
- package/lib/inspectCommits.d.ts +1 -1
- package/lib/inspectCommits.js +3 -7
- package/lib/inspectCommits.js.map +1 -1
- package/lib/package.d.ts +12 -1
- package/lib/package.js +101 -28
- package/lib/package.js.map +1 -1
- package/lib/pluginCommand.js +8 -9
- package/lib/pluginCommand.js.map +1 -1
- package/lib/registry.js +14 -11
- package/lib/registry.js.map +1 -1
- package/lib/repository.d.ts +2 -23
- package/lib/repository.js +15 -168
- package/lib/repository.js.map +1 -1
- package/messages/channel.promote.json +0 -1
- package/messages/cli.latestrc.build.json +7 -0
- package/messages/npm.package.promote.json +0 -1
- package/messages/npm.package.release.json +1 -2
- package/messages/trust.sign.json +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +15 -24
- package/lib/commands/npm/lerna/release.d.ts +0 -13
- package/lib/commands/npm/lerna/release.js +0 -144
- package/lib/commands/npm/lerna/release.js.map +0 -1
- package/messages/npm.lerna.release.json +0 -14
|
@@ -17,17 +17,13 @@ core_1.Messages.importMessagesDirectory(__dirname);
|
|
|
17
17
|
const messages = core_1.Messages.loadMessages('@salesforce/plugin-release-management', 'npm.package.release');
|
|
18
18
|
class Release extends command_1.SfdxCommand {
|
|
19
19
|
async run() {
|
|
20
|
-
if (await (0, repository_1.isMonoRepo)()) {
|
|
21
|
-
const errType = 'InvalidRepoType';
|
|
22
|
-
throw new core_1.SfdxError(messages.getMessage(errType), errType);
|
|
23
|
-
}
|
|
24
20
|
const deps = (0, dependencies_1.verifyDependencies)(this.flags);
|
|
25
21
|
if (deps.failures > 0) {
|
|
26
22
|
const errType = 'MissingDependencies';
|
|
27
23
|
const missing = deps.results.filter((d) => d.passed === false).map((d) => d.message);
|
|
28
|
-
throw new core_1.
|
|
24
|
+
throw new core_1.SfError(messages.getMessage(errType), errType, missing);
|
|
29
25
|
}
|
|
30
|
-
const pkg = await repository_1.
|
|
26
|
+
const pkg = await repository_1.PackageRepo.create({ ux: this.ux, useprerelease: this.flags.prerelease });
|
|
31
27
|
if (!pkg.shouldBePublished) {
|
|
32
28
|
this.ux.log('Found no commits that warrant a release. Exiting...');
|
|
33
29
|
return;
|
|
@@ -37,7 +33,7 @@ class Release extends command_1.SfdxCommand {
|
|
|
37
33
|
const pkgValidation = pkg.validate();
|
|
38
34
|
if (!pkgValidation.valid) {
|
|
39
35
|
const errType = 'InvalidNextVersion';
|
|
40
|
-
throw new core_1.
|
|
36
|
+
throw new core_1.SfError(messages.getMessage(errType, [pkgValidation.nextVersion]), errType);
|
|
41
37
|
}
|
|
42
38
|
this.ux.log(`Name: ${pkgValidation.name}`);
|
|
43
39
|
this.ux.log(`Current Version: ${pkgValidation.currentVersion}`);
|
|
@@ -105,7 +101,7 @@ class Release extends command_1.SfdxCommand {
|
|
|
105
101
|
}
|
|
106
102
|
}
|
|
107
103
|
catch (err) {
|
|
108
|
-
throw new core_1.
|
|
104
|
+
throw new core_1.SfError(err, 'FailedCommandExecution');
|
|
109
105
|
}
|
|
110
106
|
}
|
|
111
107
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../../../src/commands/npm/package/release.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,yBAAyB;AACzB,+BAA+B;AAC/B,iDAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../../../src/commands/npm/package/release.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;A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,GAAG;QACT,OAAO,EAAE,QAAQ;QACjB,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC;KAC3C,CAAC;IACF,SAAS,EAAE,eAAK,CAAC,MAAM,CAAC;QACtB,IAAI,EAAE,GAAG;QACT,OAAO,EAAE,QAAQ;QACjB,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC;KAC9C,CAAC;IACF,OAAO,EAAE,eAAK,CAAC,OAAO,CAAC;QACrB,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;QAC3C,OAAO,EAAE,IAAI;KACd,CAAC;IACF,UAAU,EAAE,eAAK,CAAC,MAAM,CAAC;QACvB,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,YAAY,CAAC;KAC/C,CAAC;IACF,MAAM,EAAE,eAAK,CAAC,OAAO,CAAC;QACpB,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC1C,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;KACd,CAAC;CACH,CAAC"}
|
|
@@ -8,16 +8,14 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
const command_1 = require("@salesforce/command");
|
|
10
10
|
const core_1 = require("@salesforce/core");
|
|
11
|
-
const repository_1 = require("../../../repository");
|
|
12
11
|
const package_1 = require("../../../package");
|
|
13
12
|
const inspectCommits_1 = require("../../../inspectCommits");
|
|
14
13
|
class Validate extends command_1.SfdxCommand {
|
|
15
14
|
async run() {
|
|
16
|
-
const
|
|
17
|
-
const packages = isLerna ? await repository_1.LernaRepo.getPackages() : [await package_1.Package.create()];
|
|
15
|
+
const packages = [await package_1.Package.create()];
|
|
18
16
|
const responses = [];
|
|
19
17
|
for (const pkg of packages) {
|
|
20
|
-
const commitInspection = await (0, inspectCommits_1.inspectCommits)(pkg
|
|
18
|
+
const commitInspection = await (0, inspectCommits_1.inspectCommits)(pkg);
|
|
21
19
|
const response = Object.assign(commitInspection, {
|
|
22
20
|
name: pkg.name,
|
|
23
21
|
currentVersion: pkg.packageJson.version,
|
|
@@ -26,7 +24,7 @@ class Validate extends command_1.SfdxCommand {
|
|
|
26
24
|
}
|
|
27
25
|
const majorBump = responses.some((resp) => !!resp.isMajorBump);
|
|
28
26
|
if (majorBump) {
|
|
29
|
-
throw new core_1.
|
|
27
|
+
throw new core_1.SfError('Major version bump detected. You must manually update the version in the package.json to release a new major version.', 'MajorBumpDetected');
|
|
30
28
|
}
|
|
31
29
|
const shouldRelease = responses.some((resp) => !!resp.shouldRelease) && !majorBump;
|
|
32
30
|
this.ux.log(shouldRelease.toString());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../src/commands/npm/release/validate.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,iDAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../src/commands/npm/release/validate.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,iDAAsE;AACtE,2CAA2C;AAC3C,8CAA2C;AAC3C,4DAA2E;AAa3E,MAAqB,QAAS,SAAQ,qBAAW;IASxC,KAAK,CAAC,GAAG;QACd,MAAM,QAAQ,GAAG,CAAC,MAAM,iBAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1C,MAAM,SAAS,GAAqB,EAAE,CAAC;QACvC,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;YAC1B,MAAM,gBAAgB,GAAG,MAAM,IAAA,+BAAc,EAAC,GAAG,CAAC,CAAC;YACnD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;gBAC/C,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,cAAc,EAAE,GAAG,CAAC,WAAW,CAAC,OAAO;aACxC,CAAC,CAAC;YACH,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SAC1B;QACD,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/D,IAAI,SAAS,EAAE;YACb,MAAM,IAAI,cAAO,CACf,uHAAuH,EACvH,mBAAmB,CACpB,CAAC;SACH;QACD,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC;QACnF,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;IAC/G,CAAC;;AA9BH,2BA+BC;AA9BwB,oBAAW,GAChC,0FAA0F,CAAC;AACtE,oBAAW,GAAgB;IAChD,OAAO,EAAE,eAAK,CAAC,OAAO,CAAC;QACrB,WAAW,EAAE,iEAAiE;KAC/E,CAAC;CACH,CAAC"}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
const os_1 = require("os");
|
|
10
10
|
const command_1 = require("@salesforce/command");
|
|
11
11
|
const core_1 = require("@salesforce/core");
|
|
12
|
-
const
|
|
12
|
+
const core_2 = require("@oclif/core");
|
|
13
13
|
const repositories_1 = require("../../repositories");
|
|
14
14
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
15
15
|
const messages = core_1.Messages.loadMessages('@salesforce/plugin-release-management', 'repositories');
|
|
@@ -17,7 +17,7 @@ class Repositories extends command_1.SfdxCommand {
|
|
|
17
17
|
async run() {
|
|
18
18
|
const repositories = await (0, repositories_1.retrieveKnownRepositories)();
|
|
19
19
|
if (!this.flags.json) {
|
|
20
|
-
|
|
20
|
+
core_2.CliUx.ux.table(repositories, {
|
|
21
21
|
organization: {},
|
|
22
22
|
name: {},
|
|
23
23
|
url: {},
|
|
@@ -40,6 +40,6 @@ Repositories.examples = messages.getMessage('examples').split(os_1.EOL);
|
|
|
40
40
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
41
41
|
Repositories.flagsConfig = {
|
|
42
42
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
-
...
|
|
43
|
+
...core_2.CliUx.ux.table.flags(),
|
|
44
44
|
};
|
|
45
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/repositories/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2BAAyB;AACzB,iDAA+D;AAC/D,2CAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/repositories/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,2BAAyB;AACzB,iDAA+D;AAC/D,2CAA4C;AAC5C,sCAAoC;AACpC,qDAA+E;AAE/E,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,YAAY,CAAC,uCAAuC,EAAE,cAAc,CAAC,CAAC;AAEhG,MAAqB,YAAa,SAAQ,qBAAW;IAU5C,KAAK,CAAC,GAAG;QACd,MAAM,YAAY,GAAG,MAAM,IAAA,wCAAyB,GAAE,CAAC;QAEvD,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;YACpB,YAAK,CAAC,EAAE,CAAC,KAAK,CACZ,YAAY,EACZ;gBACE,YAAY,EAAE,EAAE;gBAChB,IAAI,EAAE,EAAE;gBACR,GAAG,EAAE,EAAE;gBACP,QAAQ,EAAE;oBACR,GAAG,EAAE,CAAC,GAAmB,EAAU,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;oBACrG,QAAQ,EAAE,IAAI;iBACf;aACF,EACD;gBACE,mEAAmE;gBACnE,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC9B,GAAG,IAAI,CAAC,KAAK,EAAE,eAAe;aAC/B,CACF,CAAC;SACH;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;;AAjCH,+BAkCC;AAjCwB,wBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,qBAAQ,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,QAAG,CAAC,CAAC;AAE7E,mEAAmE;AAC5C,wBAAW,GAAgB;IAChD,8DAA8D;IAC9D,GAAI,YAAK,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAU;CACnC,CAAC"}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
const path = require("path");
|
|
10
|
+
const fs = require("fs/promises");
|
|
10
11
|
const command_1 = require("@salesforce/command");
|
|
11
12
|
const core_1 = require("@salesforce/core");
|
|
12
13
|
const shelljs_1 = require("shelljs");
|
|
@@ -14,18 +15,22 @@ const kit_1 = require("@salesforce/kit");
|
|
|
14
15
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
15
16
|
const repository_1 = require("../../repository");
|
|
16
17
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
17
|
-
const messages = core_1.Messages.
|
|
18
|
+
const messages = core_1.Messages.load('@salesforce/plugin-release-management', 'typescript.update', [
|
|
19
|
+
'description',
|
|
20
|
+
'typescriptVersion',
|
|
21
|
+
'esTarget',
|
|
22
|
+
'InvalidTargetVersion',
|
|
23
|
+
'InvalidTypescriptVersion',
|
|
24
|
+
]);
|
|
18
25
|
class Update extends command_1.SfdxCommand {
|
|
19
26
|
async run() {
|
|
20
27
|
this.typescriptPkg = this.retrieveTsPackage();
|
|
21
28
|
this.validateEsTarget();
|
|
22
29
|
this.validateTsVersion();
|
|
23
|
-
this.repo =
|
|
24
|
-
|
|
25
|
-
: await repository_1.SinglePackageRepo.create({ ux: this.ux });
|
|
26
|
-
this.packages = await this.getPackages();
|
|
30
|
+
this.repo = await repository_1.PackageRepo.create({ ux: this.ux });
|
|
31
|
+
this.packages = this.getPackages();
|
|
27
32
|
this.ux.warn('This is for testing new versions only. To update the version you must go through dev-scripts.');
|
|
28
|
-
|
|
33
|
+
this.updateTsVersion();
|
|
29
34
|
await this.updateEsTarget();
|
|
30
35
|
try {
|
|
31
36
|
this.repo.install();
|
|
@@ -37,25 +42,29 @@ class Update extends command_1.SfdxCommand {
|
|
|
37
42
|
this.repo.revertUnstagedChanges();
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
|
-
|
|
41
|
-
return
|
|
45
|
+
getPackages() {
|
|
46
|
+
return [this.repo.package];
|
|
42
47
|
}
|
|
43
48
|
async updateEsTargetConfig(packagePath) {
|
|
44
49
|
const tsConfigPath = path.join(packagePath, 'tsconfig.json');
|
|
45
|
-
const tsConfigString = await
|
|
50
|
+
const tsConfigString = await fs.readFile(tsConfigPath, 'utf-8');
|
|
46
51
|
// strip out any comments that might be in the tsconfig.json
|
|
47
52
|
const commentRegex = new RegExp(/(\/\/.*)/, 'gi');
|
|
48
53
|
const tsConfig = JSON.parse(tsConfigString.replace(commentRegex, ''));
|
|
49
54
|
(0, kit_1.set)((0, ts_types_1.asObject)(tsConfig), 'compilerOptions.target', this.flags.target);
|
|
50
55
|
this.ux.log(`Updating tsconfig target at ${tsConfigPath} to:`, this.flags.target);
|
|
51
|
-
|
|
56
|
+
const fileData = JSON.stringify(tsConfig, null, 2);
|
|
57
|
+
await fs.writeFile(tsConfigPath, fileData, {
|
|
58
|
+
encoding: 'utf8',
|
|
59
|
+
mode: '600',
|
|
60
|
+
});
|
|
52
61
|
}
|
|
53
62
|
async updateEsTarget() {
|
|
54
63
|
for (const pkg of this.packages) {
|
|
55
64
|
await this.updateEsTargetConfig(pkg.location);
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
|
-
|
|
67
|
+
updateTsVersion() {
|
|
59
68
|
const newVersion = this.determineNextTsVersion();
|
|
60
69
|
for (const pkg of this.packages) {
|
|
61
70
|
if (pkg.packageJson.devDependencies['typescript']) {
|
|
@@ -72,16 +81,6 @@ class Update extends command_1.SfdxCommand {
|
|
|
72
81
|
}
|
|
73
82
|
pkg.writePackageJson(pkg.location);
|
|
74
83
|
}
|
|
75
|
-
if (this.repo instanceof repository_1.LernaRepo) {
|
|
76
|
-
const pkgJson = (await core_1.fs.readJson('package.json'));
|
|
77
|
-
// If the install script runs sf-lerna-install, the install will fail because the typescript version
|
|
78
|
-
// won't match the expected version. So in that case, we delete the prepare script so that we
|
|
79
|
-
// get a successful install
|
|
80
|
-
if (pkgJson.scripts['install'] === 'sf-lerna-install') {
|
|
81
|
-
delete pkgJson.scripts['install'];
|
|
82
|
-
await core_1.fs.writeJson('package.json', pkgJson);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
84
|
}
|
|
86
85
|
determineNextTsVersion() {
|
|
87
86
|
return this.flags.version === 'latest' || !this.flags.version
|
|
@@ -94,7 +93,7 @@ class Update extends command_1.SfdxCommand {
|
|
|
94
93
|
return JSON.parse(result.stdout);
|
|
95
94
|
}
|
|
96
95
|
else {
|
|
97
|
-
throw new core_1.
|
|
96
|
+
throw new core_1.SfError('Could not find typescript on the npm registry', 'TypescriptNotFound');
|
|
98
97
|
}
|
|
99
98
|
}
|
|
100
99
|
validateEsTarget() {
|
|
@@ -102,15 +101,13 @@ class Update extends command_1.SfdxCommand {
|
|
|
102
101
|
return true;
|
|
103
102
|
if (/ES[0-9]{4}/g.test(this.flags.target))
|
|
104
103
|
return true;
|
|
105
|
-
throw core_1.
|
|
106
|
-
this.flags.target,
|
|
107
|
-
]);
|
|
104
|
+
throw new core_1.SfError(messages.getMessage('InvalidTargetVersion'), 'InvalidTargetVersion', [this.flags.target]);
|
|
108
105
|
}
|
|
109
106
|
validateTsVersion() {
|
|
110
107
|
if (this.flags.version === 'latest')
|
|
111
108
|
return true;
|
|
112
109
|
if (this.flags.version && !this.typescriptPkg.versions.includes(this.flags.version)) {
|
|
113
|
-
throw core_1.
|
|
110
|
+
throw new core_1.SfError(messages.getMessage('InvalidTypescriptVersion'), 'InvalidTypescriptVersion', [
|
|
114
111
|
this.flags.version,
|
|
115
112
|
]);
|
|
116
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/typescript/update.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,6BAA6B;AAC7B,iDAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/commands/typescript/update.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAEH,6BAA6B;AAC7B,kCAAkC;AAClC,iDAAsE;AACtE,2CAAqD;AACrD,qCAA+B;AAC/B,yCAAsC;AACtC,mDAAoE;AAEpE,iDAA+C;AAE/C,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,IAAI,CAAC,uCAAuC,EAAE,mBAAmB,EAAE;IAC3F,aAAa;IACb,mBAAmB;IACnB,UAAU;IACV,sBAAsB;IACtB,0BAA0B;CAC3B,CAAC,CAAC;AAEH,MAAqB,MAAO,SAAQ,qBAAW;IAmBtC,KAAK,CAAC,GAAG;QACd,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC9C,IAAI,CAAC,gBAAgB,EAAE,CAAC;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,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE;YACnF,MAAM,IAAI,cAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC,EAAE,0BAA0B,EAAE;gBAC7F,IAAI,CAAC,KAAK,CAAC,OAAO;aACnB,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAAC;IACd,CAAC;;AA1HH,yBA2HC;AA1HwB,kBAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AACjD,kBAAW,GAAgB;IAChD,OAAO,EAAE,eAAK,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,mBAAmB,CAAC;QACrD,OAAO,EAAE,QAAQ;KAClB,CAAC;IACF,MAAM,EAAE,eAAK,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,GAAG;QACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC;QAC5C,OAAO,EAAE,QAAQ;KAClB,CAAC;CACH,CAAC"}
|
package/lib/dependabot.js
CHANGED
|
@@ -7,12 +7,14 @@ exports.getOwnerAndRepo = exports.maxVersionBumpFlag = exports.meetsVersionCrite
|
|
|
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
|
|
9
9
|
*/
|
|
10
|
+
const fs = require("fs");
|
|
10
11
|
const semver_1 = require("semver");
|
|
11
12
|
const command_1 = require("@salesforce/command");
|
|
12
13
|
const core_1 = require("@salesforce/core");
|
|
14
|
+
const kit_1 = require("@salesforce/kit");
|
|
13
15
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
14
16
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
15
|
-
const messages = core_1.Messages.
|
|
17
|
+
const messages = core_1.Messages.load('@salesforce/plugin-release-management', 'dependabot.consolidate', ['maxVersionBump']);
|
|
16
18
|
const meetsVersionCriteria = (title, maxVersionBump) => {
|
|
17
19
|
const versionsRegex = /[0-9]+.[0-9]+.[0-9]+/g;
|
|
18
20
|
const [from, to] = title.match(versionsRegex);
|
|
@@ -34,10 +36,10 @@ exports.maxVersionBumpFlag = command_1.flags.enum({
|
|
|
34
36
|
required: true,
|
|
35
37
|
});
|
|
36
38
|
const getOwnerAndRepo = async (ownerFlag, repoFlag) => {
|
|
37
|
-
|
|
38
|
-
const pkgJson = (
|
|
39
|
+
const fileData = await fs.promises.readFile('package.json', 'utf8');
|
|
40
|
+
const pkgJson = (0, kit_1.parseJson)(fileData, 'package.json', false);
|
|
39
41
|
if (pkgJson.repository && (0, ts_types_1.isString)(pkgJson.repository)) {
|
|
40
|
-
const [owner, repo] =
|
|
42
|
+
const [owner, repo] = pkgJson.repository?.split('/');
|
|
41
43
|
return { owner, repo };
|
|
42
44
|
}
|
|
43
45
|
else {
|
package/lib/dependabot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependabot.js","sourceRoot":"","sources":["../src/dependabot.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,mCAA2C;AAC3C,iDAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"dependabot.js","sourceRoot":"","sources":["../src/dependabot.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,yBAAyB;AACzB,mCAA2C;AAC3C,iDAA4C;AAC5C,2CAA4C;AAC5C,yCAA4C;AAC5C,mDAA8D;AAK9D,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,IAAI,CAAC,uCAAuC,EAAE,wBAAwB,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAE/G,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAE,cAAwB,EAAW,EAAE;IACvF,MAAM,aAAa,GAAG,uBAAuB,CAAC;IAC9C,MAAM,CAAC,IAAI,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AC;KACxB;SAAM;QACL,OAAO;YACL,KAAK,EAAE,IAAA,uBAAY,EAAC,SAAS,EAAE,2BAA2B,CAAC;YAC3D,IAAI,EAAE,IAAA,uBAAY,EAAC,QAAQ,EAAE,+BAA+B,CAAC;SAC9D,CAAC;KACH;AACH,CAAC,CAAC;AAfW,QAAA,eAAe,mBAe1B"}
|
package/lib/dependencies.d.ts
CHANGED
package/lib/inspectCommits.d.ts
CHANGED
|
@@ -20,4 +20,4 @@ export interface CommitInspection {
|
|
|
20
20
|
* We, however, don't want to publish a new version for chore, docs, etc. So we analyze
|
|
21
21
|
* the commits to see if any of them indicate that a new release should be published.
|
|
22
22
|
*/
|
|
23
|
-
export declare function inspectCommits(pkg: Package
|
|
23
|
+
export declare function inspectCommits(pkg: Package): Promise<CommitInspection>;
|
package/lib/inspectCommits.js
CHANGED
|
@@ -20,21 +20,17 @@ const conventionalChangelogPresetLoader = require("conventional-changelog-preset
|
|
|
20
20
|
* We, however, don't want to publish a new version for chore, docs, etc. So we analyze
|
|
21
21
|
* the commits to see if any of them indicate that a new release should be published.
|
|
22
22
|
*/
|
|
23
|
-
async function inspectCommits(pkg
|
|
23
|
+
async function inspectCommits(pkg) {
|
|
24
24
|
const skippableCommitTypes = ['chore', 'style', 'docs', 'ci', 'test'];
|
|
25
25
|
// find the latest git tag so that we can get all the commits that have happened since
|
|
26
26
|
const tags = (0, shelljs_1.exec)('git fetch --tags && git tag', { silent: true }).stdout.split(os.EOL);
|
|
27
|
-
const latestTag =
|
|
28
|
-
? tags.find((tag) => tag.includes(`${pkg.name}@${pkg.npmPackage.version}`)) || ''
|
|
29
|
-
: tags.find((tag) => tag.includes(pkg.npmPackage.version));
|
|
27
|
+
const latestTag = tags.find((tag) => tag.includes(pkg.npmPackage.version));
|
|
30
28
|
// import the default commit parser configuration
|
|
31
29
|
const defaultConfigPath = require.resolve('conventional-changelog-conventionalcommits');
|
|
32
30
|
const configuration = await conventionalChangelogPresetLoader({ name: defaultConfigPath });
|
|
33
31
|
const commits = await new Promise((resolve) => {
|
|
34
32
|
const DELIMITER = 'SPLIT';
|
|
35
|
-
const gitLogCommand =
|
|
36
|
-
? `git log --format=%B%n-hash-%n%H%n${DELIMITER} ${latestTag}..HEAD --no-merges -- ${pkg.location}`
|
|
37
|
-
: `git log --format=%B%n-hash-%n%H%n${DELIMITER} ${latestTag}..HEAD --no-merges`;
|
|
33
|
+
const gitLogCommand = `git log --format=%B%n-hash-%n%H%n${DELIMITER} ${latestTag}..HEAD --no-merges`;
|
|
38
34
|
const gitLog = (0, shelljs_1.exec)(gitLogCommand, { silent: true })
|
|
39
35
|
.stdout.split(`${DELIMITER}${os.EOL}`)
|
|
40
36
|
.filter((c) => !!c);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inspectCommits.js","sourceRoot":"","sources":["../src/inspectCommits.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yBAAyB;AACzB,mCAAkC;AAClC,qCAA+B;AAC/B,yEAAyE;AACzE,0FAA0F;AAkB1F;;;;;;;GAOG;AACI,KAAK,UAAU,cAAc,CAAC,GAAY
|
|
1
|
+
{"version":3,"file":"inspectCommits.js","sourceRoot":"","sources":["../src/inspectCommits.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,yBAAyB;AACzB,mCAAkC;AAClC,qCAA+B;AAC/B,yEAAyE;AACzE,0FAA0F;AAkB1F;;;;;;;GAOG;AACI,KAAK,UAAU,cAAc,CAAC,GAAY;IAC/C,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAEtE,sFAAsF;IACtF,MAAM,IAAI,GAAG,IAAA,cAAI,EAAC,6BAA6B,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IACxF,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI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import { AsyncOptionalCreatable } from '@salesforce/kit';
|
|
2
|
-
import { AnyJson } from '@salesforce/ts-types';
|
|
2
|
+
import { AnyJson, Nullable } from '@salesforce/ts-types';
|
|
3
3
|
export declare type PackageJson = {
|
|
4
4
|
name: string;
|
|
5
5
|
version: string;
|
|
@@ -38,6 +38,13 @@ export interface VersionValidation {
|
|
|
38
38
|
valid: boolean;
|
|
39
39
|
name: string;
|
|
40
40
|
}
|
|
41
|
+
interface DependencyInfo {
|
|
42
|
+
dependencyName: string;
|
|
43
|
+
packageName: string;
|
|
44
|
+
alias: Nullable<string>;
|
|
45
|
+
currentVersion?: string;
|
|
46
|
+
finalVersion?: string;
|
|
47
|
+
}
|
|
41
48
|
export declare function parseAliasedPackageName(alias: string): string;
|
|
42
49
|
export declare function parsePackageVersion(alias: string): string;
|
|
43
50
|
export declare class Package extends AsyncOptionalCreatable {
|
|
@@ -62,7 +69,10 @@ export declare class Package extends AsyncOptionalCreatable {
|
|
|
62
69
|
getNextVersion(): string;
|
|
63
70
|
nextVersionIsAvailable(): boolean;
|
|
64
71
|
writePackageJson(rootDir?: string): void;
|
|
72
|
+
getDistTags(name: string): Record<string, string>;
|
|
65
73
|
bumpResolutions(tag: string): void;
|
|
74
|
+
getDependencyInfo(name: string, dependencies: Record<string, string>): DependencyInfo;
|
|
75
|
+
bumpDependencyVersions(targetDependencies: string[]): DependencyInfo[];
|
|
66
76
|
getNextRCVersion(tag: string, isPatch?: boolean): string;
|
|
67
77
|
pinDependencyVersions(targetTag: string): ChangedPackageVersions;
|
|
68
78
|
/**
|
|
@@ -74,3 +84,4 @@ export declare class Package extends AsyncOptionalCreatable {
|
|
|
74
84
|
protected init(): Promise<void>;
|
|
75
85
|
private createDefaultNpmPackage;
|
|
76
86
|
}
|
|
87
|
+
export {};
|
package/lib/package.js
CHANGED
|
@@ -7,11 +7,12 @@ exports.Package = exports.parsePackageVersion = exports.parseAliasedPackageName
|
|
|
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
|
|
9
9
|
*/
|
|
10
|
+
const fs = require("fs");
|
|
10
11
|
const path = require("path");
|
|
11
12
|
const semver = require("semver");
|
|
12
|
-
const
|
|
13
|
+
const core_1 = require("@oclif/core");
|
|
13
14
|
const shelljs_1 = require("shelljs");
|
|
14
|
-
const
|
|
15
|
+
const core_2 = require("@salesforce/core");
|
|
15
16
|
const kit_1 = require("@salesforce/kit");
|
|
16
17
|
const ts_types_1 = require("@salesforce/ts-types");
|
|
17
18
|
const registry_1 = require("./registry");
|
|
@@ -32,7 +33,8 @@ class Package extends kit_1.AsyncOptionalCreatable {
|
|
|
32
33
|
}
|
|
33
34
|
async readPackageJson() {
|
|
34
35
|
const pkgJsonPath = this.location ? path.join(this.location, 'package.json') : 'package.json';
|
|
35
|
-
|
|
36
|
+
const fileData = await fs.promises.readFile(pkgJsonPath, 'utf8');
|
|
37
|
+
return (0, kit_1.parseJson)(fileData, pkgJsonPath, false);
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
38
40
|
* Retrieve the npm package info using `npm view`
|
|
@@ -48,9 +50,8 @@ class Package extends kit_1.AsyncOptionalCreatable {
|
|
|
48
50
|
return result.stdout ? JSON.parse(result.stdout) : null;
|
|
49
51
|
}
|
|
50
52
|
validateNextVersion() {
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
const currentVersion = (_b = this.npmPackage.version) !== null && _b !== void 0 ? _b : null;
|
|
53
|
+
const nextVersionExists = (this.npmPackage.versions ?? []).includes(this.nextVersion);
|
|
54
|
+
const currentVersion = this.npmPackage.version ?? null;
|
|
54
55
|
if (!nextVersionExists) {
|
|
55
56
|
this.logger.debug(`${this.npmPackage.name}@${this.nextVersion} does not exist in the registry. Proceeding...`);
|
|
56
57
|
return {
|
|
@@ -83,25 +84,101 @@ class Package extends kit_1.AsyncOptionalCreatable {
|
|
|
83
84
|
}
|
|
84
85
|
writePackageJson(rootDir) {
|
|
85
86
|
const pkgJsonPath = rootDir ? path.join(rootDir, 'package.json') : 'package.json';
|
|
86
|
-
|
|
87
|
+
const fileData = JSON.stringify(this.packageJson, null, 2);
|
|
88
|
+
fs.writeFileSync(pkgJsonPath, fileData, {
|
|
89
|
+
encoding: 'utf8',
|
|
90
|
+
mode: '600',
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
getDistTags(name) {
|
|
94
|
+
const result = (0, shelljs_1.exec)(`npm view ${name} dist-tags ${this.registry.getRegistryParameter()} --json`, {
|
|
95
|
+
silent: true,
|
|
96
|
+
});
|
|
97
|
+
return JSON.parse(result.stdout);
|
|
87
98
|
}
|
|
88
99
|
bumpResolutions(tag) {
|
|
89
100
|
if (!this.packageJson.resolutions) {
|
|
90
|
-
throw new
|
|
101
|
+
throw new core_2.SfError('Bumping resolutions requires property "resolutions" to be present in package.json');
|
|
91
102
|
}
|
|
92
103
|
Object.keys(this.packageJson.resolutions).map((key) => {
|
|
93
|
-
const
|
|
94
|
-
silent: true,
|
|
95
|
-
});
|
|
96
|
-
const versions = JSON.parse(result.stdout);
|
|
104
|
+
const versions = this.getDistTags(key);
|
|
97
105
|
this.packageJson.resolutions[key] = versions[tag];
|
|
98
106
|
});
|
|
99
107
|
}
|
|
108
|
+
// Lookup dependency info by package name or npm alias
|
|
109
|
+
// Examples: @salesforce/plugin-info or @sf/info
|
|
110
|
+
// Pass in the dependencies you want to search through (dependencies, devDependencies, resolutions, etc)
|
|
111
|
+
getDependencyInfo(name, dependencies) {
|
|
112
|
+
for (const [key, value] of Object.entries(dependencies)) {
|
|
113
|
+
if (key === name) {
|
|
114
|
+
if (value.startsWith('npm:')) {
|
|
115
|
+
// npm alias was passed in as name, so we need to parse package name and version
|
|
116
|
+
// e.g. passed in: "@sf/login"
|
|
117
|
+
// dependency: "@sf/login": "npm:@salesforce/plugin-login@1.1.1"
|
|
118
|
+
return {
|
|
119
|
+
dependencyName: key,
|
|
120
|
+
packageName: parseAliasedPackageName(value),
|
|
121
|
+
alias: value,
|
|
122
|
+
currentVersion: parsePackageVersion(value),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// package name was passed, so we can use key and value directly
|
|
127
|
+
return {
|
|
128
|
+
dependencyName: key,
|
|
129
|
+
packageName: key,
|
|
130
|
+
alias: null,
|
|
131
|
+
currentVersion: value,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (value.startsWith(`npm:${name}`)) {
|
|
136
|
+
// package name was passed in as name, but an alias is used for the dependency
|
|
137
|
+
// e.g. passed in: "@salesforce/plugin-login"
|
|
138
|
+
// dependency: "@sf/login": "npm:@salesforce/plugin-login@1.1.1"
|
|
139
|
+
return {
|
|
140
|
+
dependencyName: key,
|
|
141
|
+
packageName: name,
|
|
142
|
+
alias: value,
|
|
143
|
+
currentVersion: parsePackageVersion(value),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
core_1.CliUx.ux.error(`${name} was not found in the dependencies section of the package.json`);
|
|
148
|
+
}
|
|
149
|
+
bumpDependencyVersions(targetDependencies) {
|
|
150
|
+
return targetDependencies
|
|
151
|
+
.map((dep) => {
|
|
152
|
+
// regex for npm package with optional namespace and version
|
|
153
|
+
// https://regex101.com/r/HmIu3N/1
|
|
154
|
+
const npmPackageRegex = /^((?:@[^/]+\/)?[^@/]+)(?:@([^@/]+))?$/;
|
|
155
|
+
const [, name, version] = npmPackageRegex.exec(dep);
|
|
156
|
+
// We will look for packages in dependencies and resolutions
|
|
157
|
+
const { dependencies, resolutions } = this.packageJson;
|
|
158
|
+
// find dependency in package.json (could be an npm alias)
|
|
159
|
+
const depInfo = this.getDependencyInfo(name, { ...dependencies, ...resolutions });
|
|
160
|
+
// if a version is not provided, we'll look up the "latest" version
|
|
161
|
+
depInfo.finalVersion = version ?? this.getDistTags(depInfo.packageName).latest;
|
|
162
|
+
// return if version did not change
|
|
163
|
+
if (depInfo.currentVersion === depInfo.finalVersion)
|
|
164
|
+
return;
|
|
165
|
+
// override final version if npm alias is used
|
|
166
|
+
if (depInfo.alias) {
|
|
167
|
+
depInfo.finalVersion = `npm:${depInfo.packageName}@${depInfo.finalVersion}`;
|
|
168
|
+
}
|
|
169
|
+
// update dependency (or resolution) in package.json
|
|
170
|
+
if (dependencies[depInfo.dependencyName]) {
|
|
171
|
+
this.packageJson.dependencies[depInfo.dependencyName] = depInfo.finalVersion;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
this.packageJson.resolutions[depInfo.dependencyName] = depInfo.finalVersion;
|
|
175
|
+
}
|
|
176
|
+
return depInfo;
|
|
177
|
+
})
|
|
178
|
+
.filter(Boolean); // remove falsy values, in this case the `undefined` if version did not change
|
|
179
|
+
}
|
|
100
180
|
getNextRCVersion(tag, isPatch = false) {
|
|
101
|
-
const
|
|
102
|
-
silent: true,
|
|
103
|
-
});
|
|
104
|
-
const versions = JSON.parse(result.stdout);
|
|
181
|
+
const versions = this.getDistTags(this.packageJson.name);
|
|
105
182
|
const version = semver.parse(versions[tag]);
|
|
106
183
|
return isPatch
|
|
107
184
|
? `${version.major}.${version.minor}.${version.patch + 1}`
|
|
@@ -110,7 +187,7 @@ class Package extends kit_1.AsyncOptionalCreatable {
|
|
|
110
187
|
pinDependencyVersions(targetTag) {
|
|
111
188
|
// get the list of dependencies to hardcode
|
|
112
189
|
if (!this.packageJson.pinnedDependencies) {
|
|
113
|
-
throw new
|
|
190
|
+
throw new core_2.SfError('Pinning package dependencies requires property "pinnedDependencies" to be present in package.json');
|
|
114
191
|
}
|
|
115
192
|
const { pinnedDependencies, dependencies } = this.packageJson;
|
|
116
193
|
const deps = pinnedDependencies
|
|
@@ -119,7 +196,7 @@ class Package extends kit_1.AsyncOptionalCreatable {
|
|
|
119
196
|
const [tag] = tagRegex.exec(d) || [];
|
|
120
197
|
const name = tag ? d.replace(new RegExp(`@${tag}$`), '') : d;
|
|
121
198
|
if (!dependencies[name]) {
|
|
122
|
-
|
|
199
|
+
core_1.CliUx.ux.warn(`${name} was not found in the dependencies section of your package.json. Skipping...`);
|
|
123
200
|
return;
|
|
124
201
|
}
|
|
125
202
|
const version = dependencies[name];
|
|
@@ -144,10 +221,7 @@ class Package extends kit_1.AsyncOptionalCreatable {
|
|
|
144
221
|
const pinnedPackages = [];
|
|
145
222
|
deps.forEach((dep) => {
|
|
146
223
|
// get the 'release' tag version or the version specified by the passed in tag
|
|
147
|
-
const
|
|
148
|
-
silent: true,
|
|
149
|
-
});
|
|
150
|
-
const versions = JSON.parse(result.stdout);
|
|
224
|
+
const versions = this.getDistTags(dep.name);
|
|
151
225
|
let tag = dep.tag;
|
|
152
226
|
// if tag is 'latest-rc' and there's no latest-rc release for a package, default to latest
|
|
153
227
|
if (!versions[tag]) {
|
|
@@ -158,7 +232,7 @@ class Package extends kit_1.AsyncOptionalCreatable {
|
|
|
158
232
|
// include a latest-rc version for a single plugin but everything else we want latest.
|
|
159
233
|
let version;
|
|
160
234
|
if (semver.gt(dep.version, versions[tag])) {
|
|
161
|
-
|
|
235
|
+
core_1.CliUx.ux.warn(`${dep.name} is currently pinned at ${dep.version} which is higher than ${tag} (${versions[tag]}). Assuming that this is intentional...`);
|
|
162
236
|
version = dep.version;
|
|
163
237
|
tag = (0, kit_1.findKey)(versions, (v) => v === version);
|
|
164
238
|
}
|
|
@@ -167,10 +241,10 @@ class Package extends kit_1.AsyncOptionalCreatable {
|
|
|
167
241
|
}
|
|
168
242
|
// insert the new hardcoded versions into the dependencies in the project's package.json
|
|
169
243
|
if (dep.alias) {
|
|
170
|
-
this.packageJson
|
|
244
|
+
this.packageJson.dependencies[dep.alias] = `npm:${dep.name}@${version}`;
|
|
171
245
|
}
|
|
172
246
|
else {
|
|
173
|
-
this.packageJson
|
|
247
|
+
this.packageJson.dependencies[dep.name] = version;
|
|
174
248
|
}
|
|
175
249
|
// accumulate information to return
|
|
176
250
|
pinnedPackages.push({ name: dep.name, version, tag, alias: dep.alias });
|
|
@@ -182,14 +256,13 @@ class Package extends kit_1.AsyncOptionalCreatable {
|
|
|
182
256
|
* published to the registry
|
|
183
257
|
*/
|
|
184
258
|
nextVersionIsHardcoded() {
|
|
185
|
-
|
|
186
|
-
return !((_a = this.npmPackage.versions) !== null && _a !== void 0 ? _a : []).includes(this.packageJson.version);
|
|
259
|
+
return !(this.npmPackage.versions ?? []).includes(this.packageJson.version);
|
|
187
260
|
}
|
|
188
261
|
hasScript(scriptName) {
|
|
189
262
|
return !!(0, ts_types_1.get)(this.packageJson, `scripts.${scriptName}`, null);
|
|
190
263
|
}
|
|
191
264
|
async init() {
|
|
192
|
-
this.logger = await
|
|
265
|
+
this.logger = await core_2.Logger.child(this.constructor.name);
|
|
193
266
|
this.packageJson = await this.readPackageJson();
|
|
194
267
|
this.name = this.packageJson.name;
|
|
195
268
|
this.npmPackage = this.retrieveNpmPackage() || this.createDefaultNpmPackage();
|