piral-cli 1.0.0-pre.2296 → 1.0.1-beta.5640
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/LICENSE +1 -1
- package/README.md +30 -7
- package/lib/api.js +23 -23
- package/lib/api.js.map +1 -1
- package/lib/apps/add-piral-instance-pilet.d.ts +26 -0
- package/lib/apps/add-piral-instance-pilet.js +53 -0
- package/lib/apps/add-piral-instance-pilet.js.map +1 -0
- package/lib/apps/build-pilet.d.ts +33 -2
- package/lib/apps/build-pilet.js +159 -32
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.d.ts +18 -1
- package/lib/apps/build-piral.js +68 -52
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.d.ts +38 -2
- package/lib/apps/debug-pilet.js +150 -108
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.d.ts +23 -0
- package/lib/apps/debug-piral.js +63 -52
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/declaration-piral.js +5 -3
- package/lib/apps/declaration-piral.js.map +1 -1
- package/lib/apps/index.d.ts +3 -0
- package/lib/apps/index.js +8 -1
- package/lib/apps/index.js.map +1 -1
- package/lib/apps/new-pilet.d.ts +7 -3
- package/lib/apps/new-pilet.js +47 -52
- package/lib/apps/new-pilet.js.map +1 -1
- package/lib/apps/new-piral.d.ts +7 -3
- package/lib/apps/new-piral.js +33 -23
- package/lib/apps/new-piral.js.map +1 -1
- package/lib/apps/pack-pilet.d.ts +9 -0
- package/lib/apps/pack-pilet.js +6 -13
- package/lib/apps/pack-pilet.js.map +1 -1
- package/lib/apps/publish-pilet.d.ts +23 -3
- package/lib/apps/publish-pilet.js +112 -62
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/apps/publish-piral.d.ts +6 -2
- package/lib/apps/publish-piral.js +30 -26
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/apps/remove-piral-instance-pilet.d.ts +22 -0
- package/lib/apps/remove-piral-instance-pilet.js +52 -0
- package/lib/apps/remove-piral-instance-pilet.js.map +1 -0
- package/lib/apps/run-emulator-piral.d.ts +34 -0
- package/lib/apps/run-emulator-piral.js +91 -0
- package/lib/apps/run-emulator-piral.js.map +1 -0
- package/lib/apps/upgrade-pilet.d.ts +6 -2
- package/lib/apps/upgrade-pilet.js +41 -43
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/apps/upgrade-piral.d.ts +2 -2
- package/lib/apps/upgrade-piral.js +21 -20
- package/lib/apps/upgrade-piral.js.map +1 -1
- package/lib/apps/validate-pilet.js +30 -36
- package/lib/apps/validate-pilet.js.map +1 -1
- package/lib/apps/validate-piral.js +13 -10
- package/lib/apps/validate-piral.js.map +1 -1
- package/lib/build/bundler-calls.d.ts +3 -0
- package/lib/build/bundler-calls.js +117 -0
- package/lib/build/bundler-calls.js.map +1 -0
- package/lib/build/run-build-pilet.d.ts +1 -0
- package/lib/build/run-build-pilet.js +65 -0
- package/lib/build/run-build-pilet.js.map +1 -0
- package/lib/build/run-build-piral.d.ts +1 -0
- package/lib/build/run-build-piral.js +67 -0
- package/lib/build/run-build-piral.js.map +1 -0
- package/lib/build/run-debug-mono-piral.d.ts +1 -0
- package/lib/build/run-debug-mono-piral.js +70 -0
- package/lib/build/run-debug-mono-piral.js.map +1 -0
- package/lib/build/run-debug-pilet.d.ts +1 -0
- package/lib/build/run-debug-pilet.js +89 -0
- package/lib/build/run-debug-pilet.js.map +1 -0
- package/lib/build/run-debug-piral.d.ts +1 -0
- package/lib/build/run-debug-piral.js +85 -0
- package/lib/build/run-debug-piral.js.map +1 -0
- package/lib/bundler.js +75 -26
- package/lib/bundler.js.map +1 -1
- package/lib/cli.js +7 -4
- package/lib/cli.js.map +1 -1
- package/lib/commands.js +266 -46
- package/lib/commands.js.map +1 -1
- package/lib/common/archive.d.ts +4 -0
- package/lib/common/archive.js +31 -10
- package/lib/common/archive.js.map +1 -1
- package/lib/common/browser.d.ts +2 -1
- package/lib/common/browser.js +17 -8
- package/lib/common/browser.js.map +1 -1
- package/lib/common/clients/index.d.ts +21 -0
- package/lib/common/clients/index.js +48 -0
- package/lib/common/clients/index.js.map +1 -0
- package/lib/common/clients/lerna.d.ts +7 -1
- package/lib/common/clients/lerna.js +93 -7
- package/lib/common/clients/lerna.js.map +1 -1
- package/lib/common/clients/npm.d.ts +6 -1
- package/lib/common/clients/npm.js +66 -18
- package/lib/common/clients/npm.js.map +1 -1
- package/lib/common/clients/pnp.d.ts +7 -0
- package/lib/common/clients/pnp.js +104 -0
- package/lib/common/clients/pnp.js.map +1 -0
- package/lib/common/clients/pnpm.d.ts +5 -0
- package/lib/common/clients/pnpm.js +55 -6
- package/lib/common/clients/pnpm.js.map +1 -1
- package/lib/common/clients/rush.d.ts +7 -0
- package/lib/common/clients/rush.js +127 -0
- package/lib/common/clients/rush.js.map +1 -0
- package/lib/common/clients/yarn.d.ts +5 -0
- package/lib/common/clients/yarn.js +57 -6
- package/lib/common/clients/yarn.js.map +1 -1
- package/lib/common/compatibility.js +14 -9
- package/lib/common/compatibility.js.map +1 -1
- package/lib/common/config.d.ts +52 -1
- package/lib/common/config.js +10 -30
- package/lib/common/config.js.map +1 -1
- package/lib/common/constants.d.ts +10 -2
- package/lib/common/constants.js +22 -4
- package/lib/common/constants.js.map +1 -1
- package/lib/common/declaration.d.ts +2 -1
- package/lib/common/declaration.js +113 -56
- package/lib/common/declaration.js.map +1 -1
- package/lib/common/emoji.d.ts +8 -0
- package/lib/common/emoji.js +10 -1
- package/lib/common/emoji.js.map +1 -1
- package/lib/common/emulator.d.ts +2 -2
- package/lib/common/emulator.js +45 -32
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/enums.d.ts +0 -4
- package/lib/common/enums.js +1 -6
- package/lib/common/enums.js.map +1 -1
- package/lib/common/envs.js +16 -5
- package/lib/common/envs.js.map +1 -1
- package/lib/common/hash.d.ts +1 -0
- package/lib/common/hash.js +8 -3
- package/lib/common/hash.js.map +1 -1
- package/lib/common/http.d.ts +5 -2
- package/lib/common/http.js +65 -23
- package/lib/common/http.js.map +1 -1
- package/lib/common/importmap.d.ts +2 -0
- package/lib/common/importmap.js +202 -0
- package/lib/common/importmap.js.map +1 -0
- package/lib/common/index.d.ts +10 -0
- package/lib/common/index.js +15 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/info.d.ts +5 -0
- package/lib/common/info.js +9 -2
- package/lib/common/info.js.map +1 -1
- package/lib/common/injectors.d.ts +36 -8
- package/lib/common/injectors.js +46 -19
- package/lib/common/injectors.js.map +1 -1
- package/lib/common/inspect.d.ts +5 -3
- package/lib/common/inspect.js +15 -15
- package/lib/common/inspect.js.map +1 -1
- package/lib/common/interactive.d.ts +9 -0
- package/lib/common/interactive.js +60 -1
- package/lib/common/interactive.js.map +1 -1
- package/lib/common/io.d.ts +9 -3
- package/lib/common/io.js +219 -116
- package/lib/common/io.js.map +1 -1
- package/lib/common/language.d.ts +9 -6
- package/lib/common/language.js +68 -12
- package/lib/common/language.js.map +1 -1
- package/lib/common/log.d.ts +5 -3
- package/lib/common/log.js +34 -48
- package/lib/common/log.js.map +1 -1
- package/lib/common/npm.d.ts +17 -16
- package/lib/common/npm.js +262 -158
- package/lib/common/npm.js.map +1 -1
- package/lib/common/pack.js +47 -26
- package/lib/common/pack.js.map +1 -1
- package/lib/common/package.d.ts +43 -20
- package/lib/common/package.js +377 -213
- package/lib/common/package.js.map +1 -1
- package/lib/common/parallel.d.ts +1 -0
- package/lib/common/parallel.js +29 -0
- package/lib/common/parallel.js.map +1 -0
- package/lib/common/patcher.js +20 -20
- package/lib/common/patcher.js.map +1 -1
- package/lib/common/platform.d.ts +13 -0
- package/lib/common/platform.js +29 -0
- package/lib/common/platform.js.map +1 -0
- package/lib/common/port.d.ts +1 -0
- package/lib/common/port.js +14 -4
- package/lib/common/port.js.map +1 -1
- package/lib/common/rules.js +4 -4
- package/lib/common/rules.js.map +1 -1
- package/lib/common/scaffold.d.ts +18 -4
- package/lib/common/scaffold.js +59 -36
- package/lib/common/scaffold.js.map +1 -1
- package/lib/common/scripts.js +8 -8
- package/lib/common/scripts.js.map +1 -1
- package/lib/common/shell.d.ts +2 -0
- package/lib/common/shell.js +33 -0
- package/lib/common/shell.js.map +1 -0
- package/lib/common/spec.d.ts +29 -0
- package/lib/common/spec.js +69 -0
- package/lib/common/spec.js.map +1 -0
- package/lib/common/template.d.ts +1 -2
- package/lib/common/template.js +23 -22
- package/lib/common/template.js.map +1 -1
- package/lib/common/url.d.ts +1 -0
- package/lib/common/url.js +17 -0
- package/lib/common/url.js.map +1 -0
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.js +8 -0
- package/lib/common/utils.js.map +1 -0
- package/lib/common/version.d.ts +2 -0
- package/lib/common/version.js +130 -0
- package/lib/common/version.js.map +1 -0
- package/lib/common/watcher.d.ts +13 -0
- package/lib/common/watcher.js +78 -0
- package/lib/common/watcher.js.map +1 -0
- package/lib/external/index.js +59413 -57862
- package/lib/helpers.d.ts +6 -6
- package/lib/helpers.js +10 -25
- package/lib/helpers.js.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/inject.js +2 -2
- package/lib/inject.js.map +1 -1
- package/lib/injectors/pilet-injector.d.ts +75 -0
- package/lib/injectors/pilet-injector.js +246 -0
- package/lib/injectors/pilet-injector.js.map +1 -0
- package/lib/injectors/{piral.d.ts → piral-injector.d.ts} +10 -2
- package/lib/injectors/piral-injector.js +97 -0
- package/lib/injectors/piral-injector.js.map +1 -0
- package/lib/messages.d.ts +567 -47
- package/lib/messages.js +638 -51
- package/lib/messages.js.map +1 -1
- package/lib/pb-cli.js +1 -1
- package/lib/pb-cli.js.map +1 -1
- package/lib/pilet-cli.js +1 -1
- package/lib/pilet-cli.js.map +1 -1
- package/lib/piral-cli.js +1 -1
- package/lib/piral-cli.js.map +1 -1
- package/lib/platforms/node.d.ts +8 -0
- package/lib/platforms/node.js +30 -0
- package/lib/platforms/node.js.map +1 -0
- package/lib/platforms/web.d.ts +8 -0
- package/lib/platforms/web.js +120 -0
- package/lib/platforms/web.js.map +1 -0
- package/lib/plugin.js +36 -11
- package/lib/plugin.js.map +1 -1
- package/lib/questionnaire.d.ts +1 -1
- package/lib/questionnaire.js +9 -4
- package/lib/questionnaire.js.map +1 -1
- package/lib/release.d.ts +1 -1
- package/lib/release.js +38 -6
- package/lib/release.js.map +1 -1
- package/lib/resolvers.js +13 -13
- package/lib/resolvers.js.map +1 -1
- package/lib/rules/index.js +8 -8
- package/lib/rules/index.js.map +1 -1
- package/lib/rules/pilet-has-externals-as-peers.d.ts +1 -1
- package/lib/rules/pilet-has-externals-as-peers.js +9 -7
- package/lib/rules/pilet-has-externals-as-peers.js.map +1 -1
- package/lib/rules/pilet-has-no-self-reference.d.ts +1 -1
- package/lib/rules/pilet-has-no-self-reference.js +2 -2
- package/lib/rules/pilet-has-no-self-reference.js.map +1 -1
- package/lib/rules/pilet-has-no-third-party-dependency.d.ts +1 -1
- package/lib/rules/pilet-stays-small.d.ts +1 -1
- package/lib/rules/pilet-stays-small.js +4 -4
- package/lib/rules/pilet-stays-small.js.map +1 -1
- package/lib/rules/pilet-uses-latest-piral.d.ts +1 -1
- package/lib/rules/pilet-uses-latest-piral.js +18 -9
- package/lib/rules/pilet-uses-latest-piral.js.map +1 -1
- package/lib/rules/piral-depends-on-piral.d.ts +1 -1
- package/lib/rules/piral-entry-ends-with-html.d.ts +1 -1
- package/lib/rules/piral-entry-ends-with-html.js +1 -1
- package/lib/rules/piral-entry-ends-with-html.js.map +1 -1
- package/lib/rules/piral-has-valid-devDependencies.d.ts +1 -1
- package/lib/rules/piral-has-valid-externals.d.ts +1 -1
- package/lib/rules/piral-has-valid-externals.js +10 -24
- package/lib/rules/piral-has-valid-externals.js.map +1 -1
- package/lib/rules/piral-has-valid-files.d.ts +1 -1
- package/lib/rules/piral-has-valid-files.js +5 -5
- package/lib/rules/piral-has-valid-files.js.map +1 -1
- package/lib/rules/piral-has-valid-scripts.d.ts +1 -1
- package/lib/runner.js +1 -1
- package/lib/runner.js.map +1 -1
- package/lib/select.js +6 -6
- package/lib/select.js.map +1 -1
- package/lib/types/common.d.ts +88 -8
- package/lib/types/common.js.map +1 -1
- package/lib/types/index.js +5 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/internal.d.ts +12 -13
- package/lib/types/public.d.ts +89 -23
- package/package.json +19 -16
- package/src/apps/add-piral-instance-pilet.ts +98 -0
- package/src/apps/build-pilet.ts +286 -38
- package/src/apps/build-piral.test.ts +20 -7
- package/src/apps/build-piral.ts +90 -39
- package/src/apps/debug-pilet.ts +229 -123
- package/src/apps/debug-piral.ts +121 -68
- package/src/apps/declaration-piral.ts +4 -2
- package/src/apps/index.ts +3 -0
- package/src/apps/new-pilet.test.ts +28 -11
- package/src/apps/new-pilet.ts +60 -48
- package/src/apps/new-piral.test.ts +25 -13
- package/src/apps/new-piral.ts +43 -19
- package/src/apps/pack-pilet.test.ts +2 -2
- package/src/apps/pack-pilet.ts +12 -10
- package/src/apps/publish-pilet.ts +148 -43
- package/src/apps/publish-piral.ts +38 -11
- package/src/apps/remove-piral-instance-pilet.ts +92 -0
- package/src/apps/run-emulator-piral.ts +154 -0
- package/src/apps/upgrade-pilet.ts +37 -31
- package/src/apps/upgrade-piral.ts +9 -7
- package/src/apps/validate-pilet.ts +30 -22
- package/src/apps/validate-piral.ts +5 -2
- package/src/build/bundler-calls.ts +133 -0
- package/src/build/run-build-pilet.ts +91 -0
- package/src/build/run-build-piral.ts +93 -0
- package/src/build/run-debug-mono-piral.ts +86 -0
- package/src/build/run-debug-pilet.ts +116 -0
- package/src/build/run-debug-piral.ts +105 -0
- package/src/bundler.test.ts +86 -68
- package/src/bundler.ts +74 -19
- package/src/cli.ts +6 -2
- package/src/commands.ts +273 -44
- package/src/common/archive.test.ts +51 -45
- package/src/common/archive.ts +28 -1
- package/src/common/browser.test.ts +20 -10
- package/src/common/browser.ts +13 -6
- package/src/common/clients/index.ts +41 -0
- package/src/common/clients/lerna.ts +85 -1
- package/src/common/clients/npm.ts +56 -14
- package/src/common/clients/pnp.ts +84 -0
- package/src/common/clients/pnpm.ts +45 -1
- package/src/common/clients/rush.ts +118 -0
- package/src/common/clients/yarn.ts +49 -3
- package/src/common/compatibility.ts +8 -1
- package/src/common/config.ts +57 -22
- package/src/common/constants.ts +21 -3
- package/src/common/declaration.ts +124 -50
- package/src/common/emoji.ts +9 -0
- package/src/common/emulator.ts +43 -23
- package/src/common/enums.ts +0 -5
- package/src/common/envs.ts +15 -3
- package/src/common/hash.ts +5 -0
- package/src/common/http.test.ts +76 -64
- package/src/common/http.ts +88 -24
- package/src/common/importmap.ts +242 -0
- package/src/common/index.ts +10 -0
- package/src/common/info.ts +9 -1
- package/src/common/injectors.ts +49 -22
- package/src/common/inspect.ts +13 -14
- package/src/common/interactive.test.ts +6 -0
- package/src/common/interactive.ts +69 -1
- package/src/common/io.ts +199 -82
- package/src/common/language.ts +87 -10
- package/src/common/log.ts +32 -46
- package/src/common/npm.test.ts +187 -166
- package/src/common/npm.ts +263 -119
- package/src/common/pack.test.ts +11 -13
- package/src/common/pack.ts +60 -21
- package/src/common/package.test.ts +59 -49
- package/src/common/package.ts +406 -167
- package/src/common/parallel.test.ts +28 -0
- package/src/common/parallel.ts +21 -0
- package/src/common/platform.ts +31 -0
- package/src/common/port.test.ts +4 -1
- package/src/common/port.ts +10 -0
- package/src/common/rules.test.ts +3 -3
- package/src/common/scaffold.ts +69 -41
- package/src/common/scripts.ts +5 -4
- package/src/common/shell.ts +34 -0
- package/src/common/spec.ts +69 -0
- package/src/common/template.ts +20 -18
- package/src/common/url.test.ts +28 -0
- package/src/common/url.ts +15 -0
- package/src/common/utils.ts +3 -0
- package/src/common/version.test.ts +233 -0
- package/src/common/version.ts +142 -0
- package/src/common/watcher.ts +89 -0
- package/src/external/index.test.ts +2 -2
- package/src/external/index.ts +7 -3
- package/src/external/resolve.ts +29 -0
- package/src/helpers.test.ts +2 -22
- package/src/helpers.ts +21 -30
- package/src/injectors/{pilet.test.ts → pilet-injector.test.ts} +13 -4
- package/src/injectors/pilet-injector.ts +346 -0
- package/src/injectors/{piral.test.ts → piral-injector.test.ts} +14 -5
- package/src/injectors/piral-injector.ts +130 -0
- package/src/messages.ts +649 -63
- package/src/platforms/node.ts +16 -0
- package/src/platforms/web.ts +148 -0
- package/src/plugin.ts +34 -5
- package/src/questionnaire.ts +17 -3
- package/src/release.ts +47 -5
- package/src/rules/index.ts +1 -1
- package/src/rules/pilet-has-externals-as-peers.test.ts +3 -2
- package/src/rules/pilet-has-externals-as-peers.ts +9 -7
- package/src/rules/pilet-has-no-self-reference.ts +1 -1
- package/src/rules/pilet-stays-small.ts +1 -1
- package/src/rules/pilet-uses-latest-piral.ts +22 -12
- package/src/rules/piral-has-valid-externals.ts +10 -29
- package/src/types/common.ts +99 -9
- package/src/types/internal.ts +14 -14
- package/src/types/public.ts +93 -27
- package/lib/external/child.js +0 -144
- package/lib/external/classes.trie +0 -0
- package/lib/external/xdg-open +0 -1066
- package/lib/injectors/pilet.d.ts +0 -47
- package/lib/injectors/pilet.js +0 -187
- package/lib/injectors/pilet.js.map +0 -1
- package/lib/injectors/piral.js +0 -62
- package/lib/injectors/piral.js.map +0 -1
- package/src/injectors/pilet.ts +0 -219
- package/src/injectors/piral.ts +0 -76
- package/templates/piral-index.js.ejs +0 -16
package/lib/types/common.d.ts
CHANGED
|
@@ -1,3 +1,47 @@
|
|
|
1
|
+
export interface Importmap {
|
|
2
|
+
imports: Record<string, string>;
|
|
3
|
+
inherit: Array<string>;
|
|
4
|
+
}
|
|
5
|
+
export interface PackageData {
|
|
6
|
+
name: string;
|
|
7
|
+
version: string;
|
|
8
|
+
description: string;
|
|
9
|
+
importmap?: Importmap;
|
|
10
|
+
main: string;
|
|
11
|
+
author: string | {
|
|
12
|
+
name?: string;
|
|
13
|
+
url?: string;
|
|
14
|
+
email?: string;
|
|
15
|
+
};
|
|
16
|
+
dependencies: Record<string, string>;
|
|
17
|
+
peerDependencies: Record<string, string>;
|
|
18
|
+
devDependencies: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
export interface PiletPackageData extends PackageData {
|
|
21
|
+
piral?: {
|
|
22
|
+
name: string;
|
|
23
|
+
};
|
|
24
|
+
custom?: any;
|
|
25
|
+
}
|
|
26
|
+
export interface PiralPackageData extends PackageData {
|
|
27
|
+
pilets?: PiletsInfo;
|
|
28
|
+
piralCLI?: {
|
|
29
|
+
generated: boolean;
|
|
30
|
+
version: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export interface PiralInstancePackageData extends PiralPackageData {
|
|
34
|
+
root: string;
|
|
35
|
+
app: string;
|
|
36
|
+
port: number;
|
|
37
|
+
}
|
|
38
|
+
export interface AppDefinition {
|
|
39
|
+
appPackage: PiralInstancePackageData;
|
|
40
|
+
appFile: string;
|
|
41
|
+
appRoot: string;
|
|
42
|
+
appPort: number;
|
|
43
|
+
emulator: boolean;
|
|
44
|
+
}
|
|
1
45
|
export declare enum LogLevels {
|
|
2
46
|
/**
|
|
3
47
|
* Logging disabled
|
|
@@ -38,8 +82,36 @@ export interface Bundler {
|
|
|
38
82
|
off(cb: (args: any) => void): void;
|
|
39
83
|
ready(): Promise<void>;
|
|
40
84
|
}
|
|
85
|
+
export interface PlatformStartModuleOptions {
|
|
86
|
+
appDir?: string;
|
|
87
|
+
open: boolean;
|
|
88
|
+
fullBase: string;
|
|
89
|
+
feed: string | Array<string>;
|
|
90
|
+
publicUrl: string;
|
|
91
|
+
customkrasrc: string;
|
|
92
|
+
originalPort: number;
|
|
93
|
+
hooks: Record<string, Function>;
|
|
94
|
+
registerWatcher(file: string): void;
|
|
95
|
+
registerEnd(cb: () => void): void;
|
|
96
|
+
maxListeners: number;
|
|
97
|
+
pilets: Array<any>;
|
|
98
|
+
}
|
|
99
|
+
export interface PlatformStartShellOptions {
|
|
100
|
+
open: boolean;
|
|
101
|
+
fullBase: string;
|
|
102
|
+
root: string;
|
|
103
|
+
feed: string | Array<string>;
|
|
104
|
+
targetDir: string;
|
|
105
|
+
publicUrl: string;
|
|
106
|
+
bundler: Bundler;
|
|
107
|
+
customkrasrc: string;
|
|
108
|
+
originalPort: number;
|
|
109
|
+
hooks: Record<string, Function>;
|
|
110
|
+
registerWatcher(file: string): void;
|
|
111
|
+
registerEnd(cb: () => void): void;
|
|
112
|
+
}
|
|
41
113
|
export interface ReleaseProvider {
|
|
42
|
-
(files: Array<string>, args: Record<string, string
|
|
114
|
+
(directory: string, files: Array<string>, args: Record<string, string>, interactive: boolean): Promise<void>;
|
|
43
115
|
}
|
|
44
116
|
export interface TemplateFileLocation {
|
|
45
117
|
from: string;
|
|
@@ -49,7 +121,7 @@ export interface TemplateFileLocation {
|
|
|
49
121
|
}
|
|
50
122
|
export interface PiletsInfo {
|
|
51
123
|
files: Array<string | TemplateFileLocation>;
|
|
52
|
-
|
|
124
|
+
template: string;
|
|
53
125
|
devDependencies: Record<string, string | true>;
|
|
54
126
|
scripts: Record<string, string>;
|
|
55
127
|
validators: Record<string, any>;
|
|
@@ -69,6 +141,16 @@ export interface RuleContext {
|
|
|
69
141
|
devDependencies: Record<string, string>;
|
|
70
142
|
peerDependencies: Record<string, string>;
|
|
71
143
|
}
|
|
144
|
+
export interface SharedDependency {
|
|
145
|
+
id: string;
|
|
146
|
+
requireId: string;
|
|
147
|
+
name: string;
|
|
148
|
+
ref: string;
|
|
149
|
+
type: 'local' | 'remote';
|
|
150
|
+
entry: string;
|
|
151
|
+
parents?: Array<string>;
|
|
152
|
+
alias?: string;
|
|
153
|
+
}
|
|
72
154
|
export interface RuleRunner<T extends RuleContext> {
|
|
73
155
|
(context: T, options: any): void | Promise<void>;
|
|
74
156
|
}
|
|
@@ -78,13 +160,11 @@ export interface Rule<T extends RuleContext> {
|
|
|
78
160
|
}
|
|
79
161
|
export interface PiralRuleContext extends RuleContext {
|
|
80
162
|
info: PiletsInfo;
|
|
163
|
+
externals: Array<SharedDependency>;
|
|
81
164
|
}
|
|
82
165
|
export interface PiletRuleContext extends RuleContext {
|
|
83
|
-
|
|
84
|
-
peerModules: Array<string>;
|
|
85
|
-
}
|
|
86
|
-
export interface PiralData {
|
|
87
|
-
appFile: string;
|
|
88
|
-
appPackage: any;
|
|
166
|
+
apps: Array<AppDefinition>;
|
|
89
167
|
piletPackage: any;
|
|
168
|
+
peerModules: Array<string>;
|
|
169
|
+
importmap: Array<SharedDependency>;
|
|
90
170
|
}
|
package/lib/types/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/types/common.ts"],"names":[],"mappings":";;;AAmDA,IAAY,SA2BX;AA3BD,WAAY,SAAS;IACnB;;OAEG;IACH,iDAAY,CAAA;IACZ;;OAEG;IACH,2CAAS,CAAA;IACT;;OAEG;IACH,+CAAW,CAAA;IACX;;OAEG;IACH,yCAAQ,CAAA;IACR;;;OAGG;IACH,+CAAW,CAAA;IACX;;;OAGG;IACH,2CAAS,CAAA;AACX,CAAC,EA3BW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QA2BpB"}
|
package/lib/types/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,6CAA2B;AAC3B,2CAAyB"}
|
package/lib/types/internal.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { LogLevels } from './common';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
custom?: any;
|
|
2
|
+
import type { LogLevels } from './common';
|
|
3
|
+
import type { PiletSchemaVersion } from './public';
|
|
4
|
+
/**
|
|
5
|
+
* Shape of the pilet.json
|
|
6
|
+
*/
|
|
7
|
+
export interface PiletDefinition {
|
|
8
|
+
schemaVersion?: PiletSchemaVersion;
|
|
9
|
+
piralInstances?: Record<string, {
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
port?: number;
|
|
12
|
+
}>;
|
|
14
13
|
}
|
|
15
14
|
export interface PackageFiles {
|
|
16
15
|
[file: string]: Buffer;
|
|
@@ -26,4 +25,4 @@ export interface FileInfo {
|
|
|
26
25
|
* 1. The unique error code
|
|
27
26
|
* 2. The (short) error message
|
|
28
27
|
*/
|
|
29
|
-
export
|
|
28
|
+
export type QuickMessage = [LogLevels, string, string];
|
package/lib/types/public.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Argv, Arguments } from 'yargs';
|
|
2
|
-
import { RuleRunner, PiletRuleContext, PiralRuleContext,
|
|
2
|
+
import { RuleRunner, PiletRuleContext, PiralRuleContext, LogLevels, SharedDependency, ReleaseProvider } from './common';
|
|
3
3
|
export interface ToolCommandRunner<U = {}> {
|
|
4
4
|
(args: Arguments<U>): void | Promise<void>;
|
|
5
5
|
}
|
|
@@ -55,23 +55,28 @@ export interface BaseBundleParameters {
|
|
|
55
55
|
_: Record<string, any>;
|
|
56
56
|
}
|
|
57
57
|
export interface DebugPiralParameters extends BaseBundleParameters {
|
|
58
|
-
|
|
58
|
+
piralInstances: Array<string>;
|
|
59
59
|
hmr: boolean;
|
|
60
60
|
externals: Array<string>;
|
|
61
61
|
publicUrl: string;
|
|
62
|
+
outFile: string;
|
|
63
|
+
outDir: string;
|
|
62
64
|
entryFiles: string;
|
|
63
65
|
logLevel: LogLevels;
|
|
64
66
|
}
|
|
65
67
|
export interface WatchPiralParameters extends BaseBundleParameters {
|
|
66
|
-
|
|
68
|
+
piralInstances: Array<string>;
|
|
67
69
|
externals: Array<string>;
|
|
70
|
+
publicUrl: string;
|
|
68
71
|
entryFiles: string;
|
|
69
72
|
logLevel: LogLevels;
|
|
70
73
|
}
|
|
71
74
|
export interface BuildPiralParameters extends BaseBundleParameters {
|
|
72
|
-
|
|
75
|
+
piralInstances: Array<string>;
|
|
73
76
|
emulator: boolean;
|
|
77
|
+
standalone: boolean;
|
|
74
78
|
sourceMaps: boolean;
|
|
79
|
+
watch: boolean;
|
|
75
80
|
contentHash: boolean;
|
|
76
81
|
minify: boolean;
|
|
77
82
|
externals: Array<string>;
|
|
@@ -82,20 +87,25 @@ export interface BuildPiralParameters extends BaseBundleParameters {
|
|
|
82
87
|
logLevel: LogLevels;
|
|
83
88
|
}
|
|
84
89
|
export interface DebugPiletParameters extends BaseBundleParameters {
|
|
85
|
-
|
|
90
|
+
piralInstances: Array<string>;
|
|
86
91
|
hmr: boolean;
|
|
87
92
|
externals: Array<string>;
|
|
93
|
+
importmap: Array<SharedDependency>;
|
|
88
94
|
targetDir: string;
|
|
95
|
+
outFile: string;
|
|
96
|
+
outDir: string;
|
|
89
97
|
entryModule: string;
|
|
90
98
|
logLevel: LogLevels;
|
|
91
99
|
version: PiletSchemaVersion;
|
|
92
100
|
}
|
|
93
101
|
export interface BuildPiletParameters extends BaseBundleParameters {
|
|
94
|
-
|
|
102
|
+
piralInstances: Array<string>;
|
|
95
103
|
sourceMaps: boolean;
|
|
104
|
+
watch: boolean;
|
|
96
105
|
contentHash: boolean;
|
|
97
106
|
minify: boolean;
|
|
98
107
|
externals: Array<string>;
|
|
108
|
+
importmap: Array<SharedDependency>;
|
|
99
109
|
targetDir: string;
|
|
100
110
|
outFile: string;
|
|
101
111
|
outDir: string;
|
|
@@ -103,24 +113,76 @@ export interface BuildPiletParameters extends BaseBundleParameters {
|
|
|
103
113
|
logLevel: LogLevels;
|
|
104
114
|
version: PiletSchemaVersion;
|
|
105
115
|
}
|
|
106
|
-
export interface
|
|
107
|
-
|
|
116
|
+
export interface BundlerPrepareArgs<T> {
|
|
117
|
+
(args: T): T | Promise<T>;
|
|
118
|
+
}
|
|
119
|
+
export interface BaseBundlerDefinition<T> {
|
|
120
|
+
path: string;
|
|
121
|
+
prepare?: BundlerPrepareArgs<T>;
|
|
108
122
|
}
|
|
109
|
-
export interface
|
|
123
|
+
export interface WatchPiralBundlerDefinition extends BaseBundlerDefinition<WatchPiralParameters> {
|
|
124
|
+
}
|
|
125
|
+
export interface DebugPiralBundlerDefinition extends BaseBundlerDefinition<DebugPiralParameters> {
|
|
110
126
|
flags?: ToolCommandFlagsSetter;
|
|
111
|
-
run(args: DebugPiralParameters): Promise<Bundler>;
|
|
112
127
|
}
|
|
113
|
-
export interface BuildPiralBundlerDefinition {
|
|
128
|
+
export interface BuildPiralBundlerDefinition extends BaseBundlerDefinition<BuildPiralParameters> {
|
|
114
129
|
flags?: ToolCommandFlagsSetter;
|
|
115
|
-
run(args: BuildPiralParameters): Promise<BundleDetails>;
|
|
116
130
|
}
|
|
117
|
-
export interface DebugPiletBundlerDefinition {
|
|
131
|
+
export interface DebugPiletBundlerDefinition extends BaseBundlerDefinition<DebugPiletParameters> {
|
|
118
132
|
flags?: ToolCommandFlagsSetter;
|
|
119
|
-
run(args: DebugPiletParameters): Promise<Bundler>;
|
|
120
133
|
}
|
|
121
|
-
export interface BuildPiletBundlerDefinition {
|
|
134
|
+
export interface BuildPiletBundlerDefinition extends BaseBundlerDefinition<BuildPiletParameters> {
|
|
122
135
|
flags?: ToolCommandFlagsSetter;
|
|
123
|
-
|
|
136
|
+
}
|
|
137
|
+
export interface PiralBuildHandler {
|
|
138
|
+
create(config: {
|
|
139
|
+
root: string;
|
|
140
|
+
entryFiles: string;
|
|
141
|
+
outDir: string;
|
|
142
|
+
outFile: string;
|
|
143
|
+
externals: Array<string>;
|
|
144
|
+
emulator: boolean;
|
|
145
|
+
sourceMaps: boolean;
|
|
146
|
+
contentHash: boolean;
|
|
147
|
+
minify: boolean;
|
|
148
|
+
publicUrl: string;
|
|
149
|
+
hmr: boolean;
|
|
150
|
+
logLevel: LogLevels;
|
|
151
|
+
watch: boolean;
|
|
152
|
+
args: any;
|
|
153
|
+
}): Promise<BundleHandlerResponse>;
|
|
154
|
+
}
|
|
155
|
+
export interface PiletBuildHandler {
|
|
156
|
+
create(config: {
|
|
157
|
+
root: string;
|
|
158
|
+
piralInstances: Array<string>;
|
|
159
|
+
entryModule: string;
|
|
160
|
+
targetDir: string;
|
|
161
|
+
outDir: string;
|
|
162
|
+
outFile: string;
|
|
163
|
+
externals: Array<string>;
|
|
164
|
+
importmap: Array<SharedDependency>;
|
|
165
|
+
version: PiletSchemaVersion;
|
|
166
|
+
develop: boolean;
|
|
167
|
+
sourceMaps: boolean;
|
|
168
|
+
contentHash: boolean;
|
|
169
|
+
minify: boolean;
|
|
170
|
+
logLevel: LogLevels;
|
|
171
|
+
watch: boolean;
|
|
172
|
+
args: any;
|
|
173
|
+
}): Promise<BundleHandlerResponse>;
|
|
174
|
+
}
|
|
175
|
+
export interface BundleResult {
|
|
176
|
+
outDir: string;
|
|
177
|
+
outFile: string;
|
|
178
|
+
hash?: string;
|
|
179
|
+
name?: string;
|
|
180
|
+
requireRef?: string;
|
|
181
|
+
}
|
|
182
|
+
export interface BundleHandlerResponse {
|
|
183
|
+
onStart(cb: () => void): void;
|
|
184
|
+
onEnd(cb: (result: BundleResult) => void): void;
|
|
185
|
+
bundle(): Promise<BundleResult>;
|
|
124
186
|
}
|
|
125
187
|
export interface BundlerDefinition {
|
|
126
188
|
debugPiral: DebugPiralBundlerDefinition;
|
|
@@ -129,17 +191,21 @@ export interface BundlerDefinition {
|
|
|
129
191
|
debugPilet: DebugPiletBundlerDefinition;
|
|
130
192
|
buildPilet: BuildPiletBundlerDefinition;
|
|
131
193
|
}
|
|
132
|
-
export
|
|
133
|
-
export
|
|
134
|
-
export
|
|
135
|
-
export
|
|
136
|
-
export
|
|
137
|
-
export
|
|
194
|
+
export type PiletSchemaVersion = 'none' | 'v0' | 'v1' | 'v2' | 'v3';
|
|
195
|
+
export type SourceLanguage = 'js' | 'ts';
|
|
196
|
+
export type PiletPublishScheme = 'none' | 'digest' | 'bearer' | 'basic';
|
|
197
|
+
export type PiletPublishSource = 'local' | 'npm' | 'remote';
|
|
198
|
+
export type PiralBuildType = 'all' | 'release' | 'emulator' | 'emulator-sources';
|
|
199
|
+
export type PiletBuildType = 'default' | 'standalone' | 'manifest';
|
|
200
|
+
export type PackageType = 'registry' | 'file' | 'git';
|
|
201
|
+
export type NpmClientType = 'npm' | 'yarn' | 'pnp' | 'pnpm' | 'lerna' | 'rush';
|
|
202
|
+
export type Framework = 'piral' | 'piral-core' | 'piral-base';
|
|
138
203
|
export interface StandardEnvProps {
|
|
139
204
|
production?: boolean;
|
|
140
205
|
debugPiral?: boolean;
|
|
141
206
|
debugPilet?: boolean;
|
|
142
207
|
root: string;
|
|
143
|
-
|
|
208
|
+
publicPath?: string;
|
|
209
|
+
piralInstances?: Array<string>;
|
|
144
210
|
dependencies?: Array<string>;
|
|
145
211
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1-beta.5640",
|
|
4
4
|
"description": "The standard CLI for creating and building a Piral instance or a Pilet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"main": "lib/index.js",
|
|
16
16
|
"typings": "lib/index.d.ts",
|
|
17
17
|
"engines": {
|
|
18
|
-
"node": ">=
|
|
18
|
+
"node": ">=14.18.0"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"lib",
|
|
@@ -41,41 +41,44 @@
|
|
|
41
41
|
"pilet": "./lib/pilet-cli.js"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"
|
|
44
|
+
"cleanup": "rimraf lib",
|
|
45
|
+
"build": "yarn build:source && rimraf lib/external && yarn build:external",
|
|
46
|
+
"build:source": "tsc --declaration",
|
|
47
|
+
"build:external": "esbuild src/external/index.ts --bundle --outfile=lib/external/index.js --format=cjs --platform=node --external:pnpapi",
|
|
45
48
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
46
49
|
},
|
|
47
50
|
"devDependencies": {
|
|
48
|
-
"@parcel/logger": "^1.11.1",
|
|
49
|
-
"@types/ejs": "^2.6.3",
|
|
50
51
|
"@types/express": "^4.16.1",
|
|
51
52
|
"@types/glob": "^7.1.1",
|
|
52
53
|
"@types/inquirer": "^6.0.0",
|
|
54
|
+
"@types/jju": "^1.4.2",
|
|
53
55
|
"@types/mime": "^2.0.0",
|
|
54
|
-
"@types/node": "
|
|
56
|
+
"@types/node": "18.0.1",
|
|
55
57
|
"@types/rc": "^1.1.0",
|
|
56
58
|
"@types/rimraf": "^2.0.2",
|
|
57
59
|
"@types/tar": "^4.0.0",
|
|
58
60
|
"@types/yargs": "^15.0.4",
|
|
59
|
-
"@zeit/ncc": "^0.22.3",
|
|
60
61
|
"axios": "^0.21.1",
|
|
62
|
+
"chalk": "^4.0.0",
|
|
63
|
+
"enhanced-resolve": "^5.10.0",
|
|
61
64
|
"form-data": "^3.0.0",
|
|
62
65
|
"get-port": "^5.0.0",
|
|
63
66
|
"glob": "^7.1.3",
|
|
64
67
|
"inquirer": "^6.2.2",
|
|
65
|
-
"
|
|
68
|
+
"is-interactive": "^2.0.0",
|
|
69
|
+
"jju": "^1.4.0",
|
|
70
|
+
"mime": "^2.5.2",
|
|
66
71
|
"open": "^7.1.0",
|
|
72
|
+
"ora": "^6.1.2",
|
|
67
73
|
"rc": "^1.2.8",
|
|
68
|
-
"strip-ansi": "^5.2.0",
|
|
69
74
|
"tar": "^4.4.8"
|
|
70
75
|
},
|
|
71
76
|
"dependencies": {
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"ejs": "^2.6.2",
|
|
75
|
-
"kras": "^0.12.2",
|
|
77
|
+
"dets": "^0.13.0",
|
|
78
|
+
"kras": "^0.15.4",
|
|
76
79
|
"rimraf": "^3.0.0",
|
|
77
|
-
"typescript": "^
|
|
78
|
-
"yargs": "^15.
|
|
80
|
+
"typescript": "^5.0.0",
|
|
81
|
+
"yargs": "^15.0.0"
|
|
79
82
|
},
|
|
80
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "fa0a72b28fd0a20afec7ef491ec19e93c090fc72"
|
|
81
84
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { dirname, resolve } from 'path';
|
|
2
|
+
import { LogLevels, NpmClientType } from '../types';
|
|
3
|
+
import {
|
|
4
|
+
setLogLevel,
|
|
5
|
+
progress,
|
|
6
|
+
log,
|
|
7
|
+
matchAnyPilet,
|
|
8
|
+
findFile,
|
|
9
|
+
readJson,
|
|
10
|
+
writeJson,
|
|
11
|
+
logDone,
|
|
12
|
+
installPiralInstance,
|
|
13
|
+
determineNpmClient,
|
|
14
|
+
findPiletRoot,
|
|
15
|
+
piletJson,
|
|
16
|
+
} from '../common';
|
|
17
|
+
|
|
18
|
+
export interface AddPiralInstancePiletOptions {
|
|
19
|
+
/**
|
|
20
|
+
* Sets the log level to use (1-5).
|
|
21
|
+
*/
|
|
22
|
+
logLevel?: LogLevels;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The name of the Piral instance to add.
|
|
26
|
+
*/
|
|
27
|
+
app?: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Sets the source directory for adding the Piral instance.
|
|
31
|
+
*/
|
|
32
|
+
source?: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Defines if the provided Piral instance should be selected initially.
|
|
36
|
+
*/
|
|
37
|
+
selected?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The npm client to be used when scaffolding.
|
|
41
|
+
* @example 'yarn'
|
|
42
|
+
*/
|
|
43
|
+
npmClient?: NpmClientType;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const addPiralInstancePiletDefaults: AddPiralInstancePiletOptions = {
|
|
47
|
+
logLevel: LogLevels.info,
|
|
48
|
+
app: undefined,
|
|
49
|
+
source: '.',
|
|
50
|
+
selected: false,
|
|
51
|
+
npmClient: undefined,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export async function addPiralInstancePilet(baseDir = process.cwd(), options: AddPiralInstancePiletOptions = {}) {
|
|
55
|
+
const {
|
|
56
|
+
npmClient: defaultNpmClient = addPiralInstancePiletDefaults.npmClient,
|
|
57
|
+
logLevel = addPiralInstancePiletDefaults.logLevel,
|
|
58
|
+
source = addPiralInstancePiletDefaults.source,
|
|
59
|
+
selected = addPiralInstancePiletDefaults.selected,
|
|
60
|
+
app = addPiralInstancePiletDefaults.app,
|
|
61
|
+
} = options;
|
|
62
|
+
const fullBase = resolve(process.cwd(), baseDir);
|
|
63
|
+
setLogLevel(logLevel);
|
|
64
|
+
progress('Reading configuration ...');
|
|
65
|
+
|
|
66
|
+
const npmClient = await determineNpmClient(fullBase, defaultNpmClient);
|
|
67
|
+
const allEntries = await matchAnyPilet(fullBase, [source]);
|
|
68
|
+
|
|
69
|
+
const tasks = allEntries.map(async (entryModule) => {
|
|
70
|
+
const targetDir = dirname(entryModule);
|
|
71
|
+
const piletJsonPath = await findFile(targetDir, piletJson);
|
|
72
|
+
|
|
73
|
+
if (piletJsonPath) {
|
|
74
|
+
const piletJsonDir = dirname(piletJsonPath);
|
|
75
|
+
const root = await findPiletRoot(piletJsonDir);
|
|
76
|
+
const oldContent = await readJson(piletJsonDir, piletJson);
|
|
77
|
+
const [appName] = await installPiralInstance(app, fullBase, root, npmClient);
|
|
78
|
+
|
|
79
|
+
const newContent = {
|
|
80
|
+
...oldContent,
|
|
81
|
+
piralInstances: {
|
|
82
|
+
...oldContent.piralInstances,
|
|
83
|
+
[appName]: {
|
|
84
|
+
selected,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
await writeJson(piletJsonDir, piletJson, newContent, true);
|
|
90
|
+
} else {
|
|
91
|
+
log('piletJsonNotAvailable_0180', targetDir);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
await Promise.all(tasks);
|
|
96
|
+
|
|
97
|
+
logDone(`Added the Piral instance!`);
|
|
98
|
+
}
|