piral-cli 0.15.0-alpha.4284 → 0.15.0-alpha.4311

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 (54) hide show
  1. package/lib/apps/new-pilet.js +3 -3
  2. package/lib/apps/new-pilet.js.map +1 -1
  3. package/lib/apps/new-piral.js +3 -3
  4. package/lib/apps/new-piral.js.map +1 -1
  5. package/lib/apps/publish-piral.d.ts +2 -2
  6. package/lib/apps/publish-piral.js +8 -7
  7. package/lib/apps/publish-piral.js.map +1 -1
  8. package/lib/apps/upgrade-pilet.js +2 -2
  9. package/lib/apps/upgrade-pilet.js.map +1 -1
  10. package/lib/apps/upgrade-piral.js +2 -2
  11. package/lib/apps/upgrade-piral.js.map +1 -1
  12. package/lib/commands.js +4 -4
  13. package/lib/commands.js.map +1 -1
  14. package/lib/common/clients/index.d.ts +3 -1
  15. package/lib/common/clients/index.js +3 -1
  16. package/lib/common/clients/index.js.map +1 -1
  17. package/lib/common/clients/npm.d.ts +1 -0
  18. package/lib/common/clients/npm.js +7 -1
  19. package/lib/common/clients/npm.js.map +1 -1
  20. package/lib/common/clients/pnp.d.ts +6 -0
  21. package/lib/common/clients/pnp.js +95 -0
  22. package/lib/common/clients/pnp.js.map +1 -0
  23. package/lib/common/clients/yarn.js +3 -3
  24. package/lib/common/clients/yarn.js.map +1 -1
  25. package/lib/common/interactive.js +4 -1
  26. package/lib/common/interactive.js.map +1 -1
  27. package/lib/common/npm.d.ts +1 -1
  28. package/lib/common/npm.js +13 -5
  29. package/lib/common/npm.js.map +1 -1
  30. package/lib/helpers.js +1 -1
  31. package/lib/helpers.js.map +1 -1
  32. package/lib/messages.d.ts +11 -11
  33. package/lib/messages.js +14 -14
  34. package/lib/messages.js.map +1 -1
  35. package/lib/release.js +1 -1
  36. package/lib/release.js.map +1 -1
  37. package/lib/types/public.d.ts +1 -1
  38. package/package.json +2 -2
  39. package/src/apps/new-pilet.ts +3 -2
  40. package/src/apps/new-piral.ts +3 -3
  41. package/src/apps/publish-piral.ts +20 -9
  42. package/src/apps/upgrade-pilet.ts +2 -1
  43. package/src/apps/upgrade-piral.ts +2 -1
  44. package/src/commands.ts +4 -4
  45. package/src/common/clients/index.ts +3 -1
  46. package/src/common/clients/npm.ts +4 -0
  47. package/src/common/clients/pnp.ts +77 -0
  48. package/src/common/clients/yarn.ts +3 -3
  49. package/src/common/interactive.ts +5 -1
  50. package/src/common/npm.ts +21 -6
  51. package/src/helpers.ts +1 -1
  52. package/src/messages.ts +14 -14
  53. package/src/release.ts +1 -1
  54. package/src/types/public.ts +1 -1
@@ -195,7 +195,7 @@ export declare type PiletPublishSource = 'local' | 'npm' | 'remote';
195
195
  export declare type PiralBuildType = 'all' | 'release' | 'emulator' | 'emulator-sources';
196
196
  export declare type PiletBuildType = 'default' | 'standalone' | 'manifest';
197
197
  export declare type PackageType = 'registry' | 'file' | 'git';
198
- export declare type NpmClientType = 'npm' | 'yarn' | 'pnpm' | 'lerna' | 'rush';
198
+ export declare type NpmClientType = 'npm' | 'yarn' | 'pnp' | 'pnpm' | 'lerna' | 'rush';
199
199
  export declare type Framework = 'piral-native' | 'piral' | 'piral-core' | 'piral-base';
