piral-cli 1.8.0-beta.7544 → 1.8.0-beta.7653

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.
Files changed (74) hide show
  1. package/lib/apps/add-piral-instance-pilet.d.ts +8 -0
  2. package/lib/apps/add-piral-instance-pilet.js +6 -2
  3. package/lib/apps/add-piral-instance-pilet.js.map +1 -1
  4. package/lib/apps/new-pilet.d.ts +8 -0
  5. package/lib/apps/new-pilet.js +6 -2
  6. package/lib/apps/new-pilet.js.map +1 -1
  7. package/lib/apps/publish-pilet.d.ts +4 -0
  8. package/lib/apps/publish-pilet.js +9 -7
  9. package/lib/apps/publish-pilet.js.map +1 -1
  10. package/lib/apps/publish-piral.d.ts +4 -0
  11. package/lib/apps/publish-piral.js +6 -4
  12. package/lib/apps/publish-piral.js.map +1 -1
  13. package/lib/apps/run-emulator-piral.d.ts +8 -0
  14. package/lib/apps/run-emulator-piral.js +7 -5
  15. package/lib/apps/run-emulator-piral.js.map +1 -1
  16. package/lib/apps/upgrade-pilet.d.ts +8 -0
  17. package/lib/apps/upgrade-pilet.js +7 -3
  18. package/lib/apps/upgrade-pilet.js.map +1 -1
  19. package/lib/commands.js +40 -0
  20. package/lib/commands.js.map +1 -1
  21. package/lib/common/config.d.ts +4 -0
  22. package/lib/common/config.js +1 -0
  23. package/lib/common/config.js.map +1 -1
  24. package/lib/common/constants.d.ts +1 -1
  25. package/lib/common/constants.js +1 -0
  26. package/lib/common/constants.js.map +1 -1
  27. package/lib/common/emulator.js +3 -3
  28. package/lib/common/emulator.js.map +1 -1
  29. package/lib/common/http.d.ts +9 -3
  30. package/lib/common/http.js +24 -8
  31. package/lib/common/http.js.map +1 -1
  32. package/lib/common/npm.d.ts +6 -6
  33. package/lib/common/npm.js +63 -34
  34. package/lib/common/npm.js.map +1 -1
  35. package/lib/common/package.d.ts +5 -3
  36. package/lib/common/package.js +7 -7
  37. package/lib/common/package.js.map +1 -1
  38. package/lib/common/release.d.ts +2 -1
  39. package/lib/common/release.js +2 -2
  40. package/lib/common/release.js.map +1 -1
  41. package/lib/common/shell.d.ts +4 -2
  42. package/lib/common/shell.js +2 -2
  43. package/lib/common/shell.js.map +1 -1
  44. package/lib/common/website.d.ts +4 -2
  45. package/lib/common/website.js +7 -11
  46. package/lib/common/website.js.map +1 -1
  47. package/lib/external/index.js +10 -10
  48. package/lib/npm-clients/index.d.ts +9 -5
  49. package/lib/npm-clients/index.js +17 -5
  50. package/lib/npm-clients/index.js.map +1 -1
  51. package/lib/types/internal.d.ts +18 -1
  52. package/lib/types/public.d.ts +3 -1
  53. package/package.json +2 -2
  54. package/src/apps/add-piral-instance-pilet.ts +20 -1
  55. package/src/apps/new-pilet.ts +19 -1
  56. package/src/apps/publish-pilet.ts +17 -7
  57. package/src/apps/publish-piral.ts +13 -4
  58. package/src/apps/run-emulator-piral.ts +22 -6
  59. package/src/apps/upgrade-pilet.ts +21 -2
  60. package/src/commands.ts +41 -1
  61. package/src/common/config.ts +5 -0
  62. package/src/common/constants.ts +1 -0
  63. package/src/common/emulator.ts +4 -4
  64. package/src/common/http.test.ts +5 -4
  65. package/src/common/http.ts +26 -7
  66. package/src/common/npm.test.ts +16 -16
  67. package/src/common/npm.ts +84 -50
  68. package/src/common/package.ts +10 -11
  69. package/src/common/release.ts +3 -2
  70. package/src/common/shell.ts +6 -4
  71. package/src/common/website.ts +8 -11
  72. package/src/npm-clients/index.ts +21 -6
  73. package/src/types/internal.ts +25 -1
  74. package/src/types/public.ts +5 -1
