piral-cli 0.15.0-alpha.4122 → 0.15.0-alpha.4231

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 (124) hide show
  1. package/lib/apps/new-pilet.js +5 -9
  2. package/lib/apps/new-pilet.js.map +1 -1
  3. package/lib/apps/new-piral.js +5 -3
  4. package/lib/apps/new-piral.js.map +1 -1
  5. package/lib/apps/publish-pilet.d.ts +4 -0
  6. package/lib/apps/publish-pilet.js +4 -3
  7. package/lib/apps/publish-pilet.js.map +1 -1
  8. package/lib/apps/publish-piral.d.ts +4 -0
  9. package/lib/apps/publish-piral.js +9 -7
  10. package/lib/apps/publish-piral.js.map +1 -1
  11. package/lib/apps/upgrade-pilet.js +2 -8
  12. package/lib/apps/upgrade-pilet.js.map +1 -1
  13. package/lib/apps/upgrade-piral.js +1 -1
  14. package/lib/apps/upgrade-piral.js.map +1 -1
  15. package/lib/bundler.js +1 -1
  16. package/lib/bundler.js.map +1 -1
  17. package/lib/commands.js +8 -0
  18. package/lib/commands.js.map +1 -1
  19. package/lib/common/browser.d.ts +1 -0
  20. package/lib/common/browser.js +16 -10
  21. package/lib/common/browser.js.map +1 -1
  22. package/lib/common/clients/index.d.ts +19 -0
  23. package/lib/common/clients/index.js +40 -0
  24. package/lib/common/clients/index.js.map +1 -0
  25. package/lib/common/clients/lerna.d.ts +6 -1
  26. package/lib/common/clients/lerna.js +67 -3
  27. package/lib/common/clients/lerna.js.map +1 -1
  28. package/lib/common/clients/npm.d.ts +4 -1
  29. package/lib/common/clients/npm.js +37 -16
  30. package/lib/common/clients/npm.js.map +1 -1
  31. package/lib/common/clients/pnpm.d.ts +4 -0
  32. package/lib/common/clients/pnpm.js +43 -9
  33. package/lib/common/clients/pnpm.js.map +1 -1
  34. package/lib/common/clients/rush.d.ts +6 -0
  35. package/lib/common/clients/rush.js +118 -0
  36. package/lib/common/clients/rush.js.map +1 -0
  37. package/lib/common/clients/yarn.d.ts +4 -0
  38. package/lib/common/clients/yarn.js +45 -11
  39. package/lib/common/clients/yarn.js.map +1 -1
  40. package/lib/common/declaration.js +12 -9
  41. package/lib/common/declaration.js.map +1 -1
  42. package/lib/common/emulator.js +2 -2
  43. package/lib/common/emulator.js.map +1 -1
  44. package/lib/common/http.d.ts +1 -1
  45. package/lib/common/http.js +12 -7
  46. package/lib/common/http.js.map +1 -1
  47. package/lib/common/info.d.ts +4 -0
  48. package/lib/common/info.js +6 -1
  49. package/lib/common/info.js.map +1 -1
  50. package/lib/common/inspect.js +2 -1
  51. package/lib/common/inspect.js.map +1 -1
  52. package/lib/common/interactive.d.ts +9 -0
  53. package/lib/common/interactive.js +31 -1
  54. package/lib/common/interactive.js.map +1 -1
  55. package/lib/common/io.js +1 -1
  56. package/lib/common/io.js.map +1 -1
  57. package/lib/common/npm.d.ts +9 -16
  58. package/lib/common/npm.js +110 -152
  59. package/lib/common/npm.js.map +1 -1
  60. package/lib/common/pack.js +1 -1
  61. package/lib/common/pack.js.map +1 -1
  62. package/lib/common/package.d.ts +6 -6
  63. package/lib/common/package.js +13 -4
  64. package/lib/common/package.js.map +1 -1
  65. package/lib/common/scaffold.js +5 -2
  66. package/lib/common/scaffold.js.map +1 -1
  67. package/lib/common/version.js +4 -4
  68. package/lib/common/version.js.map +1 -1
  69. package/lib/external/index.js +1982 -92
  70. package/lib/helpers.js +1 -1
  71. package/lib/helpers.js.map +1 -1
  72. package/lib/injectors/pilet.js +2 -2
  73. package/lib/injectors/pilet.js.map +1 -1
  74. package/lib/messages.d.ts +1 -1
  75. package/lib/messages.js.map +1 -1
  76. package/lib/plugin.js +27 -2
  77. package/lib/plugin.js.map +1 -1
  78. package/lib/release.d.ts +1 -1
  79. package/lib/release.js +7 -2
  80. package/lib/release.js.map +1 -1
  81. package/lib/types/common.d.ts +1 -1
  82. package/lib/types/internal.d.ts +9 -1
  83. package/lib/types/public.d.ts +1 -1
  84. package/package.json +5 -3
  85. package/src/apps/new-pilet.ts +9 -14
  86. package/src/apps/new-piral.ts +9 -5
  87. package/src/apps/publish-pilet.ts +10 -3
  88. package/src/apps/publish-piral.ts +21 -6
  89. package/src/apps/upgrade-pilet.ts +4 -12
  90. package/src/apps/upgrade-piral.ts +2 -2
  91. package/src/bundler.test.ts +1 -1
  92. package/src/bundler.ts +2 -2
  93. package/src/commands.ts +8 -0
  94. package/src/common/browser.ts +12 -8
  95. package/src/common/clients/index.ts +33 -0
  96. package/src/common/clients/lerna.ts +61 -1
  97. package/src/common/clients/npm.ts +32 -15
  98. package/src/common/clients/pnpm.ts +39 -10
  99. package/src/common/clients/rush.ts +111 -0
  100. package/src/common/clients/yarn.ts +41 -12
  101. package/src/common/declaration.ts +15 -9
  102. package/src/common/emulator.ts +3 -3
  103. package/src/common/http.ts +20 -6
  104. package/src/common/info.ts +6 -1
  105. package/src/common/inspect.ts +2 -1
  106. package/src/common/interactive.test.ts +3 -0
  107. package/src/common/interactive.ts +48 -1
  108. package/src/common/io.ts +1 -1
  109. package/src/common/npm.test.ts +109 -76
  110. package/src/common/npm.ts +119 -146
  111. package/src/common/pack.test.ts +1 -1
  112. package/src/common/pack.ts +2 -2
  113. package/src/common/package.ts +19 -10
  114. package/src/common/scaffold.ts +6 -2
  115. package/src/common/version.ts +4 -4
  116. package/src/external/index.ts +2 -1
  117. package/src/helpers.ts +1 -1
  118. package/src/injectors/pilet.ts +3 -3
  119. package/src/messages.ts +1 -1
  120. package/src/plugin.ts +34 -5
  121. package/src/release.ts +10 -2
  122. package/src/types/common.ts +1 -1
  123. package/src/types/internal.ts +6 -1
  124. package/src/types/public.ts +1 -1
