piral-cli 1.8.0-beta.7544 → 1.8.0-beta.7655
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/lib/api.js +10 -11
- package/lib/api.js.map +1 -1
- package/lib/apps/add-piral-instance-pilet.d.ts +8 -0
- package/lib/apps/add-piral-instance-pilet.js +8 -4
- package/lib/apps/add-piral-instance-pilet.js.map +1 -1
- package/lib/apps/build-pilet.js +2 -2
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.js +2 -2
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.js +2 -2
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.js +2 -2
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/declaration-pilet.js +2 -2
- package/lib/apps/declaration-pilet.js.map +1 -1
- package/lib/apps/declaration-piral.js +2 -2
- package/lib/apps/declaration-piral.js.map +1 -1
- package/lib/apps/new-pilet.d.ts +8 -0
- package/lib/apps/new-pilet.js +8 -4
- package/lib/apps/new-pilet.js.map +1 -1
- package/lib/apps/new-piral.js +2 -2
- package/lib/apps/new-piral.js.map +1 -1
- package/lib/apps/pack-pilet.js +2 -2
- package/lib/apps/pack-pilet.js.map +1 -1
- package/lib/apps/publish-pilet.d.ts +4 -0
- package/lib/apps/publish-pilet.js +11 -9
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/apps/publish-piral.d.ts +4 -0
- package/lib/apps/publish-piral.js +8 -6
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/apps/remove-piral-instance-pilet.js +2 -2
- package/lib/apps/remove-piral-instance-pilet.js.map +1 -1
- package/lib/apps/run-emulator-piral.d.ts +8 -0
- package/lib/apps/run-emulator-piral.js +9 -7
- package/lib/apps/run-emulator-piral.js.map +1 -1
- package/lib/apps/upgrade-pilet.d.ts +8 -0
- package/lib/apps/upgrade-pilet.js +9 -5
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/apps/upgrade-piral.js +2 -2
- package/lib/apps/upgrade-piral.js.map +1 -1
- package/lib/apps/validate-pilet.js +2 -2
- package/lib/apps/validate-pilet.js.map +1 -1
- package/lib/apps/validate-piral.js +2 -2
- package/lib/apps/validate-piral.js.map +1 -1
- package/lib/build/bundler-calls.js +2 -3
- package/lib/build/bundler-calls.js.map +1 -1
- package/lib/build/run-build-pilet.js.map +1 -1
- package/lib/build/run-build-piral.js.map +1 -1
- package/lib/build/run-debug-mono-piral.js.map +1 -1
- package/lib/build/run-debug-pilet.js.map +1 -1
- package/lib/build/run-debug-piral.js.map +1 -1
- package/lib/bundler.js +23 -14
- package/lib/bundler.js.map +1 -1
- package/lib/cli.js +1 -2
- package/lib/cli.js.map +1 -1
- package/lib/commands.js +57 -7
- package/lib/commands.js.map +1 -1
- package/lib/common/MemoryStream.d.ts +0 -1
- package/lib/common/archive.d.ts +0 -1
- package/lib/common/archive.js +4 -5
- package/lib/common/archive.js.map +1 -1
- package/lib/common/browser.js +2 -3
- package/lib/common/browser.js.map +1 -1
- package/lib/common/compatibility.js +2 -3
- package/lib/common/compatibility.js.map +1 -1
- package/lib/common/config.d.ts +4 -0
- package/lib/common/config.js +3 -2
- package/lib/common/config.js.map +1 -1
- package/lib/common/constants.d.ts +1 -1
- package/lib/common/constants.js +1 -0
- package/lib/common/constants.js.map +1 -1
- package/lib/common/declaration.js +2 -3
- package/lib/common/declaration.js.map +1 -1
- package/lib/common/emulator.js +6 -7
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/envs.js +1 -2
- package/lib/common/envs.js.map +1 -1
- package/lib/common/hash.d.ts +0 -1
- package/lib/common/hash.js +3 -4
- package/lib/common/hash.js.map +1 -1
- package/lib/common/http.d.ts +9 -5
- package/lib/common/http.js +31 -16
- package/lib/common/http.js.map +1 -1
- package/lib/common/importmap.js +1 -2
- package/lib/common/importmap.js.map +1 -1
- package/lib/common/info.js +2 -2
- package/lib/common/info.js.map +1 -1
- package/lib/common/injectors.js +2 -3
- package/lib/common/injectors.js.map +1 -1
- package/lib/common/inspect.d.ts +0 -1
- package/lib/common/inspect.js +4 -5
- package/lib/common/inspect.js.map +1 -1
- package/lib/common/interactive.d.ts +0 -1
- package/lib/common/interactive.js +3 -4
- package/lib/common/interactive.js.map +1 -1
- package/lib/common/io.d.ts +0 -1
- package/lib/common/io.js +29 -30
- package/lib/common/io.js.map +1 -1
- package/lib/common/language.js +5 -6
- package/lib/common/language.js.map +1 -1
- package/lib/common/log.js +30 -21
- package/lib/common/log.js.map +1 -1
- package/lib/common/merge.js +1 -2
- package/lib/common/merge.js.map +1 -1
- package/lib/common/npm.d.ts +6 -6
- package/lib/common/npm.js +95 -67
- package/lib/common/npm.js.map +1 -1
- package/lib/common/pack.js +1 -2
- package/lib/common/pack.js.map +1 -1
- package/lib/common/package.d.ts +5 -4
- package/lib/common/package.js +32 -33
- package/lib/common/package.js.map +1 -1
- package/lib/common/parallel.js +1 -2
- package/lib/common/parallel.js.map +1 -1
- package/lib/common/patcher.js +1 -2
- package/lib/common/patcher.js.map +1 -1
- package/lib/common/patches.js +2 -3
- package/lib/common/patches.js.map +1 -1
- package/lib/common/pilet.js +1 -2
- package/lib/common/pilet.js.map +1 -1
- package/lib/common/piral.js +2 -3
- package/lib/common/piral.js.map +1 -1
- package/lib/common/platform.js +1 -2
- package/lib/common/platform.js.map +1 -1
- package/lib/common/port.js +2 -3
- package/lib/common/port.js.map +1 -1
- package/lib/common/release.d.ts +2 -2
- package/lib/common/release.js +4 -5
- package/lib/common/release.js.map +1 -1
- package/lib/common/rules.js +2 -3
- package/lib/common/rules.js.map +1 -1
- package/lib/common/scaffold.js +4 -5
- package/lib/common/scaffold.js.map +1 -1
- package/lib/common/scripts.d.ts +0 -1
- package/lib/common/scripts.js +2 -3
- package/lib/common/scripts.js.map +1 -1
- package/lib/common/shell.d.ts +3 -2
- package/lib/common/shell.js +3 -4
- package/lib/common/shell.js.map +1 -1
- package/lib/common/spec.js +1 -2
- package/lib/common/spec.js.map +1 -1
- package/lib/common/template.js +1 -2
- package/lib/common/template.js.map +1 -1
- package/lib/common/url.js +1 -2
- package/lib/common/url.js.map +1 -1
- package/lib/common/utils.js +2 -3
- package/lib/common/utils.js.map +1 -1
- package/lib/common/validate.js +1 -2
- package/lib/common/validate.js.map +1 -1
- package/lib/common/version.js +2 -3
- package/lib/common/version.js.map +1 -1
- package/lib/common/watcher.js +1 -2
- package/lib/common/watcher.js.map +1 -1
- package/lib/common/website.d.ts +3 -2
- package/lib/common/website.js +9 -14
- package/lib/common/website.js.map +1 -1
- package/lib/external/index.js +6012 -4278
- package/lib/helpers.js +3 -3
- package/lib/helpers.js.map +1 -1
- package/lib/inject.js +18 -9
- package/lib/inject.js.map +1 -1
- package/lib/injectors/pilet-injector.d.ts +0 -3
- package/lib/injectors/pilet-injector.js.map +1 -1
- package/lib/injectors/piral-injector.d.ts +0 -2
- package/lib/injectors/piral-injector.js.map +1 -1
- package/lib/messages.js +93 -95
- package/lib/messages.js.map +1 -1
- package/lib/npm-clients/bun.js +7 -8
- package/lib/npm-clients/bun.js.map +1 -1
- package/lib/npm-clients/index.d.ts +9 -5
- package/lib/npm-clients/index.js +35 -13
- package/lib/npm-clients/index.js.map +1 -1
- package/lib/npm-clients/lerna.js +7 -8
- package/lib/npm-clients/lerna.js.map +1 -1
- package/lib/npm-clients/npm.js +13 -14
- package/lib/npm-clients/npm.js.map +1 -1
- package/lib/npm-clients/pnp.js +7 -8
- package/lib/npm-clients/pnp.js.map +1 -1
- package/lib/npm-clients/pnpm.js +7 -8
- package/lib/npm-clients/pnpm.js.map +1 -1
- package/lib/npm-clients/rush.js +7 -8
- package/lib/npm-clients/rush.js.map +1 -1
- package/lib/npm-clients/yarn.js +7 -8
- package/lib/npm-clients/yarn.js.map +1 -1
- package/lib/platforms/node.js +1 -2
- package/lib/platforms/node.js.map +1 -1
- package/lib/platforms/web.js +1 -2
- package/lib/platforms/web.js.map +1 -1
- package/lib/plugin.js +1 -2
- package/lib/plugin.js.map +1 -1
- package/lib/questionnaire.js +2 -3
- package/lib/questionnaire.js.map +1 -1
- package/lib/resolvers.js.map +1 -1
- package/lib/rules/index.js +4 -5
- package/lib/rules/index.js.map +1 -1
- package/lib/rules/pilet-has-externals-as-peers.js +1 -1
- package/lib/rules/pilet-has-externals-as-peers.js.map +1 -1
- package/lib/rules/pilet-has-no-self-reference.js +1 -1
- package/lib/rules/pilet-has-no-self-reference.js.map +1 -1
- package/lib/rules/pilet-has-no-third-party-dependency.js +1 -1
- package/lib/rules/pilet-has-no-third-party-dependency.js.map +1 -1
- package/lib/rules/pilet-has-non-conflicting-css.js +1 -1
- package/lib/rules/pilet-has-non-conflicting-css.js.map +1 -1
- package/lib/rules/pilet-stays-small.js +1 -1
- package/lib/rules/pilet-stays-small.js.map +1 -1
- package/lib/rules/pilet-uses-latest-piral.js +1 -1
- package/lib/rules/pilet-uses-latest-piral.js.map +1 -1
- package/lib/rules/piral-depends-on-piral.js +1 -1
- package/lib/rules/piral-depends-on-piral.js.map +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.js +1 -1
- package/lib/rules/piral-has-valid-devDependencies.js.map +1 -1
- package/lib/rules/piral-has-valid-externals.js +1 -1
- package/lib/rules/piral-has-valid-externals.js.map +1 -1
- package/lib/rules/piral-has-valid-files.js +1 -1
- package/lib/rules/piral-has-valid-files.js.map +1 -1
- package/lib/rules/piral-has-valid-scripts.js +1 -1
- package/lib/rules/piral-has-valid-scripts.js.map +1 -1
- package/lib/runner.js.map +1 -1
- package/lib/select.js +1 -2
- package/lib/select.js.map +1 -1
- package/lib/start.js +1 -2
- package/lib/start.js.map +1 -1
- package/lib/types/internal.d.ts +18 -2
- package/lib/types/public.d.ts +3 -1
- package/package.json +6 -6
- package/src/apps/add-piral-instance-pilet.ts +20 -1
- package/src/apps/new-pilet.ts +19 -1
- package/src/apps/publish-pilet.ts +17 -7
- package/src/apps/publish-piral.ts +13 -4
- package/src/apps/run-emulator-piral.ts +22 -6
- package/src/apps/upgrade-pilet.ts +21 -2
- package/src/commands.ts +41 -1
- package/src/common/config.ts +5 -0
- package/src/common/constants.ts +1 -0
- package/src/common/emulator.ts +4 -4
- package/src/common/http.test.ts +5 -4
- package/src/common/http.ts +26 -7
- package/src/common/npm.test.ts +16 -16
- package/src/common/npm.ts +84 -50
- package/src/common/package.ts +10 -11
- package/src/common/release.ts +3 -2
- package/src/common/shell.ts +6 -4
- package/src/common/website.ts +8 -11
- package/src/npm-clients/index.ts +21 -6
- package/src/types/internal.ts +25 -1
- package/src/types/public.ts +5 -1
package/src/commands.ts
CHANGED
|
@@ -218,6 +218,9 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
218
218
|
.string('ca-cert')
|
|
219
219
|
.describe('ca-cert', 'Sets a custom certificate authority to use, if any.')
|
|
220
220
|
.default('ca-cert', apps.publishPiralDefaults.cert)
|
|
221
|
+
.boolean('allow-self-signed')
|
|
222
|
+
.describe('allow-self-signed', 'Indicates that self-signed certificates should be allowed.')
|
|
223
|
+
.default('allow-self-signed', apps.publishPiralDefaults.allowSelfSigned)
|
|
221
224
|
.number('log-level')
|
|
222
225
|
.describe('log-level', 'Sets the log level to use (1-5).')
|
|
223
226
|
.default('log-level', apps.publishPiralDefaults.logLevel)
|
|
@@ -250,6 +253,7 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
250
253
|
logLevel: args['log-level'] as LogLevels,
|
|
251
254
|
apiKey: args['api-key'] as string,
|
|
252
255
|
cert: args['ca-cert'] as string,
|
|
256
|
+
allowSelfSigned: args['allow-self-signed'] as boolean,
|
|
253
257
|
url: args.url as string,
|
|
254
258
|
interactive: args.interactive as boolean,
|
|
255
259
|
mode: args.mode as PublishScheme,
|
|
@@ -687,6 +691,9 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
687
691
|
.boolean('interactive')
|
|
688
692
|
.describe('interactive', 'Defines if authorization tokens can be retrieved interactively.')
|
|
689
693
|
.default('interactive', apps.publishPiletDefaults.interactive)
|
|
694
|
+
.boolean('allow-self-signed')
|
|
695
|
+
.describe('allow-self-signed', 'Indicates that self-signed certificates should be allowed.')
|
|
696
|
+
.default('allow-self-signed', apps.publishPiletDefaults.allowSelfSigned)
|
|
690
697
|
.string('base')
|
|
691
698
|
.default('base', process.cwd())
|
|
692
699
|
.describe('base', 'Sets the base directory. By default the current directory is used.');
|
|
@@ -698,6 +705,7 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
698
705
|
url: args.url as string,
|
|
699
706
|
logLevel: args['log-level'] as LogLevels,
|
|
700
707
|
cert: args['ca-cert'] as string,
|
|
708
|
+
allowSelfSigned: args['allow-self-signed'] as boolean,
|
|
701
709
|
bundlerName: args.bundler as string,
|
|
702
710
|
fresh: args.fresh as boolean,
|
|
703
711
|
from: args.from as PiletPublishSource,
|
|
@@ -787,6 +795,12 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
787
795
|
.choices('bundler', bundlerKeys)
|
|
788
796
|
.describe('bundler', 'Sets the default bundler to install.')
|
|
789
797
|
.default('bundler', apps.newPiletDefaults.bundlerName)
|
|
798
|
+
.string('ca-cert')
|
|
799
|
+
.describe('ca-cert', 'Sets a custom certificate authority to use, if any.')
|
|
800
|
+
.default('ca-cert', apps.newPiletDefaults.cert)
|
|
801
|
+
.boolean('allow-self-signed')
|
|
802
|
+
.describe('allow-self-signed', 'Indicates that self-signed certificates should be allowed.')
|
|
803
|
+
.default('allow-self-signed', apps.newPiletDefaults.allowSelfSigned)
|
|
790
804
|
.option('vars', undefined)
|
|
791
805
|
.describe('vars', 'Sets additional variables to be used when scaffolding.')
|
|
792
806
|
.default('vars', apps.newPiletDefaults.variables)
|
|
@@ -811,6 +825,8 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
811
825
|
bundlerName: args.bundler as string,
|
|
812
826
|
variables: args.vars as Record<string, string>,
|
|
813
827
|
name: args['name'] as string,
|
|
828
|
+
cert: args['ca-cert'] as string,
|
|
829
|
+
allowSelfSigned: args['allow-self-signed'] as boolean,
|
|
814
830
|
});
|
|
815
831
|
},
|
|
816
832
|
},
|
|
@@ -819,7 +835,7 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
819
835
|
alias: ['upgrade'],
|
|
820
836
|
description: 'Upgrades an existing pilet to the latest version of the used Piral instance.',
|
|
821
837
|
arguments: ['[target-version]'],
|
|
822
|
-
flags(argv) {
|
|
838
|
+
flags(argv: any) {
|
|
823
839
|
return argv
|
|
824
840
|
.positional('target-version', {
|
|
825
841
|
type: 'string',
|
|
@@ -842,6 +858,12 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
842
858
|
.choices('npm-client', clientTypeKeys)
|
|
843
859
|
.describe('npm-client', 'Sets the npm client to be used when upgrading.')
|
|
844
860
|
.default('npm-client', apps.upgradePiletDefaults.npmClient)
|
|
861
|
+
.string('ca-cert')
|
|
862
|
+
.describe('ca-cert', 'Sets a custom certificate authority to use, if any.')
|
|
863
|
+
.default('ca-cert', apps.upgradePiletDefaults.cert)
|
|
864
|
+
.boolean('allow-self-signed')
|
|
865
|
+
.describe('allow-self-signed', 'Indicates that self-signed certificates should be allowed.')
|
|
866
|
+
.default('allow-self-signed', apps.upgradePiletDefaults.allowSelfSigned)
|
|
845
867
|
.option('vars', undefined)
|
|
846
868
|
.describe('vars', 'Sets additional variables to be used when scaffolding.')
|
|
847
869
|
.default('vars', apps.upgradePiletDefaults.variables)
|
|
@@ -858,6 +880,8 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
858
880
|
install: args.install as boolean,
|
|
859
881
|
npmClient: args['npm-client'] as NpmClientType,
|
|
860
882
|
variables: args.vars as Record<string, string>,
|
|
883
|
+
cert: args['ca-cert'] as string,
|
|
884
|
+
allowSelfSigned: args['allow-self-signed'] as boolean,
|
|
861
885
|
});
|
|
862
886
|
},
|
|
863
887
|
},
|
|
@@ -916,6 +940,12 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
916
940
|
.boolean('selected')
|
|
917
941
|
.describe('selected', 'Defines if the provided Piral instance should be selected initially.')
|
|
918
942
|
.default('selected', apps.addPiralInstancePiletDefaults.selected)
|
|
943
|
+
.string('ca-cert')
|
|
944
|
+
.describe('ca-cert', 'Sets a custom certificate authority to use, if any.')
|
|
945
|
+
.default('ca-cert', apps.addPiralInstancePiletDefaults.cert)
|
|
946
|
+
.boolean('allow-self-signed')
|
|
947
|
+
.describe('allow-self-signed', 'Indicates that self-signed certificates should be allowed.')
|
|
948
|
+
.default('allow-self-signed', apps.addPiralInstancePiletDefaults.allowSelfSigned)
|
|
919
949
|
.string('base')
|
|
920
950
|
.default('base', process.cwd())
|
|
921
951
|
.describe('base', 'Sets the base directory. By default the current directory is used.');
|
|
@@ -927,6 +957,8 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
927
957
|
npmClient: args['npm-client'] as NpmClientType,
|
|
928
958
|
app: args.app as string,
|
|
929
959
|
source: args.source as string,
|
|
960
|
+
cert: args['ca-cert'] as string,
|
|
961
|
+
allowSelfSigned: args['allow-self-signed'] as boolean,
|
|
930
962
|
});
|
|
931
963
|
},
|
|
932
964
|
},
|
|
@@ -995,6 +1027,12 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
995
1027
|
.choices('npm-client', clientTypeKeys)
|
|
996
1028
|
.describe('npm-client', 'Sets the npm client to be used when installing the emulator.')
|
|
997
1029
|
.default('npm-client', apps.runEmulatorPiralDefaults.npmClient)
|
|
1030
|
+
.string('ca-cert')
|
|
1031
|
+
.describe('ca-cert', 'Sets a custom certificate authority to use, if any.')
|
|
1032
|
+
.default('ca-cert', apps.runEmulatorPiralDefaults.cert)
|
|
1033
|
+
.boolean('allow-self-signed')
|
|
1034
|
+
.describe('allow-self-signed', 'Indicates that self-signed certificates should be allowed.')
|
|
1035
|
+
.default('allow-self-signed', apps.runEmulatorPiralDefaults.allowSelfSigned)
|
|
998
1036
|
.boolean('open')
|
|
999
1037
|
.describe('open', 'Opens the Piral instance directly in the browser.')
|
|
1000
1038
|
.default('open', apps.runEmulatorPiralDefaults.open)
|
|
@@ -1014,6 +1052,8 @@ const allCommands: Array<ToolCommand<any>> = [
|
|
|
1014
1052
|
logLevel: args['log-level'] as LogLevels,
|
|
1015
1053
|
open: args.open as boolean,
|
|
1016
1054
|
feed: args.feed as string,
|
|
1055
|
+
cert: args['ca-cert'] as string,
|
|
1056
|
+
allowSelfSigned: args['allow-self-signed'] as boolean,
|
|
1017
1057
|
});
|
|
1018
1058
|
},
|
|
1019
1059
|
},
|
package/src/common/config.ts
CHANGED
|
@@ -73,6 +73,10 @@ export interface PiralCliConfig {
|
|
|
73
73
|
* Npm registry.
|
|
74
74
|
*/
|
|
75
75
|
registry?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Allow self-signed certificates.
|
|
78
|
+
*/
|
|
79
|
+
allowSelfSigned?: boolean;
|
|
76
80
|
}
|
|
77
81
|
|
|
78
82
|
export const config: PiralCliConfig = rc(
|
|
@@ -89,6 +93,7 @@ export const config: PiralCliConfig = rc(
|
|
|
89
93
|
validators: {},
|
|
90
94
|
schemaVersion: 'v2' as const,
|
|
91
95
|
openBrowser: false,
|
|
96
|
+
allowSelfSigned: false,
|
|
92
97
|
port: 1234,
|
|
93
98
|
strictPort: false,
|
|
94
99
|
language: 'ts' as const,
|
package/src/common/constants.ts
CHANGED
package/src/common/emulator.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { join, resolve, relative, basename,
|
|
1
|
+
import { join, resolve, relative, basename, posix } from 'path';
|
|
2
2
|
import { findDependencyVersion, copyScaffoldingFiles, isValidDependency, flattenExternals } from './package';
|
|
3
3
|
import { createPiralStubIndexIfNotExists } from './template';
|
|
4
4
|
import { filesTar, filesOnceTar, packageJson, piralJson, emulatorJson } from './constants';
|
|
@@ -139,9 +139,9 @@ export async function createEmulatorSources(
|
|
|
139
139
|
version: cliVersion,
|
|
140
140
|
generated: true,
|
|
141
141
|
},
|
|
142
|
-
main: `./${join(appDir, 'index.js')}`,
|
|
143
|
-
typings: `./${join(appDir, 'index.d.ts')}`,
|
|
144
|
-
app: `./${join(appDir, 'index.html')}`,
|
|
142
|
+
main: `./${posix.join(appDir, 'index.js')}`,
|
|
143
|
+
typings: `./${posix.join(appDir, 'index.d.ts')}`,
|
|
144
|
+
app: `./${posix.join(appDir, 'index.html')}`,
|
|
145
145
|
peerDependencies: {},
|
|
146
146
|
optionalDependencies,
|
|
147
147
|
devDependencies: {
|
package/src/common/http.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, it, expect, vitest } from 'vitest';
|
|
2
|
-
import { postFile, downloadFile } from './http';
|
|
2
|
+
import { postFile, downloadFile, getAgent } from './http';
|
|
3
3
|
|
|
4
4
|
const apiUrl = 'http://sample.fooo.com/api/v1/pilet';
|
|
5
5
|
|
|
@@ -80,7 +80,7 @@ vitest.mock('../external', async () => {
|
|
|
80
80
|
},
|
|
81
81
|
},
|
|
82
82
|
},
|
|
83
|
-
FormData: (await vitest.importActual('form-data') as any).default,
|
|
83
|
+
FormData: ((await vitest.importActual('form-data')) as any).default,
|
|
84
84
|
};
|
|
85
85
|
});
|
|
86
86
|
|
|
@@ -155,10 +155,11 @@ describe('HTTP Module', () => {
|
|
|
155
155
|
|
|
156
156
|
it('downloadFile calls results in error', async () => {
|
|
157
157
|
errorOther = true;
|
|
158
|
-
|
|
158
|
+
const agent = getAgent({ ca: Buffer.from('example') });
|
|
159
|
+
let result = await downloadFile('http://sample.com/', agent);
|
|
159
160
|
expect(result.length).toBe(0);
|
|
160
161
|
errorOther = false;
|
|
161
|
-
result = await downloadFile('http://sample.com/',
|
|
162
|
+
result = await downloadFile('http://sample.com/', agent);
|
|
162
163
|
expect(result.length).toBe(0);
|
|
163
164
|
});
|
|
164
165
|
});
|
package/src/common/http.ts
CHANGED
|
@@ -100,8 +100,28 @@ export function getAuthorizationHeaders(scheme: PublishScheme, key: string) {
|
|
|
100
100
|
return {};
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
export
|
|
104
|
-
|
|
103
|
+
export interface AgentOptions {
|
|
104
|
+
ca?: Buffer;
|
|
105
|
+
allowSelfSigned?: boolean;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export async function getDefaultAgent() {
|
|
109
|
+
const ca = await getCertificate();
|
|
110
|
+
const allowSelfSigned = config.allowSelfSigned;
|
|
111
|
+
return getAgent({ ca, allowSelfSigned });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function getAgent({ allowSelfSigned, ca }: AgentOptions) {
|
|
115
|
+
if (ca) {
|
|
116
|
+
return new Agent({ ca });
|
|
117
|
+
} else if (allowSelfSigned) {
|
|
118
|
+
return new Agent({ rejectUnauthorized: false });
|
|
119
|
+
} else {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function downloadFile(target: string, httpsAgent: Agent): Promise<Array<string>> {
|
|
105
125
|
return axios.default
|
|
106
126
|
.get<Stream>(target, {
|
|
107
127
|
responseType: 'stream',
|
|
@@ -206,10 +226,9 @@ export async function postForm(
|
|
|
206
226
|
key: string,
|
|
207
227
|
formData: FormDataObj,
|
|
208
228
|
customHeaders: Record<string, string> = {},
|
|
209
|
-
|
|
229
|
+
httpsAgent?: Agent,
|
|
210
230
|
interactive = false,
|
|
211
231
|
): Promise<PostFormResult> {
|
|
212
|
-
const httpsAgent = ca ? new Agent({ ca }) : undefined;
|
|
213
232
|
const form = createAxiosForm(formData);
|
|
214
233
|
|
|
215
234
|
const headers: Record<string, string> = {
|
|
@@ -237,7 +256,7 @@ export async function postForm(
|
|
|
237
256
|
error,
|
|
238
257
|
interactive,
|
|
239
258
|
httpsAgent,
|
|
240
|
-
(mode, token) => postForm(target, mode, token, formData, customHeaders,
|
|
259
|
+
(mode, token) => postForm(target, mode, token, formData, customHeaders, httpsAgent, false),
|
|
241
260
|
(status, statusText, response) => {
|
|
242
261
|
if (status === 500) {
|
|
243
262
|
log('failedHttpPost_0065', response);
|
|
@@ -266,9 +285,9 @@ export function postFile(
|
|
|
266
285
|
file: Buffer,
|
|
267
286
|
customFields: Record<string, string> = {},
|
|
268
287
|
customHeaders: Record<string, string> = {},
|
|
269
|
-
|
|
288
|
+
agent?: Agent,
|
|
270
289
|
interactive = false,
|
|
271
290
|
): Promise<PostFormResult> {
|
|
272
291
|
const data: FormDataObj = { ...customFields, file: [file, 'pilet.tgz'] };
|
|
273
|
-
return postForm(target, scheme, key, data, customHeaders,
|
|
292
|
+
return postForm(target, scheme, key, data, customHeaders, agent, interactive);
|
|
274
293
|
}
|
package/src/common/npm.test.ts
CHANGED
|
@@ -202,39 +202,39 @@ describe('npm Module', () => {
|
|
|
202
202
|
|
|
203
203
|
it('installs a package using the npm command line tool without a target', async () => {
|
|
204
204
|
wrongCase = false;
|
|
205
|
-
await installNpmPackage('npm', 'foo', 'latest').then((result) => expect(result).toEqual(jsonValueString));
|
|
205
|
+
await installNpmPackage({ direct: 'npm' }, 'foo', 'latest').then((result) => expect(result).toEqual(jsonValueString));
|
|
206
206
|
wrongCase = true;
|
|
207
|
-
await installNpmPackage('npm', 'foo', 'latest').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
207
|
+
await installNpmPackage({ direct: 'npm' }, 'foo', 'latest').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
208
208
|
});
|
|
209
209
|
|
|
210
210
|
it('installs a package using the npm command line tool without a version', async () => {
|
|
211
211
|
wrongCase = false;
|
|
212
|
-
await installNpmPackage('npm', 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
212
|
+
await installNpmPackage({ direct: 'npm' }, 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
213
213
|
wrongCase = true;
|
|
214
|
-
await installNpmPackage('npm', 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
214
|
+
await installNpmPackage({ direct: 'npm' }, 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
215
215
|
});
|
|
216
216
|
|
|
217
217
|
it('installs a package using the Yarn command line tool without a version', async () => {
|
|
218
218
|
wrongCase = false;
|
|
219
|
-
await installNpmPackage('yarn', 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
219
|
+
await installNpmPackage({ direct: 'yarn' }, 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
220
220
|
wrongCase = true;
|
|
221
|
-
await installNpmPackage('yarn', 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
221
|
+
await installNpmPackage({ direct: 'yarn' }, 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
222
222
|
});
|
|
223
223
|
|
|
224
224
|
it('installs a package using the Pnpm command line tool without a version', async () => {
|
|
225
225
|
wrongCase = false;
|
|
226
|
-
await installNpmPackage('pnpm', 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
226
|
+
await installNpmPackage({ direct: 'pnpm' }, 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
227
227
|
wrongCase = true;
|
|
228
|
-
await installNpmPackage('pnpm', 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
228
|
+
await installNpmPackage({ direct: 'pnpm' }, 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
229
229
|
});
|
|
230
230
|
|
|
231
231
|
it('installs a package using the npm command line tool with some flag', async () => {
|
|
232
232
|
wrongCase = false;
|
|
233
|
-
await installNpmPackage('
|
|
233
|
+
await installNpmPackage({ direct: 'pnpm' }, 'foo', '1.3', '.', '--a=b').then((result) =>
|
|
234
234
|
expect(result).toEqual(jsonValueString),
|
|
235
235
|
);
|
|
236
236
|
wrongCase = true;
|
|
237
|
-
await installNpmPackage('
|
|
237
|
+
await installNpmPackage({ direct: 'pnpm' }, 'foo', '1.3', '.', '--a=b').then((result) =>
|
|
238
238
|
expect(result).not.toEqual(jsonValueString),
|
|
239
239
|
);
|
|
240
240
|
});
|
|
@@ -281,23 +281,23 @@ describe('npm Module', () => {
|
|
|
281
281
|
|
|
282
282
|
it('install dependencies with npm client', async () => {
|
|
283
283
|
wrongCase = false;
|
|
284
|
-
await installNpmDependencies('npm').then((result) => expect(result).toEqual(jsonValueString));
|
|
284
|
+
await installNpmDependencies({ direct: 'npm' }).then((result) => expect(result).toEqual(jsonValueString));
|
|
285
285
|
wrongCase = true;
|
|
286
|
-
await installNpmDependencies('npm').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
286
|
+
await installNpmDependencies({ direct: 'npm' }).then((result) => expect(result).not.toEqual(jsonValueString));
|
|
287
287
|
});
|
|
288
288
|
|
|
289
289
|
it('install dependencies with pnpm client', async () => {
|
|
290
290
|
wrongCase = false;
|
|
291
|
-
await installNpmDependencies('pnpm').then((result) => expect(result).toEqual(jsonValueString));
|
|
291
|
+
await installNpmDependencies({ direct: 'pnpm' }).then((result) => expect(result).toEqual(jsonValueString));
|
|
292
292
|
wrongCase = true;
|
|
293
|
-
await installNpmDependencies('pnpm').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
293
|
+
await installNpmDependencies({ direct: 'pnpm' }).then((result) => expect(result).not.toEqual(jsonValueString));
|
|
294
294
|
});
|
|
295
295
|
|
|
296
296
|
it('install dependencies with yarn client', async () => {
|
|
297
297
|
wrongCase = false;
|
|
298
|
-
await installNpmDependencies('yarn').then((result) => expect(result).toEqual(jsonValueString));
|
|
298
|
+
await installNpmDependencies({ direct: 'yarn' }).then((result) => expect(result).toEqual(jsonValueString));
|
|
299
299
|
wrongCase = true;
|
|
300
|
-
await installNpmDependencies('yarn').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
300
|
+
await installNpmDependencies({ direct: 'yarn' }).then((result) => expect(result).not.toEqual(jsonValueString));
|
|
301
301
|
});
|
|
302
302
|
|
|
303
303
|
it('create npm package', async () => {
|
package/src/common/npm.ts
CHANGED
|
@@ -5,10 +5,10 @@ import { config } from './config';
|
|
|
5
5
|
import { legacyCoreExternals, frameworkLibs, defaultRegistry, packageJson } from './constants';
|
|
6
6
|
import { inspectPackage } from './inspect';
|
|
7
7
|
import { readJson, checkExists } from './io';
|
|
8
|
-
import { clients,
|
|
8
|
+
import { clients, detectDirectClients, detectWrapperClients, isDirectClient, isWrapperClient } from '../npm-clients';
|
|
9
9
|
import { clientTypeKeys } from '../helpers';
|
|
10
10
|
import { getModulePath } from '../external';
|
|
11
|
-
import { PackageType, NpmClientType } from '../types';
|
|
11
|
+
import { PackageType, NpmClientType, NpmClient, NpmDirectClientType, NpmWapperClientType } from '../types';
|
|
12
12
|
|
|
13
13
|
const gitPrefix = 'git+';
|
|
14
14
|
const filePrefix = 'file:';
|
|
@@ -63,56 +63,88 @@ async function detectMonorepoRoot(root: string): Promise<[] | [string, NpmClient
|
|
|
63
63
|
return [];
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
* @param root The project's root directory.
|
|
70
|
-
*/
|
|
71
|
-
export async function determineNpmClient(root: string, selected?: NpmClientType): Promise<NpmClientType> {
|
|
72
|
-
if (!selected || !clientTypeKeys.includes(selected)) {
|
|
73
|
-
log('generalDebug_0003', 'No npm client selected. Checking for lock or config files ...');
|
|
66
|
+
async function determineWrapperClient(root: string): Promise<NpmWapperClientType | undefined> {
|
|
67
|
+
const searchedClients = await detectWrapperClients(root);
|
|
68
|
+
const foundClients = searchedClients.filter((m) => m.result).map((m) => m.client);
|
|
74
69
|
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
log(
|
|
79
|
-
'generalDebug_0003',
|
|
80
|
-
`Results of the lock file check: ${searchedClients.map((m) => `${m.client}=${m.result}`).join(', ')}`,
|
|
81
|
-
);
|
|
70
|
+
if (foundClients.length > 0) {
|
|
71
|
+
const [client] = foundClients;
|
|
82
72
|
|
|
83
73
|
if (foundClients.length > 1) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
log('generalDebug_0003', `Found valid wrapper client via lock or config file: "${client}".`);
|
|
89
|
-
}
|
|
74
|
+
log(
|
|
75
|
+
'generalWarning_0001',
|
|
76
|
+
`Found multiple clients via their lock or config files: "${foundClients.join('", "')}".`,
|
|
77
|
+
);
|
|
90
78
|
}
|
|
91
79
|
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
log('generalDebug_0003', `Found valid direct client via lock or config file: "${client}".`);
|
|
81
|
+
return client;
|
|
82
|
+
}
|
|
94
83
|
|
|
95
|
-
|
|
96
|
-
const clientStr = `"${foundClients.map((m) => m.client).join('", "')}"`;
|
|
97
|
-
log('generalWarning_0001', `Found multiple clients via their lock or config files: ${clientStr}.`);
|
|
98
|
-
}
|
|
84
|
+
const defaultClient = config.npmClient;
|
|
99
85
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
86
|
+
if (isWrapperClient(defaultClient)) {
|
|
87
|
+
log('generalDebug_0003', `Using the default client: "${defaultClient}".`);
|
|
88
|
+
return defaultClient;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
103
93
|
|
|
104
|
-
|
|
94
|
+
async function determineDirectClient(root: string): Promise<NpmDirectClientType> {
|
|
95
|
+
const searchedClients = await detectDirectClients(root);
|
|
96
|
+
const foundClients = searchedClients.filter((m) => m.result).map((m) => m.client);
|
|
105
97
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
if (foundClients.length > 0) {
|
|
99
|
+
const [client] = foundClients;
|
|
100
|
+
|
|
101
|
+
if (foundClients.length > 1) {
|
|
102
|
+
log(
|
|
103
|
+
'generalWarning_0001',
|
|
104
|
+
`Found multiple clients via their lock or config files: "${foundClients.join('", "')}".`,
|
|
105
|
+
);
|
|
109
106
|
}
|
|
110
107
|
|
|
111
|
-
log('generalDebug_0003',
|
|
112
|
-
return
|
|
108
|
+
log('generalDebug_0003', `Found valid direct client via lock or config file: "${client}".`);
|
|
109
|
+
return client;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const defaultClient = config.npmClient;
|
|
113
|
+
|
|
114
|
+
if (isDirectClient(defaultClient)) {
|
|
115
|
+
log('generalDebug_0003', `Using the default client: "${defaultClient}".`);
|
|
116
|
+
return defaultClient;
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
|
|
119
|
+
log('generalDebug_0003', 'Using the fallback "npm" client.');
|
|
120
|
+
return 'npm';
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* For details about how this works consult issue
|
|
125
|
+
* https://github.com/smapiot/piral/issues/203
|
|
126
|
+
* @param root The project's root directory.
|
|
127
|
+
*/
|
|
128
|
+
export async function determineNpmClient(root: string, selected?: NpmClientType): Promise<NpmClient> {
|
|
129
|
+
if (!selected || !clientTypeKeys.includes(selected)) {
|
|
130
|
+
log('generalDebug_0003', 'No npm client selected. Checking for lock or config files ...');
|
|
131
|
+
const [direct, wrapper] = await Promise.all([determineDirectClient(root), determineWrapperClient(root)]);
|
|
132
|
+
return {
|
|
133
|
+
direct,
|
|
134
|
+
wrapper,
|
|
135
|
+
};
|
|
136
|
+
} else if (isDirectClient(selected)) {
|
|
137
|
+
return {
|
|
138
|
+
proposed: selected,
|
|
139
|
+
direct: selected,
|
|
140
|
+
};
|
|
141
|
+
} else {
|
|
142
|
+
return {
|
|
143
|
+
proposed: selected,
|
|
144
|
+
direct: await determineDirectClient(root),
|
|
145
|
+
wrapper: selected,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
116
148
|
}
|
|
117
149
|
|
|
118
150
|
export async function isMonorepoPackageRef(refName: string, root: string): Promise<boolean> {
|
|
@@ -126,35 +158,37 @@ export async function isMonorepoPackageRef(refName: string, root: string): Promi
|
|
|
126
158
|
return false;
|
|
127
159
|
}
|
|
128
160
|
|
|
129
|
-
export function installNpmDependencies(client:
|
|
130
|
-
const { installDependencies } = clients[client];
|
|
161
|
+
export function installNpmDependencies(client: NpmClient, target = '.'): Promise<string> {
|
|
162
|
+
const { installDependencies } = clients[client.direct];
|
|
131
163
|
return installDependencies(target);
|
|
132
164
|
}
|
|
133
165
|
|
|
134
166
|
export async function installNpmPackageFromOptionalRegistry(
|
|
135
167
|
packageRef: string,
|
|
136
|
-
target
|
|
168
|
+
target: string,
|
|
137
169
|
registry: string,
|
|
138
170
|
): Promise<void> {
|
|
171
|
+
const client = await determineNpmClient(target, 'npm');
|
|
172
|
+
|
|
139
173
|
try {
|
|
140
|
-
await installNpmPackage(
|
|
174
|
+
await installNpmPackage(client, packageRef, target, '--registry', registry);
|
|
141
175
|
} catch (e) {
|
|
142
176
|
if (registry === defaultRegistry) {
|
|
143
177
|
throw e;
|
|
144
178
|
}
|
|
145
179
|
|
|
146
|
-
await installNpmPackage(
|
|
180
|
+
await installNpmPackage(client, packageRef, target, '--registry', defaultRegistry);
|
|
147
181
|
}
|
|
148
182
|
}
|
|
149
183
|
|
|
150
184
|
export async function uninstallNpmPackage(
|
|
151
|
-
client:
|
|
185
|
+
client: NpmClient,
|
|
152
186
|
packageRef: string,
|
|
153
187
|
target = '.',
|
|
154
188
|
...flags: Array<string>
|
|
155
189
|
): Promise<string> {
|
|
156
190
|
try {
|
|
157
|
-
const { uninstallPackage } = clients[client];
|
|
191
|
+
const { uninstallPackage } = clients[client.direct];
|
|
158
192
|
return await uninstallPackage(packageRef, target, ...flags);
|
|
159
193
|
} catch (ex) {
|
|
160
194
|
log(
|
|
@@ -166,13 +200,13 @@ export async function uninstallNpmPackage(
|
|
|
166
200
|
}
|
|
167
201
|
|
|
168
202
|
export async function installNpmPackage(
|
|
169
|
-
client:
|
|
203
|
+
client: NpmClient,
|
|
170
204
|
packageRef: string,
|
|
171
205
|
target = '.',
|
|
172
206
|
...flags: Array<string>
|
|
173
207
|
): Promise<string> {
|
|
174
208
|
try {
|
|
175
|
-
const { installPackage } = clients[client];
|
|
209
|
+
const { installPackage } = clients[client.direct];
|
|
176
210
|
return await installPackage(packageRef, target, ...flags);
|
|
177
211
|
} catch (ex) {
|
|
178
212
|
log(
|
|
@@ -183,8 +217,8 @@ export async function installNpmPackage(
|
|
|
183
217
|
}
|
|
184
218
|
}
|
|
185
219
|
|
|
186
|
-
export function initNpmProject(client:
|
|
187
|
-
const { initProject } = clients[client];
|
|
220
|
+
export function initNpmProject(client: NpmClient, projectName: string, target: string) {
|
|
221
|
+
const { initProject } = clients[client.wrapper || client.direct];
|
|
188
222
|
return initProject(projectName, target);
|
|
189
223
|
}
|
|
190
224
|
|
package/src/common/package.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Agent } from 'https';
|
|
1
2
|
import { resolve, join, extname, basename, dirname, relative } from 'path';
|
|
2
3
|
import { log, fail } from './log';
|
|
3
4
|
import { cliVersion } from './info';
|
|
@@ -161,7 +162,8 @@ async function loadPiralInstance(root: string, details?: PiralInstanceDetails):
|
|
|
161
162
|
export async function findPiralInstance(
|
|
162
163
|
proposedApp: string,
|
|
163
164
|
rootDir: string,
|
|
164
|
-
details
|
|
165
|
+
details: PiralInstanceDetails,
|
|
166
|
+
agent: Agent,
|
|
165
167
|
interactive = false,
|
|
166
168
|
) {
|
|
167
169
|
const path = findPackageRoot(proposedApp, rootDir);
|
|
@@ -172,13 +174,13 @@ export async function findPiralInstance(
|
|
|
172
174
|
|
|
173
175
|
if (url) {
|
|
174
176
|
log('generalDebug_0003', `Updating the emulator from remote "${url}" ...`);
|
|
175
|
-
await updateFromEmulatorWebsite(root, url, interactive);
|
|
177
|
+
await updateFromEmulatorWebsite(root, url, agent, interactive);
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
return await loadPiralInstance(root, details);
|
|
179
181
|
} else if (url) {
|
|
180
182
|
log('generalDebug_0003', `Piral instance not installed yet - trying from remote "${url}" ...`);
|
|
181
|
-
const emulator = await scaffoldFromEmulatorWebsite(rootDir, url);
|
|
183
|
+
const emulator = await scaffoldFromEmulatorWebsite(rootDir, url, agent);
|
|
182
184
|
return await loadPiralInstance(emulator.path, details);
|
|
183
185
|
}
|
|
184
186
|
|
|
@@ -190,6 +192,7 @@ export async function findPiralInstances(
|
|
|
190
192
|
piletPackage: PiletPackageData,
|
|
191
193
|
piletDefinition: undefined | PiletDefinition,
|
|
192
194
|
rootDir: string,
|
|
195
|
+
agent: Agent,
|
|
193
196
|
interactive?: boolean,
|
|
194
197
|
) {
|
|
195
198
|
if (proposedApps) {
|
|
@@ -208,7 +211,7 @@ export async function findPiralInstances(
|
|
|
208
211
|
if (proposedApps.length > 0) {
|
|
209
212
|
return Promise.all(
|
|
210
213
|
proposedApps.map((proposedApp) =>
|
|
211
|
-
findPiralInstance(proposedApp, rootDir, piletDefinition?.piralInstances?.[proposedApp], interactive),
|
|
214
|
+
findPiralInstance(proposedApp, rootDir, piletDefinition?.piralInstances?.[proposedApp], agent, interactive),
|
|
212
215
|
),
|
|
213
216
|
);
|
|
214
217
|
}
|
|
@@ -280,11 +283,7 @@ export async function getPiralPackage(app: string, data: PiralInstanceData, vers
|
|
|
280
283
|
};
|
|
281
284
|
}
|
|
282
285
|
|
|
283
|
-
async function getAvailableFiles(
|
|
284
|
-
root: string,
|
|
285
|
-
name: string,
|
|
286
|
-
dirName: string,
|
|
287
|
-
): Promise<Array<FileDescriptor>> {
|
|
286
|
+
async function getAvailableFiles(root: string, name: string, dirName: string): Promise<Array<FileDescriptor>> {
|
|
288
287
|
const source = getPiralPath(root, name);
|
|
289
288
|
const tgz = `${dirName}.tar`;
|
|
290
289
|
log('generalDebug_0003', `Checking if "${tgz}" exists in "${source}" ...`);
|
|
@@ -780,13 +779,13 @@ export async function findPiletRoot(proposedRoot: string) {
|
|
|
780
779
|
return dirname(packageJsonPath);
|
|
781
780
|
}
|
|
782
781
|
|
|
783
|
-
export async function retrievePiletData(target: string, app?: string, interactive?: boolean) {
|
|
782
|
+
export async function retrievePiletData(target: string, app?: string, agent?: Agent, interactive?: boolean) {
|
|
784
783
|
const piletJsonPath = await findFile(target, piletJson);
|
|
785
784
|
const proposedRoot = piletJsonPath ? dirname(piletJsonPath) : target;
|
|
786
785
|
const root = await findPiletRoot(proposedRoot);
|
|
787
786
|
const piletPackage = await readJson(root, packageJson);
|
|
788
787
|
const piletDefinition: PiletDefinition = piletJsonPath && (await readJson(proposedRoot, piletJson));
|
|
789
|
-
const appPackages = await findPiralInstances(app && [app], piletPackage, piletDefinition, root, interactive);
|
|
788
|
+
const appPackages = await findPiralInstances(app && [app], piletPackage, piletDefinition, root, agent, interactive);
|
|
790
789
|
const apps: Array<AppDefinition> = [];
|
|
791
790
|
|
|
792
791
|
for (const appPackage of appPackages) {
|
package/src/common/release.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Agent } from 'https';
|
|
1
2
|
import { basename, dirname, relative } from 'path';
|
|
2
3
|
import { readBinary } from './io';
|
|
3
4
|
import { publishNpmPackage } from './npm';
|
|
@@ -39,7 +40,7 @@ export async function publishWebsiteEmulator(
|
|
|
39
40
|
files: Array<string>,
|
|
40
41
|
interactive: boolean,
|
|
41
42
|
headers?: Record<string, string>,
|
|
42
|
-
|
|
43
|
+
agent?: Agent,
|
|
43
44
|
) {
|
|
44
45
|
const data: FormDataObj = {
|
|
45
46
|
version,
|
|
@@ -53,5 +54,5 @@ export async function publishWebsiteEmulator(
|
|
|
53
54
|
data[relPath] = [content, fileName];
|
|
54
55
|
}
|
|
55
56
|
|
|
56
|
-
return await postForm(url, mode, apiKey, data, headers,
|
|
57
|
+
return await postForm(url, mode, apiKey, data, headers, agent, interactive);
|
|
57
58
|
}
|