piral-cli 0.14.24-beta.4168 → 0.14.24-beta.4195

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 (43) hide show
  1. package/lib/apps/new-pilet.js.map +1 -1
  2. package/lib/apps/new-piral.js +3 -1
  3. package/lib/apps/new-piral.js.map +1 -1
  4. package/lib/common/clients/lerna.d.ts +2 -0
  5. package/lib/common/clients/lerna.js +28 -1
  6. package/lib/common/clients/lerna.js.map +1 -1
  7. package/lib/common/clients/npm.d.ts +1 -0
  8. package/lib/common/clients/npm.js +14 -1
  9. package/lib/common/clients/npm.js.map +1 -1
  10. package/lib/common/clients/pnpm.d.ts +2 -0
  11. package/lib/common/clients/pnpm.js +28 -1
  12. package/lib/common/clients/pnpm.js.map +1 -1
  13. package/lib/common/clients/rush.d.ts +2 -0
  14. package/lib/common/clients/rush.js +28 -1
  15. package/lib/common/clients/rush.js.map +1 -1
  16. package/lib/common/clients/yarn.d.ts +2 -0
  17. package/lib/common/clients/yarn.js +28 -1
  18. package/lib/common/clients/yarn.js.map +1 -1
  19. package/lib/common/emulator.js +1 -1
  20. package/lib/common/emulator.js.map +1 -1
  21. package/lib/common/npm.d.ts +3 -2
  22. package/lib/common/npm.js +38 -26
  23. package/lib/common/npm.js.map +1 -1
  24. package/lib/common/package.js +4 -3
  25. package/lib/common/package.js.map +1 -1
  26. package/lib/common/scaffold.js +3 -0
  27. package/lib/common/scaffold.js.map +1 -1
  28. package/lib/plugin.js +4 -4
  29. package/lib/plugin.js.map +1 -1
  30. package/package.json +2 -2
  31. package/src/apps/new-pilet.ts +0 -1
  32. package/src/apps/new-piral.ts +5 -1
  33. package/src/common/clients/lerna.ts +26 -0
  34. package/src/common/clients/npm.ts +12 -0
  35. package/src/common/clients/pnpm.ts +26 -0
  36. package/src/common/clients/rush.ts +26 -0
  37. package/src/common/clients/yarn.ts +26 -0
  38. package/src/common/emulator.ts +1 -1
  39. package/src/common/npm.test.ts +9 -9
  40. package/src/common/npm.ts +41 -27
  41. package/src/common/package.ts +4 -3
  42. package/src/common/scaffold.ts +4 -0
  43. package/src/plugin.ts +4 -4
@@ -466,13 +466,14 @@ export async function retrievePiletsInfo(entryFile: string) {
466
466
  fail('packageJsonMissing_0074');
467
467
  }
468
468
 
469
+ const root = dirname(packageJson);
469
470
  const packageInfo = require(packageJson);
470
471
  const allDeps = {
471
472
  ...packageInfo.devDependencies,
472
473
  ...packageInfo.dependencies,
473
474
  };
474
475
  const info = getPiletsInfo(packageInfo);
475
- const externals = makeExternals(allDeps, info.externals);
476
+ const externals = makeExternals(root, allDeps, info.externals);
476
477
 
477
478
  return {
478
479
  ...info,
@@ -486,7 +487,7 @@ export async function retrievePiletsInfo(entryFile: string) {
486
487
  },
487
488
  scripts: packageInfo.scripts,
488
489
  ignored: checkArrayOrUndefined(packageInfo, 'preservedDependencies'),
489
- root: dirname(packageJson),
490
+ root,
490
491
  };
491
492
  }
492
493
 
@@ -524,7 +525,7 @@ export async function patchPiletPackage(
524
525
  }
525
526
  : info.scripts;
526
527
  const peerModules = [];
527
- const allExternals = makePiletExternals(piralDependencies, externals, fromEmulator, piralInfo);
528
+ const allExternals = makePiletExternals(root, piralDependencies, externals, fromEmulator, piralInfo);
528
529
  const peerDependencies = {
529
530
  ...allExternals.reduce((deps, name) => {
530
531
  const valid = isValidDependency(name);
@@ -36,6 +36,10 @@ async function getTemplateFiles(
36
36
  if (templatePackageName.startsWith('.')) {
37
37
  templatePackageName = resolve(process.cwd(), templatePackageName);
38
38
  } else {
39
+ if (templatePackageName.indexOf('@', 1) === -1) {
40
+ templatePackageName = `${templatePackageName}@latest`;
41
+ }
42
+
39
43
  await installNpmPackage('npm', templatePackageName, __dirname, '--registry', registry);
40
44
  }
41
45
 
package/src/plugin.ts CHANGED
@@ -6,11 +6,11 @@ import { inject } from './inject';
6
6
  function getContainerDir() {
7
7
  const currentDir = __dirname.split(sep).join(posix.sep);
8
8
 
9
- if (currentDir.includes(`/.pnpm/${cliName}@${cliVersion}/node_modules/${cliName}/`)) {
10
- return resolve(__dirname, '..', '..', '..', '..', '..');
9
+ if (!currentDir.includes(`/.pnpm/${cliName}@${cliVersion}/node_modules/${cliName}/`)) {
10
+ return resolve(__dirname, '..', '..');
11
11
  }
12
12
 
13
- return resolve(__dirname, '..', '..');
13
+ return undefined;
14
14
  }
15
15
 
16
16
  async function getLocalPackageDir() {
@@ -25,7 +25,7 @@ async function getLocalPackageDir() {
25
25
  // Right now we always take the first one, but in the future this may be different
26
26
  // once we come up with more / better criteria to identify if its a good/valid
27
27
  // plugin root directory
28
- for (const dir of proposedDirs) {
28
+ for (const dir of proposedDirs.filter(Boolean)) {
29
29
  log('generalDebug_0003', `Checking for potential plugin directory "${dir}" ...`);
30
30
 
31
31
  if (await isDirectory(dir)) {