@@ -18,6 +18,8 @@ import {
18
18
  findPiralInstance,
19
19
  determineNpmClient,
20
20
  ensure,
21
+ getCertificate,
22
+ getAgent,
21
23
  } from '../common';
22
24
 
23
25
  export interface RunEmulatorPiralOptions {
@@ -61,6 +63,16 @@ export interface RunEmulatorPiralOptions {
61
63
  * The package registry to use for resolving the specified Piral app.
62
64
  */
63
65
  registry?: string;
66
+
67
+ /**
68
+ * Defines a custom certificate for the website emulator.
69
+ */
70
+ cert?: string;
71
+
72
+ /**
73
+ * Allow self-signed certificates.
74
+ */
75
+ allowSelfSigned?: boolean;
64
76
  }
65
77
 
66
78
  export const runEmulatorPiralDefaults: RunEmulatorPiralOptions = {
@@ -70,6 +82,8 @@ export const runEmulatorPiralDefaults: RunEmulatorPiralOptions = {
70
82
  strictPort: config.strictPort,
71
83
  registry: config.registry,
72
84
  npmClient: undefined,
85
+ cert: undefined,
86
+ allowSelfSigned: config.allowSelfSigned,
73
87
  };
74
88
 
75
89
  function createTempDir() {
@@ -94,13 +108,15 @@ export async function runEmulatorPiral(baseDir = process.cwd(), options: RunEmul
94
108
  logLevel = runEmulatorPiralDefaults.logLevel,
95
109
  npmClient: defaultNpmClient = runEmulatorPiralDefaults.npmClient,
96
110
  registry = runEmulatorPiralDefaults.registry,
111
+ cert = runEmulatorPiralDefaults.cert,
112
+ allowSelfSigned = runEmulatorPiralDefaults.allowSelfSigned,
97
113
  app,
98
114
  feed,
99
115
  } = options;
100
-
116
+
101
117
  ensure('baseDir', baseDir, 'string');
102
118
  ensure('app', app, 'string');
103
-
119
+
104
120
  const publicUrl = '/';
105
121
  const api = config.piletApi;
106
122
  const fullBase = resolve(process.cwd(), baseDir);
@@ -114,6 +130,8 @@ export async function runEmulatorPiral(baseDir = process.cwd(), options: RunEmul
114
130
  process.stdin?.setMaxListeners(16);
115
131
 
116
132
  const appRoot = await createTempDir();
133
+ const ca = await getCertificate(cert);
134
+ const agent = getAgent({ ca, allowSelfSigned });
117
135
 
118
136
  if (registry !== runEmulatorPiralDefaults.registry) {
119
137
  progress(`Setting up npm registry (%s) ...`, registry);
@@ -128,10 +146,8 @@ always-auth=true`,
128
146
  }
129
147
 
130
148
  const npmClient = await determineNpmClient(appRoot, defaultNpmClient);
131
- const packageName = await installPiralInstance(app, fullBase, appRoot, npmClient);
132
- const piral = await findPiralInstance(packageName, appRoot, {
133
- port: originalPort,
134
- });
149
+ const packageName = await installPiralInstance(app, fullBase, appRoot, npmClient, agent);
150
+ const piral = await findPiralInstance(packageName, appRoot, { port: originalPort }, agent);
135
151
  const port = await getAvailablePort(piral.port, strictPort);
136
152
 
137
153
  const krasBaseConfig = resolve(fullBase, krasrc);
@@ -26,6 +26,9 @@ import {
26
26
  getPiletScaffoldData,
27
27
  retrievePiletData,
28
28
  ensure,
29
+ config,
30
+ getCertificate,
31
+ getAgent,
29
32
  } from '../common';
30
33
 
31
34
  export interface UpgradePiletOptions {
@@ -58,6 +61,16 @@ export interface UpgradePiletOptions {
58
61
  */
59
62
  install?: boolean;
60
63
 
64
+ /**
65
+ * Defines a custom certificate for the website emulator.
66
+ */
67
+ cert?: string;
68
+
69
+ /**
70
+ * Allow self-signed certificates.
71
+ */
72
+ allowSelfSigned?: boolean;
73
+
61
74
  /**
62
75
  * Defines the used npm client. By default, "npm" is used
63
76
  * if no other client is autodetected. The autodetection
@@ -79,6 +92,8 @@ export const upgradePiletDefaults: UpgradePiletOptions = {
79
92
  install: true,
80
93
  npmClient: undefined,
81
94
  variables: {},
95
+ cert: undefined,
96
+ allowSelfSigned: config.allowSelfSigned,
82
97
  };
83
98
 
84
99
  export async function upgradePilet(baseDir = process.cwd(), options: UpgradePiletOptions = {}) {
@@ -90,6 +105,8 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
90
105
  install = upgradePiletDefaults.install,
91
106
  variables = upgradePiletDefaults.variables,
92
107
  npmClient: defaultNpmClient = upgradePiletDefaults.npmClient,
108
+ cert = upgradePiletDefaults.cert,
109
+ allowSelfSigned = upgradePiletDefaults.allowSelfSigned,
93
110
  } = options;
94
111
 
95
112
  ensure('baseDir', baseDir, 'string');
@@ -106,10 +123,12 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
106
123
  }
107
124
 
108
125
  const npmClient = await determineNpmClient(root, defaultNpmClient);
126
+ const ca = await getCertificate(cert);
127
+ const agent = getAgent({ ca, allowSelfSigned });
109
128
 
110
129
  // in case we run from a user's CLI we want to allow updating
111
130
  const interactive = isInteractive();
112
- const { apps, piletPackage } = await retrievePiletData(root, undefined, interactive);
131
+ const { apps, piletPackage } = await retrievePiletData(root, undefined, agent, interactive);
113
132
  const { devDependencies = {}, dependencies = {}, source } = piletPackage;
114
133
 
115
134
  if (apps.length === 0) {
@@ -144,7 +163,7 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
144
163
  if (!monorepoRef) {
145
164
  // only install the latest if the shell does come from remote
146
165
  progress(`Updating npm package to %s ...`, packageRef);
147
- await installNpmPackage(npmClient, packageRef, root, '--no-save');
166
+ await installNpmPackage(npmClient, packageRef, root);
148
167
  }
149
168
 
150
169
  const piralInfo = await readPiralPackage(root, sourceName);
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
  },
@@ -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,
@@ -29,6 +29,7 @@ export const bundlerNames = [
29
29
  'webpack5' as const,
30
30
  'vite' as const,
31
31
  'vite5' as const,
32
+ 'vite6' as const,
32
33
  'xbuild' as const,
33
34
  ];
34
35
  export const declarationEntryExtensions = ['.html', '.pug', ...entryModuleExtensions];
@@ -1,4 +1,4 @@
1
- import { join, resolve, relative, basename, extname } from 'path';
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: {
@@ -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
- let result = await downloadFile('http://sample.com/', Buffer.from('example'));
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/', Buffer.from('example'));
162
+ result = await downloadFile('http://sample.com/', agent);
162
163
  expect(result.length).toBe(0);
163
164
  });
164
165
  });
@@ -100,8 +100,28 @@ export function getAuthorizationHeaders(scheme: PublishScheme, key: string) {
100
100
  return {};
101
101
  }
102
102
 
103
- export function downloadFile(target: string, ca?: Buffer): Promise<Array<string>> {
104
- const httpsAgent = ca ? new Agent({ ca }) : undefined;
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
- ca?: Buffer,
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, ca, false),
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
- ca?: Buffer,
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, ca, interactive);
292
+ return postForm(target, scheme, key, data, customHeaders, agent, interactive);
274
293
  }
@@ -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('npm', 'foo', '1.3', '.', '--a=b').then((result) =>
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('npm', 'foo', '1.3', '.', '--a=b').then((result) =>
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 () => {