piral-cli 0.15.0-alpha.4332 → 0.15.0-alpha.4345
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/package.json +2 -2
- package/src/common/npm.test.ts +14 -58
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-cli",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.4345",
|
|
4
4
|
"description": "The standard CLI for creating and building a Piral instance or a Pilet.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"portal",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"typescript": "^4.7.3",
|
|
79
79
|
"yargs": "^15.4.1"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "56ecd6ad080b3d275752b19afcf8435e4bd09140"
|
|
82
82
|
}
|
package/src/common/npm.test.ts
CHANGED
|
@@ -66,7 +66,7 @@ jest.mock('fs', () => ({
|
|
|
66
66
|
existsSync: (file: string) => {
|
|
67
67
|
return true;
|
|
68
68
|
},
|
|
69
|
-
readFile: (file: string, type: string, callback: (err: NodeJS.ErrnoException, data: string) => void) => {
|
|
69
|
+
readFile: (file: string, type: string, callback: (err: NodeJS.ErrnoException | undefined, data: string) => void) => {
|
|
70
70
|
return callback(undefined, '');
|
|
71
71
|
},
|
|
72
72
|
realpathSync: () => ({}),
|
|
@@ -320,7 +320,7 @@ describe('npm Module', () => {
|
|
|
320
320
|
});
|
|
321
321
|
|
|
322
322
|
it('check if package from nothing is not local', () => {
|
|
323
|
-
const result = isLocalPackage('./',
|
|
323
|
+
const result = isLocalPackage('./', '');
|
|
324
324
|
expect(result).toBeFalsy();
|
|
325
325
|
});
|
|
326
326
|
|
|
@@ -364,7 +364,7 @@ describe('npm Module', () => {
|
|
|
364
364
|
expect(result).toBeTruthy();
|
|
365
365
|
result = isGitPackage('git+');
|
|
366
366
|
expect(result).toBeTruthy();
|
|
367
|
-
result = isGitPackage(
|
|
367
|
+
result = isGitPackage('');
|
|
368
368
|
expect(result).toBeFalsy();
|
|
369
369
|
});
|
|
370
370
|
|
|
@@ -395,11 +395,11 @@ describe('npm Module', () => {
|
|
|
395
395
|
it('combine package refernce', () => {
|
|
396
396
|
let result = combinePackageRef('foo', '1.0.0', 'registry');
|
|
397
397
|
expect(result).toBe('foo@1.0.0');
|
|
398
|
-
result = combinePackageRef('foo',
|
|
398
|
+
result = combinePackageRef('foo', '', 'registry');
|
|
399
399
|
expect(result).toBe('foo@latest');
|
|
400
|
-
result = combinePackageRef('foo',
|
|
400
|
+
result = combinePackageRef('foo', '', 'file');
|
|
401
401
|
expect(result).toBe('foo');
|
|
402
|
-
result = combinePackageRef('foo',
|
|
402
|
+
result = combinePackageRef('foo', '', 'git');
|
|
403
403
|
expect(result).toBe('foo');
|
|
404
404
|
});
|
|
405
405
|
|
|
@@ -430,18 +430,18 @@ describe('npm Module', () => {
|
|
|
430
430
|
expect(result).toEqual('1.0.0');
|
|
431
431
|
result = getPackageVersion(false, 'foo', '1.0.0', 'registry', './');
|
|
432
432
|
expect(result).toBeFalsy();
|
|
433
|
-
result = getPackageVersion(true, './foo.tgz',
|
|
433
|
+
result = getPackageVersion(true, './foo.tgz', '', 'file', './');
|
|
434
434
|
expect(result).toEqual('file:foo.tgz');
|
|
435
|
-
result = getPackageVersion(true, 'git+https://.foo.git',
|
|
435
|
+
result = getPackageVersion(true, 'git+https://.foo.git', '', 'git', '');
|
|
436
436
|
expect(result).toEqual('git+https://.foo.git');
|
|
437
437
|
});
|
|
438
438
|
|
|
439
439
|
it('gets path to git package', () => {
|
|
440
|
-
const result = getCurrentPackageDetails('./', './foo.tgz',
|
|
440
|
+
const result = getCurrentPackageDetails('./', './foo.tgz', '', 'file://foo.tgz', './');
|
|
441
441
|
result.then(([path, version]) => {
|
|
442
442
|
expect(path).not.toBeUndefined();
|
|
443
443
|
});
|
|
444
|
-
const result2 = getCurrentPackageDetails('./', './foo.tgz',
|
|
444
|
+
const result2 = getCurrentPackageDetails('./', './foo.tgz', '', 'git+https://.foo.git', './');
|
|
445
445
|
result2.then(([path, version]) => {
|
|
446
446
|
expect(path).not.toBeUndefined();
|
|
447
447
|
});
|
|
@@ -454,32 +454,12 @@ describe('npm Module', () => {
|
|
|
454
454
|
|
|
455
455
|
it('makeExternals without externals returns coreExternals', () => {
|
|
456
456
|
const externals = makeExternals(process.cwd(), { piral: '*' });
|
|
457
|
-
expect(externals).toEqual([
|
|
458
|
-
'react',
|
|
459
|
-
'react-dom',
|
|
460
|
-
'react-router',
|
|
461
|
-
'react-router-dom',
|
|
462
|
-
'history',
|
|
463
|
-
'tslib',
|
|
464
|
-
'path-to-regexp',
|
|
465
|
-
'@libre/atom',
|
|
466
|
-
'@dbeining/react-atom',
|
|
467
|
-
]);
|
|
457
|
+
expect(externals).toEqual(['react', 'react-dom', 'react-router', 'react-router-dom', 'history', 'tslib']);
|
|
468
458
|
});
|
|
469
459
|
|
|
470
460
|
it('makeExternals with no externals returns coreExternals', () => {
|
|
471
461
|
const externals = makeExternals(process.cwd(), { piral: '*' }, []);
|
|
472
|
-
expect(externals).toEqual([
|
|
473
|
-
'react',
|
|
474
|
-
'react-dom',
|
|
475
|
-
'react-router',
|
|
476
|
-
'react-router-dom',
|
|
477
|
-
'history',
|
|
478
|
-
'tslib',
|
|
479
|
-
'path-to-regexp',
|
|
480
|
-
'@libre/atom',
|
|
481
|
-
'@dbeining/react-atom',
|
|
482
|
-
]);
|
|
462
|
+
expect(externals).toEqual(['react', 'react-dom', 'react-router', 'react-router-dom', 'history', 'tslib']);
|
|
483
463
|
});
|
|
484
464
|
|
|
485
465
|
it('makeExternals with exclude coreExternals returns empty set', () => {
|
|
@@ -498,41 +478,17 @@ describe('npm Module', () => {
|
|
|
498
478
|
'react-router-dom',
|
|
499
479
|
'history',
|
|
500
480
|
'tslib',
|
|
501
|
-
'path-to-regexp',
|
|
502
|
-
'@libre/atom',
|
|
503
|
-
'@dbeining/react-atom',
|
|
504
481
|
]);
|
|
505
482
|
});
|
|
506
483
|
|
|
507
484
|
it('makeExternals with external duplicate only reflects coreExternals', () => {
|
|
508
485
|
const externals = makeExternals(process.cwd(), { piral: '*' }, ['react', 'foo']);
|
|
509
|
-
expect(externals).toEqual([
|
|
510
|
-
'react',
|
|
511
|
-
'foo',
|
|
512
|
-
'react-dom',
|
|
513
|
-
'react-router',
|
|
514
|
-
'react-router-dom',
|
|
515
|
-
'history',
|
|
516
|
-
'tslib',
|
|
517
|
-
'path-to-regexp',
|
|
518
|
-
'@libre/atom',
|
|
519
|
-
'@dbeining/react-atom',
|
|
520
|
-
]);
|
|
486
|
+
expect(externals).toEqual(['react', 'foo', 'react-dom', 'react-router', 'react-router-dom', 'history', 'tslib']);
|
|
521
487
|
});
|
|
522
488
|
|
|
523
489
|
it('makeExternals with explicit include and exclude', () => {
|
|
524
490
|
const externals = makeExternals(process.cwd(), { piral: '*' }, ['react', 'react-calendar', '!history']);
|
|
525
|
-
expect(externals).toEqual([
|
|
526
|
-
'react',
|
|
527
|
-
'react-calendar',
|
|
528
|
-
'react-dom',
|
|
529
|
-
'react-router',
|
|
530
|
-
'react-router-dom',
|
|
531
|
-
'tslib',
|
|
532
|
-
'path-to-regexp',
|
|
533
|
-
'@libre/atom',
|
|
534
|
-
'@dbeining/react-atom',
|
|
535
|
-
]);
|
|
491
|
+
expect(externals).toEqual(['react', 'react-calendar', 'react-dom', 'react-router', 'react-router-dom', 'tslib']);
|
|
536
492
|
});
|
|
537
493
|
|
|
538
494
|
it('makeExternals with all exclude and explicit include', () => {
|