piral-cli 1.8.1 → 1.8.2-beta.7851

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.
@@ -1,5 +1,5 @@
1
- import { Argv, Arguments } from 'yargs';
2
- import { RuleRunner, PiletRuleContext, PiralRuleContext, LogLevels, SharedDependency } from './common';
1
+ import type { Argv, Arguments } from 'yargs';
2
+ import type { RuleRunner, PiletRuleContext, PiralRuleContext, LogLevels, SharedDependency } from './common';
3
3
  export type FlagType = 'string' | 'number' | 'boolean' | 'object';
4
4
  export interface Flag {
5
5
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-cli",
3
- "version": "1.8.1",
3
+ "version": "1.8.2-beta.7851",
4
4
  "description": "The standard CLI for creating and building a Piral instance or a Pilet.",
5
5
  "keywords": [
6
6
  "portal",
@@ -54,7 +54,7 @@
54
54
  "@types/mime": "^4",
55
55
  "@types/node": "^18",
56
56
  "@types/rc": "^1",
57
- "@types/yargs": "^17",
57
+ "@types/yargs": "^15",
58
58
  "axios": "^1",
59
59
  "chalk": "^5",
60
60
  "enhanced-resolve": "^5",
@@ -68,15 +68,15 @@
68
68
  "ora": "^8",
69
69
  "rc": "^1",
70
70
  "rimraf": "^6",
71
- "tar": "^7"
71
+ "tar": "^7",
72
+ "yargs": "^15"
72
73
  },
73
74
  "dependencies": {
74
75
  "css-conflict-inspector": "^0.2",
75
76
  "dets": "^0.16.7",
76
77
  "kras": "^1",
77
78
  "open": "^10",
78
- "typescript": "^5",
79
- "yargs": "^17"
79
+ "typescript": "^5"
80
80
  },
81
- "gitHead": "77a33ee784435d771d31b752240babe2a692b6aa"
81
+ "gitHead": "fa0dcf704b6146a1ceb6daa2787540365030e943"
82
82
  }
package/src/cli.ts CHANGED
@@ -1,7 +1,6 @@
1
- import yargs from 'yargs';
2
- import { detailed } from 'yargs-parser';
3
1
  import { caterpillerIcon, zapIcon, butterflyIcon, cliName, cliVersion } from './common';
4
2
  import { runQuestionnaireFor } from './questionnaire';
3
+ import { yargs, detailed } from './external';
5
4
  import { ToolCommand } from './types';
6
5
 
7
6
  let argv = yargs;
@@ -22,25 +22,19 @@ describe('Pack Module', () => {
22
22
  it('createPilePackage without package json', async () => {
23
23
  json = null;
24
24
  expect.assertions(1);
25
- await expect(createPiletPackage('./', '', '')).rejects.toEqual(
26
- Error('[0020] No valid package.json could be found.'),
27
- );
25
+ await expect(createPiletPackage('./', '', '')).rejects.toThrow('[0020] No valid package.json could be found.');
28
26
  });
29
27
 
30
28
  it('createPilePackage without package json name', async () => {
31
29
  json = {};
32
30
  expect.assertions(1);
33
- await expect(createPiletPackage('./', '', '')).rejects.toEqual(
34
- Error('[0021] Cannot pack the pilet - missing name.'),
35
- );
31
+ await expect(createPiletPackage('./', '', '')).rejects.toThrow('[0021] Cannot pack the pilet - missing name.');
36
32
  });
37
33
 
38
34
  it('createPilePackage without package json version', async () => {
39
35
  json = { name: 'Test' };
40
36
  expect.assertions(1);
41
- await expect(createPiletPackage('./', '', '')).rejects.toEqual(
42
- Error('[0022] Cannot pack the pilet - missing version.'),
43
- );
37
+ await expect(createPiletPackage('./', '', '')).rejects.toThrow('[0022] Cannot pack the pilet - missing version.');
44
38
  });
45
39
 
46
40
  it('createPilePackage source = target', async () => {
@@ -135,18 +135,11 @@ describe('CLI package module', () => {
135
135
  it(
136
136
  'retrievePiletData error cases',
137
137
  async () => {
138
- await retrievePiletData('foo', '').catch((err) =>
139
- expect(err).toStrictEqual(Error('[0012] No Piral instances have been provided.')),
138
+ await expect(retrievePiletData('foo', 'bar')).rejects.toThrow(
139
+ '[0010] The defined Piral instance ("bar") could not be found.',
140
140
  );
141
-
142
- await retrievePiletData('foo', 'bar').catch((err) =>
143
- expect(err).toStrictEqual(Error('[0010] The defined Piral instance ("bar") could not be found.')),
144
- );
145
-
146
- await retrievePiletData('/foo', 'sample-piral').catch((err) =>
147
- expect(err).toStrictEqual(
148
- Error('[0075] Cannot find the "package.json". You need a valid package.json for your pilet.'),
149
- ),
141
+ await expect(retrievePiletData('/foo', 'sample-piral')).rejects.toThrow(
142
+ '[0075] Cannot find the "package.json". You need a valid package.json for your pilet.',
150
143
  );
151
144
  },
152
145
  testOptions,
@@ -12,7 +12,7 @@ describe('Rules Module', () => {
12
12
  const runException = () => {
13
13
  ruleSummary(['Error!'], []);
14
14
  };
15
- expect(runException).toThrow(Error('[0080] Validation failed. Found 1 error(s).'));
15
+ expect(runException).toThrow('[0080] Validation failed. Found 1 error(s).');
16
16
 
17
17
  let consoleSpy = vitest.spyOn(process.stderr, 'write');
18
18
  ruleSummary([], []);
@@ -1,5 +1,7 @@
1
1
  import * as jju from 'jju';
2
2
  import * as tar from 'tar';
3
+ import yargs from 'yargs';
4
+ import { detailed } from 'yargs-parser';
3
5
  import glob from 'glob';
4
6
  import FormData from 'form-data';
5
7
  import rc = require('rc');
@@ -34,4 +36,6 @@ export {
34
36
  getPort,
35
37
  jju,
36
38
  getModulePath,
39
+ yargs,
40
+ detailed,
37
41
  };
@@ -1,5 +1,5 @@
1
- import { Argv, Arguments } from 'yargs';
2
- import { RuleRunner, PiletRuleContext, PiralRuleContext, LogLevels, SharedDependency } from './common';
1
+ import type { Argv, Arguments } from 'yargs';
2
+ import type { RuleRunner, PiletRuleContext, PiralRuleContext, LogLevels, SharedDependency } from './common';
3
3
 
4
4
  export type FlagType = 'string' | 'number' | 'boolean' | 'object';
5
5