@forgecart/cli 2.202610130131.0 → 2.202610130431.0

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 (67) hide show
  1. package/dist/src/admin-api/admin-api-refusal.error.d.ts +2 -2
  2. package/dist/src/admin-api/admin-api-refusal.error.js +2 -2
  3. package/dist/src/admin-api/admin-api.client.d.ts +8 -4
  4. package/dist/src/admin-api/admin-api.client.js +11 -9
  5. package/dist/src/admin-api/admin-api.client.js.map +1 -1
  6. package/dist/src/admin-api/admin-api.result.d.ts +7 -0
  7. package/dist/src/admin-api/admin-api.result.js +31 -2
  8. package/dist/src/admin-api/admin-api.result.js.map +1 -1
  9. package/dist/src/authorization/cli-authorization-flow.d.ts +21 -14
  10. package/dist/src/authorization/cli-authorization-flow.js +40 -31
  11. package/dist/src/authorization/cli-authorization-flow.js.map +1 -1
  12. package/dist/src/authorization/cli-credential-check.d.ts +6 -13
  13. package/dist/src/authorization/cli-credential-check.js +6 -23
  14. package/dist/src/authorization/cli-credential-check.js.map +1 -1
  15. package/dist/src/authorization/cli-credential-step.d.ts +74 -0
  16. package/dist/src/authorization/cli-credential-step.js +154 -0
  17. package/dist/src/authorization/cli-credential-step.js.map +1 -0
  18. package/dist/src/authorization/cli-unauthorized-refusal.d.ts +18 -8
  19. package/dist/src/authorization/cli-unauthorized-refusal.js +26 -11
  20. package/dist/src/authorization/cli-unauthorized-refusal.js.map +1 -1
  21. package/dist/src/authorization/type/cli-authorization.types.d.ts +36 -4
  22. package/dist/src/authorization/type/cli-authorization.types.js +16 -3
  23. package/dist/src/authorization/type/cli-authorization.types.js.map +1 -1
  24. package/dist/src/commands/init.d.ts +0 -10
  25. package/dist/src/commands/init.js +17 -42
  26. package/dist/src/commands/init.js.map +1 -1
  27. package/dist/src/commands/sync.js +2 -2
  28. package/dist/src/commands/sync.js.map +1 -1
  29. package/dist/src/deploy/deploy.runner.d.ts +15 -8
  30. package/dist/src/deploy/deploy.runner.js +19 -10
  31. package/dist/src/deploy/deploy.runner.js.map +1 -1
  32. package/dist/src/sync/sync-bundle-push.d.ts +34 -0
  33. package/dist/src/sync/sync-bundle-push.js +97 -0
  34. package/dist/src/sync/sync-bundle-push.js.map +1 -0
  35. package/dist/src/sync/sync-dotenv.file.d.ts +30 -22
  36. package/dist/src/sync/sync-dotenv.file.js +49 -54
  37. package/dist/src/sync/sync-dotenv.file.js.map +1 -1
  38. package/dist/src/sync/sync-env-channel.d.ts +47 -0
  39. package/dist/src/sync/sync-env-channel.js +106 -0
  40. package/dist/src/sync/sync-env-channel.js.map +1 -0
  41. package/dist/src/sync/sync-env.runner.d.ts +26 -10
  42. package/dist/src/sync/sync-env.runner.js +73 -40
  43. package/dist/src/sync/sync-env.runner.js.map +1 -1
  44. package/dist/src/sync/sync-record.file.d.ts +18 -10
  45. package/dist/src/sync/sync-record.file.js +30 -10
  46. package/dist/src/sync/sync-record.file.js.map +1 -1
  47. package/dist/src/sync/sync-repository.d.ts +7 -2
  48. package/dist/src/sync/sync-repository.js +26 -5
  49. package/dist/src/sync/sync-repository.js.map +1 -1
  50. package/dist/src/sync/sync-round.d.ts +28 -15
  51. package/dist/src/sync/sync-round.js +78 -39
  52. package/dist/src/sync/sync-round.js.map +1 -1
  53. package/dist/src/sync/sync-watch.d.ts +2 -1
  54. package/dist/src/sync/sync-watch.js +2 -1
  55. package/dist/src/sync/sync-watch.js.map +1 -1
  56. package/dist/src/sync/sync.runner.d.ts +16 -8
  57. package/dist/src/sync/sync.runner.js +30 -26
  58. package/dist/src/sync/sync.runner.js.map +1 -1
  59. package/dist/src/sync/type/sync.types.d.ts +78 -16
  60. package/dist/src/sync/type/sync.types.js.map +1 -1
  61. package/dist/src/sync/workspace-sync.client.d.ts +43 -16
  62. package/dist/src/sync/workspace-sync.client.js +125 -31
  63. package/dist/src/sync/workspace-sync.client.js.map +1 -1
  64. package/dist/src/util/dotenv.util.d.ts +19 -5
  65. package/dist/src/util/dotenv.util.js +42 -5
  66. package/dist/src/util/dotenv.util.js.map +1 -1
  67. package/package.json +1 -1
