piral-cli 1.0.0-pre.2217 → 1.0.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/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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PlatformStartShellOptions, PlatformStartModuleOptions } from '../types';
|
|
2
|
+
|
|
3
|
+
async function startModule(options: PlatformStartModuleOptions) {
|
|
4
|
+
//TODO
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
async function startShell(options: PlatformStartShellOptions) {
|
|
8
|
+
//TODO
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function setup() {
|
|
12
|
+
return {
|
|
13
|
+
startModule,
|
|
14
|
+
startShell,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { readKrasConfig, krasrc, buildKrasWithCli } from 'kras';
|
|
2
|
+
import { dirname, join, resolve } from 'path';
|
|
3
|
+
import { createInitialKrasConfig, notifyServerOnline } from '../common/injectors';
|
|
4
|
+
import { log } from '../common/log';
|
|
5
|
+
import { config } from '../common/config';
|
|
6
|
+
import { openBrowser } from '../common/browser';
|
|
7
|
+
import { checkExistingDirectory, findFile } from '../common/io';
|
|
8
|
+
import { getAvailablePort } from '../common/port';
|
|
9
|
+
import { PlatformStartShellOptions, PlatformStartModuleOptions } from '../types';
|
|
10
|
+
|
|
11
|
+
async function startModule(options: PlatformStartModuleOptions) {
|
|
12
|
+
const {
|
|
13
|
+
appDir,
|
|
14
|
+
fullBase,
|
|
15
|
+
open,
|
|
16
|
+
feed,
|
|
17
|
+
publicUrl,
|
|
18
|
+
customkrasrc,
|
|
19
|
+
originalPort,
|
|
20
|
+
hooks,
|
|
21
|
+
registerWatcher,
|
|
22
|
+
registerEnd,
|
|
23
|
+
pilets,
|
|
24
|
+
maxListeners,
|
|
25
|
+
} = options;
|
|
26
|
+
|
|
27
|
+
const sources = pilets.map((m) => m.mocks).filter(Boolean);
|
|
28
|
+
const api = `${publicUrl}${config.piletApi.replace(/^\/+/, '')}`;
|
|
29
|
+
const baseMocks = resolve(fullBase, 'mocks');
|
|
30
|
+
const initial = createInitialKrasConfig(baseMocks, sources, { [api]: '' }, feed);
|
|
31
|
+
const configs = [...pilets.map((p) => resolve(p.root, krasrc))];
|
|
32
|
+
|
|
33
|
+
const required = {
|
|
34
|
+
injectors: {
|
|
35
|
+
piral: {
|
|
36
|
+
active: false,
|
|
37
|
+
},
|
|
38
|
+
pilet: {
|
|
39
|
+
active: true,
|
|
40
|
+
pilets,
|
|
41
|
+
app: appDir,
|
|
42
|
+
publicUrl,
|
|
43
|
+
handle: ['/', api],
|
|
44
|
+
api,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
if (appDir) {
|
|
50
|
+
const appPackageJson = await findFile(appDir, 'package.json');
|
|
51
|
+
|
|
52
|
+
if (appPackageJson) {
|
|
53
|
+
configs.unshift(resolve(dirname(appPackageJson), krasrc));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (customkrasrc) {
|
|
58
|
+
configs.push(resolve(fullBase, customkrasrc));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
configs.forEach(registerWatcher);
|
|
62
|
+
|
|
63
|
+
const port = await getAvailablePort(originalPort);
|
|
64
|
+
const krasConfig = readKrasConfig({ port, initial, required }, ...configs);
|
|
65
|
+
|
|
66
|
+
log('generalVerbose_0004', `Using kras with configuration: ${JSON.stringify(krasConfig, undefined, 2)}`);
|
|
67
|
+
|
|
68
|
+
const krasServer = buildKrasWithCli(krasConfig);
|
|
69
|
+
krasServer.setMaxListeners(maxListeners);
|
|
70
|
+
krasServer.removeAllListeners('open');
|
|
71
|
+
krasServer.on('open', notifyServerOnline(publicUrl, krasConfig.api));
|
|
72
|
+
|
|
73
|
+
await hooks.beforeOnline?.({ krasServer, krasConfig, open, port, api, feed, pilets, publicUrl });
|
|
74
|
+
await krasServer.start();
|
|
75
|
+
openBrowser(open, port, publicUrl, !!krasConfig.ssl);
|
|
76
|
+
await hooks.afterOnline?.({ krasServer, krasConfig, open, port, api, feed, pilets, publicUrl });
|
|
77
|
+
|
|
78
|
+
registerEnd(() => krasServer.stop());
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async function startShell(options: PlatformStartShellOptions) {
|
|
82
|
+
const {
|
|
83
|
+
fullBase,
|
|
84
|
+
open,
|
|
85
|
+
root,
|
|
86
|
+
targetDir,
|
|
87
|
+
feed,
|
|
88
|
+
publicUrl,
|
|
89
|
+
bundler,
|
|
90
|
+
customkrasrc,
|
|
91
|
+
originalPort,
|
|
92
|
+
hooks,
|
|
93
|
+
registerWatcher,
|
|
94
|
+
registerEnd,
|
|
95
|
+
} = options;
|
|
96
|
+
const krasBaseConfig = resolve(fullBase, krasrc);
|
|
97
|
+
const krasRootConfig = resolve(root, krasrc);
|
|
98
|
+
|
|
99
|
+
const mocks = join(targetDir, 'mocks');
|
|
100
|
+
const baseMocks = resolve(fullBase, 'mocks');
|
|
101
|
+
const mocksExist = await checkExistingDirectory(mocks);
|
|
102
|
+
const sources = [mocksExist ? mocks : undefined].filter(Boolean);
|
|
103
|
+
const initial = createInitialKrasConfig(baseMocks, sources);
|
|
104
|
+
const configs = [krasBaseConfig, krasRootConfig];
|
|
105
|
+
const required = {
|
|
106
|
+
injectors: {
|
|
107
|
+
piral: {
|
|
108
|
+
active: true,
|
|
109
|
+
handle: ['/'],
|
|
110
|
+
feed,
|
|
111
|
+
publicUrl,
|
|
112
|
+
bundler,
|
|
113
|
+
},
|
|
114
|
+
pilet: {
|
|
115
|
+
active: false,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
if (customkrasrc) {
|
|
121
|
+
configs.push(resolve(fullBase, customkrasrc));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
configs.forEach(registerWatcher);
|
|
125
|
+
|
|
126
|
+
const port = await getAvailablePort(originalPort);
|
|
127
|
+
const krasConfig = readKrasConfig({ port, initial, required }, ...configs);
|
|
128
|
+
log('generalVerbose_0004', `Using kras with configuration: ${JSON.stringify(krasConfig, undefined, 2)}`);
|
|
129
|
+
|
|
130
|
+
const krasServer = buildKrasWithCli(krasConfig);
|
|
131
|
+
krasServer.setMaxListeners(16);
|
|
132
|
+
krasServer.removeAllListeners('open');
|
|
133
|
+
krasServer.on('open', notifyServerOnline(publicUrl, krasConfig.api));
|
|
134
|
+
|
|
135
|
+
await hooks.beforeOnline?.({ krasServer, krasConfig, open, port, publicUrl });
|
|
136
|
+
await krasServer.start();
|
|
137
|
+
openBrowser(open, port, publicUrl, !!krasConfig.ssl);
|
|
138
|
+
await hooks.afterOnline?.({ krasServer, krasConfig, open, port, publicUrl });
|
|
139
|
+
|
|
140
|
+
registerEnd(() => krasServer.stop());
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function setup() {
|
|
144
|
+
return {
|
|
145
|
+
startModule,
|
|
146
|
+
startShell,
|
|
147
|
+
};
|
|
148
|
+
}
|
package/src/plugin.ts
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
import { readdir, stat } from 'fs';
|
|
2
|
-
import { join, resolve } from 'path';
|
|
3
|
-
import { log } from './common';
|
|
2
|
+
import { join, resolve, sep, posix } from 'path';
|
|
3
|
+
import { cliName, cliVersion, log } from './common';
|
|
4
4
|
import { inject } from './inject';
|
|
5
5
|
|
|
6
|
-
function
|
|
7
|
-
|
|
6
|
+
function getContainerDir() {
|
|
7
|
+
const currentDir = __dirname.split(sep).join(posix.sep);
|
|
8
|
+
|
|
9
|
+
if (!currentDir.includes(`/.pnpm/${cliName}@${cliVersion}/node_modules/${cliName}/`)) {
|
|
10
|
+
return resolve(__dirname, '..', '..');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async function getLocalPackageDir() {
|
|
17
|
+
const proposedDirs = [
|
|
18
|
+
getContainerDir(),
|
|
19
|
+
resolve(process.cwd(), 'node_modules'),
|
|
20
|
+
resolve(process.cwd(), '..', 'node_modules'),
|
|
21
|
+
resolve(process.cwd(), '..', '..', 'node_modules'),
|
|
22
|
+
resolve(process.cwd(), '..', '..', '..', 'node_modules'),
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
// Right now we always take the first one, but in the future this may be different
|
|
26
|
+
// once we come up with more / better criteria to identify if its a good/valid
|
|
27
|
+
// plugin root directory
|
|
28
|
+
for (const dir of proposedDirs.filter(Boolean)) {
|
|
29
|
+
log('generalDebug_0003', `Checking for potential plugin directory "${dir}" ...`);
|
|
30
|
+
|
|
31
|
+
if (await isDirectory(dir)) {
|
|
32
|
+
return dir;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return undefined;
|
|
8
37
|
}
|
|
9
38
|
|
|
10
39
|
function isDirectory(dir: string) {
|
|
@@ -83,7 +112,7 @@ async function getAllPlugins(rootDir: string): Promise<Array<string>> {
|
|
|
83
112
|
}
|
|
84
113
|
|
|
85
114
|
export async function loadPlugins() {
|
|
86
|
-
const localDir = getLocalPackageDir();
|
|
115
|
+
const localDir = await getLocalPackageDir();
|
|
87
116
|
const allPlugins = await getAllPlugins(localDir);
|
|
88
117
|
|
|
89
118
|
for (const pluginPath of allPlugins) {
|
package/src/questionnaire.ts
CHANGED
|
@@ -7,6 +7,7 @@ type FlagType = 'string' | 'number' | 'boolean' | 'object';
|
|
|
7
7
|
interface Flag {
|
|
8
8
|
name: string;
|
|
9
9
|
type?: FlagType;
|
|
10
|
+
alias: Array<string>;
|
|
10
11
|
values?: Array<any>;
|
|
11
12
|
describe?: string;
|
|
12
13
|
default?: any;
|
|
@@ -16,16 +17,23 @@ interface Flag {
|
|
|
16
17
|
function getCommandData(retrieve: any) {
|
|
17
18
|
const instructions: Array<Flag> = [];
|
|
18
19
|
const fn = {
|
|
20
|
+
alias(name: string, altName: string) {
|
|
21
|
+
return this.swap(name, (flag) => ({
|
|
22
|
+
...flag,
|
|
23
|
+
alias: [...flag.alias, altName],
|
|
24
|
+
}));
|
|
25
|
+
},
|
|
19
26
|
positional(name: string, info: Flag) {
|
|
20
27
|
instructions.push({
|
|
21
28
|
...info,
|
|
29
|
+
alias: [],
|
|
22
30
|
name,
|
|
23
31
|
});
|
|
24
32
|
return this;
|
|
25
33
|
},
|
|
26
34
|
swap(name: string, swapper: (flag: Flag) => Flag) {
|
|
27
35
|
const [flag] = instructions.filter((m) => m.name === name);
|
|
28
|
-
const newFlag = swapper(flag || { name });
|
|
36
|
+
const newFlag = swapper(flag || { name, alias: [] });
|
|
29
37
|
|
|
30
38
|
if (!flag) {
|
|
31
39
|
instructions.push(newFlag);
|
|
@@ -102,6 +110,8 @@ function getValue(type: FlagType, value: string) {
|
|
|
102
110
|
return +value;
|
|
103
111
|
case 'string':
|
|
104
112
|
return value;
|
|
113
|
+
case 'object':
|
|
114
|
+
return value;
|
|
105
115
|
}
|
|
106
116
|
}
|
|
107
117
|
|
|
@@ -133,7 +143,7 @@ export function runQuestionnaireFor(
|
|
|
133
143
|
const questions = instructions
|
|
134
144
|
.filter((instruction) => !ignored.includes(instruction.name))
|
|
135
145
|
.filter((instruction) => !acceptAll || (instruction.default === undefined && instruction.required))
|
|
136
|
-
.filter((instruction) =>
|
|
146
|
+
.filter((instruction) => [...instruction.alias, instruction.name].every((m) => args[m] === undefined))
|
|
137
147
|
.filter((instruction) => instruction.type !== 'object')
|
|
138
148
|
.map((instruction) => ({
|
|
139
149
|
name: instruction.name,
|
|
@@ -144,12 +154,16 @@ export function runQuestionnaireFor(
|
|
|
144
154
|
validate: instruction.type === 'number' ? (input: string) => !isNaN(+input) : () => true,
|
|
145
155
|
}));
|
|
146
156
|
|
|
157
|
+
|
|
147
158
|
return inquirer.prompt(questions).then((answers) => {
|
|
148
159
|
const parameters: any = {};
|
|
149
160
|
|
|
150
161
|
for (const instruction of instructions) {
|
|
151
162
|
const name = instruction.name;
|
|
152
|
-
const value =
|
|
163
|
+
const value =
|
|
164
|
+
answers[name] ??
|
|
165
|
+
ignoredInstructions[name] ??
|
|
166
|
+
[...instruction.alias, instruction.name].map((m) => args[m]).find((v) => v !== undefined);
|
|
153
167
|
parameters[name] = value !== undefined ? getValue(instruction.type, value as any) : instruction.default;
|
|
154
168
|
}
|
|
155
169
|
|
package/src/release.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { basename, resolve } from 'path';
|
|
2
|
-
import { copy, fail } from './common';
|
|
1
|
+
import { basename, dirname, relative, resolve } from 'path';
|
|
2
|
+
import { copy, fail, findFile, FormDataObj, postForm, readBinary } from './common';
|
|
3
3
|
import { availableReleaseProviders } from './helpers';
|
|
4
4
|
import { ReleaseProvider } from './types';
|
|
5
5
|
|
|
6
|
+
async function getVersion(directory: string) {
|
|
7
|
+
const data = await findFile(directory, 'package.json');
|
|
8
|
+
|
|
9
|
+
if (!data) {
|
|
10
|
+
fail('packageJsonNotFound_0020');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const { version } = require(data);
|
|
14
|
+
return version;
|
|
15
|
+
}
|
|
16
|
+
|
|
6
17
|
export interface QualifiedReleaseProvider {
|
|
7
18
|
name: string;
|
|
8
19
|
action: ReleaseProvider;
|
|
@@ -12,7 +23,7 @@ const providers: Record<string, ReleaseProvider> = {
|
|
|
12
23
|
none() {
|
|
13
24
|
return Promise.resolve();
|
|
14
25
|
},
|
|
15
|
-
async xcopy(files, args) {
|
|
26
|
+
async xcopy(_, files, args) {
|
|
16
27
|
const { target } = args;
|
|
17
28
|
|
|
18
29
|
if (!target) {
|
|
@@ -21,6 +32,31 @@ const providers: Record<string, ReleaseProvider> = {
|
|
|
21
32
|
|
|
22
33
|
await Promise.all(files.map(async (file) => copy(file, resolve(target, basename(file)))));
|
|
23
34
|
},
|
|
35
|
+
async feed(directory, files, args, interactive) {
|
|
36
|
+
const { url, apiKey, scheme = 'basic', version = await getVersion(directory) } = args;
|
|
37
|
+
|
|
38
|
+
if (!url) {
|
|
39
|
+
fail('publishFeedMissingUrl_0115');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!version) {
|
|
43
|
+
fail('publishFeedMissingVersion_0116');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const data: FormDataObj = {
|
|
47
|
+
version,
|
|
48
|
+
type: 'custom',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
for (const file of files) {
|
|
52
|
+
const relPath = relative(directory, file);
|
|
53
|
+
const fileName = basename(file);
|
|
54
|
+
const content = await readBinary(dirname(file), fileName);
|
|
55
|
+
data[relPath] = [content, fileName];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
await postForm(url, scheme as any, apiKey, data, {}, undefined, interactive);
|
|
59
|
+
},
|
|
24
60
|
};
|
|
25
61
|
|
|
26
62
|
function findReleaseProvider(providerName: string) {
|
|
@@ -43,7 +79,13 @@ export function setReleaseProvider(provider: QualifiedReleaseProvider) {
|
|
|
43
79
|
}
|
|
44
80
|
}
|
|
45
81
|
|
|
46
|
-
export function publishArtifacts(
|
|
82
|
+
export function publishArtifacts(
|
|
83
|
+
providerName: string,
|
|
84
|
+
directory: string,
|
|
85
|
+
files: Array<string>,
|
|
86
|
+
args: Record<string, string>,
|
|
87
|
+
interactive: boolean,
|
|
88
|
+
) {
|
|
47
89
|
const runRelease = findReleaseProvider(providerName);
|
|
48
|
-
return runRelease(files, args);
|
|
90
|
+
return runRelease(directory, files, args, interactive);
|
|
49
91
|
}
|
package/src/rules/index.ts
CHANGED
|
@@ -19,7 +19,7 @@ function getRules<T extends RuleContext>(target: 'pilet' | 'piral') {
|
|
|
19
19
|
.map((fileName) => {
|
|
20
20
|
log('generalDebug_0003', `Including module "${fileName}" ...`);
|
|
21
21
|
const run = require(`./${fileName}`).default;
|
|
22
|
-
const name = fileName.
|
|
22
|
+
const name = fileName.substring(prefix.length).replace(/\.js$/, '');
|
|
23
23
|
log('generalDebug_0003', `Included rule with name: "${name}".`);
|
|
24
24
|
return {
|
|
25
25
|
run,
|
|
@@ -38,13 +38,14 @@ describe('Rule pilet-has-externals-as-peers', () => {
|
|
|
38
38
|
|
|
39
39
|
function createContext(externals: string[]): PiletRuleContext {
|
|
40
40
|
return {
|
|
41
|
-
|
|
41
|
+
apps: [{
|
|
42
42
|
appPackage: {
|
|
43
43
|
pilets: {
|
|
44
44
|
externals,
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
|
-
},
|
|
47
|
+
}],
|
|
48
|
+
piletPackage: {},
|
|
48
49
|
peerDependencies,
|
|
49
50
|
peerModules,
|
|
50
51
|
entry: 'test-entry',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PiletRuleContext } from '../types';
|
|
2
|
-
import {
|
|
2
|
+
import { retrieveExternals, getSourceFiles, isValidDependency } from '../common';
|
|
3
3
|
|
|
4
4
|
export type Options = 'ignore' | 'active' | 'only-used';
|
|
5
5
|
|
|
@@ -20,15 +20,17 @@ Received: Missing "${missingNames.join('", "')}".
|
|
|
20
20
|
* Checks that "externals" dependencies have been specified in "peerDependencies".
|
|
21
21
|
*/
|
|
22
22
|
export default async function (context: PiletRuleContext, options: Options = 'ignore') {
|
|
23
|
-
if
|
|
24
|
-
|
|
23
|
+
// only check if options are not set to ignore and if importmap feature is not used
|
|
24
|
+
if (options !== 'ignore' && !context.piletPackage.importmap) {
|
|
25
|
+
const [app] = context.apps;
|
|
26
|
+
const externals = await retrieveExternals(app.appRoot, app.appPackage);
|
|
25
27
|
const markedPeerDependencies = Object.keys(context.peerDependencies);
|
|
26
28
|
const markedPeerModules = context.peerModules;
|
|
27
29
|
const missingExternals = externals
|
|
28
|
-
.map((
|
|
29
|
-
const valid = isValidDependency(name);
|
|
30
|
-
const missing = !(valid ? markedPeerDependencies : markedPeerModules).includes(name);
|
|
31
|
-
return { name, valid, missing };
|
|
30
|
+
.map((external) => {
|
|
31
|
+
const valid = isValidDependency(external.name);
|
|
32
|
+
const missing = !(valid ? markedPeerDependencies : markedPeerModules).includes(external.name);
|
|
33
|
+
return { name: external.name, valid, missing };
|
|
32
34
|
})
|
|
33
35
|
.filter((m) => m.missing);
|
|
34
36
|
|
|
@@ -8,7 +8,7 @@ export type Options = 'ignore' | 'active';
|
|
|
8
8
|
*/
|
|
9
9
|
export default async function (context: PiletRuleContext, options: Options = 'ignore') {
|
|
10
10
|
if (options !== 'ignore') {
|
|
11
|
-
const { name } = context.
|
|
11
|
+
const { name } = context.apps[0].appPackage;
|
|
12
12
|
const names = ['piral', 'piral-core', 'piral-base', name];
|
|
13
13
|
const files = await getSourceFiles(context.entry);
|
|
14
14
|
const testers: Array<RegExp> = [];
|
|
@@ -50,7 +50,7 @@ function getFileSizeInKB(path: string) {
|
|
|
50
50
|
export default async function (context: PiletRuleContext, options: Options = -50) {
|
|
51
51
|
if (options !== 0 && typeof options === 'number') {
|
|
52
52
|
const maxSize = Math.abs(options);
|
|
53
|
-
const { main } = context.
|
|
53
|
+
const { main } = context.piletPackage;
|
|
54
54
|
const path = await getPiletMainPath(main, context.root);
|
|
55
55
|
|
|
56
56
|
if (path) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { findLatestVersion } from '../common';
|
|
1
|
+
import { isMonorepoPackageRef, findLatestVersion } from '../common';
|
|
2
2
|
import { PiletRuleContext } from '../types';
|
|
3
3
|
|
|
4
4
|
export type Options = 'suggest' | 'required' | 'ignore';
|
|
@@ -8,22 +8,32 @@ export type Options = 'suggest' | 'required' | 'ignore';
|
|
|
8
8
|
*/
|
|
9
9
|
export default async function (context: PiletRuleContext, options: Options = 'suggest') {
|
|
10
10
|
if (options !== 'ignore') {
|
|
11
|
-
const { name, version } = context.
|
|
11
|
+
const { name, version } = context.apps[0].appPackage;
|
|
12
12
|
const demanded = (context.devDependencies && context.devDependencies[name]) || '';
|
|
13
13
|
const isfixed = demanded.startsWith('git+') || demanded.startsWith('file:');
|
|
14
14
|
|
|
15
15
|
if (!isfixed) {
|
|
16
|
-
const
|
|
16
|
+
const isMonorepoRef = await isMonorepoPackageRef(name, context.root);
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
`
|
|
22
|
-
The used version of "${name}"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
// either we are not in a monorepo or the app shell is not part of the monorepo
|
|
19
|
+
if (!isMonorepoRef) {
|
|
20
|
+
const latestVersion = await findLatestVersion(name).catch((err) => {
|
|
21
|
+
context.warning(`
|
|
22
|
+
The used version of "${name}" could not be determined: ${err}.
|
|
23
|
+
`);
|
|
24
|
+
return version;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (version !== latestVersion) {
|
|
28
|
+
const notify = options === 'required' ? context.error : context.warning;
|
|
29
|
+
notify(
|
|
30
|
+
`
|
|
31
|
+
The used version of "${name}" is outdated.
|
|
32
|
+
Expected: v${latestVersion}.
|
|
33
|
+
Received: v${version}.
|
|
34
|
+
`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
27
37
|
}
|
|
28
38
|
}
|
|
29
39
|
}
|
|
@@ -6,38 +6,19 @@ export type Options = void;
|
|
|
6
6
|
* Checks that the externals to be used in pilets are valid.
|
|
7
7
|
*/
|
|
8
8
|
export default function (context: PiralRuleContext, options: Options = undefined) {
|
|
9
|
-
const { externals } = context
|
|
9
|
+
const { externals } = context;
|
|
10
|
+
const invalidDepRefs = externals
|
|
11
|
+
.filter((ext) => !ext.parents || ext.parents.length === 0)
|
|
12
|
+
.map((ext) => ext.name)
|
|
13
|
+
.filter((name) => context.dependencies[name] === undefined && context.devDependencies[name] === undefined);
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
context.
|
|
15
|
+
for (const invalidDepRef of invalidDepRefs) {
|
|
16
|
+
context.warning(
|
|
13
17
|
`
|
|
14
|
-
The shared
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
The shared dependency "${invalidDepRef}" is not listed in the "dependencies" and "devDependencies".
|
|
19
|
+
Expected: "${invalidDepRef}" in dependencies.
|
|
20
|
+
Received: <none>.
|
|
17
21
|
`,
|
|
18
22
|
);
|
|
19
|
-
} else {
|
|
20
|
-
const invalidDepTypes = externals.filter((ext) => typeof ext !== 'string');
|
|
21
|
-
const invalidDepRefs = externals.filter((ext) => typeof ext === 'string' && !context.dependencies[ext]);
|
|
22
|
-
|
|
23
|
-
if (invalidDepTypes.length > 0) {
|
|
24
|
-
context.error(
|
|
25
|
-
`
|
|
26
|
-
The shared dependencies in pilets.external are invalid.
|
|
27
|
-
Expected: Only names (<string>) in the array.
|
|
28
|
-
Received: Found ${invalidDepTypes.length} non-<string> entries.
|
|
29
|
-
`,
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
for (const invalidDepRef of invalidDepRefs) {
|
|
34
|
-
context.warning(
|
|
35
|
-
`
|
|
36
|
-
The shared dependency "${invalidDepRef}" is listed in pilets.external, but not in dependencies.
|
|
37
|
-
Expected: "${invalidDepRef}" in dependencies.
|
|
38
|
-
Received: <none>.
|
|
39
|
-
`,
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
23
|
}
|
|
43
24
|
}
|
package/src/types/common.ts
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
|
+
export interface Importmap {
|
|
2
|
+
imports: Record<string, string>;
|
|
3
|
+
inherit: Array<string>;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface PackageData {
|
|
7
|
+
name: string;
|
|
8
|
+
version: string;
|
|
9
|
+
description: string;
|
|
10
|
+
importmap?: Importmap;
|
|
11
|
+
main: string;
|
|
12
|
+
author:
|
|
13
|
+
| string
|
|
14
|
+
| {
|
|
15
|
+
name?: string;
|
|
16
|
+
url?: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
};
|
|
19
|
+
dependencies: Record<string, string>;
|
|
20
|
+
peerDependencies: Record<string, string>;
|
|
21
|
+
devDependencies: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Shape of the package.json of a pilet
|
|
25
|
+
export interface PiletPackageData extends PackageData {
|
|
26
|
+
piral?: {
|
|
27
|
+
name: string;
|
|
28
|
+
};
|
|
29
|
+
custom?: any;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Shape of the package.json of a Piral instance or emulator
|
|
33
|
+
export interface PiralPackageData extends PackageData {
|
|
34
|
+
pilets?: PiletsInfo;
|
|
35
|
+
piralCLI?: { generated: boolean; version: string };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface PiralInstancePackageData extends PiralPackageData {
|
|
39
|
+
root: string;
|
|
40
|
+
app: string;
|
|
41
|
+
port: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface AppDefinition {
|
|
45
|
+
appPackage: PiralInstancePackageData;
|
|
46
|
+
appFile: string;
|
|
47
|
+
appRoot: string;
|
|
48
|
+
appPort: number;
|
|
49
|
+
emulator: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
1
52
|
export enum LogLevels {
|
|
2
53
|
/**
|
|
3
54
|
* Logging disabled
|
|
@@ -41,8 +92,39 @@ export interface Bundler {
|
|
|
41
92
|
ready(): Promise<void>;
|
|
42
93
|
}
|
|
43
94
|
|
|
95
|
+
export interface PlatformStartModuleOptions {
|
|
96
|
+
appDir?: string;
|
|
97
|
+
open: boolean;
|
|
98
|
+
fullBase: string;
|
|
99
|
+
feed: string | Array<string>;
|
|
100
|
+
publicUrl: string;
|
|
101
|
+
customkrasrc: string;
|
|
102
|
+
originalPort: number;
|
|
103
|
+
hooks: Record<string, Function>;
|
|
104
|
+
registerWatcher(file: string): void;
|
|
105
|
+
registerEnd(cb: () => void): void;
|
|
106
|
+
|
|
107
|
+
maxListeners: number;
|
|
108
|
+
pilets: Array<any>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface PlatformStartShellOptions {
|
|
112
|
+
open: boolean;
|
|
113
|
+
fullBase: string;
|
|
114
|
+
root: string;
|
|
115
|
+
feed: string | Array<string>;
|
|
116
|
+
targetDir: string;
|
|
117
|
+
publicUrl: string;
|
|
118
|
+
bundler: Bundler;
|
|
119
|
+
customkrasrc: string;
|
|
120
|
+
originalPort: number;
|
|
121
|
+
hooks: Record<string, Function>;
|
|
122
|
+
registerWatcher(file: string): void;
|
|
123
|
+
registerEnd(cb: () => void): void;
|
|
124
|
+
}
|
|
125
|
+
|
|
44
126
|
export interface ReleaseProvider {
|
|
45
|
-
(files: Array<string>, args: Record<string, string
|
|
127
|
+
(directory: string, files: Array<string>, args: Record<string, string>, interactive: boolean): Promise<void>;
|
|
46
128
|
}
|
|
47
129
|
|
|
48
130
|
export interface TemplateFileLocation {
|
|
@@ -54,7 +136,7 @@ export interface TemplateFileLocation {
|
|
|
54
136
|
|
|
55
137
|
export interface PiletsInfo {
|
|
56
138
|
files: Array<string | TemplateFileLocation>;
|
|
57
|
-
|
|
139
|
+
template: string;
|
|
58
140
|
devDependencies: Record<string, string | true>;
|
|
59
141
|
scripts: Record<string, string>;
|
|
60
142
|
validators: Record<string, any>;
|
|
@@ -76,6 +158,17 @@ export interface RuleContext {
|
|
|
76
158
|
peerDependencies: Record<string, string>;
|
|
77
159
|
}
|
|
78
160
|
|
|
161
|
+
export interface SharedDependency {
|
|
162
|
+
id: string;
|
|
163
|
+
requireId: string;
|
|
164
|
+
name: string;
|
|
165
|
+
ref: string;
|
|
166
|
+
type: 'local' | 'remote';
|
|
167
|
+
entry: string;
|
|
168
|
+
parents?: Array<string>;
|
|
169
|
+
alias?: string;
|
|
170
|
+
}
|
|
171
|
+
|
|
79
172
|
export interface RuleRunner<T extends RuleContext> {
|
|
80
173
|
(context: T, options: any): void | Promise<void>;
|
|
81
174
|
}
|
|
@@ -87,15 +180,12 @@ export interface Rule<T extends RuleContext> {
|
|
|
87
180
|
|
|
88
181
|
export interface PiralRuleContext extends RuleContext {
|
|
89
182
|
info: PiletsInfo;
|
|
183
|
+
externals: Array<SharedDependency>;
|
|
90
184
|
}
|
|
91
185
|
|
|
92
186
|
export interface PiletRuleContext extends RuleContext {
|
|
93
|
-
|
|
94
|
-
peerModules: Array<string>;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export interface PiralData {
|
|
98
|
-
appFile: string;
|
|
99
|
-
appPackage: any;
|
|
187
|
+
apps: Array<AppDefinition>;
|
|
100
188
|
piletPackage: any;
|
|
189
|
+
peerModules: Array<string>;
|
|
190
|
+
importmap: Array<SharedDependency>;
|
|
101
191
|
}
|