200
200
  export interface StandardEnvProps {
201
201
  production?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-cli",
3
- "version": "0.15.0-alpha.4284",
3
+ "version": "0.15.0-alpha.4311",
4
4
  "description": "The standard CLI for creating and building a Piral instance or a Pilet.",
5
5
  "keywords": [
6
6
  "portal",
@@ -80,5 +80,5 @@
80
80
  "typescript": "^4.0.2",
81
81
  "yargs": "^15.4.1"
82
82
  },
83
- "gitHead": "c48d6a2c320241d04e3c9c4c4edb423345003587"
83
+ "gitHead": "394262be7ca4f7883adf6d34d5635445fd1ef9b8"
84
84
  }
@@ -102,7 +102,7 @@ export const newPiletDefaults: NewPiletOptions = {
102
102
  install: true,
103
103
  template: undefined,
104
104
  logLevel: LogLevels.info,
105
- npmClient: config.npmClient,
105
+ npmClient: undefined,
106
106
  bundlerName: 'none',
107
107
  variables: {},
108
108
  };
@@ -119,6 +119,7 @@ export async function newPilet(baseDir = process.cwd(), options: NewPiletOptions
119
119
  logLevel = newPiletDefaults.logLevel,
120
120
  bundlerName = newPiletDefaults.bundlerName,
121
121
  variables = newPiletDefaults.variables,
122
+ npmClient: defaultNpmClient = newPiletDefaults.npmClient,
122
123
  } = options;
123
124
  const fullBase = resolve(process.cwd(), baseDir);
124
125
  const root = resolve(fullBase, target);