@@ -1,10 +1,24 @@
1
1
  /**
2
- * The `.env` rules a storefront's `.env` is written and read by (#1123, #2781):
3
- * init's merge — the keys a run manages refreshed in place, every other line
4
- * verbatim — and the split `forgecart sync` carries `.env` by: the platform's
5
- * own `FORGECART_*` keys, which init writes and which never cross between a
6
- * laptop and its workspace, against the merchant's keys, which do.
2
+ * The env files a Next.js storefront reads, in the order `forgecart sync` names
3
+ * them. Each keeps its own lines: in development a key resolves from
4
+ * `.env.development.local`, then `.env.local`, then `.env.development`, then
5
+ * `.env` — in production from the `.production` pair the same way — so the files
6
+ * travel apart and are never flattened into one.
7
7
  */
8
+ export declare enum StorefrontEnvFile {
9
+ BASE = ".env",
10
+ LOCAL = ".env.local",
11
+ DEVELOPMENT = ".env.development",
12
+ DEVELOPMENT_LOCAL = ".env.development.local",
13
+ PRODUCTION = ".env.production",
14
+ PRODUCTION_LOCAL = ".env.production.local"
15
+ }
16
+ /** Every env file a storefront reads, in {@link StorefrontEnvFile}'s order. */
17
+ export declare const STOREFRONT_ENV_FILES: readonly StorefrontEnvFile[];
18
+ /** Whether `name` is one of the env files a storefront reads — and so a file sync may write. */
19
+ export declare function isStorefrontEnvFile(name: string): name is StorefrontEnvFile;
20
+ /** The env file's text — null when there is no such file; any other failure propagates. */
21
+ export declare function readDotenvFile(path: string): Promise<string | null>;
8
22
  /** The key `line` assigns — undefined for a comment, a blank or any other line. */
9
23
  export declare function dotenvKey(line: string): string | undefined;
10
24
  /** Whether `key` is the platform's — init's to write, never a merchant's to carry. */
@@ -1,14 +1,51 @@
1
+ import { readFile } from 'node:fs/promises';
1
2
  /**
2
- * The `.env` rules a storefront's `.env` is written and read by (#1123, #2781):
3
- * init's merge — the keys a run manages refreshed in place, every other line
4
- * verbatim — and the split `forgecart sync` carries `.env` by: the platform's
5
- * own `FORGECART_*` keys, which init writes and which never cross between a
6
- * laptop and its workspace, against the merchant's keys, which do.
3
+ * The env-file rules a storefront's env files are written and read by (#1123,
4
+ * #2781): init's merge — the keys a run manages refreshed in place, every other
5
+ * line verbatim — the split `forgecart sync` carries them by: the platform's own
6
+ * `FORGECART_*` keys, which init writes and which never cross between a laptop
7
+ * and its workspace, against the merchant's keys, which do — and the env files a
8
+ * storefront reads, which `forgecart sync` carries file for file.
7
9
  */
