piral-cli 0.15.0-alpha.4257 → 0.15.0-alpha.4314

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 (111) hide show
  1. package/README.md +7 -5
  2. package/lib/apps/debug-pilet.js +2 -1
  3. package/lib/apps/debug-pilet.js.map +1 -1
  4. package/lib/apps/debug-piral.js +2 -1
  5. package/lib/apps/debug-piral.js.map +1 -1
  6. package/lib/apps/new-pilet.d.ts +2 -2
  7. package/lib/apps/new-pilet.js +3 -3
  8. package/lib/apps/new-pilet.js.map +1 -1
  9. package/lib/apps/new-piral.d.ts +2 -2
  10. package/lib/apps/new-piral.js +6 -5
  11. package/lib/apps/new-piral.js.map +1 -1
  12. package/lib/apps/publish-piral.d.ts +2 -2
  13. package/lib/apps/publish-piral.js +9 -8
  14. package/lib/apps/publish-piral.js.map +1 -1
  15. package/lib/apps/upgrade-pilet.js +3 -3
  16. package/lib/apps/upgrade-pilet.js.map +1 -1
  17. package/lib/apps/upgrade-piral.js +2 -2
  18. package/lib/apps/upgrade-piral.js.map +1 -1
  19. package/lib/commands.js +8 -8
  20. package/lib/commands.js.map +1 -1
  21. package/lib/common/clients/index.d.ts +3 -1
  22. package/lib/common/clients/index.js +3 -1
  23. package/lib/common/clients/index.js.map +1 -1
  24. package/lib/common/clients/npm.d.ts +1 -0
  25. package/lib/common/clients/npm.js +7 -1
  26. package/lib/common/clients/npm.js.map +1 -1
  27. package/lib/common/clients/pnp.d.ts +6 -0
  28. package/lib/common/clients/pnp.js +95 -0
  29. package/lib/common/clients/pnp.js.map +1 -0
  30. package/lib/common/clients/yarn.js +3 -3
  31. package/lib/common/clients/yarn.js.map +1 -1
  32. package/lib/common/config.d.ts +1 -2
  33. package/lib/common/config.js +1 -2
  34. package/lib/common/config.js.map +1 -1
  35. package/lib/common/emulator.js +1 -1
  36. package/lib/common/emulator.js.map +1 -1
  37. package/lib/common/enums.d.ts +0 -4
  38. package/lib/common/enums.js +1 -6
  39. package/lib/common/enums.js.map +1 -1
  40. package/lib/common/http.d.ts +4 -2
  41. package/lib/common/http.js +25 -11
  42. package/lib/common/http.js.map +1 -1
  43. package/lib/common/interactive.js +10 -5
  44. package/lib/common/interactive.js.map +1 -1
  45. package/lib/common/language.d.ts +3 -13
  46. package/lib/common/language.js +52 -12
  47. package/lib/common/language.js.map +1 -1
  48. package/lib/common/log.d.ts +1 -0
  49. package/lib/common/log.js +9 -2
  50. package/lib/common/log.js.map +1 -1
  51. package/lib/common/npm.d.ts +1 -1
  52. package/lib/common/npm.js +13 -5
  53. package/lib/common/npm.js.map +1 -1
  54. package/lib/common/package.d.ts +9 -3
  55. package/lib/common/package.js +11 -25
  56. package/lib/common/package.js.map +1 -1
  57. package/lib/common/port.d.ts +1 -0
  58. package/lib/common/port.js +11 -1
  59. package/lib/common/port.js.map +1 -1
  60. package/lib/common/scaffold.d.ts +12 -10
  61. package/lib/common/scaffold.js +6 -12
  62. package/lib/common/scaffold.js.map +1 -1
  63. package/lib/common/template.d.ts +1 -3
  64. package/lib/common/template.js +21 -47
  65. package/lib/common/template.js.map +1 -1
  66. package/lib/helpers.d.ts +3 -5
  67. package/lib/helpers.js +3 -21
  68. package/lib/helpers.js.map +1 -1
  69. package/lib/messages.d.ts +83 -5
  70. package/lib/messages.js +95 -8
  71. package/lib/messages.js.map +1 -1
  72. package/lib/release.d.ts +1 -1
  73. package/lib/release.js +32 -5
  74. package/lib/release.js.map +1 -1
  75. package/lib/types/common.d.ts +1 -2
  76. package/lib/types/public.d.ts +2 -1
  77. package/package.json +3 -5
  78. package/src/apps/debug-pilet.ts +3 -1
  79. package/src/apps/debug-piral.ts +3 -1
  80. package/src/apps/new-pilet.test.ts +1 -2
  81. package/src/apps/new-pilet.ts +4 -4
  82. package/src/apps/new-piral.test.ts +1 -2
  83. package/src/apps/new-piral.ts +8 -12
  84. package/src/apps/publish-piral.ts +21 -10
  85. package/src/apps/upgrade-pilet.ts +3 -3
  86. package/src/apps/upgrade-piral.ts +2 -1
  87. package/src/commands.ts +9 -10
  88. package/src/common/clients/index.ts +3 -1
  89. package/src/common/clients/npm.ts +4 -0
  90. package/src/common/clients/pnp.ts +77 -0
  91. package/src/common/clients/yarn.ts +3 -3
  92. package/src/common/config.ts +2 -3
  93. package/src/common/emulator.ts +2 -2
  94. package/src/common/enums.ts +0 -5
  95. package/src/common/http.ts +37 -14
  96. package/src/common/interactive.ts +12 -7
  97. package/src/common/language.ts +66 -11
  98. package/src/common/log.ts +9 -1
  99. package/src/common/npm.ts +21 -6
  100. package/src/common/package.test.ts +11 -3
  101. package/src/common/package.ts +20 -34
  102. package/src/common/port.ts +10 -0
  103. package/src/common/scaffold.ts +8 -16
  104. package/src/common/template.ts +19 -40
  105. package/src/helpers.test.ts +2 -22
  106. package/src/helpers.ts +4 -24
  107. package/src/messages.ts +93 -6
  108. package/src/release.ts +40 -6
  109. package/src/types/common.ts +1 -2
  110. package/src/types/public.ts +3 -1
  111. package/templates/piral-index.js.ejs +0 -16