package/src/plugin.ts CHANGED
@@ -1,10 +1,39 @@
1
1
  import { readdir, stat } from 'fs';
2
- import { join, resolve } from 'path';
3
- import { log } from './common';
2
+ import { join, resolve, sep, posix } from 'path';
3
+ import { cliName, cliVersion, log } from './common';
4
4
  import { inject } from './inject';
5
5
 
6
- function getLocalPackageDir() {
7
- return resolve(__dirname, '..', '..');
6
+ function getContainerDir() {
7
+ const currentDir = __dirname.split(sep).join(posix.sep);
8
+
9
+ if (!currentDir.includes(`/.pnpm/${cliName}@${cliVersion}/node_modules/${cliName}/`)) {
10
+ return resolve(__dirname, '..', '..');
11
+ }
12
+
13
+ return undefined;
14
+ }
15
+
16
+ async function getLocalPackageDir() {
17
+ const proposedDirs = [
18
+ getContainerDir(),
19
+ resolve(process.cwd(), 'node_modules'),
20
+ resolve(process.cwd(), '..', 'node_modules'),
21
+ resolve(process.cwd(), '..', '..', 'node_modules'),
22
+ resolve(process.cwd(), '..', '..', '..', 'node_modules'),
23
+ ];
24
+
25
+ // Right now we always take the first one, but in the future this may be different
26
+ // once we come up with more / better criteria to identify if its a good/valid
27
+ // plugin root directory
28
+ for (const dir of proposedDirs.filter(Boolean)) {
29
+ log('generalDebug_0003', `Checking for potential plugin directory "${dir}" ...`);
30
+
31
+ if (await isDirectory(dir)) {
32
+ return dir;
33
+ }
34
+ }
35
+
36
+ return undefined;
8
37
  }
9
38
 
10
39
  function isDirectory(dir: string) {
@@ -83,7 +112,7 @@ async function getAllPlugins(rootDir: string): Promise<Array<string>> {
83
112
  }
84
113
 
85
114
  export async function loadPlugins() {
86
- const localDir = getLocalPackageDir();
115
+ const localDir = await getLocalPackageDir();
87
116
  const allPlugins = await getAllPlugins(localDir);
88
117
 
89
118
  for (const pluginPath of allPlugins) {
package/src/release.ts CHANGED
@@ -21,6 +21,9 @@ const providers: Record<string, ReleaseProvider> = {
21
21
 
22
22
  await Promise.all(files.map(async (file) => copy(file, resolve(target, basename(file)))));
23
23
  },
24
+ async feed(files, args, interactive) {
25
+ //TODO post files to Piral Feed Service
26
+ },
24
27
  };
25
28
 
26
29
  function findReleaseProvider(providerName: string) {
@@ -43,7 +46,12 @@ export function setReleaseProvider(provider: QualifiedReleaseProvider) {
43
46
  }
44
47
  }
45
48
 
46
- export function publishArtifacts(providerName: string, files: Array<string>, args: Record<string, string>) {
49
+ export function publishArtifacts(
50
+ providerName: string,
51
+ files: Array<string>,
52
+ args: Record<string, string>,
53
+ interactive: boolean,
54
+ ) {
47
55
  const runRelease = findReleaseProvider(providerName);
48
- return runRelease(files, args);
56
+ return runRelease(files, args, interactive);
49
57
  }
@@ -42,7 +42,7 @@ export interface Bundler {
42
42
  }
43
43
 
44
44
  export interface ReleaseProvider {
45
- (files: Array<string>, args: Record<string, string>): Promise<void>;
45
+ (files: Array<string>, args: Record<string, string>, interactive: boolean): Promise<void>;
46
46
  }
47
47
 
48
48
  export interface TemplateFileLocation {
@@ -1,4 +1,4 @@
1
- import { LogLevels } from './common';
1
+ import type { LogLevels, PiletsInfo } from './common';
2
2
 
3
3
  export interface PackageData {
4
4
  name: string;
@@ -13,6 +13,11 @@ export interface PackageData {
13
13
  email?: string;
14
14
  };
15
15
  custom?: any;
16
+ pilets?: PiletsInfo;
17
+ piralCLI?: { generated: boolean; version: string };
18
+ dependencies: Record<string, string>;
19
+ peerDependencies: Record<string, string>;
20
+ devDependencies: Record<string, string>;
16
21
  }
17
22
 
18
23
  export interface PackageFiles {
@@ -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';
232
+ export type NpmClientType = 'npm' | 'yarn' | 'pnpm' | 'lerna' | 'rush';
233
233
 
234
234
  export type Framework = 'piral-native' | 'piral' | 'piral-core' | 'piral-base';
235
235