@@ -128,7 +129,7 @@ export async function newPilet(baseDir = process.cwd(), options: NewPiletOptions
128
129
  const success = await createDirectory(root);
129
130
 
130
131
  if (success) {
131
- const npmClient = await determineNpmClient(root, options.npmClient);
132
+ const npmClient = await determineNpmClient(root, defaultNpmClient);
132
133
  const projectName = basename(root);
133
134
 
134
135
  progress(`Scaffolding new pilet in %s ...`, root);
@@ -22,7 +22,6 @@ import {
22
22
  config,
23
23
  initNpmProject,
24
24
  } from '../common';
25
- import { sourceLanguageKeys } from '..';
26
25
 
27
26
  export interface NewPiralOptions {
28
27
  /**
@@ -102,7 +101,7 @@ export const newPiralDefaults: NewPiralOptions = {
102
101
  install: true,
103
102
  template: 'default',
104
103
  logLevel: LogLevels.info,
105
- npmClient: config.npmClient,
104
+ npmClient: undefined,
106
105
  bundlerName: 'none',
107
106
  variables: {},
108
107
  };
@@ -121,6 +120,7 @@ export async function newPiral(baseDir = process.cwd(), options: NewPiralOptions
121
120
  logLevel = newPiralDefaults.logLevel,
122
121
  bundlerName = newPiralDefaults.bundlerName,
123
122
  variables = newPiralDefaults.variables,
123
+ npmClient: defaultNpmClient = newPiralDefaults.npmClient,
124
124
  } = options;
125
125
  const fullBase = resolve(process.cwd(), baseDir);
126
126
  const root = resolve(fullBase, target);
@@ -134,7 +134,7 @@ export async function newPiral(baseDir = process.cwd(), options: NewPiralOptions
134
134
  const success = await createDirectory(root);
135
135
 
136
136
  if (success) {
137
- const npmClient = await determineNpmClient(root, options.npmClient);
137
+ const npmClient = await determineNpmClient(root, defaultNpmClient);
138
138
  const packageRef = combinePackageRef(framework, version, 'registry');
139
139
  const projectName = basename(root);
140
140
 
@@ -1,7 +1,17 @@
1
1
  import { resolve } from 'path';
2
2
  import { publishArtifacts } from '../release';
3
+ import {
4
+ setLogLevel,
5
+ progress,
6
+ checkExists,
7
+ fail,
8
+ logDone,
9
+ logReset,
10
+ publishNpmPackage,
11
+ matchFiles,
12
+ log,
13
+ } from '../common';
3
14
  import { LogLevels, PiralBuildType } from '../types';
4
- import { setLogLevel, progress, checkExists, fail, logDone, logReset, publishNpmPackage, matchFiles } from '../common';
5
15
 
6
16
  export interface PublishPiralOptions {
7
17
  /**
@@ -15,9 +25,9 @@ export interface PublishPiralOptions {
15
25
  logLevel?: LogLevels;
16
26
 
17
27
  /**
18
- * The additional fields to supply for the provider.
28
+ * The options to supply for the provider.
19
29
  */
20
- fields?: Record<string, string>;
30
+ opts?: Record<string, string>;
21
31
 
22
32
  /**
23
33
  * Defines if authorization tokens can be retrieved interactively.
@@ -40,7 +50,7 @@ export const publishPiralDefaults: PublishPiralOptions = {
40
50
  logLevel: LogLevels.info,
41
51
  type: 'all',
42
52
  provider: 'none',
43
- fields: {},
53
+ opts: {},
44
54
  interactive: false,
45
55
  };
46
56
 
@@ -59,6 +69,7 @@ async function publishEmulator(
59
69
  }
60
70
 
61
71
  const files = await matchFiles(directory, '*.tgz');
72
+ log('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
62
73
 
63
74
  if (files.length !== 1) {
64
75
  fail('publishEmulatorFilesUnexpected_0111', directory);
@@ -70,8 +81,7 @@ async function publishEmulator(
70
81
  return p;
71
82
  }, [] as Array<string>);
72
83
 
73
- //TODO support interactive here, too?
74
- await publishNpmPackage(directory, file, flags);
84
+ await publishNpmPackage(directory, file, flags, interactive);
75
85
  }
76
86
 
77
87
  async function publishRelease(
@@ -90,6 +100,7 @@ async function publishRelease(
90
100
  }
91
101
 
92
102
  const files = await matchFiles(directory, '**/*');
103
+ log('generalDebug_0003', `Found ${files.length} in "${directory}": ${files.join(', ')}`);
93
104
  await publishArtifacts(providerName, directory, files, args, interactive);
94
105
  }
95
106
 
@@ -98,7 +109,7 @@ export async function publishPiral(baseDir = process.cwd(), options: PublishPira
98
109
  source = publishPiralDefaults.source,
99
110
  type = publishPiralDefaults.type,
100
111
  logLevel = publishPiralDefaults.logLevel,
101
- fields = publishPiralDefaults.fields,
112
+ opts = publishPiralDefaults.opts,
102
113
  provider = publishPiralDefaults.provider,
103
114
  interactive = publishPiralDefaults.interactive,
104
115
  } = options;
@@ -113,14 +124,14 @@ export async function publishPiral(baseDir = process.cwd(), options: PublishPira
113
124
 
114
125
  if (type !== 'release') {
115
126
  progress('Publishing emulator package ...');
116
- await publishEmulator(fullBase, source, fields, interactive);
127
+ await publishEmulator(fullBase, source, opts, interactive);
117
128
  logDone(`Successfully published emulator.`);
118
129
  logReset();
119
130
  }
120
131
 
121
132
  if (type !== 'emulator') {
122
133
  progress('Publishing release files ...');
123
- await publishRelease(fullBase, source, provider, fields, interactive);
134
+ await publishRelease(fullBase, source, provider, opts, interactive);
124
135
  logDone(`Successfully published release.`);
125
136
  logReset();
126
137
  }
@@ -88,6 +88,7 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
88
88
  logLevel = upgradePiletDefaults.logLevel,
89
89
  install = upgradePiletDefaults.install,
90
90
  variables = upgradePiletDefaults.variables,
91
+ npmClient: defaultNpmClient = upgradePiletDefaults.npmClient,
91
92
  } = options;
92
93
  const fullBase = resolve(process.cwd(), baseDir);
93
94
  const root = resolve(fullBase, target);
@@ -98,7 +99,7 @@ export async function upgradePilet(baseDir = process.cwd(), options: UpgradePile
98
99
  fail('invalidPiletTarget_0040');
99
100
  }
100
101
 
101
- const npmClient = await determineNpmClient(root, options.npmClient);
102
+ const npmClient = await determineNpmClient(root, defaultNpmClient);
102
103
  const pckg = await readJson(root, 'package.json');
103
104
  const { devDependencies = {}, dependencies = {}, piral, source } = pckg;
104
105
 
@@ -80,6 +80,7 @@ export async function upgradePiral(baseDir = process.cwd(), options: UpgradePira
80
80
  target = upgradePiralDefaults.target,
81
81
  logLevel = upgradePiralDefaults.logLevel,
82
82
  install = upgradePiralDefaults.install,
83
+ npmClient: defaultNpmClient = upgradePiralDefaults.npmClient,
83
84
  } = options;
84
85
  const fullBase = resolve(process.cwd(), baseDir);
85
86
  const root = resolve(fullBase, target);
@@ -91,7 +92,7 @@ export async function upgradePiral(baseDir = process.cwd(), options: UpgradePira
91
92
  fail('packageJsonNotFound_0020');
92
93
  }
93
94
 
94
- const npmClient = await determineNpmClient(root, options.npmClient);
95
+ const npmClient = await determineNpmClient(root, defaultNpmClient);
95
96
 
96
97
  progress(`Checking provided version ...`);
97
98
  const realVersion = await findSpecificVersion('piral-cli', version);
package/src/commands.ts CHANGED
@@ -205,9 +205,9 @@ const allCommands: Array<ToolCommand<any>> = [
205
205
  .choices('provider', availableReleaseProviders)
206
206
  .describe('provider', 'Sets the provider for publishing the release assets.')
207
207
  .default('provider', apps.publishPiralDefaults.provider)
208
- .option('fields', undefined)
209
- .describe('fields', 'Sets additional fields to be included in the feed service request.')
210
- .default('fields', apps.publishPiralDefaults.fields)
208
+ .option('opts', undefined)
209
+ .describe('opts', 'Sets the options to forward to the chosen provider.')
210
+ .default('opts', apps.publishPiralDefaults.opts)
211
211
  .boolean('interactive')
212
212
  .describe('interactive', 'Defines if authorization tokens can be retrieved interactively.')
213
213
  .default('interactive', apps.publishPiralDefaults.interactive)
@@ -221,7 +221,7 @@ const allCommands: Array<ToolCommand<any>> = [
221
221
  logLevel: args['log-level'] as LogLevels,
222
222
  type: args.type as PiralBuildType,
223
223
  provider: args.provider as string,
224
- fields: args.fields as Record<string, string>,
224
+ opts: args.opts as Record<string, string>,
225
225
  interactive: args.interactive as boolean,
226
226
  });
227
227
  },
@@ -1,5 +1,6 @@
1
1
  import * as lerna from './lerna';
2
2
  import * as npm from './npm';
3
+ import * as pnp from './pnp';
3
4
  import * as pnpm from './pnpm';
4
5
  import * as rush from './rush';
5
6
  import * as yarn from './yarn';
@@ -7,6 +8,7 @@ import * as yarn from './yarn';
7
8
  export const clients = {
8
9
  lerna,
9
10
  npm,
11
+ pnp,
10
12
  pnpm,
11
13
  rush,
12
14
  yarn,
@@ -14,7 +16,7 @@ export const clients = {
14
16
 
15
17
  type ClientName = keyof typeof clients;
16
18
 
17
- const directClients = ['npm', 'yarn', 'pnpm'];
19
+ const directClients = ['npm', 'pnp', 'yarn', 'pnpm'];
18
20
 
19
21
  export function isWrapperClient(client: ClientName) {
20
22
  return !directClients.includes(client);
@@ -47,6 +47,10 @@ export async function initProject(projectName: string, target: string) {}
47
47
 
48
48
  // Functions to exclusively use from npm client:
49
49
 
50
+ export async function loginUser() {
51
+ await runNpmProcess(['login'], '.');
52
+ }
53
+
50
54
  export async function unpackPackage(packageRef: string, target = '.', ...flags: Array<string>) {
51
55
  const ms = new MemoryStream();
52
56
  await runNpmProcess(['pack', packageRef, ...flags], target, ms);
@@ -0,0 +1,77 @@
1
+ import { resolve } from 'path';
2
+ import { log } from '../log';
3
+ import { findFile } from '../io';
4
+ import { runCommand } from '../scripts';
5
+ import { MemoryStream } from '../MemoryStream';
6
+
7
+ // Helpers:
8
+
9
+ function runYarnProcess(args: Array<string>, target: string, output?: NodeJS.WritableStream) {
10
+ log('generalDebug_0003', 'Starting the Yarn PnP process ...');
11
+ const cwd = resolve(process.cwd(), target);
12
+ return runCommand('yarn', args, cwd, output);
13
+ }
14
+
15
+ function convert(flags: Array<string>) {
16
+ return flags.map((flag) => {
17
+ switch (flag) {
18
+ case '--save-exact':
19
+ return '--exact';
20
+ case '--save-dev':
21
+ return '--dev';
22
+ case '--no-save':
23
+ // unfortunately no (https://github.com/yarnpkg/yarn/issues/1743)
24
+ return '';
25
+ default:
26
+ return flag;
27
+ }
28
+ });
29
+ }
30
+
31
+ // Client interface functions:
32
+
33
+ export async function installDependencies(target = '.', ...flags: Array<string>) {
34
+ const ms = new MemoryStream();
35
+ await runYarnProcess(['install', ...convert(flags)], target, ms);
36
+ log('generalDebug_0003', `Yarn PnP install dependencies result: ${ms.value}`);
37
+ return ms.value;
38
+ }
39
+
40
+ export async function installPackage(packageRef: string, target = '.', ...flags: Array<string>) {
41
+ const ms = new MemoryStream();
42
+ await runYarnProcess(['add', packageRef, ...convert(flags)], target, ms);
43
+ log('generalDebug_0003', `Yarn PnP install package result: ${ms.value}`);
44
+ return ms.value;
45
+ }
46
+
47
+ export async function detectClient(root: string) {
48
+ return !!(await findFile(root, '.pnp.cjs'));
49
+ }
50
+
51
+ export async function initProject(projectName: string, target: string) {}
52
+
53
+ export async function isProject(root: string, packageRef: string) {
54
+ const details = await listProjects(root);
55
+
56
+ if (typeof details === 'object') {
57
+ return typeof details?.[packageRef]?.location === 'string';
58
+ }
59
+
60
+ return false;
61
+ }
62
+
63
+ // Functions to exclusively use from yarn client:
64
+
65
+ export async function listProjects(target: string) {
66
+ const ms = new MemoryStream();
67
+
68
+ try {
69
+ await runYarnProcess(['workspaces', 'info'], target, ms);
70
+ } catch (e) {
71
+ log('generalDebug_0003', `yarn workspaces error: ${e}`);
72
+ return {};
73
+ }
74
+
75
+ log('generalDebug_0003', `yarn workspaces result: ${ms.value}`);
76
+ return JSON.parse(ms.value);
77
+ }
@@ -7,7 +7,7 @@ import { MemoryStream } from '../MemoryStream';
7
7
  // Helpers:
8
8
 
9
9
  function runYarnProcess(args: Array<string>, target: string, output?: NodeJS.WritableStream) {
10
- log('generalDebug_0003', 'Starting the Yarn@1 process ...');
10
+ log('generalDebug_0003', 'Starting the Yarn Classic process ...');
11
11
  const cwd = resolve(process.cwd(), target);
12
12
  return runCommand('yarn', args, cwd, output);
13
13
  }
@@ -33,14 +33,14 @@ function convert(flags: Array<string>) {
33
33
  export async function installDependencies(target = '.', ...flags: Array<string>) {
34
34
  const ms = new MemoryStream();
35
35
  await runYarnProcess(['install', ...convert(flags)], target, ms);
36
- log('generalDebug_0003', `Yarn@1 install dependencies result: ${ms.value}`);
36
+ log('generalDebug_0003', `Yarn Classic install dependencies result: ${ms.value}`);
37
37
  return ms.value;
38
38
  }
39
39
 
40
40
  export async function installPackage(packageRef: string, target = '.', ...flags: Array<string>) {
41
41
  const ms = new MemoryStream();
42
42
  await runYarnProcess(['add', packageRef, ...convert(flags)], target, ms);
43
- log('generalDebug_0003', `Yarn@1 install package result: ${ms.value}`);
43
+ log('generalDebug_0003', `Yarn Classic install package result: ${ms.value}`);
44
44
  return ms.value;
45
45
  }
46
46
 
@@ -56,7 +56,11 @@ export function getTokenInteractively(url: string, httpsAgent: Agent): TokenResu
56
56
  )
57
57
  .then((res) => {
58
58
  const { loginUrl, callbackUrl, expires } = res.data;
59
- console.log(`Use the URL below to complete the login. The link expires at ${new Date(expires)}.`);
59
+ const now = new Date();
60
+ const then = new Date(expires);
61
+ const diff = ~~((then.valueOf() - now.valueOf()) / (60 * 1000));
62
+
63
+ console.log(`Use the URL below to complete the login. The link expires in ${diff} minutes (${then}).`);
60
64
  console.log('===');
61
65
  console.log(loginUrl);
62
66
  console.log('===');
package/src/common/npm.ts CHANGED
@@ -43,6 +43,10 @@ async function detectMonorepoRoot(root: string): Promise<[] | [string, NpmClient
43
43
  const packageJson = await readJson(root, 'package.json');
44
44
 
45
45
  if (Array.isArray(packageJson?.workspaces)) {
46
+ if (await checkExists(resolve(root, '.pnp.cjs'))) {
47
+ return [root, 'pnp'];
48
+ }
49
+
46
50
  if (await checkExists(resolve(root, 'yarn.lock'))) {
47
51
  return [root, 'yarn'];
48
52
  }
@@ -74,8 +78,6 @@ export async function determineNpmClient(root: string, selected?: NpmClientType)
74
78
  `Results of the lock file check: ${searchedClients.map((m) => `${m.client}=${m.result}`).join(', ')}`,
75
79
  );
76
80
 
77
- const defaultClient = config.npmClient;
78
-
79
81
  if (foundClients.length > 1) {
80
82
  const wrapperClient = foundClients.find((m) => isWrapperClient(m.client));
81
83
 
@@ -97,12 +99,14 @@ export async function determineNpmClient(root: string, selected?: NpmClientType)
97
99
  return client;
98
100
  }
99
101
 
102
+ const defaultClient = config.npmClient;
103
+
100
104
  if (clientTypeKeys.includes(defaultClient)) {
101
105
  log('generalDebug_0003', `Using the default client: "${defaultClient}".`);
102
106
  return defaultClient;
103
107
  }
104
108
 
105
- log('generalDebug_0003', 'Using the default "npm" client.');
109
+ log('generalDebug_0003', 'Using the fallback "npm" client.');
106
110
  return 'npm';
107
111
  }
108
112
 
@@ -148,9 +152,20 @@ export function initNpmProject(client: NpmClientType, projectName: string, targe
148
152
  return initProject(projectName, target);
149
153
  }
150
154
 
151
- export function publishNpmPackage(target = '.', file = '*.tgz', flags: Array<string> = []): Promise<string> {
152
- const { publishPackage } = clients.npm;
153
- return publishPackage(target, file, ...flags);
155
+ export function publishNpmPackage(
156
+ target = '.',
157
+ file = '*.tgz',
158
+ flags: Array<string> = [],
159
+ interactive = false,
160
+ ): Promise<string> {
161
+ const { publishPackage, loginUser } = clients.npm;
162
+ return publishPackage(target, file, ...flags).catch(err => {
163
+ if (!interactive) {
164
+ throw err;
165
+ }
166
+
167
+ return loginUser().then(() => publishNpmPackage(target, file, flags, false));
168
+ });
154
169
  }
155
170
 
156
171
  export function createNpmPackage(target = '.'): Promise<string> {
package/src/helpers.ts CHANGED
@@ -15,7 +15,7 @@ export const publishModeKeys: Array<PiletPublishScheme> = ['none', 'basic', 'bea
15
15
  export const fromKeys: Array<PiletPublishSource> = ['local', 'remote', 'npm'];
16
16
  export const piralBuildTypeKeys: Array<PiralBuildType> = ['all', 'release', 'emulator', 'emulator-sources'];
17
17
  export const piletBuildTypeKeys: Array<PiletBuildType> = ['default', 'standalone', 'manifest'];
18
- export const clientTypeKeys: Array<NpmClientType> = ['npm', 'pnpm', 'yarn', 'lerna', 'rush'];
18
+ export const clientTypeKeys: Array<NpmClientType> = ['npm', 'pnpm', 'pnp', 'yarn', 'lerna', 'rush'];
19
19
  export const bundlerKeys: Array<string> = ['none', ...bundlerNames];
20
20
  export const availableBundlers: Array<string> = [];
21
21
  export const availableReleaseProviders: Array<string> = [];
package/src/messages.ts CHANGED
@@ -2217,24 +2217,24 @@ export function publishEmulatorFilesUnexpected_0111(directory: string): QuickMes
2217
2217
  * @kind Error
2218
2218
  *
2219
2219
  * @summary
2220
- * The "xcopy" provider requires a "--fields.target" argument.
2220
+ * The "xcopy" provider requires a "--opts.target" argument.
2221
2221
  *
2222
2222
  * @abstract
2223
2223
  * The `piral publish --type release` command requires the selection of a suitable
2224
2224
  * provider for running successfully. The "xcopy" provider just copies the sources from
2225
2225
  * the output directory (source) to a specified target directory.
2226
2226
  *
2227
- * Make sure to supply the target directory via the `--fields.target` command line flag.
2227
+ * Make sure to supply the target directory via the `--opts.target` command line flag.
2228
2228
  *
2229
2229
  * @example
2230
2230
  * The following command would specify `/temp/dest` as target directory:
2231
2231
  *
2232
2232
  * ```sh
2233
- * piral publish --type release --provider xcopy --fields.target "/temp/dest"
2233
+ * piral publish --type release --provider xcopy --opts.target "/temp/dest"
2234
2234
  * ```
2235
2235
  */
2236
2236
  export function publishXcopyMissingTarget_0112(): QuickMessage {
2237
- return [LogLevels.error, '0112', `The "xcopy" provider requires a "--fields.target" argument.`];
2237
+ return [LogLevels.error, '0112', `The "xcopy" provider requires a "--opts.target" argument.`];
2238
2238
  }
2239
2239
 
2240
2240
  /**
@@ -2257,7 +2257,7 @@ export function publishXcopyMissingTarget_0112(): QuickMessage {
2257
2257
  * The following command uses the in-built "xcopy" provider for releasing to a local directory.
2258
2258
  *
2259
2259
  * ```sh
2260
- * piral publish --type release --provider xcopy --fields.target "/temp/dest"
2260
+ * piral publish --type release --provider xcopy --opts.target "/temp/dest"
2261
2261
  * ```
2262
2262
  */
2263
2263
  export function publishProviderMissing_0113(providerName: string, availableProviders: Array<string>): QuickMessage {
@@ -2278,7 +2278,7 @@ export function publishProviderMissing_0113(providerName: string, availableProvi
2278
2278
  * The following command uses the in-built "xcopy" provider for releasing to a local directory.
2279
2279
  *
2280
2280
  * ```sh
2281
- * piral publish --type release --provider xcopy --fields.target "/temp/dest"
2281
+ * piral publish --type release --provider xcopy --opts.target "/temp/dest"
2282
2282
  * ```
2283
2283
  *
2284
2284
  * The type is "release".
@@ -2295,14 +2295,14 @@ export function publishEmulatorSourcesInvalid_0114(): QuickMessage {
2295
2295
  * @kind Error
2296
2296
  *
2297
2297
  * @summary
2298
- * The "feed" provider requires a "--fields.url" argument.
2298
+ * The "feed" provider requires a "--opts.url" argument.
2299
2299
  *
2300
2300
  * @abstract
2301
2301
  * The `piral publish --type release` command requires the selection of a suitable
2302
2302
  * provider for running successfully. The "feed" provider releases the files to
2303
2303
  * the a Piral Feed Service with the static page feature.
2304
2304
  *
2305
- * Make sure to supply the URL for the feed service via the `--fields.url` command
2305
+ * Make sure to supply the URL for the feed service via the `--opts.url` command
2306
2306
  * line flag.
2307
2307
  *
2308
2308
  * @example
@@ -2310,25 +2310,25 @@ export function publishEmulatorSourcesInvalid_0114(): QuickMessage {
2310
2310
  * for the feed service:
2311
2311
  *
2312
2312
  * ```sh
2313
- * piral publish --type release --provider feed --fields.url "https://feed.piral.cloud/api/v1/feed/sample/page" --fields.apikey "foobar123"
2313
+ * piral publish --type release --provider feed --opts.url "https://feed.piral.cloud/api/v1/feed/sample/page" --opts.apikey "foobar123"
2314
2314
  * ```
2315
2315
  */
2316
2316
  export function publishFeedMissingUrl_0115(): QuickMessage {
2317
- return [LogLevels.error, '0115', `The "feed" provider requires a "--fields.url" argument.`];
2317
+ return [LogLevels.error, '0115', `The "feed" provider requires a "--opts.url" argument.`];
2318
2318
  }
2319
2319
 
2320
2320
  /**
2321
2321
  * @kind Error
2322
2322
  *
2323
2323
  * @summary
2324
- * The "feed" provider requires a "--fields.version" argument.
2324
+ * The "feed" provider requires a "--opts.version" argument.
2325
2325
  *
2326
2326
  * @abstract
2327
2327
  * The `piral publish --type release` command requires the selection of a suitable
2328
2328
  * provider for running successfully. The "feed" provider releases the files to
2329
2329
  * the a Piral Feed Service with the static page feature.
2330
2330
  *
2331
- * Make sure to supply the version either explicitly via the `--fields.version` argument
2331
+ * Make sure to supply the version either explicitly via the `--opts.version` argument
2332
2332
  * or implicitly by having the artifacts stored in a sub-directory of the project's root,
2333
2333
  * which contains a package.json with the version to use.
2334
2334
  *
@@ -2336,11 +2336,11 @@ export function publishFeedMissingUrl_0115(): QuickMessage {
2336
2336
  * The following command would specify version "1.2.3" for the feed service:
2337
2337
  *
2338
2338
  * ```sh
2339
- * piral publish --type release --provider feed --fields.url "..." --fields.apikey "..." --fields.version "1.2.3"
2339
+ * piral publish --type release --provider feed --opts.url "..." --opts.apikey "..." --opts.version "1.2.3"
2340
2340
  * ```
2341
2341
  */
2342
2342
  export function publishFeedMissingVersion_0116(): QuickMessage {
2343
- return [LogLevels.error, '0116', `The "feed" provider requires either a "--fields.version" argument or a package.json with a version.`];
2343
+ return [LogLevels.error, '0116', `The "feed" provider requires either a "--opts.version" argument or a package.json with a version.`];
2344
2344
  }
2345
2345
 
2346
2346
  /**
package/src/release.ts CHANGED
@@ -49,7 +49,7 @@ const providers: Record<string, ReleaseProvider> = {
49
49
  };
50
50
 
51
51
  for (const file of files) {
52
- const relPath = relative(file, directory);
52
+ const relPath = relative(directory, file);
53
53
  const fileName = basename(file);
54
54
  const content = await readBinary(dirname(file), fileName);
55
55
  data[relPath] = [content, fileName];
@@ -229,7 +229,7 @@ export type PiletBuildType = 'default' | 'standalone' | 'manifest';
229
229
 
230
230
  export type PackageType = 'registry' | 'file' | 'git';
231
231
 
232
- export type NpmClientType = 'npm' | 'yarn' | 'pnpm' | 'lerna' | 'rush';
232
+ export type NpmClientType = 'npm' | 'yarn' | 'pnp' | 'pnpm' | 'lerna' | 'rush';
233
233
 
234
234
  export type Framework = 'piral-native' | 'piral' | 'piral-core' | 'piral-base';
235
235