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/src/apps/new-piral.ts
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { resolve, basename } from 'path';
|
|
2
|
-
import {
|
|
2
|
+
import { frameworkKeys } from '../helpers';
|
|
3
|
+
import { SourceLanguage, LogLevels, Framework, NpmClientType } from '../types';
|
|
3
4
|
import {
|
|
4
5
|
ForceOverwrite,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
updateExistingJson,
|
|
8
|
-
getPiralPackage,
|
|
6
|
+
installNpmPackage,
|
|
7
|
+
patchPiralPackage,
|
|
9
8
|
scaffoldPiralSourceFiles,
|
|
10
9
|
createDirectory,
|
|
11
10
|
createFileIfNotExists,
|
|
12
11
|
logDone,
|
|
13
|
-
|
|
12
|
+
installNpmDependencies,
|
|
14
13
|
combinePackageRef,
|
|
15
14
|
setLogLevel,
|
|
16
15
|
fail,
|
|
17
16
|
progress,
|
|
18
17
|
determineNpmClient,
|
|
19
|
-
defaultRegistry,
|
|
20
18
|
cliVersion,
|
|
19
|
+
getPiralScaffoldData,
|
|
20
|
+
config,
|
|
21
|
+
initNpmProject,
|
|
22
|
+
piralJson,
|
|
21
23
|
} from '../common';
|
|
22
24
|
|
|
23
25
|
export interface NewPiralOptions {
|
|
@@ -72,7 +74,7 @@ export interface NewPiralOptions {
|
|
|
72
74
|
logLevel?: LogLevels;
|
|
73
75
|
|
|
74
76
|
/**
|
|
75
|
-
* Sets the
|
|
77
|
+
* Sets the npm client to be used when scaffolding. (e.g. 'yarn')
|
|
76
78
|
*/
|
|
77
79
|
npmClient?: NpmClientType;
|
|
78
80
|
|
|
@@ -85,22 +87,28 @@ export interface NewPiralOptions {
|
|
|
85
87
|
* Places additional variables that should used when scaffolding.
|
|
86
88
|
*/
|
|
87
89
|
variables?: Record<string, string>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Sets new app name
|
|
93
|
+
*/
|
|
94
|
+
name?: string;
|
|
88
95
|
}
|
|
89
96
|
|
|
90
97
|
export const newPiralDefaults: NewPiralOptions = {
|
|
91
98
|
app: './src/index.html',
|
|
92
|
-
registry:
|
|
99
|
+
registry: config.registry,
|
|
93
100
|
framework: 'piral',
|
|
94
101
|
target: '.',
|
|
95
102
|
version: cliVersion,
|
|
96
103
|
forceOverwrite: ForceOverwrite.no,
|
|
97
|
-
language:
|
|
104
|
+
language: config.language,
|
|
98
105
|
install: true,
|
|
99
106
|
template: 'default',
|
|
100
107
|
logLevel: LogLevels.info,
|
|
101
108
|
npmClient: undefined,
|
|
102
109
|
bundlerName: 'none',
|
|
103
110
|
variables: {},
|
|
111
|
+
name: undefined,
|
|
104
112
|
};
|
|
105
113
|
|
|
106
114
|
export async function newPiral(baseDir = process.cwd(), options: NewPiralOptions = {}) {
|
|
@@ -117,15 +125,25 @@ export async function newPiral(baseDir = process.cwd(), options: NewPiralOptions
|
|
|
117
125
|
logLevel = newPiralDefaults.logLevel,
|
|
118
126
|
bundlerName = newPiralDefaults.bundlerName,
|
|
119
127
|
variables = newPiralDefaults.variables,
|
|
128
|
+
name = newPiralDefaults.name,
|
|
129
|
+
npmClient: defaultNpmClient = newPiralDefaults.npmClient,
|
|
120
130
|
} = options;
|
|
131
|
+
const fullBase = resolve(process.cwd(), baseDir);
|
|
132
|
+
const root = resolve(fullBase, target);
|
|
133
|
+
|
|
134
|
+
if (!frameworkKeys.includes(framework)) {
|
|
135
|
+
fail('generalError_0002', `The "framework" value must be one of: ${frameworkKeys.join(', ')}`);
|
|
136
|
+
}
|
|
137
|
+
|
|
121
138
|
setLogLevel(logLevel);
|
|
139
|
+
|
|
122
140
|
progress('Preparing source and target ...');
|
|
123
|
-
const root = resolve(baseDir, target);
|
|
124
141
|
const success = await createDirectory(root);
|
|
125
142
|
|
|
126
143
|
if (success) {
|
|
127
|
-
const npmClient = await determineNpmClient(root,
|
|
144
|
+
const npmClient = await determineNpmClient(root, defaultNpmClient);
|
|
128
145
|
const packageRef = combinePackageRef(framework, version, 'registry');
|
|
146
|
+
const projectName = name || basename(root);
|
|
129
147
|
|
|
130
148
|
progress(`Creating a new Piral instance in %s ...`, root);
|
|
131
149
|
|
|
@@ -134,7 +152,7 @@ export async function newPiral(baseDir = process.cwd(), options: NewPiralOptions
|
|
|
134
152
|
'package.json',
|
|
135
153
|
JSON.stringify(
|
|
136
154
|
{
|
|
137
|
-
name:
|
|
155
|
+
name: projectName,
|
|
138
156
|
version: '1.0.0',
|
|
139
157
|
description: '',
|
|
140
158
|
keywords: ['piral'],
|
|
@@ -146,8 +164,10 @@ export async function newPiral(baseDir = process.cwd(), options: NewPiralOptions
|
|
|
146
164
|
),
|
|
147
165
|
);
|
|
148
166
|
|
|
167
|
+
await initNpmProject(npmClient, projectName, root);
|
|
168
|
+
|
|
149
169
|
if (registry !== newPiralDefaults.registry) {
|
|
150
|
-
progress(`Setting up
|
|
170
|
+
progress(`Setting up npm registry (%s) ...`, registry);
|
|
151
171
|
|
|
152
172
|
await createFileIfNotExists(
|
|
153
173
|
root,
|
|
@@ -158,19 +178,23 @@ always-auth=true`,
|
|
|
158
178
|
);
|
|
159
179
|
}
|
|
160
180
|
|
|
161
|
-
await
|
|
181
|
+
await createFileIfNotExists(root, piralJson, JSON.stringify({}, undefined, 2));
|
|
162
182
|
|
|
163
|
-
progress(`Installing
|
|
183
|
+
progress(`Installing npm package ${packageRef} ...`);
|
|
164
184
|
|
|
165
|
-
await
|
|
185
|
+
await installNpmPackage(npmClient, packageRef, root, '--save-exact');
|
|
166
186
|
|
|
167
187
|
progress(`Taking care of templating ...`);
|
|
168
188
|
|
|
169
|
-
|
|
189
|
+
const data = getPiralScaffoldData(language, root, app, framework, variables);
|
|
190
|
+
|
|
191
|
+
await patchPiralPackage(root, app, data, version, bundlerName);
|
|
192
|
+
|
|
193
|
+
await scaffoldPiralSourceFiles(template, registry, data, forceOverwrite);
|
|
170
194
|
|
|
171
195
|
if (install) {
|
|
172
196
|
progress(`Installing dependencies ...`);
|
|
173
|
-
await
|
|
197
|
+
await installNpmDependencies(npmClient, root);
|
|
174
198
|
}
|
|
175
199
|
|
|
176
200
|
logDone(`Piral instance scaffolded successfully!`);
|
|
@@ -8,7 +8,7 @@ function createTempDir() {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
describe('Pack Pilet Command', () => {
|
|
11
|
-
it('can pack a standard
|
|
11
|
+
it('can pack a standard npm package to a specified target', async () => {
|
|
12
12
|
const dir = createTempDir();
|
|
13
13
|
const target = 'foo.tgz';
|
|
14
14
|
const packageJson = resolve(dir, 'package.json');
|
|
@@ -28,7 +28,7 @@ describe('Pack Pilet Command', () => {
|
|
|
28
28
|
expect(existsSync(resolve(dir, target))).toBeTruthy();
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
it('can pack a standard
|
|
31
|
+
it('can pack a standard npm package to a the default target using the process directory', async () => {
|
|
32
32
|
const originalDir = process.cwd();
|
|
33
33
|
const dir = createTempDir();
|
|
34
34
|
const packageJson = resolve(dir, 'package.json');
|
package/src/apps/pack-pilet.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
1
2
|
import { createPiletPackage, logDone, setLogLevel, progress } from '../common';
|
|
2
3
|
import { LogLevels } from '../types';
|
|
3
4
|
|
|
4
5
|
export interface PackPiletOptions {
|
|
5
|
-
source?: string;
|
|
6
|
-
target?: string;
|
|
7
|
-
logLevel?: LogLevels;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const packPiletDefaults: PackPiletOptions = {
|
|
11
6
|
/**
|
|
12
|
-
* Sets the source directory for creating the
|
|
7
|
+
* Sets the source directory for creating the npm package.
|
|
13
8
|
*/
|
|
14
|
-
source
|
|
9
|
+
source?: string;
|
|
15
10
|
|
|
16
11
|
/**
|
|
17
12
|
* Sets the target directory for storing the tarball.
|
|
18
13
|
*/
|
|
19
|
-
target
|
|
14
|
+
target?: string;
|
|
20
15
|
|
|
21
16
|
/**
|
|
22
17
|
* Sets the log level to use (1-5).
|
|
23
18
|
*/
|
|
19
|
+
logLevel?: LogLevels;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const packPiletDefaults: PackPiletOptions = {
|
|
23
|
+
source: '.',
|
|
24
|
+
target: '.',
|
|
24
25
|
logLevel: LogLevels.info,
|
|
25
26
|
};
|
|
26
27
|
|
|
@@ -30,8 +31,9 @@ export async function packPilet(baseDir = process.cwd(), options: PackPiletOptio
|
|
|
30
31
|
target = packPiletDefaults.target,
|
|
31
32
|
logLevel = packPiletDefaults.logLevel,
|
|
32
33
|
} = options;
|
|
34
|
+
const fullBase = resolve(process.cwd(), baseDir);
|
|
33
35
|
setLogLevel(logLevel);
|
|
34
36
|
progress('Reading configuration ...');
|
|
35
|
-
await createPiletPackage(
|
|
37
|
+
await createPiletPackage(fullBase, source, target);
|
|
36
38
|
logDone(`Pilet packed successfully!`);
|
|
37
39
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { relative,
|
|
2
|
-
import {
|
|
3
|
-
import { LogLevels, PiletSchemaVersion, PiletPublishSource } from '../types';
|
|
1
|
+
import { relative, dirname, basename, resolve, isAbsolute } from 'path';
|
|
2
|
+
import { callPiletBuild } from '../bundler';
|
|
3
|
+
import { LogLevels, PiletSchemaVersion, PiletPublishSource, PiletPublishScheme } from '../types';
|
|
4
4
|
import {
|
|
5
5
|
postFile,
|
|
6
6
|
readBinary,
|
|
@@ -13,8 +13,14 @@ import {
|
|
|
13
13
|
log,
|
|
14
14
|
config,
|
|
15
15
|
checkExists,
|
|
16
|
-
|
|
16
|
+
findNpmTarball,
|
|
17
17
|
downloadFile,
|
|
18
|
+
matchAnyPilet,
|
|
19
|
+
retrievePiletData,
|
|
20
|
+
removeDirectory,
|
|
21
|
+
logInfo,
|
|
22
|
+
combinePiletExternals,
|
|
23
|
+
defaultSchemaVersion,
|
|
18
24
|
} from '../common';
|
|
19
25
|
|
|
20
26
|
export interface PublishPiletOptions {
|
|
@@ -23,7 +29,7 @@ export interface PublishPiletOptions {
|
|
|
23
29
|
* used with `--fresh`, otherwise expects source to be a path leading
|
|
24
30
|
* to a `*.tgz` file.
|
|
25
31
|
*/
|
|
26
|
-
source?: string
|
|
32
|
+
source?: string | Array<string>;
|
|
27
33
|
|
|
28
34
|
/**
|
|
29
35
|
* Sets the URL of the feed service to deploy to.
|
|
@@ -59,7 +65,7 @@ export interface PublishPiletOptions {
|
|
|
59
65
|
/**
|
|
60
66
|
* Changing the publish source makes it possible to publish pilets that have
|
|
61
67
|
* been stored on non-local paths, e.g., when a pilet was already published to
|
|
62
|
-
* an
|
|
68
|
+
* an npm feed.
|
|
63
69
|
*/
|
|
64
70
|
from?: PiletPublishSource;
|
|
65
71
|
|
|
@@ -67,73 +73,171 @@ export interface PublishPiletOptions {
|
|
|
67
73
|
* Places additional fields that should be posted to the feed service.
|
|
68
74
|
*/
|
|
69
75
|
fields?: Record<string, string>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Places additional headers that should be posted to the feed service.
|
|
79
|
+
*/
|
|
80
|
+
headers?: Record<string, string>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Defines if authorization tokens can be retrieved interactively.
|
|
84
|
+
*/
|
|
85
|
+
interactive?: boolean;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Sets the bundler to use for building, if any specific.
|
|
89
|
+
*/
|
|
90
|
+
bundlerName?: string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Sets the authorization scheme to use.
|
|
94
|
+
*/
|
|
95
|
+
mode?: PiletPublishScheme;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Additional arguments for a specific bundler.
|
|
99
|
+
*/
|
|
100
|
+
_?: Record<string, any>;
|
|
70
101
|
}
|
|
71
102
|
|
|
72
103
|
export const publishPiletDefaults: PublishPiletOptions = {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
apiKey: '',
|
|
104
|
+
url: undefined,
|
|
105
|
+
apiKey: undefined,
|
|
76
106
|
fresh: false,
|
|
77
107
|
cert: undefined,
|
|
78
108
|
logLevel: LogLevels.info,
|
|
79
|
-
schemaVersion:
|
|
109
|
+
schemaVersion: undefined,
|
|
110
|
+
mode: 'basic',
|
|
80
111
|
from: 'local',
|
|
81
112
|
fields: {},
|
|
113
|
+
headers: {},
|
|
114
|
+
interactive: false,
|
|
82
115
|
};
|
|
83
116
|
|
|
117
|
+
function isSubDir(parent: string, dir: string) {
|
|
118
|
+
const rel = relative(parent, dir);
|
|
119
|
+
return rel && !rel.startsWith('..') && !isAbsolute(rel);
|
|
120
|
+
}
|
|
121
|
+
|
|
84
122
|
async function getFiles(
|
|
85
123
|
baseDir: string,
|
|
86
|
-
|
|
124
|
+
sources: Array<string>,
|
|
87
125
|
from: PiletPublishSource,
|
|
88
126
|
fresh: boolean,
|
|
89
|
-
|
|
127
|
+
originalSchemaVersion: PiletSchemaVersion,
|
|
128
|
+
logLevel: LogLevels,
|
|
129
|
+
bundlerName: string,
|
|
130
|
+
_?: Record<string, any>,
|
|
90
131
|
ca?: Buffer,
|
|
91
132
|
): Promise<Array<string>> {
|
|
92
133
|
if (fresh) {
|
|
93
134
|
log('generalDebug_0003', 'Detected "--fresh". Trying to resolve the package.json.');
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
135
|
+
const allEntries = await matchAnyPilet(baseDir, sources);
|
|
136
|
+
|
|
137
|
+
if (allEntries.length === 0) {
|
|
138
|
+
fail('entryFileMissing_0077');
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return await Promise.all(
|
|
142
|
+
allEntries.map(async (entryModule) => {
|
|
143
|
+
const targetDir = dirname(entryModule);
|
|
144
|
+
|
|
145
|
+
progress('Triggering pilet build ...');
|
|
146
|
+
const { root, piletPackage, importmap, peerDependencies, peerModules, apps, schema } = await retrievePiletData(
|
|
147
|
+
targetDir,
|
|
148
|
+
);
|
|
149
|
+
const schemaVersion = originalSchemaVersion || schema || config.schemaVersion || defaultSchemaVersion;
|
|
150
|
+
const piralInstances = apps.map((m) => m.appPackage.name);
|
|
151
|
+
const { main = 'dist/index.js', name = 'pilet' } = piletPackage;
|
|
152
|
+
const propDest = resolve(root, main);
|
|
153
|
+
log('generalDebug_0003', `Pilet "${name}" is supposed to generate artifact in "${propDest}".`);
|
|
154
|
+
const usePropDest = dirname(propDest) !== root && isSubDir(root, propDest);
|
|
155
|
+
const dest = usePropDest ? propDest : resolve(root, 'dist');
|
|
156
|
+
log('generalDebug_0003', `Pilet "${name}" is generating artifact in "${dest}".`);
|
|
157
|
+
const outDir = dirname(dest);
|
|
158
|
+
const outFile = basename(dest);
|
|
159
|
+
const externals = combinePiletExternals(piralInstances, peerDependencies, peerModules, importmap);
|
|
160
|
+
log('generalDebug_0003', `Pilet "${name}" uses externals: ${externals.join(', ')}.`);
|
|
161
|
+
|
|
162
|
+
progress('Removing output directory ...');
|
|
163
|
+
await removeDirectory(outDir);
|
|
164
|
+
|
|
165
|
+
logInfo('Bundle pilet ...');
|
|
166
|
+
await callPiletBuild(
|
|
167
|
+
{
|
|
168
|
+
root,
|
|
169
|
+
piralInstances,
|
|
170
|
+
optimizeModules: false,
|
|
171
|
+
sourceMaps: true,
|
|
172
|
+
watch: false,
|
|
173
|
+
contentHash: true,
|
|
174
|
+
minify: true,
|
|
175
|
+
externals,
|
|
176
|
+
targetDir,
|
|
177
|
+
importmap,
|
|
178
|
+
outFile,
|
|
179
|
+
outDir,
|
|
180
|
+
entryModule: `./${relative(root, entryModule)}`,
|
|
181
|
+
logLevel,
|
|
182
|
+
version: schemaVersion,
|
|
183
|
+
ignored: [],
|
|
184
|
+
_,
|
|
185
|
+
},
|
|
186
|
+
bundlerName,
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
log('generalDebug_0003', `Pilet "${name}" built successfully!`);
|
|
190
|
+
progress('Triggering pilet pack ...');
|
|
191
|
+
|
|
192
|
+
const file = await createPiletPackage(root, '.', '.');
|
|
193
|
+
log('generalDebug_0003', `Pilet "${name}" packed successfully!`);
|
|
194
|
+
|
|
195
|
+
return file;
|
|
196
|
+
}),
|
|
197
|
+
);
|
|
106
198
|
} else {
|
|
107
199
|
log('generalDebug_0003', `Did not find fresh flag. Trying to match from "${from}".`);
|
|
108
200
|
|
|
109
201
|
switch (from) {
|
|
110
|
-
case 'local':
|
|
111
|
-
log('generalDebug_0003', `Matching files using "${
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
202
|
+
case 'local': {
|
|
203
|
+
log('generalDebug_0003', `Matching files using "${sources.join('", "')}".`);
|
|
204
|
+
const allFiles = await Promise.all(sources.map((s) => matchFiles(baseDir, s)));
|
|
205
|
+
return allFiles.reduce((result, files) => [...result, ...files], []);
|
|
206
|
+
}
|
|
207
|
+
case 'remote': {
|
|
208
|
+
log('generalDebug_0003', `Download file from "${sources.join('", "')}".`);
|
|
209
|
+
const allFiles = await Promise.all(sources.map((s) => downloadFile(s, ca)));
|
|
210
|
+
return allFiles.reduce((result, files) => [...result, ...files], []);
|
|
211
|
+
}
|
|
212
|
+
case 'npm': {
|
|
213
|
+
log('generalDebug_0003', `View npm package "${sources.join('", "')}".`);
|
|
214
|
+
const allUrls = await Promise.all(sources.map((s) => findNpmTarball(s)));
|
|
215
|
+
log('generalDebug_0003', `Download file from "${allUrls.join('", "')}".`);
|
|
216
|
+
const allFiles = await Promise.all(allUrls.map((url) => downloadFile(url, ca)));
|
|
217
|
+
return allFiles.reduce((result, files) => [...result, ...files], []);
|
|
218
|
+
}
|
|
121
219
|
}
|
|
122
220
|
}
|
|
123
221
|
}
|
|
124
222
|
|
|
125
223
|
export async function publishPilet(baseDir = process.cwd(), options: PublishPiletOptions = {}) {
|
|
126
224
|
const {
|
|
127
|
-
source = publishPiletDefaults.source,
|
|
128
|
-
url = config.url ?? publishPiletDefaults.url,
|
|
129
|
-
apiKey = config.apiKey ?? publishPiletDefaults.apiKey,
|
|
130
225
|
fresh = publishPiletDefaults.fresh,
|
|
226
|
+
source = fresh ? './src/index' : '*.tgz',
|
|
227
|
+
url = config.url ?? publishPiletDefaults.url,
|
|
228
|
+
apiKey = config.apiKeys?.[url] ?? config.apiKey ?? publishPiletDefaults.apiKey,
|
|
131
229
|
logLevel = publishPiletDefaults.logLevel,
|
|
132
230
|
from = publishPiletDefaults.from,
|
|
133
231
|
schemaVersion = publishPiletDefaults.schemaVersion,
|
|
134
232
|
cert = config.cert ?? publishPiletDefaults.cert,
|
|
135
233
|
fields = publishPiletDefaults.fields,
|
|
234
|
+
headers = publishPiletDefaults.headers,
|
|
235
|
+
mode = publishPiletDefaults.mode,
|
|
236
|
+
interactive = publishPiletDefaults.interactive,
|
|
237
|
+
_ = {},
|
|
238
|
+
bundlerName,
|
|
136
239
|
} = options;
|
|
240
|
+
const fullBase = resolve(process.cwd(), baseDir);
|
|
137
241
|
setLogLevel(logLevel);
|
|
138
242
|
progress('Reading configuration ...');
|
|
139
243
|
|
|
@@ -152,24 +256,25 @@ export async function publishPilet(baseDir = process.cwd(), options: PublishPile
|
|
|
152
256
|
}
|
|
153
257
|
|
|
154
258
|
log('generalDebug_0003', 'Getting the tgz files ...');
|
|
155
|
-
const
|
|
259
|
+
const sources = Array.isArray(source) ? source : [source];
|
|
260
|
+
const files = await getFiles(fullBase, sources, from, fresh, schemaVersion, logLevel, bundlerName, _, ca);
|
|
156
261
|
const successfulUploads: Array<string> = [];
|
|
157
262
|
log('generalDebug_0003', 'Received available tgz files.');
|
|
158
263
|
|
|
159
264
|
if (files.length === 0) {
|
|
160
|
-
fail('missingPiletTarball_0061',
|
|
265
|
+
fail('missingPiletTarball_0061', sources);
|
|
161
266
|
}
|
|
162
267
|
|
|
163
268
|
log('generalInfo_0000', `Using feed service "${url}".`);
|
|
164
269
|
|
|
165
270
|
for (const file of files) {
|
|
166
271
|
log('generalDebug_0003', 'Reading the file for upload ...');
|
|
167
|
-
const fileName = relative(
|
|
168
|
-
const content = await readBinary(
|
|
272
|
+
const fileName = relative(fullBase, file);
|
|
273
|
+
const content = await readBinary(fullBase, fileName);
|
|
169
274
|
|
|
170
275
|
if (content) {
|
|
171
276
|
progress(`Publishing "%s" ...`, file, url);
|
|
172
|
-
const result = await postFile(url, apiKey, content, fields, ca);
|
|
277
|
+
const result = await postFile(url, mode, apiKey, content, fields, headers, ca, interactive);
|
|
173
278
|
|
|
174
279
|
if (result.success) {
|
|
175
280
|
successfulUploads.push(file);
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
2
|
import { publishArtifacts } from '../release';
|
|
3
3
|
import { LogLevels, PiralBuildType } from '../types';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
setLogLevel,
|
|
6
|
+
progress,
|
|
7
|
+
checkExists,
|
|
8
|
+
fail,
|
|
9
|
+
logDone,
|
|
10
|
+
logReset,
|
|
11
|
+
publishNpmPackage,
|
|
12
|
+
matchFiles,
|
|
13
|
+
log,
|
|
14
|
+
} from '../common';
|
|
5
15
|
|
|
6
16
|
export interface PublishPiralOptions {
|
|
7
17
|
/**
|
|
@@ -15,9 +25,14 @@ export interface PublishPiralOptions {
|
|
|
15
25
|
logLevel?: LogLevels;
|
|
16
26
|
|
|
17
27
|
/**
|
|
18
|
-
* The
|
|
28
|
+
* The options to supply for the provider.
|
|
19
29
|
*/
|
|
20
|
-
|
|
30
|
+
opts?: Record<string, string>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Defines if authorization tokens can be retrieved interactively.
|
|
34
|
+
*/
|
|
35
|
+
interactive?: boolean;
|
|
21
36
|
|
|
22
37
|
/**
|
|
23
38
|
* The provider to use for publishing the release artifacts.
|
|
@@ -35,10 +50,16 @@ export const publishPiralDefaults: PublishPiralOptions = {
|
|
|
35
50
|
logLevel: LogLevels.info,
|
|
36
51
|
type: 'all',
|
|
37
52
|
provider: 'none',
|
|
38
|
-
|
|
53
|
+
opts: {},
|
|
54
|
+
interactive: false,
|
|
39
55
|
};
|
|
40
56
|
|
|
41
|
-
async function publishEmulator(
|
|
57
|
+
async function publishEmulator(
|
|
58
|
+
baseDir: string,
|
|
59
|
+
source: string,
|
|
60
|
+
args: Record<string, string> = {},
|
|
61
|
+
interactive = false,
|
|
62
|
+
) {
|
|
42
63
|
const type = 'emulator';
|
|
43
64
|
const directory = resolve(baseDir, source, type);
|
|
44
65
|
const exists = await checkExists(directory);
|
|
@@ -48,6 +69,7 @@ async function publishEmulator(baseDir: string, source: string, args: Record<str
|
|
|
48
69
|
}
|
|
49
70
|
|
|
50
71
|
const files = await matchFiles(directory, '*.tgz');
|
|
72
|
+
log('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
|
|
51
73
|
|
|
52
74
|
if (files.length !== 1) {
|
|
53
75
|
fail('publishEmulatorFilesUnexpected_0111', directory);
|
|
@@ -58,7 +80,8 @@ async function publishEmulator(baseDir: string, source: string, args: Record<str
|
|
|
58
80
|
p.push(`--${c}`, args[c]);
|
|
59
81
|
return p;
|
|
60
82
|
}, [] as Array<string>);
|
|
61
|
-
|
|
83
|
+
|
|
84
|
+
await publishNpmPackage(directory, file, flags, interactive);
|
|
62
85
|
}
|
|
63
86
|
|
|
64
87
|
async function publishRelease(
|
|
@@ -66,6 +89,7 @@ async function publishRelease(
|
|
|
66
89
|
source: string,
|
|
67
90
|
providerName: string,
|
|
68
91
|
args: Record<string, string> = {},
|
|
92
|
+
interactive = false,
|
|
69
93
|
) {
|
|
70
94
|
const type = 'release';
|
|
71
95
|
const directory = resolve(baseDir, source, type);
|
|
@@ -76,7 +100,8 @@ async function publishRelease(
|
|
|
76
100
|
}
|
|
77
101
|
|
|
78
102
|
const files = await matchFiles(directory, '**/*');
|
|
79
|
-
|
|
103
|
+
log('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
|
|
104
|
+
await publishArtifacts(providerName, directory, files, args, interactive);
|
|
80
105
|
}
|
|
81
106
|
|
|
82
107
|
export async function publishPiral(baseDir = process.cwd(), options: PublishPiralOptions = {}) {
|
|
@@ -84,27 +109,29 @@ export async function publishPiral(baseDir = process.cwd(), options: PublishPira
|
|
|
84
109
|
source = publishPiralDefaults.source,
|
|
85
110
|
type = publishPiralDefaults.type,
|
|
86
111
|
logLevel = publishPiralDefaults.logLevel,
|
|
87
|
-
|
|
112
|
+
opts = publishPiralDefaults.opts,
|
|
88
113
|
provider = publishPiralDefaults.provider,
|
|
114
|
+
interactive = publishPiralDefaults.interactive,
|
|
89
115
|
} = options;
|
|
116
|
+
const fullBase = resolve(process.cwd(), baseDir);
|
|
90
117
|
setLogLevel(logLevel);
|
|
91
118
|
|
|
92
119
|
if (type === 'emulator-sources') {
|
|
93
120
|
fail('publishEmulatorSourcesInvalid_0114');
|
|
94
121
|
}
|
|
95
|
-
|
|
122
|
+
|
|
96
123
|
progress('Reading configuration ...');
|
|
97
124
|
|
|
98
125
|
if (type !== 'release') {
|
|
99
126
|
progress('Publishing emulator package ...');
|
|
100
|
-
await publishEmulator(
|
|
127
|
+
await publishEmulator(fullBase, source, opts, interactive);
|
|
101
128
|
logDone(`Successfully published emulator.`);
|
|
102
129
|
logReset();
|
|
103
130
|
}
|
|
104
131
|
|
|
105
132
|
if (type !== 'emulator') {
|
|
106
133
|
progress('Publishing release files ...');
|
|
107
|
-
await publishRelease(
|
|
134
|
+
await publishRelease(fullBase, source, provider, opts, interactive);
|
|
108
135
|
logDone(`Successfully published release.`);
|
|
109
136
|
logReset();
|
|
110
137
|
}
|