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
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { dirname, relative, resolve } from 'path';
|
|
2
|
+
import { log } from '../log';
|
|
3
|
+
import { findFile, readText, writeText } from '../io';
|
|
4
|
+
import { jju } from '../../external';
|
|
5
|
+
import { runCommand } from '../scripts';
|
|
6
|
+
import { MemoryStream } from '../MemoryStream';
|
|
7
|
+
|
|
8
|
+
// Helpers:
|
|
9
|
+
const rushJson = 'rush.json';
|
|
10
|
+
|
|
11
|
+
function runRushProcess(args: Array<string>, target: string, output?: NodeJS.WritableStream) {
|
|
12
|
+
log('generalDebug_0003', 'Starting the Rush process ...');
|
|
13
|
+
const cwd = resolve(process.cwd(), target);
|
|
14
|
+
return runCommand('rush', args, cwd, output);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function convert(flags: Array<string>) {
|
|
18
|
+
return flags.map((flag) => {
|
|
19
|
+
switch (flag) {
|
|
20
|
+
case '--save-exact':
|
|
21
|
+
// discard as this may lead to problems
|
|
22
|
+
return '';
|
|
23
|
+
case '--save-dev':
|
|
24
|
+
return '--dev';
|
|
25
|
+
case '--no-save':
|
|
26
|
+
// unfortunately no
|
|
27
|
+
return '';
|
|
28
|
+
default:
|
|
29
|
+
return flag;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Client interface functions:
|
|
35
|
+
|
|
36
|
+
export async function installDependencies(target = '.', ...flags: Array<string>) {
|
|
37
|
+
const ms = new MemoryStream();
|
|
38
|
+
await runRushProcess(['update', ...convert(flags)], target, ms);
|
|
39
|
+
log('generalDebug_0003', `Rush install dependencies result: ${ms.value}`);
|
|
40
|
+
return ms.value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export async function uninstallPackage(packageRef: string, target = '.', ...flags: Array<string>) {
|
|
44
|
+
const ms = new MemoryStream();
|
|
45
|
+
await runRushProcess(['remove', packageRef, ...convert(flags)], target, ms);
|
|
46
|
+
log('generalDebug_0003', `Rush remove package result: ${ms.value}`);
|
|
47
|
+
return ms.value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function installPackage(packageRef: string, target = '.', ...flags: Array<string>) {
|
|
51
|
+
const ms = new MemoryStream();
|
|
52
|
+
await runRushProcess(['add', '--package', packageRef, ...convert(flags)], target, ms);
|
|
53
|
+
log('generalDebug_0003', `Rush add package result: ${ms.value}`);
|
|
54
|
+
return ms.value;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export async function detectClient(root: string, stopDir = resolve(root, '/')) {
|
|
58
|
+
return !!(await findFile(root, rushJson, stopDir));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export async function initProject(packageName: string, target: string) {
|
|
62
|
+
const rushPath = await findFile(target, rushJson);
|
|
63
|
+
|
|
64
|
+
if (!rushPath) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
`Could not find the "${rushJson}" from "${target}". Sure you want to create the project in the right directory?`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const rushDir = dirname(rushPath);
|
|
71
|
+
const rushContent = await readText(rushDir, rushJson);
|
|
72
|
+
const rushData = jju.parse(rushContent);
|
|
73
|
+
const projectFolder = relative(rushDir, target);
|
|
74
|
+
|
|
75
|
+
if (!Array.isArray(rushData.projects)) {
|
|
76
|
+
rushData.projects = [];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
rushData.projects.push({
|
|
80
|
+
packageName,
|
|
81
|
+
projectFolder,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
await writeText(
|
|
85
|
+
rushDir,
|
|
86
|
+
rushJson,
|
|
87
|
+
jju.update(rushContent, rushData, {
|
|
88
|
+
mode: 'cjson',
|
|
89
|
+
indent: 2,
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export async function isProject(root: string, packageRef: string) {
|
|
95
|
+
const details = await listProjects(root);
|
|
96
|
+
|
|
97
|
+
if (typeof details === 'object' && Array.isArray(details?.projects)) {
|
|
98
|
+
return details?.projects?.some((p) => p.name === packageRef) ?? false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Functions to exclusively use from rush client:
|
|
105
|
+
|
|
106
|
+
export async function listProjects(target: string) {
|
|
107
|
+
const ms = new MemoryStream();
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
await runRushProcess(['list', '--json'], target, ms);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
log('generalDebug_0003', `rush list error: ${e}`);
|
|
113
|
+
return {};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
log('generalDebug_0003', `rush list project result: ${ms.value}`);
|
|
117
|
+
return JSON.parse(ms.value);
|
|
118
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { log } from '../log';
|
|
3
|
+
import { findFile } from '../io';
|
|
3
4
|
import { runCommand } from '../scripts';
|
|
4
5
|
import { MemoryStream } from '../MemoryStream';
|
|
5
6
|
|
|
7
|
+
// Helpers:
|
|
8
|
+
|
|
6
9
|
function runYarnProcess(args: Array<string>, target: string, output?: NodeJS.WritableStream) {
|
|
7
|
-
log('generalDebug_0003', 'Starting the Yarn process ...');
|
|
10
|
+
log('generalDebug_0003', 'Starting the Yarn Classic process ...');
|
|
8
11
|
const cwd = resolve(process.cwd(), target);
|
|
9
12
|
return runCommand('yarn', args, cwd, output);
|
|
10
13
|
}
|
|
@@ -12,6 +15,8 @@ function runYarnProcess(args: Array<string>, target: string, output?: NodeJS.Wri
|
|
|
12
15
|
function convert(flags: Array<string>) {
|
|
13
16
|
return flags.map((flag) => {
|
|
14
17
|
switch (flag) {
|
|
18
|
+
case '--save-exact':
|
|
19
|
+
return '--exact';
|
|
15
20
|
case '--save-dev':
|
|
16
21
|
return '--dev';
|
|
17
22
|
case '--no-save':
|
|
@@ -23,16 +28,57 @@ function convert(flags: Array<string>) {
|
|
|
23
28
|
});
|
|
24
29
|
}
|
|
25
30
|
|
|
31
|
+
// Client interface functions:
|
|
32
|
+
|
|
26
33
|
export async function installDependencies(target = '.', ...flags: Array<string>) {
|
|
27
34
|
const ms = new MemoryStream();
|
|
28
35
|
await runYarnProcess(['install', ...convert(flags)], target, ms);
|
|
29
|
-
log('generalDebug_0003', `Yarn install dependencies result: ${ms.value}`);
|
|
36
|
+
log('generalDebug_0003', `Yarn Classic install dependencies result: ${ms.value}`);
|
|
37
|
+
return ms.value;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function uninstallPackage(packageRef: string, target = '.', ...flags: Array<string>) {
|
|
41
|
+
const ms = new MemoryStream();
|
|
42
|
+
await runYarnProcess(['remove', packageRef, ...convert(flags)], target, ms);
|
|
43
|
+
log('generalDebug_0003', `Yarn Classic remove package result: ${ms.value}`);
|
|
30
44
|
return ms.value;
|
|
31
45
|
}
|
|
32
46
|
|
|
33
47
|
export async function installPackage(packageRef: string, target = '.', ...flags: Array<string>) {
|
|
34
48
|
const ms = new MemoryStream();
|
|
35
49
|
await runYarnProcess(['add', packageRef, ...convert(flags)], target, ms);
|
|
36
|
-
log('generalDebug_0003', `Yarn
|
|
50
|
+
log('generalDebug_0003', `Yarn Classic add package result: ${ms.value}`);
|
|
37
51
|
return ms.value;
|
|
38
52
|
}
|
|
53
|
+
|
|
54
|
+
export async function detectClient(root: string, stopDir = resolve(root, '/')) {
|
|
55
|
+
return !!(await findFile(root, 'yarn.lock', stopDir));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export async function initProject(projectName: string, target: string) {}
|
|
59
|
+
|
|
60
|
+
export async function isProject(root: string, packageRef: string) {
|
|
61
|
+
const details = await listProjects(root);
|
|
62
|
+
|
|
63
|
+
if (typeof details === 'object') {
|
|
64
|
+
return typeof details?.[packageRef]?.location === 'string';
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Functions to exclusively use from yarn client:
|
|
71
|
+
|
|
72
|
+
export async function listProjects(target: string) {
|
|
73
|
+
const ms = new MemoryStream();
|
|
74
|
+
|
|
75
|
+
try {
|
|
76
|
+
await runYarnProcess(['workspaces', 'info'], target, ms);
|
|
77
|
+
} catch (e) {
|
|
78
|
+
log('generalDebug_0003', `yarn workspaces error: ${e}`);
|
|
79
|
+
return {};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
log('generalDebug_0003', `yarn workspaces result: ${ms.value}`);
|
|
83
|
+
return JSON.parse(ms.value);
|
|
84
|
+
}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import { findCompatVersion, compatVersion, cliVersion } from './info';
|
|
2
2
|
import { findPackageVersion } from './package';
|
|
3
|
+
import { frameworkLibs } from './constants';
|
|
3
4
|
import { log } from './log';
|
|
4
5
|
|
|
5
6
|
export function checkAppShellCompatibility(piralVersion: string) {
|
|
6
7
|
log('generalDebug_0003', `Checking compatibility ...`);
|
|
8
|
+
|
|
9
|
+
if (!piralVersion) {
|
|
10
|
+
log('appShellMaybeIncompatible_0102', cliVersion);
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
7
14
|
const compatible = findCompatVersion(piralVersion);
|
|
8
15
|
log('generalDebug_0003', `Used versions: "${compatible}" and "${compatVersion}".`);
|
|
9
16
|
|
|
@@ -17,7 +24,7 @@ export function checkAppShellCompatibility(piralVersion: string) {
|
|
|
17
24
|
|
|
18
25
|
export async function checkCliCompatibility(root: string) {
|
|
19
26
|
log('generalDebug_0003', `Checking compatibility ...`);
|
|
20
|
-
const piralVersion = await findPackageVersion(root,
|
|
27
|
+
const piralVersion = await findPackageVersion(root, frameworkLibs);
|
|
21
28
|
const compatible = findCompatVersion(piralVersion);
|
|
22
29
|
log('generalDebug_0003', `Used versions: "${compatible}" and "${compatVersion}".`);
|
|
23
30
|
|
package/src/common/config.ts
CHANGED
|
@@ -1,51 +1,86 @@
|
|
|
1
|
+
import { defaultRegistry } from './constants';
|
|
1
2
|
import { rc } from '../external';
|
|
2
|
-
import { NpmClientType } from '../types';
|
|
3
|
+
import { SourceLanguage, NpmClientType, PiletSchemaVersion } from '../types';
|
|
3
4
|
|
|
4
5
|
export interface PiralCliConfig {
|
|
5
|
-
apiKey?: string;
|
|
6
|
-
apiKeys?: Record<string, string>;
|
|
7
|
-
url?: string;
|
|
8
|
-
cert?: string;
|
|
9
|
-
npmClient?: NpmClientType;
|
|
10
|
-
bundler?: string;
|
|
11
|
-
piletApi?: string;
|
|
12
|
-
validators?: Record<string, any>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const config: PiralCliConfig = rc('piral', {
|
|
16
6
|
/**
|
|
17
7
|
* Key to be used for all servers in case there is
|
|
18
8
|
* no specialized key in apiKeys specified.
|
|
19
9
|
*/
|
|
20
|
-
apiKey
|
|
10
|
+
apiKey?: string;
|
|
21
11
|
/**
|
|
22
|
-
*
|
|
12
|
+
* Feed URL to API key specifications.
|
|
23
13
|
*/
|
|
24
|
-
apiKeys
|
|
14
|
+
apiKeys?: Record<string, string>;
|
|
25
15
|
/**
|
|
26
16
|
* URL to be used for publishing a pilet in case
|
|
27
17
|
* there is no specialized key in url specified.
|
|
28
18
|
*/
|
|
29
|
-
url
|
|
19
|
+
url?: string;
|
|
30
20
|
/**
|
|
31
21
|
* Path to a custom certificate file.
|
|
32
22
|
*/
|
|
33
|
-
cert
|
|
23
|
+
cert?: string;
|
|
34
24
|
/**
|
|
35
25
|
* Selects the default npm client to use.
|
|
36
26
|
*/
|
|
37
|
-
npmClient
|
|
27
|
+
npmClient?: NpmClientType;
|
|
38
28
|
/**
|
|
39
29
|
* Selects the default bundler to use, if
|
|
40
30
|
* none given and found.
|
|
41
31
|
*/
|
|
42
|
-
bundler
|
|
32
|
+
bundler?: string;
|
|
43
33
|
/**
|
|
44
34
|
* Selects the default pilet API path to use.
|
|
45
35
|
*/
|
|
46
|
-
piletApi
|
|
36
|
+
piletApi?: string;
|
|
47
37
|
/**
|
|
48
38
|
* Sets the validators configuration for a Piral instance.
|
|
49
39
|
*/
|
|
50
|
-
validators
|
|
51
|
-
|
|
40
|
+
validators?: Record<string, any>;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the schema version to be used for pilets.
|
|
43
|
+
*/
|
|
44
|
+
schemaVersion?: PiletSchemaVersion;
|
|
45
|
+
/**
|
|
46
|
+
* Automatically open the browser.
|
|
47
|
+
*/
|
|
48
|
+
openBrowser?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Port number.
|
|
51
|
+
*/
|
|
52
|
+
port?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Template language.
|
|
55
|
+
*/
|
|
56
|
+
language?: SourceLanguage;
|
|
57
|
+
/**
|
|
58
|
+
* Host name.
|
|
59
|
+
*/
|
|
60
|
+
host?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Npm registry.
|
|
63
|
+
*/
|
|
64
|
+
registry?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const config: PiralCliConfig = rc(
|
|
68
|
+
'piral',
|
|
69
|
+
{
|
|
70
|
+
apiKey: undefined,
|
|
71
|
+
apiKeys: {},
|
|
72
|
+
url: undefined,
|
|
73
|
+
cert: undefined,
|
|
74
|
+
npmClient: 'npm' as const,
|
|
75
|
+
bundler: 'webpack5' as const,
|
|
76
|
+
piletApi: '/$pilet-api',
|
|
77
|
+
validators: {},
|
|
78
|
+
schemaVersion: 'v2' as const,
|
|
79
|
+
openBrowser: false,
|
|
80
|
+
port: 1234,
|
|
81
|
+
language: 'ts' as const,
|
|
82
|
+
host: 'localhost',
|
|
83
|
+
registry: defaultRegistry,
|
|
84
|
+
},
|
|
85
|
+
{},
|
|
86
|
+
);
|
package/src/common/constants.ts
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
export const defaultRegistry = 'https://registry.npmjs.org/';
|
|
2
2
|
export const filesTar = 'files';
|
|
3
|
+
export const packageJson = 'package.json';
|
|
4
|
+
export const piralJson = 'piral.json';
|
|
5
|
+
export const piletJson = 'pilet.json';
|
|
3
6
|
export const filesOnceTar = 'files_once';
|
|
4
|
-
export const piralBaseRoot = 'piral-base/
|
|
7
|
+
export const piralBaseRoot = 'piral-base/package.json';
|
|
8
|
+
export const defaultSchemaVersion = 'v2';
|
|
9
|
+
export const frameworkLibs = ['piral' as const, 'piral-core' as const, 'piral-base' as const];
|
|
10
|
+
export const piletJsonSchemaUrl = 'https://docs.piral.io/schemas/pilet-v0.json';
|
|
11
|
+
export const piralJsonSchemaUrl = 'https://docs.piral.io/schemas/piral-v0.json';
|
|
5
12
|
export const entryModuleExtensions = ['.ts', '.tsx', '.js', '.jsx'];
|
|
6
|
-
export const
|
|
7
|
-
|
|
13
|
+
export const bundlerNames = [
|
|
14
|
+
'esbuild' as const,
|
|
15
|
+
'parcel' as const,
|
|
16
|
+
'parcel2' as const,
|
|
17
|
+
'rollup' as const,
|
|
18
|
+
'rspack' as const,
|
|
19
|
+
'webpack' as const,
|
|
20
|
+
'webpack5' as const,
|
|
21
|
+
'vite' as const,
|
|
22
|
+
'xbuild' as const,
|
|
23
|
+
];
|
|
24
|
+
export const declarationEntryExtensions = ['.html', '.pug', ...entryModuleExtensions];
|
|
25
|
+
export const legacyCoreExternals = [
|
|
8
26
|
'@dbeining/react-atom',
|
|
9
27
|
'@libre/atom',
|
|
10
28
|
'history',
|
|
@@ -1,28 +1,61 @@
|
|
|
1
|
-
import { generateDeclaration } from 'dets';
|
|
1
|
+
import { DeclOptions, generateDeclaration, createExcludePlugin, Logger } from 'dets';
|
|
2
2
|
import { dirname, basename, resolve, extname } from 'path';
|
|
3
3
|
import { progress, log, logWarn, logVerbose, logInfo } from './log';
|
|
4
|
-
import { makeExternals } from './npm';
|
|
5
4
|
import { ForceOverwrite } from './enums';
|
|
6
|
-
import { retrievePiralRoot, retrievePiletsInfo } from './package';
|
|
5
|
+
import { retrievePiralRoot, retrievePiletsInfo, flattenExternals, validateSharedDependencies } from './package';
|
|
7
6
|
import { entryModuleExtensions, piralBaseRoot } from './constants';
|
|
8
7
|
import { readText, getEntryFiles, matchFiles, createFileIfNotExists } from './io';
|
|
8
|
+
import { getModulePath } from '../external';
|
|
9
9
|
import { LogLevels } from '../types';
|
|
10
10
|
|
|
11
|
-
function
|
|
11
|
+
function findPiralBaseRoot(root: string, framework: string) {
|
|
12
|
+
const piralJson = `${framework}/package.json`;
|
|
13
|
+
|
|
14
|
+
if (piralJson !== piralBaseRoot) {
|
|
15
|
+
try {
|
|
16
|
+
const packageJsonPath = getModulePath(root, piralJson);
|
|
17
|
+
return dirname(packageJsonPath);
|
|
18
|
+
} catch {}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return root;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function findPiralBaseApi(root: string, framework: string) {
|
|
25
|
+
// for some package managers, e.g., pnpm we need to first go into
|
|
26
|
+
// some specifics before being able to retrieve "piral-base"
|
|
27
|
+
const baseRoot = findPiralBaseRoot(root, framework);
|
|
28
|
+
|
|
12
29
|
try {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
30
|
+
const packageJsonPath = getModulePath(baseRoot, piralBaseRoot);
|
|
31
|
+
const projectDir = dirname(packageJsonPath);
|
|
32
|
+
const project = require(packageJsonPath);
|
|
33
|
+
// By default support for piral-base < 0.15
|
|
34
|
+
const { piletApiTypings = 'lib/types.d.ts' } = project;
|
|
35
|
+
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
file: resolve(projectDir, piletApiTypings),
|
|
39
|
+
name: 'PiletApi',
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
} catch (err) {
|
|
43
|
+
log('generalError_0002', `Could not find the root API of "piral-base" from "${root}": ${err}`);
|
|
44
|
+
return [];
|
|
20
45
|
}
|
|
21
46
|
}
|
|
22
47
|
|
|
23
48
|
function findDeclaredTypings(root: string) {
|
|
24
49
|
try {
|
|
25
|
-
const { typings } = require(resolve(root, 'package.json'));
|
|
50
|
+
const { typings, extraTypes } = require(resolve(root, 'package.json'));
|
|
51
|
+
|
|
52
|
+
if (extraTypes) {
|
|
53
|
+
if (typeof extraTypes === 'string') {
|
|
54
|
+
return [resolve(root, extraTypes)];
|
|
55
|
+
} else if (Array.isArray(extraTypes)) {
|
|
56
|
+
return extraTypes.filter((types) => typeof types === 'string').map((types) => resolve(root, types));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
26
59
|
|
|
27
60
|
if (typings) {
|
|
28
61
|
return [resolve(root, typings)];
|
|
@@ -54,7 +87,68 @@ async function getEntryModules(entryFiles: string) {
|
|
|
54
87
|
return [entryFiles];
|
|
55
88
|
}
|
|
56
89
|
|
|
57
|
-
|
|
90
|
+
function createLogger(): Logger {
|
|
91
|
+
return {
|
|
92
|
+
error(message) {
|
|
93
|
+
throw new Error(message);
|
|
94
|
+
},
|
|
95
|
+
info(message) {
|
|
96
|
+
logInfo(message);
|
|
97
|
+
},
|
|
98
|
+
verbose(message) {
|
|
99
|
+
logVerbose(message);
|
|
100
|
+
},
|
|
101
|
+
warn(message) {
|
|
102
|
+
logWarn(message);
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function createDeclarationFile(
|
|
108
|
+
options: DeclOptions,
|
|
109
|
+
source: string,
|
|
110
|
+
target: string,
|
|
111
|
+
forceOverwrite: ForceOverwrite,
|
|
112
|
+
) {
|
|
113
|
+
progress('Bundling declaration file ...');
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
const result = generateDeclaration(options);
|
|
117
|
+
|
|
118
|
+
progress('Writing declaration file ...');
|
|
119
|
+
await createFileIfNotExists(target, 'index.d.ts', result, forceOverwrite);
|
|
120
|
+
} catch (ex) {
|
|
121
|
+
log('declarationCouldNotBeGenerated_0076', source, ex);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export async function createPiletDeclaration(
|
|
126
|
+
name: string,
|
|
127
|
+
root: string,
|
|
128
|
+
entry: string,
|
|
129
|
+
allowedImports: Array<string>,
|
|
130
|
+
target: string,
|
|
131
|
+
forceOverwrite: ForceOverwrite,
|
|
132
|
+
logLevel: LogLevels,
|
|
133
|
+
) {
|
|
134
|
+
const files = await getAllFiles([entry]);
|
|
135
|
+
const types = findDeclaredTypings(root);
|
|
136
|
+
const options: DeclOptions = {
|
|
137
|
+
name,
|
|
138
|
+
root,
|
|
139
|
+
files,
|
|
140
|
+
types: [...types, ...files],
|
|
141
|
+
plugins: [createExcludePlugin([name])],
|
|
142
|
+
apis: [],
|
|
143
|
+
noModuleDeclaration: true,
|
|
144
|
+
imports: allowedImports,
|
|
145
|
+
logLevel,
|
|
146
|
+
logger: createLogger(),
|
|
147
|
+
};
|
|
148
|
+
return await createDeclarationFile(options, root, target, forceOverwrite);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export async function createPiralDeclaration(
|
|
58
152
|
baseDir: string,
|
|
59
153
|
entry: string,
|
|
60
154
|
target: string,
|
|
@@ -63,46 +157,26 @@ export async function createDeclaration(
|
|
|
63
157
|
) {
|
|
64
158
|
progress('Reading configuration ...');
|
|
65
159
|
const entryFiles = await retrievePiralRoot(baseDir, entry);
|
|
66
|
-
const { name, root, externals } = await retrievePiletsInfo(entryFiles);
|
|
67
|
-
const allowedImports = makeExternals(externals);
|
|
160
|
+
const { name, root, externals, framework } = await retrievePiletsInfo(entryFiles);
|
|
68
161
|
const entryModules = await getEntryModules(entryFiles);
|
|
69
162
|
const files = await getAllFiles(entryModules);
|
|
163
|
+
const options: DeclOptions = {
|
|
164
|
+
name,
|
|
165
|
+
root,
|
|
166
|
+
files,
|
|
167
|
+
types: findDeclaredTypings(root),
|
|
168
|
+
apis: findPiralBaseApi(root, framework),
|
|
169
|
+
noModuleDeclaration: true,
|
|
170
|
+
imports: flattenExternals(externals),
|
|
171
|
+
logLevel,
|
|
172
|
+
logger: createLogger(),
|
|
173
|
+
};
|
|
70
174
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
const result = generateDeclaration({
|
|
75
|
-
name,
|
|
76
|
-
root,
|
|
77
|
-
files,
|
|
78
|
-
types: findDeclaredTypings(root),
|
|
79
|
-
apis: [
|
|
80
|
-
{
|
|
81
|
-
file: findPiralBaseApi(root),
|
|
82
|
-
name: 'PiletApi',
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
imports: allowedImports,
|
|
86
|
-
logLevel,
|
|
87
|
-
logger: {
|
|
88
|
-
error(message) {
|
|
89
|
-
throw new Error(message);
|
|
90
|
-
},
|
|
91
|
-
info(message) {
|
|
92
|
-
logInfo(message);
|
|
93
|
-
},
|
|
94
|
-
verbose(message) {
|
|
95
|
-
logVerbose(message);
|
|
96
|
-
},
|
|
97
|
-
warn(message) {
|
|
98
|
-
logWarn(message);
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
});
|
|
175
|
+
validateSharedDependencies(externals);
|
|
102
176
|
|
|
103
|
-
|
|
104
|
-
await
|
|
105
|
-
} catch (ex) {
|
|
106
|
-
log('declarationCouldNotBeGenerated_0076', baseDir, ex);
|
|
177
|
+
if (options.apis.length) {
|
|
178
|
+
return await createDeclarationFile(options, baseDir, target, forceOverwrite);
|
|
107
179
|
}
|
|
180
|
+
|
|
181
|
+
log('declarationCouldNotBeGenerated_0076', baseDir, 'The main Pilet API interface could not be found.');
|
|
108
182
|
}
|
package/src/common/emoji.ts
CHANGED
|
@@ -2,5 +2,14 @@ import { isWindows } from './info';
|
|
|
2
2
|
|
|
3
3
|
const supportsEmoji = !isWindows || process.env.TERM === 'xterm-256color';
|
|
4
4
|
|
|
5
|
+
// see https://unicode.org/emoji/charts/full-emoji-list.html
|
|
5
6
|
export const liveIcon = supportsEmoji ? '🚀 ' : '>';
|
|
6
7
|
export const settingsIcon = supportsEmoji ? '🔧 ' : '>';
|
|
8
|
+
export const cactusIcon = supportsEmoji ? '👻 ' : '>';
|
|
9
|
+
export const clapIcon = supportsEmoji ? '👏 ' : '^';
|
|
10
|
+
export const sparklesIcon = supportsEmoji ? '✨ ' : '>';
|
|
11
|
+
export const unicornIcon = supportsEmoji ? '🦄 ' : '>';
|
|
12
|
+
export const caterpillerIcon = supportsEmoji ? '🐛 ' : '+';
|
|
13
|
+
export const butterflyIcon = supportsEmoji ? '🦋 ' : '+';
|
|
14
|
+
export const zapIcon = supportsEmoji ? '⚡ ' : '>';
|
|
15
|
+
export const rainbowIcon = supportsEmoji ? '🌈 ' : '~';
|