8
10
  /** An assignment line: its key, then `=`. A line of any other shape is carried verbatim and never travels. */
9
11
  const ASSIGNMENT = /^([A-Za-z_]\w*)=/;
10
12
  /** The prefix every platform-owned key carries. */
11
13
  const PLATFORM_KEY_PREFIX = 'FORGECART_';
14
+ /**
15
+ * The env files a Next.js storefront reads, in the order `forgecart sync` names
16
+ * them. Each keeps its own lines: in development a key resolves from
17
+ * `.env.development.local`, then `.env.local`, then `.env.development`, then
18
+ * `.env` — in production from the `.production` pair the same way — so the files
19
+ * travel apart and are never flattened into one.
20
+ */
21
+ export var StorefrontEnvFile;
22
+ (function (StorefrontEnvFile) {
23
+ StorefrontEnvFile["BASE"] = ".env";
24
+ StorefrontEnvFile["LOCAL"] = ".env.local";
25
+ StorefrontEnvFile["DEVELOPMENT"] = ".env.development";
26
+ StorefrontEnvFile["DEVELOPMENT_LOCAL"] = ".env.development.local";
27
+ StorefrontEnvFile["PRODUCTION"] = ".env.production";
28
+ StorefrontEnvFile["PRODUCTION_LOCAL"] = ".env.production.local";
29
+ })(StorefrontEnvFile || (StorefrontEnvFile = {}));
30
+ /** Every env file a storefront reads, in {@link StorefrontEnvFile}'s order. */
31
+ export const STOREFRONT_ENV_FILES = Object.values(StorefrontEnvFile);
32
+ /** The env files' names, for checking a name read from elsewhere. */
33
+ const STOREFRONT_ENV_FILE_NAMES = new Set(STOREFRONT_ENV_FILES);
34
+ /** Whether `name` is one of the env files a storefront reads — and so a file sync may write. */
35
+ export function isStorefrontEnvFile(name) {
36
+ return STOREFRONT_ENV_FILE_NAMES.has(name);
37
+ }
38
+ /** The env file's text — null when there is no such file; any other failure propagates. */
39
+ export async function readDotenvFile(path) {
40
+ try {
41
+ return await readFile(path, 'utf8');
42
+ }
43
+ catch (error) {
44
+ if (error.code === 'ENOENT')
45
+ return null;
46
+ throw error;
47
+ }
48
+ }
12
49
  /** The key `line` assigns — undefined for a comment, a blank or any other line. */
13
50
  export function dotenvKey(line) {
14
51
  return ASSIGNMENT.exec(line)?.[1];
@@ -1 +1 @@
1
- {"version":3,"file":"dotenv.util.js","sourceRoot":"","sources":["../../../src/util/dotenv.util.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8GAA8G;AAC9G,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC,mDAAmD;AACnD,MAAM,mBAAmB,GAAG,YAAY,CAAC;AAEzC,mFAAmF;AACnF,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAC7C,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,GAAW;IACnD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAwB;IAC1D,MAAM,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC9C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,GAAG,KAAK,SAAS,IAAI,aAAa,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAC9E,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7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,MAAM,CAAC,CAAC;IAC3B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAClB,IAAY,EACZ,OAAoC,EACpC,SAAsB;IAEtB,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED,uFAAuF;AACvF,SAAS,kBAAkB,CAAC,KAAe;IACzC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;QAC1D,KAAK,CAAC,GAAG,EAAE,CAAC;IACd,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgecart/cli",
3
- "version": "2.202610130131.0",
3
+ "version": "2.202610130431.0",
4
4
  "type": "module",
5
5
  "description": "CLI for scaffolding and operating ForgeCart channel storefronts",
6
6
  "bin": {