@servicetitan/startup 31.3.2 → 31.5.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/dist/cli/commands/build.d.ts +0 -7
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +28 -17
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.d.ts +1 -1
- package/dist/cli/commands/bundle-package.d.ts.map +1 -1
- package/dist/cli/commands/bundle-package.js +13 -21
- package/dist/cli/commands/bundle-package.js.map +1 -1
- package/dist/cli/commands/clean.js +1 -1
- package/dist/cli/commands/clean.js.map +1 -1
- package/dist/cli/commands/eslint.d.ts +0 -1
- package/dist/cli/commands/eslint.d.ts.map +1 -1
- package/dist/cli/commands/eslint.js +0 -3
- package/dist/cli/commands/eslint.js.map +1 -1
- package/dist/cli/commands/get-command.d.ts.map +1 -1
- package/dist/cli/commands/get-command.js +3 -1
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/get-user-commands.js +3 -2
- package/dist/cli/commands/get-user-commands.js.map +1 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mfe-package-clean.d.ts +3 -4
- package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-clean.js +0 -3
- package/dist/cli/commands/mfe-package-clean.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.d.ts +9 -4
- package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +70 -47
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-publish.d.ts +3 -3
- package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-publish.js +7 -1
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/prepare-package.d.ts +0 -1
- package/dist/cli/commands/prepare-package.d.ts.map +1 -1
- package/dist/cli/commands/prepare-package.js +0 -3
- package/dist/cli/commands/prepare-package.js.map +1 -1
- package/dist/cli/commands/review/review.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-anvil-uikit-contrib-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-collection-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-uikit-version.js.map +1 -1
- package/dist/cli/commands/run-task.d.ts +0 -1
- package/dist/cli/commands/run-task.d.ts.map +1 -1
- package/dist/cli/commands/run-task.js +0 -3
- package/dist/cli/commands/run-task.js.map +1 -1
- package/dist/cli/commands/start.d.ts +0 -8
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +28 -16
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/styles-check.d.ts +0 -1
- package/dist/cli/commands/styles-check.d.ts.map +1 -1
- package/dist/cli/commands/styles-check.js +40 -99
- package/dist/cli/commands/styles-check.js.map +1 -1
- package/dist/cli/commands/tests.js.map +1 -1
- package/dist/cli/commands/types.d.ts +1 -1
- package/dist/cli/commands/types.d.ts.map +1 -1
- package/dist/cli/commands/upload-sourcemaps.d.ts +22 -0
- package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -0
- package/dist/cli/commands/upload-sourcemaps.js +179 -0
- package/dist/cli/commands/upload-sourcemaps.js.map +1 -0
- package/dist/cli/tasks/cli-task.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package.js.map +1 -1
- package/dist/cli/tasks/task.js.map +1 -1
- package/dist/cli/tasks/tsc-compile-package.js.map +1 -1
- package/dist/cli/tasks/tsc-compile.js.map +1 -1
- package/dist/cli/utils/bundle.d.ts +4 -1
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +67 -74
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/cli-os.js +2 -2
- package/dist/cli/utils/cli-os.js.map +1 -1
- package/dist/cli/utils/ts-config.js.map +1 -1
- package/dist/utils/find-packages.d.ts.map +1 -1
- package/dist/utils/find-packages.js +3 -4
- package/dist/utils/find-packages.js.map +1 -1
- package/dist/utils/find-up.d.ts +2 -0
- package/dist/utils/find-up.d.ts.map +1 -0
- package/dist/utils/find-up.js +28 -0
- package/dist/utils/find-up.js.map +1 -0
- package/dist/utils/get-configuration.d.ts +3 -1
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +1 -0
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/log.js.map +1 -1
- package/dist/webpack/configs/cache-config.d.ts +6 -0
- package/dist/webpack/configs/cache-config.d.ts.map +1 -0
- package/dist/webpack/configs/cache-config.js +52 -0
- package/dist/webpack/configs/cache-config.js.map +1 -0
- package/dist/webpack/configs/dev-server-config.js +1 -1
- package/dist/webpack/configs/dev-server-config.js.map +1 -1
- package/dist/webpack/configs/entry.config.d.ts.map +1 -1
- package/dist/webpack/configs/entry.config.js +15 -6
- package/dist/webpack/configs/entry.config.js.map +1 -1
- package/dist/webpack/configs/externals-config.d.ts.map +1 -1
- package/dist/webpack/configs/externals-config.js +6 -2
- package/dist/webpack/configs/externals-config.js.map +1 -1
- package/dist/webpack/configs/index.d.ts +1 -0
- package/dist/webpack/configs/index.d.ts.map +1 -1
- package/dist/webpack/configs/index.js +1 -0
- package/dist/webpack/configs/index.js.map +1 -1
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +7 -11
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js +25 -4
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts +6 -0
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +50 -8
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +3 -7
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +3 -2
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js +2 -2
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.d.ts +1 -1
- package/dist/webpack/configs/plugins/html-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.js +2 -3
- package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts +4 -0
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/html-tags-plugin.js +49 -0
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -0
- package/dist/webpack/configs/plugins/index.d.ts +2 -0
- package/dist/webpack/configs/plugins/index.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/index.js +2 -0
- package/dist/webpack/configs/plugins/index.js.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts +4 -0
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js +25 -0
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js.map +1 -0
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts +1 -0
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js +23 -14
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
- package/dist/webpack/configs/plugins-config.js +2 -0
- package/dist/webpack/configs/plugins-config.js.map +1 -1
- package/dist/webpack/configs/rules/css-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/css-rules.js +13 -18
- package/dist/webpack/configs/rules/css-rules.js.map +1 -1
- package/dist/webpack/configs/utils/get-bundle-type.d.ts +3 -0
- package/dist/webpack/configs/utils/get-bundle-type.d.ts.map +1 -0
- package/dist/webpack/configs/utils/get-bundle-type.js +24 -0
- package/dist/webpack/configs/utils/get-bundle-type.js.map +1 -0
- package/dist/webpack/configs/utils/index.d.ts +1 -0
- package/dist/webpack/configs/utils/index.d.ts.map +1 -1
- package/dist/webpack/configs/utils/index.js +1 -0
- package/dist/webpack/configs/utils/index.js.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +37 -48
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/types.d.ts +4 -0
- package/dist/webpack/types.d.ts.map +1 -1
- package/dist/webpack/utils/index.d.ts +1 -0
- package/dist/webpack/utils/index.d.ts.map +1 -1
- package/dist/webpack/utils/index.js +1 -0
- package/dist/webpack/utils/index.js.map +1 -1
- package/dist/webpack/utils/stringify-config.d.ts +2 -0
- package/dist/webpack/utils/stringify-config.d.ts.map +1 -0
- package/dist/webpack/utils/stringify-config.js +35 -0
- package/dist/webpack/utils/stringify-config.js.map +1 -0
- package/package.json +17 -15
- package/src/cli/commands/__tests__/build.test.ts +19 -2
- package/src/cli/commands/__tests__/bundle-package.test.ts +29 -8
- package/src/cli/commands/__tests__/clean.test.ts +2 -0
- package/src/cli/commands/__tests__/get-user-commands.test.ts +1 -1
- package/src/cli/commands/__tests__/mfe-package-publish.test.ts +91 -15
- package/src/cli/commands/__tests__/mfe-publish.test.ts +2 -0
- package/src/cli/commands/__tests__/start.test.ts +15 -1
- package/src/cli/commands/__tests__/styles-check.test.ts +27 -80
- package/src/cli/commands/__tests__/upload-sourcemaps.test.ts +127 -0
- package/src/cli/commands/build.ts +33 -17
- package/src/cli/commands/bundle-package.ts +10 -19
- package/src/cli/commands/clean.ts +1 -1
- package/src/cli/commands/eslint.ts +0 -4
- package/src/cli/commands/get-command.ts +2 -0
- package/src/cli/commands/get-user-commands.ts +1 -1
- package/src/cli/commands/mfe-package-clean.ts +2 -6
- package/src/cli/commands/mfe-package-publish.ts +104 -70
- package/src/cli/commands/mfe-publish.ts +8 -5
- package/src/cli/commands/prepare-package.ts +0 -4
- package/src/cli/commands/run-task.ts +0 -4
- package/src/cli/commands/start.ts +22 -5
- package/src/cli/commands/styles-check.ts +28 -131
- package/src/cli/commands/types.ts +1 -1
- package/src/cli/commands/upload-sourcemaps.ts +108 -0
- package/src/cli/utils/__tests__/bundle.test.ts +119 -9
- package/src/cli/utils/__tests__/cli-os.test.ts +2 -2
- package/src/cli/utils/__tests__/compile.test.ts +2 -0
- package/src/cli/utils/__tests__/type-check.test.ts +2 -0
- package/src/cli/utils/bundle.ts +76 -54
- package/src/cli/utils/cli-os.ts +2 -2
- package/src/utils/__tests__/get-configuration.test.ts +1 -1
- package/src/utils/find-packages.ts +3 -5
- package/src/utils/find-up.ts +12 -0
- package/src/utils/get-configuration.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/webpack/__mocks__/style-rules.ts +1 -1
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +274 -45
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +25 -1
- package/src/webpack/__tests__/create-webpack-config.test.ts +9 -57
- package/src/webpack/configs/cache-config.ts +37 -0
- package/src/webpack/configs/dev-server-config.ts +1 -1
- package/src/webpack/configs/entry.config.ts +18 -8
- package/src/webpack/configs/externals-config.ts +7 -2
- package/src/webpack/configs/index.ts +1 -0
- package/src/webpack/configs/optimization-config.ts +7 -11
- package/src/webpack/configs/output-config.ts +23 -7
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +46 -10
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +1 -6
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +3 -2
- package/src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts +2 -2
- package/src/webpack/configs/plugins/html-plugin.ts +2 -3
- package/src/webpack/configs/plugins/html-tags-plugin.ts +28 -0
- package/src/webpack/configs/plugins/index.ts +2 -0
- package/src/webpack/configs/plugins/remove-empty-scripts-plugin.ts +11 -0
- package/src/webpack/configs/plugins/virtual-modules-plugin.ts +27 -16
- package/src/webpack/configs/plugins-config.ts +4 -0
- package/src/webpack/configs/rules/css-rules.ts +19 -20
- package/src/webpack/configs/utils/get-bundle-type.ts +22 -0
- package/src/webpack/configs/utils/index.ts +1 -0
- package/src/webpack/create-webpack-config.ts +46 -52
- package/src/webpack/types.ts +4 -0
- package/src/webpack/utils/index.ts +1 -0
- package/src/webpack/utils/stringify-config.ts +19 -0
|
@@ -13,12 +13,13 @@ interface Args {
|
|
|
13
13
|
'use-tsc'?: boolean;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
enum BuildProcesses {
|
|
17
|
+
Compile,
|
|
18
|
+
KendoUILicense,
|
|
19
|
+
PreparePackage,
|
|
20
|
+
TypeCheck,
|
|
21
|
+
BundleExposedDependencies,
|
|
22
|
+
BundlePackage,
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export class Build implements Command {
|
|
@@ -50,6 +51,9 @@ export class Build implements Command {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
const scope = packages.map(({ name }) => name);
|
|
54
|
+
const webpackScope = packages
|
|
55
|
+
.filter(({ type }) => type === PackageType.Webpack)
|
|
56
|
+
.map(({ name }) => name);
|
|
53
57
|
|
|
54
58
|
const processTree = new ProcessTree<typeof BuildProcesses>();
|
|
55
59
|
|
|
@@ -66,25 +70,17 @@ export class Build implements Command {
|
|
|
66
70
|
dependsOn: [BuildProcesses.PreparePackage],
|
|
67
71
|
});
|
|
68
72
|
processTree.add(
|
|
69
|
-
BuildProcesses.
|
|
73
|
+
BuildProcesses.BundleExposedDependencies,
|
|
70
74
|
() => {
|
|
71
|
-
const webpackScope = packages
|
|
72
|
-
.filter(({ type }) => type === PackageType.Webpack)
|
|
73
|
-
.map(({ name }) => name);
|
|
74
|
-
|
|
75
75
|
if (webpackScope.length === 0) {
|
|
76
76
|
return Promise.resolve();
|
|
77
77
|
}
|
|
78
|
-
|
|
79
78
|
return lernaExec({
|
|
80
79
|
'cmd': 'startup bundle-package',
|
|
81
80
|
'scope': webpackScope,
|
|
81
|
+
'parallel': true,
|
|
82
82
|
'stream': true,
|
|
83
|
-
'--': [
|
|
84
|
-
...[this.args.config ? `--config "${this.args.config}"` : undefined],
|
|
85
|
-
...[this.args['code-coverage'] ? '--code-coverage' : undefined],
|
|
86
|
-
...[this.args.stat ? '--stat' : undefined],
|
|
87
|
-
].filter(item => !!item) as string[],
|
|
83
|
+
'--': ['--exposed-dependencies'],
|
|
88
84
|
});
|
|
89
85
|
},
|
|
90
86
|
{
|
|
@@ -95,6 +91,26 @@ export class Build implements Command {
|
|
|
95
91
|
],
|
|
96
92
|
}
|
|
97
93
|
);
|
|
94
|
+
processTree.add(
|
|
95
|
+
BuildProcesses.BundlePackage,
|
|
96
|
+
() => {
|
|
97
|
+
if (webpackScope.length === 0) {
|
|
98
|
+
return Promise.resolve();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return lernaExec({
|
|
102
|
+
'cmd': 'startup bundle-package',
|
|
103
|
+
'scope': webpackScope,
|
|
104
|
+
'stream': true,
|
|
105
|
+
'--': [
|
|
106
|
+
...[this.args.config ? `--config "${this.args.config}"` : undefined],
|
|
107
|
+
...[this.args['code-coverage'] ? '--code-coverage' : undefined],
|
|
108
|
+
...[this.args.stat ? '--stat' : undefined],
|
|
109
|
+
].filter(item => !!item) as string[],
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
{ dependsOn: [BuildProcesses.BundleExposedDependencies] }
|
|
113
|
+
);
|
|
98
114
|
|
|
99
115
|
await processTree.run();
|
|
100
116
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { log, logErrors } from '../../utils';
|
|
4
|
-
import { bundle, bundleWatch, getModuleType } from '../utils';
|
|
1
|
+
import { getTsConfig, log, logErrors } from '../../utils';
|
|
2
|
+
import { bundle, getModuleType } from '../utils';
|
|
5
3
|
import { Command } from '.';
|
|
6
4
|
|
|
7
5
|
interface Args {
|
|
8
6
|
'config'?: string;
|
|
9
7
|
'code-coverage'?: boolean;
|
|
8
|
+
'exposed-dependencies'?: boolean;
|
|
10
9
|
'stat'?: boolean;
|
|
11
10
|
'watch'?: boolean;
|
|
12
11
|
}
|
|
@@ -14,31 +13,23 @@ interface Args {
|
|
|
14
13
|
export class BundlePackage implements Command {
|
|
15
14
|
constructor(private args: Args) {}
|
|
16
15
|
|
|
17
|
-
description() {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
16
|
@logErrors
|
|
22
17
|
async execute() {
|
|
23
18
|
const { config, stat = false, watch } = this.args;
|
|
24
19
|
|
|
25
|
-
if (getModuleType(
|
|
20
|
+
if (getModuleType(getTsConfig()) !== 'esnext') {
|
|
26
21
|
log.warning(
|
|
27
|
-
'
|
|
28
|
-
'It\'s recommended to use the "esnext" option for the "compilerOptions.module" in the "tsconfig.json" for the Webpack packages!',
|
|
29
|
-
'\x1b[0m'
|
|
22
|
+
'webpack packages should set compilerOptions.module to "esnext" in tsconfig.json'
|
|
30
23
|
);
|
|
31
24
|
}
|
|
32
25
|
|
|
33
|
-
const
|
|
34
|
-
|
|
26
|
+
const emitExposedDependencies = this.args['exposed-dependencies'];
|
|
27
|
+
const options: Parameters<typeof bundle>[0] = {
|
|
28
|
+
...(emitExposedDependencies ? {} : { config }),
|
|
35
29
|
codeCoverage: this.args['code-coverage'],
|
|
30
|
+
emitExposedDependencies,
|
|
36
31
|
};
|
|
37
32
|
|
|
38
|
-
|
|
39
|
-
await bundle({ buildStat: stat, ...options });
|
|
40
|
-
} else {
|
|
41
|
-
await bundleWatch(options);
|
|
42
|
-
}
|
|
33
|
+
await bundle({ buildStat: stat, ...options, watch });
|
|
43
34
|
}
|
|
44
35
|
}
|
|
@@ -19,6 +19,7 @@ import { Start } from './start';
|
|
|
19
19
|
import { StylesCheck } from './styles-check';
|
|
20
20
|
import { Tests } from './tests';
|
|
21
21
|
import { Command, Newable } from './types';
|
|
22
|
+
import { UploadSourcemaps } from './upload-sourcemaps';
|
|
22
23
|
|
|
23
24
|
const commands: Record<CommandName, Newable<Command>> = {
|
|
24
25
|
[CommandName.build]: Build,
|
|
@@ -39,6 +40,7 @@ const commands: Record<CommandName, Newable<Command>> = {
|
|
|
39
40
|
[CommandName['styles-check']]: StylesCheck,
|
|
40
41
|
[CommandName.test]: Tests,
|
|
41
42
|
[CommandName.task]: RunTask,
|
|
43
|
+
[CommandName['upload-sourcemaps']]: UploadSourcemaps,
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
export function getCommand(name: CommandName): Newable<Command> | undefined {
|
|
@@ -13,7 +13,7 @@ export function getUserCommands() {
|
|
|
13
13
|
.map(name => {
|
|
14
14
|
const Command = getCommand(name)!;
|
|
15
15
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
|
-
return { name, description: new Command({ _: [] }).description() };
|
|
16
|
+
return { name, description: new Command({ _: [] }).description?.() };
|
|
17
17
|
})
|
|
18
18
|
.filter(({ description }) => !!description) as UserCommand[];
|
|
19
19
|
}
|
|
@@ -4,7 +4,7 @@ import { gitGetBranch } from '../utils/cli-git';
|
|
|
4
4
|
import { Version, npmGetPackageVersionsDetails, npmUnpublish } from '../utils/cli-npm';
|
|
5
5
|
import { Command } from './types';
|
|
6
6
|
|
|
7
|
-
export interface
|
|
7
|
+
export interface Args {
|
|
8
8
|
all?: true;
|
|
9
9
|
branch?: string;
|
|
10
10
|
count?: number;
|
|
@@ -13,11 +13,7 @@ export interface ArgsPackageClean {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export class MFEPackageClean implements Command {
|
|
16
|
-
constructor(private args:
|
|
17
|
-
|
|
18
|
-
description() {
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
16
|
+
constructor(private readonly args: Args) {}
|
|
21
17
|
|
|
22
18
|
@logErrors
|
|
23
19
|
async execute() {
|
|
@@ -1,131 +1,165 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { getFolders, isWebComponent, log, logErrors, readJson } from '../../utils';
|
|
4
|
+
import { getBranchesConfigs } from '../../utils/get-branch-configs';
|
|
5
|
+
import { EntryPoint, EntryPoints, Metadata } from '../../webpack/configs';
|
|
4
6
|
import { gitGetBranch, gitGetCommitHash } from '../utils/cli-git';
|
|
5
7
|
import { npmGetPackageVersions, npmPackageSet, npmPublish, npmTagVersion } from '../utils/cli-npm';
|
|
6
|
-
import {
|
|
8
|
+
import { runCommand } from '../utils/cli-os';
|
|
7
9
|
import { getDefaultBuildVersion } from '../utils/publish';
|
|
8
|
-
import { EntryPoint, EntryPoints, Metadata } from '../../webpack/configs';
|
|
9
10
|
import { Command } from './types';
|
|
10
11
|
|
|
11
|
-
export interface
|
|
12
|
+
export interface Args {
|
|
12
13
|
branch?: string;
|
|
13
14
|
build?: string;
|
|
14
15
|
dry?: boolean;
|
|
15
16
|
force?: boolean;
|
|
16
17
|
registry?: string;
|
|
17
18
|
tag?: string;
|
|
19
|
+
uploadSourcemaps?: boolean;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
interface PublishData {
|
|
23
|
+
buildVersion: string;
|
|
24
|
+
dry: boolean;
|
|
25
|
+
fallbackTag: string;
|
|
26
|
+
force: boolean;
|
|
27
|
+
isBranchConfigured: boolean;
|
|
28
|
+
registry: string;
|
|
29
|
+
tag: string;
|
|
30
|
+
uploadSourcemaps: boolean;
|
|
31
|
+
version: string;
|
|
32
|
+
}
|
|
22
33
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
34
|
+
interface PackageJson {
|
|
35
|
+
name: string;
|
|
36
|
+
private?: boolean;
|
|
37
|
+
files?: string[];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class MFEPackagePublish implements Command {
|
|
41
|
+
constructor(private readonly args: Args) {}
|
|
26
42
|
|
|
27
43
|
@logErrors
|
|
28
44
|
async execute() {
|
|
29
|
-
if (
|
|
30
|
-
|
|
45
|
+
if (this.args.dry) {
|
|
46
|
+
log.warning('DRY-RUN MODE ENABLED, WILL NOT PUBLISH PACKAGES');
|
|
31
47
|
}
|
|
32
48
|
|
|
33
|
-
const packageJson = readJson('package.json');
|
|
34
|
-
|
|
35
|
-
if (packageJson
|
|
36
|
-
log.info('package is private, skipping publish');
|
|
49
|
+
const packageJson = readJson<PackageJson>('package.json');
|
|
50
|
+
const data = this.getPublishData();
|
|
51
|
+
if (!this.checkPackage(packageJson, data)) {
|
|
37
52
|
return;
|
|
38
53
|
}
|
|
39
54
|
|
|
40
|
-
|
|
41
|
-
|
|
55
|
+
if (!(await this.tryTagExistingVersion(packageJson, data))) {
|
|
56
|
+
await this.publishPackage(packageJson, data);
|
|
57
|
+
}
|
|
42
58
|
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
59
|
+
if (data.uploadSourcemaps) {
|
|
60
|
+
this.uploadSourcemaps(data);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private get dryRunPrefix() {
|
|
65
|
+
return this.args.dry ? '(dry-run) ' : '';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private checkPackage(packageJson: PackageJson, { force, isBranchConfigured }: PublishData) {
|
|
69
|
+
if (!isWebComponent()) {
|
|
70
|
+
throw new Error('only web-components can be published');
|
|
46
71
|
}
|
|
47
72
|
|
|
48
|
-
if (
|
|
49
|
-
log.
|
|
73
|
+
if (packageJson.private) {
|
|
74
|
+
log.warning('package is private, skipping publish');
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!isBranchConfigured && !force) {
|
|
79
|
+
log.warning(
|
|
50
80
|
'branch is not configured for publishing, use --force flag to publish if needed'
|
|
51
81
|
);
|
|
52
|
-
return;
|
|
82
|
+
return false;
|
|
53
83
|
}
|
|
54
84
|
|
|
55
|
-
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
56
87
|
|
|
57
|
-
|
|
58
|
-
|
|
88
|
+
private async tryTagExistingVersion(
|
|
89
|
+
{ name }: PackageJson,
|
|
90
|
+
{ dry, registry, tag, version }: PublishData
|
|
91
|
+
) {
|
|
92
|
+
const versions = npmGetPackageVersions(registry, name);
|
|
93
|
+
if (!versions.includes(version)) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
59
96
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
97
|
+
log.warning(
|
|
98
|
+
`${this.dryRunPrefix}${name} version ${version} is already published, skipping publish`
|
|
99
|
+
);
|
|
64
100
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
tag: data.tag,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
101
|
+
if (tag) {
|
|
102
|
+
log.info(`${this.dryRunPrefix}adding tag "${tag}" to ${name} version ${version}`);
|
|
103
|
+
if (!dry) {
|
|
104
|
+
await npmTagVersion({
|
|
105
|
+
packageName: name,
|
|
106
|
+
packageVersion: version,
|
|
107
|
+
registry,
|
|
108
|
+
tag,
|
|
109
|
+
});
|
|
77
110
|
}
|
|
78
|
-
return;
|
|
79
111
|
}
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private async publishPackage(
|
|
116
|
+
packageJson: PackageJson,
|
|
117
|
+
{ dry, fallbackTag, registry, tag, version }: PublishData
|
|
118
|
+
) {
|
|
119
|
+
this.validateMetadata(version);
|
|
80
120
|
|
|
81
|
-
await npmPackageSet('version',
|
|
82
|
-
await npmPackageSet('publishConfig.registry',
|
|
121
|
+
await npmPackageSet('version', version);
|
|
122
|
+
await npmPackageSet('publishConfig.registry', registry);
|
|
83
123
|
await this.setPackageFiles(packageJson);
|
|
84
124
|
|
|
85
|
-
await npmPublish({ dry
|
|
125
|
+
await npmPublish({ dry, tag: tag || fallbackTag });
|
|
126
|
+
log.info(`${this.dryRunPrefix}published ${packageJson.name} version ${version}`);
|
|
127
|
+
}
|
|
86
128
|
|
|
87
|
-
|
|
129
|
+
private uploadSourcemaps({ dry, version }: PublishData) {
|
|
130
|
+
const options = [...[dry && '--dry'], `--releaseVersion=${version}`].filter(
|
|
131
|
+
option => !!option
|
|
132
|
+
) as string[];
|
|
133
|
+
|
|
134
|
+
runCommand(`npx startup upload-sourcemaps ${options.join(' ')}`);
|
|
88
135
|
}
|
|
89
136
|
|
|
90
|
-
private getPublishData(): {
|
|
91
|
-
version: string;
|
|
92
|
-
buildVersion: string;
|
|
93
|
-
tag: string;
|
|
94
|
-
registry: string;
|
|
95
|
-
dry: boolean;
|
|
96
|
-
force: boolean;
|
|
97
|
-
isBranchConfigured: boolean;
|
|
98
|
-
fallbackTag: string;
|
|
99
|
-
} {
|
|
137
|
+
private getPublishData(): PublishData {
|
|
100
138
|
const cli = this.args;
|
|
101
139
|
const branch = cli.branch ?? gitGetBranch();
|
|
102
140
|
const branchConfig = getBranchesConfigs()[branch];
|
|
141
|
+
|
|
103
142
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
104
143
|
const buildVersion = cli.build || getDefaultBuildVersion(branch, gitGetCommitHash());
|
|
105
|
-
|
|
106
|
-
let tag: string;
|
|
107
|
-
|
|
108
|
-
if (cli.tag) {
|
|
109
|
-
tag = cli.tag;
|
|
110
|
-
} else {
|
|
111
|
-
tag = branchConfig?.publishTag ?? '';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
144
|
const registry = cli.registry ?? 'https://verdaccio.servicetitan.com';
|
|
145
|
+
const tag = cli.tag ?? branchConfig?.publishTag ?? '';
|
|
146
|
+
const uploadSourcemaps = cli.uploadSourcemaps ?? branchConfig?.uploadSourcemaps ?? true;
|
|
147
|
+
const version = '0.0.0-' + buildVersion;
|
|
115
148
|
|
|
116
149
|
return {
|
|
117
|
-
tag,
|
|
118
|
-
version: '0.0.0-' + buildVersion,
|
|
119
150
|
buildVersion,
|
|
120
|
-
registry,
|
|
121
151
|
dry: !!cli.dry,
|
|
152
|
+
fallbackTag: 'latest',
|
|
122
153
|
force: !!cli.force,
|
|
123
154
|
isBranchConfigured: !!branchConfig,
|
|
124
|
-
|
|
155
|
+
registry,
|
|
156
|
+
tag,
|
|
157
|
+
uploadSourcemaps,
|
|
158
|
+
version,
|
|
125
159
|
};
|
|
126
160
|
}
|
|
127
161
|
|
|
128
|
-
private async setPackageFiles({ files: inputFiles }:
|
|
162
|
+
private async setPackageFiles({ files: inputFiles }: PackageJson) {
|
|
129
163
|
let outputFiles = ['dist/bundle', 'dist/metadata.json', 'package.json'];
|
|
130
164
|
|
|
131
165
|
if (inputFiles?.length) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getPackages, isWebComponent, logErrors, PackageType } from '../../utils';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Args as CleanArgs } from './mfe-package-clean';
|
|
3
|
+
import { Args as PublishArgs } from './mfe-package-publish';
|
|
4
4
|
import { Command } from './types';
|
|
5
5
|
import { lernaExec } from '../utils';
|
|
6
6
|
|
|
7
|
-
interface Args extends
|
|
7
|
+
interface Args extends PublishArgs, CleanArgs {
|
|
8
8
|
clean?: boolean;
|
|
9
9
|
concurrency?: number;
|
|
10
10
|
scope?: string | string[];
|
|
@@ -38,7 +38,8 @@ export class MFEPublish implements Command {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
getPublishOptions() {
|
|
41
|
-
const { build, branch, dry, force, registry, tag } = this
|
|
41
|
+
const { build, branch, dry, force, registry, tag, uploadSourcemaps } = this
|
|
42
|
+
.args as PublishArgs;
|
|
42
43
|
return [
|
|
43
44
|
...[branch && `--branch ${branch}`],
|
|
44
45
|
...[build && `--build ${build}`],
|
|
@@ -46,11 +47,13 @@ export class MFEPublish implements Command {
|
|
|
46
47
|
...[force && '--force'],
|
|
47
48
|
...[registry && `--registry ${registry}`],
|
|
48
49
|
...[typeof tag === 'string' && `--tag ${tag}`],
|
|
50
|
+
...[uploadSourcemaps === true && `--upload-sourcemaps`],
|
|
51
|
+
...[uploadSourcemaps === false && `--no-upload-sourcemaps`],
|
|
49
52
|
].filter(item => !!item) as string[];
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
getCleanOptions() {
|
|
53
|
-
const { all, branch, count, dry, registry } = this.args as
|
|
56
|
+
const { all, branch, count, dry, registry } = this.args as CleanArgs;
|
|
54
57
|
return [
|
|
55
58
|
...[all && '--all'],
|
|
56
59
|
...[typeof branch === 'string' && `--branch ${branch}`],
|
|
@@ -20,10 +20,6 @@ const tasks: Record<string, new (args: Args) => Task> = {
|
|
|
20
20
|
export class RunTask implements Command {
|
|
21
21
|
constructor(private readonly args: Args) {}
|
|
22
22
|
|
|
23
|
-
description() {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
23
|
@logErrors
|
|
28
24
|
async execute() {
|
|
29
25
|
const taskName = this.args._[0];
|
|
@@ -18,12 +18,13 @@ interface Args {
|
|
|
18
18
|
'use-tsc'?: boolean;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
enum StartProcesses {
|
|
22
22
|
Compile,
|
|
23
23
|
KendoUILicense,
|
|
24
24
|
PreparePackage,
|
|
25
25
|
PreparePackageWatch,
|
|
26
26
|
TypeCheck,
|
|
27
|
+
BundleExposedDependencies,
|
|
27
28
|
BundlePackage,
|
|
28
29
|
}
|
|
29
30
|
|
|
@@ -52,6 +53,9 @@ export class Start implements Command {
|
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
const scope = packages.map(({ name }) => name);
|
|
56
|
+
const webpackScope = packages
|
|
57
|
+
.filter(({ type }) => type === PackageType.Webpack)
|
|
58
|
+
.map(({ name }) => name);
|
|
55
59
|
|
|
56
60
|
const processTree = new ProcessTree<typeof StartProcesses>();
|
|
57
61
|
|
|
@@ -122,12 +126,25 @@ export class Start implements Command {
|
|
|
122
126
|
() => typeCheck({ packages: scope, watch: true }),
|
|
123
127
|
{ dependsOn: [StartProcesses.PreparePackage] }
|
|
124
128
|
);
|
|
129
|
+
processTree.add(
|
|
130
|
+
StartProcesses.BundleExposedDependencies,
|
|
131
|
+
() => {
|
|
132
|
+
if (webpackScope.length === 0) {
|
|
133
|
+
return Promise.resolve();
|
|
134
|
+
}
|
|
135
|
+
return lernaExec({
|
|
136
|
+
'cmd': 'startup bundle-package',
|
|
137
|
+
'scope': webpackScope,
|
|
138
|
+
'parallel': true,
|
|
139
|
+
'stream': true,
|
|
140
|
+
'--': ['--exposed-dependencies', '--use-watch-config'],
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
{ dependsOn: [StartProcesses.Compile, StartProcesses.PreparePackage] }
|
|
144
|
+
);
|
|
125
145
|
processTree.add(
|
|
126
146
|
StartProcesses.BundlePackage,
|
|
127
147
|
() => {
|
|
128
|
-
const webpackScope = packages
|
|
129
|
-
.filter(({ type }) => type === PackageType.Webpack)
|
|
130
|
-
.map(({ name }) => name);
|
|
131
148
|
if (webpackScope.length === 0) {
|
|
132
149
|
return Promise.resolve();
|
|
133
150
|
}
|
|
@@ -143,7 +160,7 @@ export class Start implements Command {
|
|
|
143
160
|
].filter(item => !!item) as string[],
|
|
144
161
|
});
|
|
145
162
|
},
|
|
146
|
-
{ dependsOn: [StartProcesses.
|
|
163
|
+
{ dependsOn: [StartProcesses.BundleExposedDependencies] }
|
|
147
164
|
);
|
|
148
165
|
|
|
149
166
|
await processTree.run();
|