@@ -1,53 +1,32 @@
1
- import { renderFile } from 'ejs';
2
- import { writeFile } from 'fs';
3
- import { resolve } from 'path';
4
- import { log } from './log';
5
1
  import { ForceOverwrite } from './enums';
6
2
  import { createFileIfNotExists } from './io';
7
3
 
8
- export async function applyTemplate(file: string, data: Record<string, string>) {
9
- const content = await new Promise<string>((resolve, reject) => {
10
- log('generalDebug_0003', `Filling template in "${file}".`);
11
- renderFile(file, data, (err, str) => {
12
- if (err) {
13
- reject(err);
14
- } else {
15
- resolve(str);
16
- }
17
- });
18
- });
19
- await new Promise<void>((resolve, reject) => {
20
- writeFile(file, content, 'utf8', (err) => {
21
- if (err) {
22
- reject(err);
23
- } else {
24
- resolve();
25
- }
26
- });
27
- });
28
- }
4
+ function fillTemplate(data: any = {}) {
5
+ return `if (process.env.NODE_ENV === 'test') {
6
+ // behavior for the test environment, we'll try to make it work
29
7
 
30
- export function fillTemplate(name: string, data: any = {}) {
31
- const path = resolve(__dirname, '..', '..', 'templates', `${name}.ejs`);
32
- return new Promise<string>((resolve, reject) => {
33
- log('generalDebug_0003', `Rendering template "${name}" in "${path}".`);
34
- renderFile(path, data, (err, str) => {
35
- if (err) {
36
- reject(err);
37
- } else {
38
- resolve(str);
39
- }
40
- });
41
- });
8
+ if (typeof window !== 'undefined') {
9
+ require('./${data.outFile}');
10
+ const ctx = window['dbg:piral'];
11
+ const dependencies = (ctx && ctx.pilets && ctx.pilets.getDependencies({})) || {};
12
+ module.exports = dependencies['${data.name}'] || {};
13
+ } else {
14
+ console.error('Your test environment does not define "window". Please make sure to provide a proper environment.');
15
+ module.exports = {};
16
+ }
17
+ } else {
18
+ // under "normal" circumstances disallow such an import
19
+ throw new Error("This file should not be included anywhere. Usually, this means you've imported the Piral instance directly.");
20
+ }
21
+ `;
42
22
  }
43
23
 
