@servicetitan/startup 28.0.0 → 28.1.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/dist/cli/commands/mfe-package-clean.d.ts +1 -0
- package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-clean.js +13 -2
- package/dist/cli/commands/mfe-package-clean.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +3 -3
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-publish.d.ts +2 -1
- package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-publish.js +13 -13
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/utils/get-branch-configs.d.ts +3 -0
- package/dist/utils/get-branch-configs.d.ts.map +1 -0
- package/dist/utils/get-branch-configs.js +18 -0
- package/dist/utils/get-branch-configs.js.map +1 -0
- package/dist/utils/get-configuration.d.ts +13 -3
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +29 -5
- package/dist/utils/get-configuration.js.map +1 -1
- package/package.json +7 -7
- package/src/cli/commands/__tests__/mfe-package-clean.test.ts +44 -5
- package/src/cli/commands/__tests__/mfe-publish.test.ts +19 -1
- package/src/cli/commands/mfe-package-clean.ts +14 -3
- package/src/cli/commands/mfe-package-publish.ts +3 -3
- package/src/cli/commands/mfe-publish.ts +22 -13
- package/src/utils/__tests__/get-branch-configs.test.ts +36 -0
- package/src/utils/__tests__/get-configuration.test.ts +108 -0
- package/src/utils/get-branch-configs.ts +17 -0
- package/src/utils/get-configuration.ts +48 -7
- package/dist/cli/commands/get-branch-configs.d.ts +0 -4
- package/dist/cli/commands/get-branch-configs.d.ts.map +0 -1
- package/dist/cli/commands/get-branch-configs.js +0 -13
- package/dist/cli/commands/get-branch-configs.js.map +0 -1
- package/src/cli/commands/get-branch-configs.ts +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfe-package-clean.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/mfe-package-clean.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mfe-package-clean.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/mfe-package-clean.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,WAAW,gBAAgB;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,eAAgB,YAAW,OAAO;IAC/B,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,gBAAgB;IAE1C,WAAW;IAKL,OAAO;IA+Cb,OAAO,CAAC,YAAY;IAyBpB,OAAO,CAAC,mBAAmB;CAmD9B"}
|
|
@@ -11,8 +11,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MFEPackageClean = void 0;
|
|
13
13
|
const utils_1 = require("../../utils");
|
|
14
|
+
const cli_git_1 = require("../utils/cli-git");
|
|
14
15
|
const cli_npm_1 = require("../utils/cli-npm");
|
|
15
|
-
const get_branch_configs_1 = require("
|
|
16
|
+
const get_branch_configs_1 = require("../../utils/get-branch-configs");
|
|
16
17
|
class MFEPackageClean {
|
|
17
18
|
constructor(args) {
|
|
18
19
|
Object.defineProperty(this, "args", {
|
|
@@ -60,8 +61,18 @@ class MFEPackageClean {
|
|
|
60
61
|
if (!count) {
|
|
61
62
|
count = 5;
|
|
62
63
|
}
|
|
64
|
+
let branches;
|
|
65
|
+
if (this.args.branch === true) {
|
|
66
|
+
branches = [(0, cli_git_1.gitGetBranch)()];
|
|
67
|
+
}
|
|
68
|
+
else if (typeof this.args.branch === 'string') {
|
|
69
|
+
branches = [this.args.branch];
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
branches = Object.keys((0, get_branch_configs_1.getBranchesConfigs)());
|
|
73
|
+
}
|
|
63
74
|
const registry = 'https://verdaccio.servicetitan.com';
|
|
64
|
-
return { count, registry, branches
|
|
75
|
+
return { count, registry, branches };
|
|
65
76
|
}
|
|
66
77
|
getBranchedVersions(packageName, registry) {
|
|
67
78
|
const versions = (0, cli_npm_1.npmGetPackageVersionDates)(registry, packageName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfe-package-clean.js","sourceRoot":"","sources":["../../../src/cli/commands/mfe-package-clean.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAuE;AACvE,8CAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"mfe-package-clean.js","sourceRoot":"","sources":["../../../src/cli/commands/mfe-package-clean.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAuE;AACvE,8CAAgD;AAChD,8CAA2E;AAC3E,uEAAoE;AAQpE,MAAa,eAAe;IACxB,YAAoB,IAAsB;QAA9B;;;;mBAAQ,IAAI;WAAkB;IAAG,CAAC;IAE9C,WAAW;QACP,OAAO,SAAS,CAAC;IACrB,CAAC;IAGK,AAAN,KAAK,CAAC,OAAO;QACT,IAAI,CAAC,IAAA,sBAAc,GAAE,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QAC1D,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,IAAA,gBAAQ,EAAC,cAAc,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC;QACrC,MAAM,gBAAgB,GAAG,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAE9E,WAAG,CAAC,IAAI,CACJ,sBAAsB,IAAI,CAAC,KAAK,IAAI,EACpC,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE,SAAS,EAAE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C;CACJ;AAnID,0CAmIC;AA3HS;IADL,iBAAS;;;;8CA8CT"}
|
|
@@ -18,8 +18,8 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
18
18
|
const utils_1 = require("../../utils");
|
|
19
19
|
const cli_git_1 = require("../utils/cli-git");
|
|
20
20
|
const cli_npm_1 = require("../utils/cli-npm");
|
|
21
|
+
const get_branch_configs_1 = require("../../utils/get-branch-configs");
|
|
21
22
|
const publish_1 = require("../utils/publish");
|
|
22
|
-
const get_branch_configs_1 = require("./get-branch-configs");
|
|
23
23
|
class MFEPackagePublish {
|
|
24
24
|
constructor(args) {
|
|
25
25
|
Object.defineProperty(this, "args", {
|
|
@@ -87,7 +87,7 @@ class MFEPackagePublish {
|
|
|
87
87
|
var _a, _b, _c;
|
|
88
88
|
const cli = this.args;
|
|
89
89
|
const branch = (_a = cli.branch) !== null && _a !== void 0 ? _a : (0, cli_git_1.gitGetBranch)();
|
|
90
|
-
const branchConfig = (0, get_branch_configs_1.
|
|
90
|
+
const branchConfig = (0, get_branch_configs_1.getBranchesConfigs)()[branch];
|
|
91
91
|
let buildVersion = cli.build;
|
|
92
92
|
if (!buildVersion) {
|
|
93
93
|
buildVersion = (0, publish_1.getDefaultBuildVersion)(branch, (0, cli_git_1.gitGetCommitHash)());
|
|
@@ -103,7 +103,7 @@ class MFEPackagePublish {
|
|
|
103
103
|
tag = cli.tag;
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
tag = (_b = branchConfig === null || branchConfig === void 0 ? void 0 : branchConfig.
|
|
106
|
+
tag = (_b = branchConfig === null || branchConfig === void 0 ? void 0 : branchConfig.publishTag) !== null && _b !== void 0 ? _b : '';
|
|
107
107
|
}
|
|
108
108
|
const registry = (_c = cli.registry) !== null && _c !== void 0 ? _c : 'https://verdaccio.servicetitan.com';
|
|
109
109
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfe-package-publish.js","sourceRoot":"","sources":["../../../src/cli/commands/mfe-package-publish.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,uCAAmF;AACnF,8CAAkE;AAClE,8CAM0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"mfe-package-publish.js","sourceRoot":"","sources":["../../../src/cli/commands/mfe-package-publish.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,4CAAoB;AACpB,uCAAmF;AACnF,8CAAkE;AAClE,8CAM0B;AAC1B,uEAAoE;AACpE,8CAA0D;AAa1D,MAAa,iBAAiB;IAC1B,YAAoB,IAAwB;QAAhC;;;;mBAAQ,IAAI;WAAoB;IAAG,CAAC;IAEhD,WAAW;QACP,OAAO,SAAS,CAAC;IACrB,CAAC;IAGK,AAAN,KAAK,CAAC,OAAO;QACT,IAAI,CAAC,IAAA,sBAAc,GAAE,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,WAAW,GAAG,IAAA,gBAAQ,EAAC,cAAc,CAAC,CAAC;QAE7C,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACtB,WAAG,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;YACjD,OAAO;QACX,CAAC;QAED,MAAM,IAAI,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QACnC,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC;QAErC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAChB,WAAG,CAAC,IAAI,CAAC,0CAA0C,CAAC,CAAC;YACrD,OAAO;QACX,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAC1C,WAAG,CAAC,IAAI,CACJ,gFAAgF,CACnF,CAAC;YACF,OAAO;QACX,CAAC;QAED,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAExB,MAAM,QAAQ,GAAG,IA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,CAAC,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;oBAC9D,MAAM,IAAI,KAAK,CAAC,qBAAqB,QAAQ,gBAAgB,CAAC,CAAC;gBACnE,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAnKD,8CAmKC;AA3JS;IADL,iBAAS;;;;gDAqET"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArgsPackageClean } from './mfe-package-clean';
|
|
2
2
|
import { ArgsPackagePublish } from './mfe-package-publish';
|
|
3
3
|
import { Command } from './types';
|
|
4
|
-
interface Args extends ArgsPackagePublish, ArgsPackageClean {
|
|
4
|
+
interface Args extends Omit<ArgsPackagePublish, 'branch'>, ArgsPackageClean {
|
|
5
5
|
clean?: boolean;
|
|
6
6
|
concurrency?: number;
|
|
7
7
|
scope?: string | string[];
|
|
@@ -12,6 +12,7 @@ export declare class MFEPublish implements Command {
|
|
|
12
12
|
description(): string;
|
|
13
13
|
execute(): Promise<void>;
|
|
14
14
|
getPublishOptions(): string[];
|
|
15
|
+
getCleanOptions(): string[];
|
|
15
16
|
}
|
|
16
17
|
export {};
|
|
17
18
|
//# sourceMappingURL=mfe-publish.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfe-publish.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/mfe-publish.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mfe-publish.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/mfe-publish.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,UAAU,IAAK,SAAQ,IAAI,CAAC,kBAAkB,EAAE,QAAQ,CAAC,EAAE,gBAAgB;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B;AAED,qBAAa,UAAW,YAAW,OAAO;IAC1B,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI;IAE9B,WAAW;IAKL,OAAO;IA0Bb,iBAAiB,IAUe,MAAM,EAAE;IAGxC,eAAe,IAMiB,MAAM,EAAE;CAE3C"}
|
|
@@ -8,12 +8,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.MFEPublish = void 0;
|
|
16
|
-
const path_1 = __importDefault(require("path"));
|
|
17
13
|
const utils_1 = require("../../utils");
|
|
18
14
|
const utils_2 = require("../utils");
|
|
19
15
|
class MFEPublish {
|
|
@@ -31,11 +27,7 @@ class MFEPublish {
|
|
|
31
27
|
async execute() {
|
|
32
28
|
var _a, _b;
|
|
33
29
|
let packages = (_a = (0, utils_1.splitPackagesByType)((0, utils_1.getPackages)())[utils_1.PackageType.Webpack]) !== null && _a !== void 0 ? _a : [];
|
|
34
|
-
packages = packages.filter(p =>
|
|
35
|
-
var _a;
|
|
36
|
-
const packageJson = (0, utils_1.readJson)(path_1.default.join(p.location, 'package.json'));
|
|
37
|
-
return ((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.cli) === null || _a === void 0 ? void 0 : _a['web-component']) === true;
|
|
38
|
-
});
|
|
30
|
+
packages = packages.filter(p => (0, utils_1.isWebComponent)(p.location));
|
|
39
31
|
if (this.args.scope) {
|
|
40
32
|
packages = packages.filter(p => Array.isArray(this.args.scope)
|
|
41
33
|
? this.args.scope.includes(p.name)
|
|
@@ -44,20 +36,20 @@ class MFEPublish {
|
|
|
44
36
|
if (!packages.length) {
|
|
45
37
|
throw new Error('no packages found for publication');
|
|
46
38
|
}
|
|
39
|
+
const isClean = !!this.args.clean;
|
|
47
40
|
await (0, utils_2.lernaExec)({
|
|
48
|
-
'cmd': `startup mfe-package-${
|
|
41
|
+
'cmd': `startup mfe-package-${isClean ? 'clean' : 'publish'}`,
|
|
49
42
|
'concurrency': (_b = this.args.concurrency) !== null && _b !== void 0 ? _b : 1,
|
|
50
43
|
'scope': packages.map(({ name }) => name),
|
|
51
44
|
'stream': true,
|
|
52
|
-
'--': this.getPublishOptions(),
|
|
45
|
+
'--': isClean ? this.getCleanOptions() : this.getPublishOptions(),
|
|
53
46
|
});
|
|
54
47
|
}
|
|
55
48
|
getPublishOptions() {
|
|
56
|
-
const { build, branch,
|
|
49
|
+
const { build, branch, dry, force, registry, tag } = this.args;
|
|
57
50
|
return [
|
|
58
51
|
...[branch && `--branch ${branch}`],
|
|
59
52
|
...[build && `--build ${build}`],
|
|
60
|
-
...[count && `--count ${count}`],
|
|
61
53
|
...[dry && '--dry'],
|
|
62
54
|
...[force && '--force'],
|
|
63
55
|
...[registry && `--registry ${registry}`],
|
|
@@ -65,6 +57,14 @@ class MFEPublish {
|
|
|
65
57
|
...[tag === false && `--no-tag`],
|
|
66
58
|
].filter(item => !!item);
|
|
67
59
|
}
|
|
60
|
+
getCleanOptions() {
|
|
61
|
+
const { branch, count } = this.args;
|
|
62
|
+
return [
|
|
63
|
+
...[branch && typeof branch === 'string' && `--branch ${branch}`],
|
|
64
|
+
...[branch && branch === true && '--branch'],
|
|
65
|
+
...[count && `--count ${count}`],
|
|
66
|
+
].filter(item => !!item);
|
|
67
|
+
}
|
|
68
68
|
}
|
|
69
69
|
exports.MFEPublish = MFEPublish;
|
|
70
70
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfe-publish.js","sourceRoot":"","sources":["../../../src/cli/commands/mfe-publish.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mfe-publish.js","sourceRoot":"","sources":["../../../src/cli/commands/mfe-publish.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAMqB;AAIrB,oCAAqC;AAQrC,MAAa,UAAU;IACnB,YAAoB,IAAU;QAAlB;;;;mBAAQ,IAAI;WAAM;IAAG,CAAC;IAElC,WAAW;QACP,OAAO,mCAAmC,CAAC;IAC/C,CAAC;IAGK,AAAN,KAAK,CAAC,OAAO;;QACT,IAAI,QAAQ,GAAG,MAAA,IAAA,2BAAmB,EAAC,IAAA,mBAAW,GAAE,CAAC,CAAC,mBAAW,CAAC,OAAO,CAAC,mCAAI,EAAE,CAAC;QAC7E,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,sBAAc,EAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE5D,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;YAClB,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAC3B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;gBAC1B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;gBAClC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,IAAI,CACnC,CAAC;QACN,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACzD,CAAC;QAED,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,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,MAAM,EAAE,CAAC;YACjE,GAAG,CAAC,MAAM,IAAI,MAAM,KAAK,IAAI,IAAI,UAAU,CAAC;YAC5C,GAAG,CAAC,KAAK,IAAI,WAAW,KAAK,EAAE,CAAC;SACnC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAa,CAAC;IACzC,CAAC;CACJ;AAvDD,gCAuDC;AA/CS;IADL,iBAAS;;;;yCAyBT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-branch-configs.d.ts","sourceRoot":"","sources":["../../src/utils/get-branch-configs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAWlF,wBAAgB,kBAAkB,IAAI,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,CAK9E"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBranchesConfigs = getBranchesConfigs;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
function getDefaultConfigs() {
|
|
6
|
+
return {
|
|
7
|
+
develop: { publishTag: 'dev' },
|
|
8
|
+
dev: { publishTag: 'dev' },
|
|
9
|
+
next: { publishTag: 'next' },
|
|
10
|
+
master: { publishTag: 'prod' },
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function getBranchesConfigs() {
|
|
14
|
+
const packageConfigs = (0, index_1.getWebComponentBranchConfigs)();
|
|
15
|
+
const defaultConfigs = getDefaultConfigs();
|
|
16
|
+
return packageConfigs !== null && packageConfigs !== void 0 ? packageConfigs : defaultConfigs;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=get-branch-configs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-branch-configs.js","sourceRoot":"","sources":["../../src/utils/get-branch-configs.ts"],"names":[],"mappings":";;AAWA,gDAKC;AAhBD,mCAAkF;AAElF,SAAS,iBAAiB;IACtB,OAAO;QACH,OAAO,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC9B,GAAG,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE;QAC1B,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE;QAC5B,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE;KACjC,CAAC;AACN,CAAC;AAED,SAAgB,kBAAkB;IAC9B,MAAM,cAAc,GAAG,IAAA,oCAA4B,GAAE,CAAC;IACtD,MAAM,cAAc,GAAG,iBAAiB,EAAE,CAAC;IAE3C,OAAO,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,cAAc,CAAC;AAC5C,CAAC"}
|
|
@@ -50,8 +50,16 @@ export declare enum CommandName {
|
|
|
50
50
|
'styles-check' = "styles-check",
|
|
51
51
|
'test' = "test"
|
|
52
52
|
}
|
|
53
|
+
export interface WebComponentBranchConfigs {
|
|
54
|
+
publishTag?: string;
|
|
55
|
+
}
|
|
53
56
|
interface WebComponentOptions {
|
|
54
|
-
legacyRoot
|
|
57
|
+
legacyRoot?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* mapping of git branches to configs.
|
|
60
|
+
* Used to separate configs (ex publish tag) depending on current branch
|
|
61
|
+
*/
|
|
62
|
+
branches?: Record<string, WebComponentBranchConfigs>;
|
|
55
63
|
}
|
|
56
64
|
type Configuration = {
|
|
57
65
|
'legacy'?: boolean;
|
|
@@ -60,7 +68,7 @@ type Configuration = {
|
|
|
60
68
|
stylelint: StylelintConfiguration;
|
|
61
69
|
};
|
|
62
70
|
'test'?: JestConfiguration;
|
|
63
|
-
'web-component'?: boolean | WebComponentOptions;
|
|
71
|
+
'web-component'?: boolean | string | WebComponentOptions;
|
|
64
72
|
'webpack'?: false | WebpackConfiguration;
|
|
65
73
|
} & {
|
|
66
74
|
[key in CommandName]: NodeConfiguration;
|
|
@@ -72,6 +80,8 @@ export declare function getESLintConfiguration(): ESLintConfiguration;
|
|
|
72
80
|
export declare function getJestConfiguration(): JestConfiguration & NodeConfiguration;
|
|
73
81
|
export declare function getStylelintConfiguration(): StylelintConfiguration;
|
|
74
82
|
export declare function getWebpackConfiguration(locationOrJson?: LocationOrJson): WebpackConfiguration;
|
|
83
|
+
export declare function getWebComponentConfiguration(locationOrJson?: LocationOrJson): WebComponentOptions | undefined;
|
|
84
|
+
export declare function getWebComponentBranchConfigs(locationOrJson?: LocationOrJson): Record<string, WebComponentBranchConfigs> | undefined;
|
|
75
85
|
export declare function isBundle(locationOrJson?: LocationOrJson): boolean;
|
|
76
86
|
export declare function isCustomStyleRules(): boolean;
|
|
77
87
|
export declare function isDevServerDisabled(): boolean;
|
|
@@ -79,6 +89,6 @@ export declare function isExposeSharedDependencies(): boolean;
|
|
|
79
89
|
export declare function isLegacy(locationOrJson?: LocationOrJson): boolean;
|
|
80
90
|
export declare function isLegacyRoot(): boolean;
|
|
81
91
|
export declare function isStyleCheckDisabled(): boolean;
|
|
82
|
-
export declare function isWebComponent(): boolean;
|
|
92
|
+
export declare function isWebComponent(locationOrJson?: LocationOrJson): boolean;
|
|
83
93
|
export {};
|
|
84
94
|
//# sourceMappingURL=get-configuration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-configuration.d.ts","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-configuration.d.ts","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,IAAI,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,eAAO,MAAM,8BAA8B,iDAAkD,CAAC;AAE9F,KAAK,WAAW,CAAC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ExC;AAED,wBAAgB,uBAAuB,CAAC,cAAc,CAAC,EAAE,cAAc,wBAGtE;AAED,wBAAgB,4BAA4B,CACxC,cAAc,GAAE,cAAqB,GACtC,mBAAmB,GAAG,SAAS,CAsBjC;AAED,wBAAgB,4BAA4B,CAAC,cAAc,GAAE,cAAqB,yDAIjF;AAED,wBAAgB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,WAEvD;AAED,wBAAgB,kBAAkB,YAEjC;AAED,wBAAgB,mBAAmB,YAGlC;AAED,wBAAgB,0BAA0B,YAEzC;AAED,wBAAgB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,WAEvD;AAED,wBAAgB,YAAY,YAE3B;AAED,wBAAgB,oBAAoB,YAEnC;AAED,wBAAgB,cAAc,CAAC,cAAc,GAAE,cAAqB,WAEnE"}
|
|
@@ -10,6 +10,8 @@ exports.getESLintConfiguration = getESLintConfiguration;
|
|
|
10
10
|
exports.getJestConfiguration = getJestConfiguration;
|
|
11
11
|
exports.getStylelintConfiguration = getStylelintConfiguration;
|
|
12
12
|
exports.getWebpackConfiguration = getWebpackConfiguration;
|
|
13
|
+
exports.getWebComponentConfiguration = getWebComponentConfiguration;
|
|
14
|
+
exports.getWebComponentBranchConfigs = getWebComponentBranchConfigs;
|
|
13
15
|
exports.isBundle = isBundle;
|
|
14
16
|
exports.isCustomStyleRules = isCustomStyleRules;
|
|
15
17
|
exports.isDevServerDisabled = isDevServerDisabled;
|
|
@@ -18,8 +20,10 @@ exports.isLegacy = isLegacy;
|
|
|
18
20
|
exports.isLegacyRoot = isLegacyRoot;
|
|
19
21
|
exports.isStyleCheckDisabled = isStyleCheckDisabled;
|
|
20
22
|
exports.isWebComponent = isWebComponent;
|
|
23
|
+
const fs_1 = __importDefault(require("fs"));
|
|
21
24
|
const path_1 = __importDefault(require("path"));
|
|
22
25
|
const read_json_1 = require("./read-json");
|
|
26
|
+
const log_1 = require("./log");
|
|
23
27
|
exports.allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'static'];
|
|
24
28
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
25
29
|
var CommandName;
|
|
@@ -69,6 +73,27 @@ function getWebpackConfiguration(locationOrJson) {
|
|
|
69
73
|
const { webpack } = getConfiguration(locationOrJson);
|
|
70
74
|
return typeof webpack === 'object' ? webpack : {};
|
|
71
75
|
}
|
|
76
|
+
function getWebComponentConfiguration(locationOrJson = './') {
|
|
77
|
+
const config = getConfigurationSafe(locationOrJson)['web-component'];
|
|
78
|
+
if (config === true) {
|
|
79
|
+
return {};
|
|
80
|
+
}
|
|
81
|
+
if (typeof config === 'object') {
|
|
82
|
+
return config;
|
|
83
|
+
}
|
|
84
|
+
if (typeof config === 'string') {
|
|
85
|
+
const configPath = path_1.default.resolve(typeof locationOrJson === 'string' ? path_1.default.join(locationOrJson, config) : config);
|
|
86
|
+
if (fs_1.default.existsSync(configPath)) {
|
|
87
|
+
return require(path_1.default.resolve(configPath));
|
|
88
|
+
}
|
|
89
|
+
log_1.log.warning(`could not find web-component configuration: "${config}"`);
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function getWebComponentBranchConfigs(locationOrJson = './') {
|
|
94
|
+
const config = getWebComponentConfiguration(locationOrJson);
|
|
95
|
+
return config === null || config === void 0 ? void 0 : config.branches;
|
|
96
|
+
}
|
|
72
97
|
function isBundle(locationOrJson) {
|
|
73
98
|
return getConfiguration(locationOrJson).webpack !== false;
|
|
74
99
|
}
|
|
@@ -86,14 +111,13 @@ function isLegacy(locationOrJson) {
|
|
|
86
111
|
return getConfiguration(locationOrJson).legacy === true;
|
|
87
112
|
}
|
|
88
113
|
function isLegacyRoot() {
|
|
89
|
-
|
|
90
|
-
return
|
|
114
|
+
var _a;
|
|
115
|
+
return ((_a = getWebComponentConfiguration()) === null || _a === void 0 ? void 0 : _a.legacyRoot) === true;
|
|
91
116
|
}
|
|
92
117
|
function isStyleCheckDisabled() {
|
|
93
118
|
return getWebpackConfiguration()['disable-style-check'] === true;
|
|
94
119
|
}
|
|
95
|
-
function isWebComponent() {
|
|
96
|
-
|
|
97
|
-
return config === true || typeof config === 'object';
|
|
120
|
+
function isWebComponent(locationOrJson = './') {
|
|
121
|
+
return !!getWebComponentConfiguration(locationOrJson);
|
|
98
122
|
}
|
|
99
123
|
//# sourceMappingURL=get-configuration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-configuration.js","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"get-configuration.js","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":";;;;;;AAoGA,4CAMC;AAED,oDAMC;AAED,wDAEC;AAED,oDAEC;AAED,8DAEC;AAED,0DAGC;AAED,oEAwBC;AAED,oEAIC;AAED,4BAEC;AAED,gDAEC;AAED,kDAGC;AAED,gEAEC;AAED,4BAEC;AAED,oCAEC;AAED,oDAEC;AAED,wCAEC;AApMD,4CAAoB;AACpB,gDAAwB;AAMxB,2CAAqD;AACrD,+BAA4B;AAEf,QAAA,8BAA8B,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AA8C9F,yDAAyD;AACzD,IAAY,WAeX;AAfD,WAAY,WAAW;IACnB,8BAAiB,CAAA;IACjB,gDAAmC,CAAA;IACnC,gCAAmB,CAAA;IACnB,4BAAe,CAAA;IACf,kCAAqB,CAAA;IACrB,oDAAuC,CAAA;IACvC,4BAAe,CAAA;IACf,sDAAyC,CAAA;IACzC,0DAA6C,CAAA;IAC7C,0CAA6B,CAAA;IAC7B,kDAAqC,CAAA;IACrC,8BAAiB,CAAA;IACjB,4CAA+B,CAAA;IAC/B,4BAAe,CAAA;AACnB,CAAC,EAfW,WAAW,2BAAX,WAAW,QAetB;AA4BD,SAAgB,gBAAgB,CAAC,iBAAiC,IAAI;;IAClE,MAAM,IAAI,GACN,OAAO,cAAc,KA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B,QAAQ,CAAC,cAA+B;IACpD,OAAO,gBAAgB,CAAC,cAAc,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC;AAC5D,CAAC;AAED,SAAgB,YAAY;;IACxB,OAAO,CAAA,MAAA,4BAA4B,EAAE,0CAAE,UAAU,MAAK,IAAI,CAAC;AAC/D,CAAC;AAED,SAAgB,oBAAoB;IAChC,OAAO,uBAAuB,EAAE,CAAC,qBAAqB,CAAC,KAAK,IAAI,CAAC;AACrE,CAAC;AAED,SAAgB,cAAc,CAAC,iBAAiC,IAAI;IAChE,OAAO,CAAC,CAAC,4BAA4B,CAAC,cAAc,CAAC,CAAC;AAC1D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/startup",
|
|
3
|
-
"version": "28.
|
|
3
|
+
"version": "28.1.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/startup",
|
|
6
6
|
"repository": {
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"@jest/core": "~29.7.0",
|
|
32
32
|
"@jest/types": "~29.6.3",
|
|
33
33
|
"@jsdevtools/coverage-istanbul-loader": "^3.0.5",
|
|
34
|
-
"@servicetitan/eslint-config": "28.
|
|
35
|
-
"@servicetitan/stylelint-config": "28.
|
|
34
|
+
"@servicetitan/eslint-config": "28.1.1",
|
|
35
|
+
"@servicetitan/stylelint-config": "28.1.1",
|
|
36
36
|
"@svgr/webpack": "^8.1.0",
|
|
37
|
-
"@swc/core": "1.
|
|
37
|
+
"@swc/core": "1.9.2",
|
|
38
38
|
"@types/debug": "^4.1.12",
|
|
39
39
|
"@types/jest": "~29.5.12",
|
|
40
40
|
"chalk": "~4.1.2",
|
|
@@ -65,9 +65,9 @@
|
|
|
65
65
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
66
66
|
"multimatch": "~5.0.0",
|
|
67
67
|
"portfinder": "~1.0.32",
|
|
68
|
-
"postcss": "~8.4.
|
|
68
|
+
"postcss": "~8.4.49",
|
|
69
69
|
"prettier": "~3.3.3",
|
|
70
|
-
"sass": "~1.
|
|
70
|
+
"sass": "~1.81.0",
|
|
71
71
|
"sass-loader": "~16.0.3",
|
|
72
72
|
"source-map-loader": "~5.0.0",
|
|
73
73
|
"string-width": "<5.0.0",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"cli": {
|
|
103
103
|
"webpack": false
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "35c714f4eaf0ba60dd6fa3fc583f0283edfb4a44"
|
|
106
106
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { fs, vol } from 'memfs';
|
|
2
2
|
import { isWebComponent, log } from '../../../utils';
|
|
3
|
+
import { gitGetBranch } from '../../utils/cli-git';
|
|
3
4
|
import { npmGetPackageVersionDates, npmUnpublish } from '../../utils/cli-npm';
|
|
4
5
|
|
|
5
6
|
import { MFEPackageClean } from '../mfe-package-clean';
|
|
@@ -14,6 +15,9 @@ jest.mock('../../utils/cli-npm', () => ({
|
|
|
14
15
|
npmGetPackageVersionDates: jest.fn(),
|
|
15
16
|
npmUnpublish: jest.fn(),
|
|
16
17
|
}));
|
|
18
|
+
jest.mock('../../utils/cli-git', () => ({
|
|
19
|
+
gitGetBranch: jest.fn(),
|
|
20
|
+
}));
|
|
17
21
|
|
|
18
22
|
const DEFAULT_VERSIONS_TO_KEEP = 5;
|
|
19
23
|
|
|
@@ -23,18 +27,23 @@ describe(`[startup] ${MFEPackageClean.name}`, () => {
|
|
|
23
27
|
let args: ConstructorParameters<typeof MFEPackageClean>[0];
|
|
24
28
|
let versions: Record<string, Date>;
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
`0.0.0-master.${(0xff000000 + index).toString(16)}`,
|
|
30
|
+
function getBranchVersions(branchName: string, length: number) {
|
|
31
|
+
return Object.fromEntries(
|
|
32
|
+
Array.from({ length }).map((_, index) => [
|
|
33
|
+
`0.0.0-${branchName}.${(0xff000000 + index).toString(16)}`,
|
|
31
34
|
dayAgo(index + 1), // tests assume versions are in reverse chronological order
|
|
32
35
|
])
|
|
33
36
|
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
beforeEach(() => {
|
|
40
|
+
args = {};
|
|
41
|
+
versions = getBranchVersions('master', 10);
|
|
34
42
|
|
|
35
43
|
jest.resetAllMocks();
|
|
36
44
|
jest.mocked(isWebComponent).mockReturnValue(true);
|
|
37
45
|
jest.mocked(npmGetPackageVersionDates).mockImplementation(() => Object.entries(versions));
|
|
46
|
+
jest.mocked(gitGetBranch).mockImplementation(() => 'current');
|
|
38
47
|
vol.fromJSON({ 'package.json': JSON.stringify({ name: packageName }) });
|
|
39
48
|
});
|
|
40
49
|
|
|
@@ -74,6 +83,36 @@ describe(`[startup] ${MFEPackageClean.name}`, () => {
|
|
|
74
83
|
itLogsAndUnpublishedOldestPackages({ branch });
|
|
75
84
|
});
|
|
76
85
|
|
|
86
|
+
describe.each(['qa', true])('when selected branch is %s', (branch: string | true) => {
|
|
87
|
+
let branchedVersions: typeof versions = {};
|
|
88
|
+
const branchName = branch === true ? 'current' : branch;
|
|
89
|
+
|
|
90
|
+
beforeEach(() => {
|
|
91
|
+
args.branch = branch;
|
|
92
|
+
|
|
93
|
+
branchedVersions = getBranchVersions(branchName, 7);
|
|
94
|
+
|
|
95
|
+
versions = {
|
|
96
|
+
...versions,
|
|
97
|
+
...branchedVersions,
|
|
98
|
+
};
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test(`logs and unpublishes oldest packages for ${branchName} branch`, async () => {
|
|
102
|
+
const oldest = Object.entries(branchedVersions).slice(DEFAULT_VERSIONS_TO_KEEP);
|
|
103
|
+
|
|
104
|
+
await subject();
|
|
105
|
+
|
|
106
|
+
expect(log.info).toHaveBeenCalledWith(
|
|
107
|
+
'found versions for unpublish:',
|
|
108
|
+
JSON.stringify({ [branchName]: oldest }, null, 4)
|
|
109
|
+
);
|
|
110
|
+
oldest.forEach(([version]) => {
|
|
111
|
+
expect(npmUnpublish).toHaveBeenCalledWith(registry, packageName, version);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
77
116
|
describe('with master versions generated by nerdbank versioning', () => {
|
|
78
117
|
beforeEach(() => {
|
|
79
118
|
versions = transform(versions, (v: string, index: number) =>
|
|
@@ -94,6 +94,25 @@ describe(`[startup] ${MFEPublish.name}`, () => {
|
|
|
94
94
|
expect.objectContaining({ cmd: 'startup mfe-package-clean' })
|
|
95
95
|
);
|
|
96
96
|
});
|
|
97
|
+
|
|
98
|
+
type ArgumentName = keyof typeof args;
|
|
99
|
+
const testArgs: { name: ArgumentName; value: any; expected?: string }[] = [
|
|
100
|
+
{ name: 'count', value: 10 },
|
|
101
|
+
{ name: 'branch', value: 'foo-123' },
|
|
102
|
+
{ name: 'branch', value: true, expected: '--branch' },
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
describe.each(testArgs)('with "{$name: $value}"', ({ name, value, expected }) => {
|
|
106
|
+
beforeEach(() => (args[name] = value));
|
|
107
|
+
|
|
108
|
+
test(`runs clean with "${expected ?? `--${name} ${value}`}"`, async () => {
|
|
109
|
+
await subject();
|
|
110
|
+
|
|
111
|
+
expect(lernaExec).toHaveBeenCalledWith(
|
|
112
|
+
expect.objectContaining({ '--': [expected ?? `--${name} ${value}`] })
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
97
116
|
});
|
|
98
117
|
|
|
99
118
|
type ArgumentName = keyof typeof args;
|
|
@@ -105,7 +124,6 @@ describe(`[startup] ${MFEPublish.name}`, () => {
|
|
|
105
124
|
{ name: 'dry', value: true, expected: '--dry' },
|
|
106
125
|
{ name: 'force', value: true, expected: '--force' },
|
|
107
126
|
{ name: 'registry', value: 'https://foo' },
|
|
108
|
-
{ name: 'count', value: 42 },
|
|
109
127
|
];
|
|
110
128
|
|
|
111
129
|
describe.each(testArgs)('with "{$name: $value}"', ({ name, value, expected }) => {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { isWebComponent, log, logErrors, readJson } from '../../utils';
|
|
2
|
+
import { gitGetBranch } from '../utils/cli-git';
|
|
2
3
|
import { npmGetPackageVersionDates, npmUnpublish } from '../utils/cli-npm';
|
|
3
|
-
import {
|
|
4
|
+
import { getBranchesConfigs } from '../../utils/get-branch-configs';
|
|
4
5
|
import { Command } from './types';
|
|
5
6
|
|
|
6
7
|
export interface ArgsPackageClean {
|
|
8
|
+
branch?: string | true;
|
|
7
9
|
count?: number;
|
|
8
10
|
}
|
|
9
11
|
|
|
@@ -68,14 +70,23 @@ export class MFEPackageClean implements Command {
|
|
|
68
70
|
branches: string[];
|
|
69
71
|
} {
|
|
70
72
|
let count = this.args.count;
|
|
71
|
-
|
|
72
73
|
if (!count) {
|
|
73
74
|
count = 5;
|
|
74
75
|
}
|
|
75
76
|
|
|
77
|
+
let branches: string[];
|
|
78
|
+
|
|
79
|
+
if (this.args.branch === true) {
|
|
80
|
+
branches = [gitGetBranch()];
|
|
81
|
+
} else if (typeof this.args.branch === 'string') {
|
|
82
|
+
branches = [this.args.branch];
|
|
83
|
+
} else {
|
|
84
|
+
branches = Object.keys(getBranchesConfigs());
|
|
85
|
+
}
|
|
86
|
+
|
|
76
87
|
const registry = 'https://verdaccio.servicetitan.com';
|
|
77
88
|
|
|
78
|
-
return { count, registry, branches
|
|
89
|
+
return { count, registry, branches };
|
|
79
90
|
}
|
|
80
91
|
|
|
81
92
|
private getBranchedVersions(packageName: string, registry: string) {
|
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
npmPublishDry,
|
|
10
10
|
npmTagVersion,
|
|
11
11
|
} from '../utils/cli-npm';
|
|
12
|
+
import { getBranchesConfigs } from '../../utils/get-branch-configs';
|
|
12
13
|
import { getDefaultBuildVersion } from '../utils/publish';
|
|
13
14
|
import { EntryPoint, EntryPoints, Metadata } from '../../webpack/configs';
|
|
14
|
-
import { getBranchConfigs } from './get-branch-configs';
|
|
15
15
|
import { Command } from './types';
|
|
16
16
|
|
|
17
17
|
export interface ArgsPackagePublish {
|
|
@@ -112,7 +112,7 @@ export class MFEPackagePublish implements Command {
|
|
|
112
112
|
} {
|
|
113
113
|
const cli = this.args;
|
|
114
114
|
const branch = cli.branch ?? gitGetBranch();
|
|
115
|
-
const branchConfig =
|
|
115
|
+
const branchConfig = getBranchesConfigs()[branch];
|
|
116
116
|
let buildVersion = cli.build;
|
|
117
117
|
|
|
118
118
|
if (!buildVersion) {
|
|
@@ -130,7 +130,7 @@ export class MFEPackagePublish implements Command {
|
|
|
130
130
|
} else if (cli.tag) {
|
|
131
131
|
tag = cli.tag;
|
|
132
132
|
} else {
|
|
133
|
-
tag = branchConfig?.
|
|
133
|
+
tag = branchConfig?.publishTag ?? '';
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
const registry = cli.registry ?? 'https://verdaccio.servicetitan.com';
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
getPackages,
|
|
3
|
+
isWebComponent,
|
|
4
|
+
logErrors,
|
|
5
|
+
PackageType,
|
|
6
|
+
splitPackagesByType,
|
|
7
|
+
} from '../../utils';
|
|
4
8
|
import { ArgsPackageClean } from './mfe-package-clean';
|
|
5
9
|
import { ArgsPackagePublish } from './mfe-package-publish';
|
|
6
10
|
import { Command } from './types';
|
|
7
11
|
import { lernaExec } from '../utils';
|
|
8
12
|
|
|
9
|
-
interface Args extends ArgsPackagePublish, ArgsPackageClean {
|
|
13
|
+
interface Args extends Omit<ArgsPackagePublish, 'branch'>, ArgsPackageClean {
|
|
10
14
|
clean?: boolean;
|
|
11
15
|
concurrency?: number;
|
|
12
16
|
scope?: string | string[];
|
|
@@ -22,11 +26,7 @@ export class MFEPublish implements Command {
|
|
|
22
26
|
@logErrors
|
|
23
27
|
async execute() {
|
|
24
28
|
let packages = splitPackagesByType(getPackages())[PackageType.Webpack] ?? [];
|
|
25
|
-
packages = packages.filter(p =>
|
|
26
|
-
const packageJson = readJson(path.join(p.location, 'package.json'));
|
|
27
|
-
|
|
28
|
-
return packageJson?.cli?.['web-component'] === true;
|
|
29
|
-
});
|
|
29
|
+
packages = packages.filter(p => isWebComponent(p.location));
|
|
30
30
|
|
|
31
31
|
if (this.args.scope) {
|
|
32
32
|
packages = packages.filter(p =>
|
|
@@ -40,21 +40,21 @@ export class MFEPublish implements Command {
|
|
|
40
40
|
throw new Error('no packages found for publication');
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
const isClean = !!this.args.clean;
|
|
43
44
|
await lernaExec({
|
|
44
|
-
'cmd': `startup mfe-package-${
|
|
45
|
+
'cmd': `startup mfe-package-${isClean ? 'clean' : 'publish'}`,
|
|
45
46
|
'concurrency': this.args.concurrency ?? 1,
|
|
46
47
|
'scope': packages.map(({ name }) => name),
|
|
47
48
|
'stream': true,
|
|
48
|
-
'--': this.getPublishOptions(),
|
|
49
|
+
'--': isClean ? this.getCleanOptions() : this.getPublishOptions(),
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
getPublishOptions() {
|
|
53
|
-
const { build, branch,
|
|
54
|
+
const { build, branch, dry, force, registry, tag } = this.args as ArgsPackagePublish;
|
|
54
55
|
return [
|
|
55
56
|
...[branch && `--branch ${branch}`],
|
|
56
57
|
...[build && `--build ${build}`],
|
|
57
|
-
...[count && `--count ${count}`],
|
|
58
58
|
...[dry && '--dry'],
|
|
59
59
|
...[force && '--force'],
|
|
60
60
|
...[registry && `--registry ${registry}`],
|
|
@@ -62,4 +62,13 @@ export class MFEPublish implements Command {
|
|
|
62
62
|
...[tag === false && `--no-tag`],
|
|
63
63
|
].filter(item => !!item) as string[];
|
|
64
64
|
}
|
|
65
|
+
|
|
66
|
+
getCleanOptions() {
|
|
67
|
+
const { branch, count } = this.args as ArgsPackageClean;
|
|
68
|
+
return [
|
|
69
|
+
...[branch && typeof branch === 'string' && `--branch ${branch}`],
|
|
70
|
+
...[branch && branch === true && '--branch'],
|
|
71
|
+
...[count && `--count ${count}`],
|
|
72
|
+
].filter(item => !!item) as string[];
|
|
73
|
+
}
|
|
65
74
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { fs, vol } from 'memfs';
|
|
2
|
+
|
|
3
|
+
import { getBranchesConfigs } from '../get-branch-configs';
|
|
4
|
+
|
|
5
|
+
jest.mock('fs', () => fs);
|
|
6
|
+
|
|
7
|
+
describe(`[Startup] ${getBranchesConfigs.name}`, () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
vol.reset();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const subject = () => getBranchesConfigs();
|
|
13
|
+
|
|
14
|
+
test('returns default configs', () => {
|
|
15
|
+
expect(subject()).toEqual({
|
|
16
|
+
develop: { publishTag: 'dev' },
|
|
17
|
+
dev: { publishTag: 'dev' },
|
|
18
|
+
next: { publishTag: 'next' },
|
|
19
|
+
master: { publishTag: 'prod' },
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('when "branches" configs', () => {
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
vol.fromJSON({
|
|
26
|
+
'package.json': JSON.stringify({
|
|
27
|
+
cli: { 'web-component': { branches: { qa: { publishTag: 'qs' } } } },
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('returns configs', () => {
|
|
33
|
+
expect(subject()).toEqual({ qa: { publishTag: 'qs' } });
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { fs, vol } from 'memfs';
|
|
2
|
+
import path from 'path';
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
getConfiguration,
|
|
@@ -6,6 +7,8 @@ import {
|
|
|
6
7
|
getESLintConfiguration,
|
|
7
8
|
getJestConfiguration,
|
|
8
9
|
getStylelintConfiguration,
|
|
10
|
+
getWebComponentBranchConfigs,
|
|
11
|
+
getWebComponentConfiguration,
|
|
9
12
|
isBundle,
|
|
10
13
|
isCustomStyleRules,
|
|
11
14
|
isDevServerDisabled,
|
|
@@ -183,6 +186,110 @@ describe('[startup] Utils', () => {
|
|
|
183
186
|
});
|
|
184
187
|
});
|
|
185
188
|
|
|
189
|
+
describe(`${getWebComponentConfiguration.name}`, () => {
|
|
190
|
+
let locationOrJson: string | Record<string, any> | undefined;
|
|
191
|
+
|
|
192
|
+
beforeEach(() => (locationOrJson = undefined));
|
|
193
|
+
|
|
194
|
+
const subject = () => getWebComponentConfiguration(locationOrJson);
|
|
195
|
+
|
|
196
|
+
itReturns(subject, undefined);
|
|
197
|
+
|
|
198
|
+
test('returns undefined', () => {
|
|
199
|
+
expect(subject()).toEqual(undefined);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
describe('with "cli.web-component true"', () => {
|
|
203
|
+
beforeEach(() => mockPackageJson({ cli: { 'web-component': true } }));
|
|
204
|
+
|
|
205
|
+
test('returns empty object', () => {
|
|
206
|
+
expect(subject()).toEqual({});
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe('with "cli.web-component.{}"', () => {
|
|
211
|
+
beforeEach(() => {
|
|
212
|
+
mockPackageJson({ cli: { 'web-component': { branches: { foo: 'bar' } } } });
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
test('returns web-component config', () => {
|
|
216
|
+
expect(subject()).toEqual({ branches: { foo: 'bar' } });
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
describe('with a location', () => {
|
|
221
|
+
const cli = { 'web-component': { baz: 'qux' } };
|
|
222
|
+
|
|
223
|
+
beforeEach(() => {
|
|
224
|
+
locationOrJson = 'packages/foo';
|
|
225
|
+
vol.fromJSON({ [`${locationOrJson}/package.json`]: JSON.stringify({ cli }) });
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
test("returns location's web-component config", () => {
|
|
229
|
+
expect(subject()).toEqual(cli['web-component']);
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
describe('when "cli.web-component" is a path', () => {
|
|
234
|
+
const configPath = './config.json';
|
|
235
|
+
const cli = { 'web-component': configPath };
|
|
236
|
+
const configJSON = { branches: { foo: 'bar' } };
|
|
237
|
+
|
|
238
|
+
beforeEach(() => {
|
|
239
|
+
vol.fromJSON({
|
|
240
|
+
...packageJsonFS({ cli }),
|
|
241
|
+
[configPath]: '',
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
jest.doMock(path.resolve(configPath), () => configJSON, {
|
|
245
|
+
virtual: true,
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
test('returns web-component config', () => {
|
|
250
|
+
expect(subject()).toEqual(configJSON);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
describe('with a location', () => {
|
|
254
|
+
const locationConfigJSON = { branches: { baz: 'qux' } };
|
|
255
|
+
|
|
256
|
+
beforeEach(() => {
|
|
257
|
+
locationOrJson = 'packages/foo';
|
|
258
|
+
vol.fromJSON({
|
|
259
|
+
[path.join(locationOrJson, 'package.json')]: JSON.stringify({ cli }),
|
|
260
|
+
[path.join(locationOrJson, configPath)]: '',
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
jest.doMock(
|
|
264
|
+
path.resolve(path.join(locationOrJson, configPath)),
|
|
265
|
+
() => locationConfigJSON,
|
|
266
|
+
{ virtual: true }
|
|
267
|
+
);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
test('returns web-component config relative to location', () => {
|
|
271
|
+
expect(subject()).toEqual(locationConfigJSON);
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
describe(`${getWebComponentBranchConfigs.name}`, () => {
|
|
278
|
+
const subject = () => getWebComponentBranchConfigs();
|
|
279
|
+
|
|
280
|
+
itReturns(subject, undefined);
|
|
281
|
+
|
|
282
|
+
describe('with "cli.web-component.branches"', () => {
|
|
283
|
+
const content = { cli: { 'web-component': { branches: { foo: 'bar' } } } };
|
|
284
|
+
|
|
285
|
+
beforeEach(() => mockPackageJson(content));
|
|
286
|
+
|
|
287
|
+
test('returns "cli.web-component.branches"', () => {
|
|
288
|
+
expect(subject()).toEqual(content.cli['web-component'].branches);
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
186
293
|
describe.each([
|
|
187
294
|
{
|
|
188
295
|
fn: isBundle,
|
|
@@ -221,6 +328,7 @@ describe('[startup] Utils', () => {
|
|
|
221
328
|
{ cli: { 'web-component': true } },
|
|
222
329
|
{ cli: { 'web-component': { legacyRoot: true } } },
|
|
223
330
|
{ cli: { 'web-component': { legacyRoot: false } } },
|
|
331
|
+
{ cli: { 'web-component': { branches: { develop: { publishTag: 'qa' } } } } },
|
|
224
332
|
],
|
|
225
333
|
},
|
|
226
334
|
{
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getWebComponentBranchConfigs, WebComponentBranchConfigs } from './index';
|
|
2
|
+
|
|
3
|
+
function getDefaultConfigs(): Record<string, WebComponentBranchConfigs> {
|
|
4
|
+
return {
|
|
5
|
+
develop: { publishTag: 'dev' },
|
|
6
|
+
dev: { publishTag: 'dev' },
|
|
7
|
+
next: { publishTag: 'next' },
|
|
8
|
+
master: { publishTag: 'prod' },
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function getBranchesConfigs(): Record<string, WebComponentBranchConfigs> {
|
|
13
|
+
const packageConfigs = getWebComponentBranchConfigs();
|
|
14
|
+
const defaultConfigs = getDefaultConfigs();
|
|
15
|
+
|
|
16
|
+
return packageConfigs ?? defaultConfigs;
|
|
17
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
1
2
|
import path from 'path';
|
|
2
3
|
|
|
3
4
|
import { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
|
|
@@ -5,6 +6,7 @@ import { ESLint } from 'eslint';
|
|
|
5
6
|
import { LinterOptions } from 'stylelint';
|
|
6
7
|
import { Config } from '@jest/types';
|
|
7
8
|
import { readJson, readJsonSafe } from './read-json';
|
|
9
|
+
import { log } from './log';
|
|
8
10
|
|
|
9
11
|
export const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'static'] as const;
|
|
10
12
|
|
|
@@ -71,15 +73,24 @@ export enum CommandName {
|
|
|
71
73
|
}
|
|
72
74
|
/* eslint-enable @typescript-eslint/naming-convention */
|
|
73
75
|
|
|
76
|
+
export interface WebComponentBranchConfigs {
|
|
77
|
+
publishTag?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
74
80
|
interface WebComponentOptions {
|
|
75
|
-
legacyRoot
|
|
81
|
+
legacyRoot?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* mapping of git branches to configs.
|
|
84
|
+
* Used to separate configs (ex publish tag) depending on current branch
|
|
85
|
+
*/
|
|
86
|
+
branches?: Record<string, WebComponentBranchConfigs>;
|
|
76
87
|
}
|
|
77
88
|
|
|
78
89
|
type Configuration = {
|
|
79
90
|
'legacy'?: boolean;
|
|
80
91
|
'lint'?: { eslint: ESLintConfiguration; stylelint: StylelintConfiguration };
|
|
81
92
|
'test'?: JestConfiguration;
|
|
82
|
-
'web-component'?: boolean | WebComponentOptions;
|
|
93
|
+
'web-component'?: boolean | string | WebComponentOptions;
|
|
83
94
|
'webpack'?: false | WebpackConfiguration;
|
|
84
95
|
} & {
|
|
85
96
|
[key in CommandName]: NodeConfiguration;
|
|
@@ -120,6 +131,38 @@ export function getWebpackConfiguration(locationOrJson?: LocationOrJson) {
|
|
|
120
131
|
return typeof webpack === 'object' ? webpack : {};
|
|
121
132
|
}
|
|
122
133
|
|
|
134
|
+
export function getWebComponentConfiguration(
|
|
135
|
+
locationOrJson: LocationOrJson = './'
|
|
136
|
+
): WebComponentOptions | undefined {
|
|
137
|
+
const config = getConfigurationSafe(locationOrJson)['web-component'];
|
|
138
|
+
|
|
139
|
+
if (config === true) {
|
|
140
|
+
return {};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (typeof config === 'object') {
|
|
144
|
+
return config;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (typeof config === 'string') {
|
|
148
|
+
const configPath = path.resolve(
|
|
149
|
+
typeof locationOrJson === 'string' ? path.join(locationOrJson, config) : config
|
|
150
|
+
);
|
|
151
|
+
if (fs.existsSync(configPath)) {
|
|
152
|
+
return require(path.resolve(configPath));
|
|
153
|
+
}
|
|
154
|
+
log.warning(`could not find web-component configuration: "${config}"`);
|
|
155
|
+
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function getWebComponentBranchConfigs(locationOrJson: LocationOrJson = './') {
|
|
161
|
+
const config = getWebComponentConfiguration(locationOrJson);
|
|
162
|
+
|
|
163
|
+
return config?.branches;
|
|
164
|
+
}
|
|
165
|
+
|
|
123
166
|
export function isBundle(locationOrJson?: LocationOrJson) {
|
|
124
167
|
return getConfiguration(locationOrJson).webpack !== false;
|
|
125
168
|
}
|
|
@@ -142,15 +185,13 @@ export function isLegacy(locationOrJson?: LocationOrJson) {
|
|
|
142
185
|
}
|
|
143
186
|
|
|
144
187
|
export function isLegacyRoot() {
|
|
145
|
-
|
|
146
|
-
return typeof config === 'object' && config.legacyRoot === true;
|
|
188
|
+
return getWebComponentConfiguration()?.legacyRoot === true;
|
|
147
189
|
}
|
|
148
190
|
|
|
149
191
|
export function isStyleCheckDisabled() {
|
|
150
192
|
return getWebpackConfiguration()['disable-style-check'] === true;
|
|
151
193
|
}
|
|
152
194
|
|
|
153
|
-
export function isWebComponent() {
|
|
154
|
-
|
|
155
|
-
return config === true || typeof config === 'object';
|
|
195
|
+
export function isWebComponent(locationOrJson: LocationOrJson = './') {
|
|
196
|
+
return !!getWebComponentConfiguration(locationOrJson);
|
|
156
197
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-branch-configs.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/get-branch-configs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,QAAO,MAAM,CAAC,MAAM,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAOlE,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBranchConfigs = void 0;
|
|
4
|
-
const getBranchConfigs = () => {
|
|
5
|
-
return {
|
|
6
|
-
develop: { tag: 'dev' },
|
|
7
|
-
dev: { tag: 'dev' },
|
|
8
|
-
next: { tag: 'next' },
|
|
9
|
-
master: { tag: 'prod' },
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
exports.getBranchConfigs = getBranchConfigs;
|
|
13
|
-
//# sourceMappingURL=get-branch-configs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-branch-configs.js","sourceRoot":"","sources":["../../../src/cli/commands/get-branch-configs.ts"],"names":[],"mappings":";;;AAAO,MAAM,gBAAgB,GAAG,GAAqC,EAAE;IACnE,OAAO;QACH,OAAO,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE;QACvB,GAAG,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE;QACnB,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;QACrB,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;KAC1B,CAAC;AACN,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B"}
|