44
- export async function createFileFromTemplateIfNotExists(
45
- prefix: string,
24
+ export async function createPiralStubIndexIfNotExists(
46
25
  targetDir: string,
47
26
  fileName: string,
48
27
  forceOverwrite?: ForceOverwrite,
49
28
  data?: any,
50
29
  ) {
51
- const content = await fillTemplate(`${prefix}-${fileName}`, data);
30
+ const content = fillTemplate(data);
52
31
  await createFileIfNotExists(targetDir, fileName, content, forceOverwrite);
53
32
  }
@@ -1,5 +1,5 @@
1
- import { keyOfForceOverwrite, keyOfSourceLanguage, valueOfForceOverwrite, valueOfSourceLanguage } from './helpers';
2
- import { ForceOverwrite, SourceLanguage } from './common/enums';
1
+ import { keyOfForceOverwrite, valueOfForceOverwrite } from './helpers';
2
+ import { ForceOverwrite } from './common/enums';
3
3
 
4
4
  describe('Piral CLI Command Helpers Module', () => {
5
5
  it('correct value of keyOfForceOverwrite results in same key', () => {
@@ -12,16 +12,6 @@ describe('Piral CLI Command Helpers Module', () => {
12
12
  expect(result).toBe('no');
13
13
  });
14
14
 
15
- it('correct value of keyOfPiletLanguage results in same key', () => {
16
- const result = keyOfSourceLanguage(SourceLanguage.ts);
17
- expect(result).toBe('ts');
18
- });
19
-
20
- it('incorrect value of keyOfPiletLanguage results in key for TS', () => {
21
- const result = keyOfSourceLanguage(5);
22
- expect(result).toBe('ts');
23
- });
24
-
25
15
  it('correct key of valueOfForceOverwrite results in same value', () => {
26
16
  const result = valueOfForceOverwrite('prompt');
27
17
  expect(result).toBe(ForceOverwrite.prompt);
@@ -31,14 +21,4 @@ describe('Piral CLI Command Helpers Module', () => {
31
21
  const result = valueOfForceOverwrite('foo');
32
22
  expect(result).toBe(ForceOverwrite.no);
33
23
  });
34
-
35
- it('correct key of valueOfPiletLanguage results in same value', () => {
36
- const result = valueOfSourceLanguage('ts');
37
- expect(result).toBe(SourceLanguage.ts);
38
- });
39
-
40
- it('incorrect key of valueOfPiletLanguage results in value for TS', () => {
41
- const result = valueOfSourceLanguage('foo');
42
- expect(result).toBe(SourceLanguage.ts);
43
- });
44
24
  });
package/src/helpers.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ForceOverwrite, SourceLanguage } from './common/enums';
1
+ import { ForceOverwrite } from './common/enums';
2
2
  import { bundlerNames, frameworkLibs } from './common/constants';
3
3
  import type {
4
4
  Framework,
@@ -8,6 +8,7 @@ import type {
8
8
  PiralBuildType,
9
9
  PiletBuildType,
10
10
  PiletPublishScheme,
11
+ SourceLanguage,
11
12
  } from './types';
12
13
 
13
14
  export const schemaKeys: Array<PiletSchemaVersion> = ['v0', 'v1', 'v2', 'none'];
@@ -15,7 +16,8 @@ export const publishModeKeys: Array<PiletPublishScheme> = ['none', 'basic', 'bea
15
16
  export const fromKeys: Array<PiletPublishSource> = ['local', 'remote', 'npm'];
16
17
  export const piralBuildTypeKeys: Array<PiralBuildType> = ['all', 'release', 'emulator', 'emulator-sources'];
17
18
  export const piletBuildTypeKeys: Array<PiletBuildType> = ['default', 'standalone', 'manifest'];
18
- export const clientTypeKeys: Array<NpmClientType> = ['npm', 'pnpm', 'yarn', 'lerna', 'rush'];
19
+ export const clientTypeKeys: Array<NpmClientType> = ['npm', 'pnpm', 'pnp', 'yarn', 'lerna', 'rush'];
20
+ export const sourceLanguageKeys: Array<SourceLanguage> = ['ts', 'js'];
19
21
  export const bundlerKeys: Array<string> = ['none', ...bundlerNames];
20
22
  export const availableBundlers: Array<string> = [];
21
23
  export const availableReleaseProviders: Array<string> = [];
@@ -41,25 +43,3 @@ export function keyOfForceOverwrite(value: ForceOverwrite) {
41
43
 
42
44
  return forceOverwriteKeys[0];
43
45
  }
44
-
45
- export const sourceLanguageKeys = Object.keys(SourceLanguage).filter((m) => typeof SourceLanguage[m] === 'number');
46
-
47
- export function valueOfSourceLanguage(key: string): SourceLanguage {
48
- for (const piletLanguageKey of sourceLanguageKeys) {
49
- if (piletLanguageKey === key) {
50
- return SourceLanguage[piletLanguageKey];
51
- }
52
- }
53
-
54
- return SourceLanguage.ts;
55
- }
56
-
57
- export function keyOfSourceLanguage(value: SourceLanguage) {
58
- for (const piletLanguageKey of sourceLanguageKeys) {
59
- if (SourceLanguage[piletLanguageKey] === value) {
60
- return piletLanguageKey;
61
- }
62
- }
63
-
64
- return sourceLanguageKeys[0];
65
- }
package/src/messages.ts CHANGED
@@ -953,6 +953,41 @@ export function cannotFindFile_0046(file: string): QuickMessage {
953
953
  return [LogLevels.error, '0046', `The file "${file}" does not exist!`];
954
954
  }
955
955
 
956
+ /**
957
+ * @kind Warning
958
+ *
959
+ * @summary
960
+ * Reported when the provided / default port was not available.
961
+ *
962
+ * @abstract
963
+ * By default, the debug commands spawn at the port 1234. However, under certain
964
+ * circumstances (e.g., another debug command running somewhere) this port may not
965
+ * be free.
966
+ *
967
+ * The piral-cli can select a new port, which is free, however, it will still report
968
+ * a warning message in such cases. You can then always abort the current debug
969
+ * process and start a new one - either closing the other run blocking the port or
970
+ * explicitly selecting a new one using the `--port` flag.
971
+ *
972
+ * @see
973
+ * - [Port (computer networking)](https://en.wikipedia.org/wiki/Port_(computer_networking))
974
+ *
975
+ * @example
976
+ * If you start one process to debug an app shell using `piral debug` and another process
977
+ * to debug some pilet using `pilet debug` both processes would want to run on the default
978
+ * port 1234.
979
+ *
980
+ * As a mitigation you can now either be very explicit, e.g., `piral debug --port 1010` and
981
+ * `pilet debug --port 1020` or you can just drop one of the two and always only run a single
982
+ * debug process.
983
+ *
984
+ * In any case, running both without any options also works, but then a new port will be chosen.
985
+ * The output of the Piral CLI will always show you what port is currently used.
986
+ */
987
+ export function portNotFree_0047(newPort: number, oldPort: number): QuickMessage {
988
+ return [LogLevels.warning, '0047', `The selected port "${oldPort}" is already used. Changed port to "${newPort}".`];
989
+ }
990
+
956
991
  /**
957
992
  * @kind Warning
958
993
  *
@@ -2182,24 +2217,24 @@ export function publishEmulatorFilesUnexpected_0111(directory: string): QuickMes
2182
2217
  * @kind Error
2183
2218
  *
2184
2219
  * @summary
2185
- * The "xcopy" provider requires a "--fields.target" argument.
2220
+ * The "xcopy" provider requires a "--opts.target" argument.
2186
2221
  *
2187
2222
  * @abstract
2188
2223
  * The `piral publish --type release` command requires the selection of a suitable
2189
2224
  * provider for running successfully. The "xcopy" provider just copies the sources from
2190
2225
  * the output directory (source) to a specified target directory.
2191
2226
  *
2192
- * 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.
2193
2228
  *
2194
2229
  * @example
2195
2230
  * The following command would specify `/temp/dest` as target directory:
2196
2231
  *
2197
2232
  * ```sh
2198
- * piral publish --type release --provider xcopy --fields.target "/temp/dest"
2233
+ * piral publish --type release --provider xcopy --opts.target "/temp/dest"
2199
2234
  * ```
2200
2235
  */
2201
2236
  export function publishXcopyMissingTarget_0112(): QuickMessage {
2202
- 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.`];
2203
2238
  }
2204
2239
 
2205
2240
  /**
@@ -2222,7 +2257,7 @@ export function publishXcopyMissingTarget_0112(): QuickMessage {
2222
2257
  * The following command uses the in-built "xcopy" provider for releasing to a local directory.
2223
2258
  *
2224
2259
  * ```sh
2225
- * piral publish --type release --provider xcopy --fields.target "/temp/dest"
2260
+ * piral publish --type release --provider xcopy --opts.target "/temp/dest"
2226
2261
  * ```
2227
2262
  */
2228
2263
  export function publishProviderMissing_0113(providerName: string, availableProviders: Array<string>): QuickMessage {
@@ -2243,7 +2278,7 @@ export function publishProviderMissing_0113(providerName: string, availableProvi
2243
2278
  * The following command uses the in-built "xcopy" provider for releasing to a local directory.
2244
2279
  *
2245
2280
  * ```sh
2246
- * piral publish --type release --provider xcopy --fields.target "/temp/dest"
2281
+ * piral publish --type release --provider xcopy --opts.target "/temp/dest"
2247
2282
  * ```
2248
2283
  *
2249
2284
  * The type is "release".
@@ -2256,6 +2291,58 @@ export function publishEmulatorSourcesInvalid_0114(): QuickMessage {
2256
2291
  ];
2257
2292
  }
2258
2293
 
2294
+ /**
2295
+ * @kind Error
2296
+ *
2297
+ * @summary
2298
+ * The "feed" provider requires a "--opts.url" argument.
2299
+ *
2300
+ * @abstract
2301
+ * The `piral publish --type release` command requires the selection of a suitable
2302
+ * provider for running successfully. The "feed" provider releases the files to
2303
+ * the a Piral Feed Service with the static page feature.
2304
+ *
2305
+ * Make sure to supply the URL for the feed service via the `--opts.url` command
2306
+ * line flag.
2307
+ *
2308
+ * @example
2309
+ * The following command would specify `https://feed.piral.cloud/api/v1/feed/sample/page`
2310
+ * for the feed service:
2311
+ *
2312
+ * ```sh
2313
+ * piral publish --type release --provider feed --opts.url "https://feed.piral.cloud/api/v1/feed/sample/page" --opts.apikey "foobar123"
2314
+ * ```
2315
+ */
2316
+ export function publishFeedMissingUrl_0115(): QuickMessage {
2317
+ return [LogLevels.error, '0115', `The "feed" provider requires a "--opts.url" argument.`];
2318
+ }
2319
+
2320
+ /**
2321
+ * @kind Error
2322
+ *
2323
+ * @summary
2324
+ * The "feed" provider requires a "--opts.version" argument.
2325
+ *
2326
+ * @abstract
2327
+ * The `piral publish --type release` command requires the selection of a suitable
2328
+ * provider for running successfully. The "feed" provider releases the files to
2329
+ * the a Piral Feed Service with the static page feature.
2330
+ *
2331
+ * Make sure to supply the version either explicitly via the `--opts.version` argument
2332
+ * or implicitly by having the artifacts stored in a sub-directory of the project's root,
2333
+ * which contains a package.json with the version to use.
2334
+ *
2335
+ * @example
2336
+ * The following command would specify version "1.2.3" for the feed service:
2337
+ *
2338
+ * ```sh
2339
+ * piral publish --type release --provider feed --opts.url "..." --opts.apikey "..." --opts.version "1.2.3"
2340
+ * ```
2341
+ */
2342
+ export function publishFeedMissingVersion_0116(): QuickMessage {
2343
+ return [LogLevels.error, '0116', `The "feed" provider requires either a "--opts.version" argument or a package.json with a version.`];
2344
+ }
2345
+
2259
2346
  /**
2260
2347
  * @kind Warning
2261
2348
  *
package/src/release.ts CHANGED
@@ -1,8 +1,19 @@
1
- import { basename, resolve } from 'path';
2
- import { copy, fail } from './common';
1
+ import { basename, dirname, relative, resolve } from 'path';
2
+ import { copy, fail, findFile, FormDataObj, postForm, readBinary } from './common';
3
3
  import { availableReleaseProviders } from './helpers';
4
4
  import { ReleaseProvider } from './types';
5
5
 
6
+ async function getVersion(directory: string) {
7
+ const data = await findFile(directory, 'package.json');
8
+
9
+ if (!data) {
10
+ fail('packageJsonNotFound_0020');
11
+ }
12
+
13
+ const { version } = require(data);
14
+ return version;
15
+ }
16
+
6
17
  export interface QualifiedReleaseProvider {
7
18
  name: string;
8
19
  action: ReleaseProvider;
@@ -12,7 +23,7 @@ const providers: Record<string, ReleaseProvider> = {
12
23
  none() {
13
24
  return Promise.resolve();
14
25
  },
15
- async xcopy(files, args) {
26
+ async xcopy(_, files, args) {
16
27
  const { target } = args;
17
28
 
18
29
  if (!target) {
@@ -21,8 +32,30 @@ const providers: Record<string, ReleaseProvider> = {
21
32
 
22
33
  await Promise.all(files.map(async (file) => copy(file, resolve(target, basename(file)))));
23
34
  },
24
- async feed(files, args, interactive) {
25
- //TODO post files to Piral Feed Service
35
+ async feed(directory, files, args, interactive) {
36
+ const { url, apiKey, scheme = 'basic', version = await getVersion(directory) } = args;
37
+
38
+ if (!url) {
39
+ fail('publishFeedMissingUrl_0115');
40
+ }
41
+
42
+ if (!version) {
43
+ fail('publishFeedMissingVersion_0116');
44
+ }
45
+
46
+ const data: FormDataObj = {
47
+ version,
48
+ type: 'custom',
49
+ };
50
+
51
+ for (const file of files) {
52
+ const relPath = relative(directory, file);
53
+ const fileName = basename(file);
54
+ const content = await readBinary(dirname(file), fileName);
55
+ data[relPath] = [content, fileName];
56
+ }
57
+
58
+ await postForm(url, scheme as any, apiKey, data, {}, undefined, interactive);
26
59
  },
27
60
  };
28
61
 
@@ -48,10 +81,11 @@ export function setReleaseProvider(provider: QualifiedReleaseProvider) {
48
81
 
49
82
  export function publishArtifacts(
50
83
  providerName: string,
84
+ directory: string,
51
85
  files: Array<string>,
52
86
  args: Record<string, string>,
53
87
  interactive: boolean,
54
88
  ) {
55
89
  const runRelease = findReleaseProvider(providerName);
56
- return runRelease(files, args, interactive);
90
+ return runRelease(directory, files, args, interactive);
57
91
  }
@@ -42,13 +42,12 @@ export interface Bundler {
42
42
  }
43
43
 
44
44
  export interface ReleaseProvider {
45
- (files: Array<string>, args: Record<string, string>, interactive: boolean): Promise<void>;
45
+ (directory: string, files: Array<string>, args: Record<string, string>, interactive: boolean): Promise<void>;
46
46
  }
47
47
 
48
48
  export interface TemplateFileLocation {
49
49
  from: string;
50
50
  to: string;
51
- template?: boolean;
52
51
  deep?: boolean;
53
52
  once?: boolean;
54
53
  }
@@ -219,6 +219,8 @@ export interface BundlerDefinition {
219
219
 
220
220
  export type PiletSchemaVersion = 'none' | 'v0' | 'v1' | 'v2';
221
221
 
222
+ export type SourceLanguage = 'js' | 'ts';
223
+
222
224
  export type PiletPublishScheme = 'none' | 'digest' | 'bearer' | 'basic';
223
225
 
224
226
  export type PiletPublishSource = 'local' | 'npm' | 'remote';
@@ -229,7 +231,7 @@ export type PiletBuildType = 'default' | 'standalone' | 'manifest';
229
231
 
230
232
  export type PackageType = 'registry' | 'file' | 'git';
231
233
 
232
- export type NpmClientType = 'npm' | 'yarn' | 'pnpm' | 'lerna' | 'rush';
234
+ export type NpmClientType = 'npm' | 'yarn' | 'pnp' | 'pnpm' | 'lerna' | 'rush';
233
235
 
234
236
  export type Framework = 'piral-native' | 'piral' | 'piral-core' | 'piral-base';
235
237
 
@@ -1,16 +0,0 @@
1
- if (process.env.NODE_ENV === 'test') {
2
- // behavior for the test environment, we'll try to make it work
3
-
4
- if (typeof window !== 'undefined') {
5
- require('./<%- outFile %>');
6
- const ctx = window['dbg:piral'];
7
- const dependencies = (ctx && ctx.pilets && ctx.pilets.getDependencies({})) || {};
8
- module.exports = dependencies['<%- name %>'] || {};
9
- } else {
10
- console.error('Your test environment does not define "window". Please make sure to provide a proper environment.');
11
- module.exports = {};
12
- }
13
- } else {
14
- // under "normal" circumstances disallow such an import
15
- throw new Error("This file should not be included anywhere. Usually, this means you've imported the Piral instance directly.");
16
- }