@_linked/cli 1.46.2 → 1.47.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 (167) hide show
  1. package/CHANGELOG.md +107 -0
  2. package/README.md +48 -36
  3. package/hooks/drift.cjs +169 -0
  4. package/hooks/git-hook.cjs +170 -0
  5. package/hooks/hook-shim.cjs +63 -0
  6. package/hooks/lock-at-rest.cjs +268 -0
  7. package/hooks/manifests.cjs +216 -0
  8. package/hooks/platform.cjs +25 -0
  9. package/lib/esm/app-release/build-backend.d.ts.map +1 -1
  10. package/lib/esm/app-release/build-backend.js +2 -1
  11. package/lib/esm/app-release/build-backend.js.map +1 -1
  12. package/lib/esm/cli-methods.d.ts.map +1 -1
  13. package/lib/esm/cli-methods.js +166 -150
  14. package/lib/esm/cli-methods.js.map +1 -1
  15. package/lib/esm/cli.js +20 -22
  16. package/lib/esm/cli.js.map +1 -1
  17. package/lib/esm/commands/build-app.d.ts.map +1 -1
  18. package/lib/esm/commands/build-app.js +2 -1
  19. package/lib/esm/commands/build-app.js.map +1 -1
  20. package/lib/esm/commands/build-package.d.ts.map +1 -1
  21. package/lib/esm/commands/build-package.js +6 -2
  22. package/lib/esm/commands/build-package.js.map +1 -1
  23. package/lib/esm/commands/localize.d.ts +9 -15
  24. package/lib/esm/commands/localize.d.ts.map +1 -1
  25. package/lib/esm/commands/localize.js +43 -74
  26. package/lib/esm/commands/localize.js.map +1 -1
  27. package/lib/esm/commands/setup-publish.d.ts.map +1 -1
  28. package/lib/esm/commands/setup-publish.js +22 -15
  29. package/lib/esm/commands/setup-publish.js.map +1 -1
  30. package/lib/esm/commands/start.d.ts +8 -0
  31. package/lib/esm/commands/start.d.ts.map +1 -1
  32. package/lib/esm/commands/start.js +20 -8
  33. package/lib/esm/commands/start.js.map +1 -1
  34. package/lib/esm/installed-packages.d.ts +5 -13
  35. package/lib/esm/installed-packages.d.ts.map +1 -1
  36. package/lib/esm/installed-packages.js +5 -38
  37. package/lib/esm/installed-packages.js.map +1 -1
  38. package/lib/esm/lifecycle.d.ts +35 -22
  39. package/lib/esm/lifecycle.d.ts.map +1 -1
  40. package/lib/esm/lifecycle.js +62 -36
  41. package/lib/esm/lifecycle.js.map +1 -1
  42. package/lib/esm/localize/adopt.d.ts +5 -5
  43. package/lib/esm/localize/adopt.d.ts.map +1 -1
  44. package/lib/esm/localize/adopt.js +46 -55
  45. package/lib/esm/localize/adopt.js.map +1 -1
  46. package/lib/esm/localize/app-root.d.ts +16 -0
  47. package/lib/esm/localize/app-root.d.ts.map +1 -0
  48. package/lib/esm/localize/app-root.js +94 -0
  49. package/lib/esm/localize/app-root.js.map +1 -0
  50. package/lib/esm/localize/app-setup.d.ts +21 -0
  51. package/lib/esm/localize/app-setup.d.ts.map +1 -0
  52. package/lib/esm/localize/app-setup.js +178 -0
  53. package/lib/esm/localize/app-setup.js.map +1 -0
  54. package/lib/esm/localize/delocalize.d.ts.map +1 -1
  55. package/lib/esm/localize/delocalize.js +169 -104
  56. package/lib/esm/localize/delocalize.js.map +1 -1
  57. package/lib/esm/localize/drift-hook.d.ts +18 -0
  58. package/lib/esm/localize/drift-hook.d.ts.map +1 -0
  59. package/lib/esm/localize/drift-hook.js +37 -0
  60. package/lib/esm/localize/drift-hook.js.map +1 -0
  61. package/lib/esm/localize/drift.d.ts +36 -0
  62. package/lib/esm/localize/drift.d.ts.map +1 -0
  63. package/lib/esm/localize/drift.js +34 -0
  64. package/lib/esm/localize/drift.js.map +1 -0
  65. package/lib/esm/localize/errors.d.ts +14 -8
  66. package/lib/esm/localize/errors.d.ts.map +1 -1
  67. package/lib/esm/localize/errors.js +14 -8
  68. package/lib/esm/localize/errors.js.map +1 -1
  69. package/lib/esm/localize/fsops.d.ts +11 -27
  70. package/lib/esm/localize/fsops.d.ts.map +1 -1
  71. package/lib/esm/localize/fsops.js +40 -115
  72. package/lib/esm/localize/fsops.js.map +1 -1
  73. package/lib/esm/localize/git-hooks.d.ts +33 -0
  74. package/lib/esm/localize/git-hooks.d.ts.map +1 -0
  75. package/lib/esm/localize/git-hooks.js +146 -0
  76. package/lib/esm/localize/git-hooks.js.map +1 -0
  77. package/lib/esm/localize/hook-module.d.ts +6 -0
  78. package/lib/esm/localize/hook-module.d.ts.map +1 -0
  79. package/lib/esm/localize/hook-module.js +37 -0
  80. package/lib/esm/localize/hook-module.js.map +1 -0
  81. package/lib/esm/localize/index.d.ts +14 -15
  82. package/lib/esm/localize/index.d.ts.map +1 -1
  83. package/lib/esm/localize/index.js +8 -9
  84. package/lib/esm/localize/index.js.map +1 -1
  85. package/lib/esm/localize/list.d.ts +6 -10
  86. package/lib/esm/localize/list.d.ts.map +1 -1
  87. package/lib/esm/localize/list.js +49 -189
  88. package/lib/esm/localize/list.js.map +1 -1
  89. package/lib/esm/localize/localize.d.ts +46 -62
  90. package/lib/esm/localize/localize.d.ts.map +1 -1
  91. package/lib/esm/localize/localize.js +411 -285
  92. package/lib/esm/localize/localize.js.map +1 -1
  93. package/lib/esm/localize/members.d.ts +13 -0
  94. package/lib/esm/localize/members.d.ts.map +1 -0
  95. package/lib/esm/localize/members.js +46 -0
  96. package/lib/esm/localize/members.js.map +1 -0
  97. package/lib/esm/localize/resolve.d.ts +1 -2
  98. package/lib/esm/localize/resolve.d.ts.map +1 -1
  99. package/lib/esm/localize/resolve.js +3 -5
  100. package/lib/esm/localize/resolve.js.map +1 -1
  101. package/lib/esm/localize/run.d.ts +1 -0
  102. package/lib/esm/localize/run.d.ts.map +1 -1
  103. package/lib/esm/localize/run.js +11 -6
  104. package/lib/esm/localize/run.js.map +1 -1
  105. package/lib/esm/localize/setup-lockfile.d.ts +13 -0
  106. package/lib/esm/localize/setup-lockfile.d.ts.map +1 -0
  107. package/lib/esm/localize/setup-lockfile.js +80 -0
  108. package/lib/esm/localize/setup-lockfile.js.map +1 -0
  109. package/lib/esm/utils/createPackageLocation.d.ts +4 -13
  110. package/lib/esm/utils/createPackageLocation.d.ts.map +1 -1
  111. package/lib/esm/utils/createPackageLocation.js +12 -21
  112. package/lib/esm/utils/createPackageLocation.js.map +1 -1
  113. package/lib/esm/utils/packageSetup.d.ts +5 -2
  114. package/lib/esm/utils/packageSetup.d.ts.map +1 -1
  115. package/lib/esm/utils/packageSetup.js +9 -3
  116. package/lib/esm/utils/packageSetup.js.map +1 -1
  117. package/lib/esm/utils/platform.d.ts +24 -0
  118. package/lib/esm/utils/platform.d.ts.map +1 -0
  119. package/lib/esm/utils/platform.js +62 -0
  120. package/lib/esm/utils/platform.js.map +1 -0
  121. package/lib/esm/utils/shapeReferences.d.ts.map +1 -1
  122. package/lib/esm/utils/shapeReferences.js +3 -2
  123. package/lib/esm/utils/shapeReferences.js.map +1 -1
  124. package/lib/esm/utils/spawn.d.ts +65 -0
  125. package/lib/esm/utils/spawn.d.ts.map +1 -0
  126. package/lib/esm/utils/spawn.js +181 -0
  127. package/lib/esm/utils/spawn.js.map +1 -0
  128. package/lib/esm/utils.d.ts.map +1 -1
  129. package/lib/esm/utils.js +19 -5
  130. package/lib/esm/utils.js.map +1 -1
  131. package/lib/esm/vite-config.d.ts +5 -12
  132. package/lib/esm/vite-config.d.ts.map +1 -1
  133. package/lib/esm/vite-config.js +41 -33
  134. package/lib/esm/vite-config.js.map +1 -1
  135. package/package.json +4 -3
  136. package/lib/esm/localize/ensure.d.ts +0 -44
  137. package/lib/esm/localize/ensure.d.ts.map +0 -1
  138. package/lib/esm/localize/ensure.js +0 -151
  139. package/lib/esm/localize/ensure.js.map +0 -1
  140. package/lib/esm/localize/manifest.d.ts +0 -63
  141. package/lib/esm/localize/manifest.d.ts.map +0 -1
  142. package/lib/esm/localize/manifest.js +0 -133
  143. package/lib/esm/localize/manifest.js.map +0 -1
  144. package/lib/esm/localize/one-copy-hook.d.ts +0 -16
  145. package/lib/esm/localize/one-copy-hook.d.ts.map +0 -1
  146. package/lib/esm/localize/one-copy-hook.js +0 -20
  147. package/lib/esm/localize/one-copy-hook.js.map +0 -1
  148. package/lib/esm/localize/provided.d.ts +0 -28
  149. package/lib/esm/localize/provided.d.ts.map +0 -1
  150. package/lib/esm/localize/provided.js +0 -89
  151. package/lib/esm/localize/provided.js.map +0 -1
  152. package/lib/esm/localize/prune.d.ts +0 -182
  153. package/lib/esm/localize/prune.d.ts.map +0 -1
  154. package/lib/esm/localize/prune.js +0 -703
  155. package/lib/esm/localize/prune.js.map +0 -1
  156. package/lib/esm/localize/relink.d.ts +0 -13
  157. package/lib/esm/localize/relink.d.ts.map +0 -1
  158. package/lib/esm/localize/relink.js +0 -181
  159. package/lib/esm/localize/relink.js.map +0 -1
  160. package/lib/esm/localized-dedupe.d.ts +0 -26
  161. package/lib/esm/localized-dedupe.d.ts.map +0 -1
  162. package/lib/esm/localized-dedupe.js +0 -139
  163. package/lib/esm/localized-dedupe.js.map +0 -1
  164. package/lib/esm/utils/relinkHooks.d.ts +0 -19
  165. package/lib/esm/utils/relinkHooks.d.ts.map +0 -1
  166. package/lib/esm/utils/relinkHooks.js +0 -74
  167. package/lib/esm/utils/relinkHooks.js.map +0 -1
package/lib/esm/cli.js CHANGED
@@ -19,7 +19,7 @@ import fs from 'fs-extra';
19
19
  import path from 'path';
20
20
  import 'require-extensions';
21
21
  import { unknownCommandError } from './unknown-command.js';
22
- import { installOneCopyHook } from './localize/one-copy-hook.js';
22
+ import { installDriftHook } from './localize/drift-hook.js';
23
23
  /**
24
24
  * Run an async command action and report a failure the way the rest of this
25
25
  * CLI does — one red message and exit code 1 — instead of letting the rejection
@@ -101,7 +101,7 @@ const reportRefusal = (e) => {
101
101
  console.error(chalk.red(e.message));
102
102
  process.exitCode = 1;
103
103
  };
104
- const LOCATION_HELP = "packages: part of this app's repository, a workspace member added to its dependencies. packages-local: its own git repository (git init + a first commit), linked and recorded by `linked localize` and not added to the app's dependencies until it is published.";
104
+ const LOCATION_HELP = "packages: part of this app's repository, a workspace member added to its dependencies. packages-local: its own git repository (git init + a first commit) in packages-local/, which the app gitignores; a workspace member through the app's \"packages-local/*\" glob, so npm links it (`linked localize --adopt` sets the app up and installs). Not added to the app's dependencies until it is published.";
105
105
  const REMOTE_HELP = "The new repository's origin; also written to repository.url. Implies --location packages-local.";
106
106
  const PUSH_HELP = 'Push the first commit to --remote.';
107
107
  const SKIP_INSTALL_HELP = 'Write the files only: no install, no build, no git.';
@@ -324,7 +324,7 @@ program
324
324
  program
325
325
  .command('build-all')
326
326
  .action((options) => {
327
- buildAll(options);
327
+ return buildAll(options);
328
328
  })
329
329
  .option('--sync', 'build each package 1 by 1 - use this if you have build issues due to low available RAM memory')
330
330
  .option('--from <char>', 'start from a specific package');
@@ -348,28 +348,26 @@ program
348
348
  }));
349
349
  program
350
350
  .command('localize [packages...]')
351
- .description('Develop an npm dependency from a git checkout: clone it, install inside the checkout, build it and symlink it into node_modules — without touching package.json or package-lock.json. Name packages exactly as npm names them (@_linked/rdfs, lodash); the repository is read from the published `repository` field. With no names, reports what is localized.')
352
- .option('--list', 'Report what is localized rather than localizing anything.')
353
- .option('--adopt', 'Link a checkout that is already in packages-local under its localize name (e.g. packages-local/_linked-foo for @_linked/foo): install, build, link and record it, without cloning or asking the registry. For a package created locally, or a clone put there by hand.')
354
- .option('--check', 'With --list: exit 1 when something recorded is not actually linked.')
355
- .option('--relink', 'Recreate the recorded symlinks. This is what a postinstall runs.')
356
- .option('--ensure', "Remove every localized checkout's own copy of a package the app provides (what --relink would prune), and exit 0. Takes no package names; skips a checkout localized with --no-prune, and with --no-prune does nothing. Never runs npm; prints nothing when there is nothing to remove. For an app's npm pre* scripts (linked start, script, call and build-all already run it).")
357
- .option('--reinstall <package>', "npm install inside that package's checkout, then remove its own copies of what the app provides. Use this instead of running npm install in a checkout by hand.")
358
- .option('--dir <path>', 'Where checkouts live (default: packages-local).')
359
- .option('--repo <git-url>', "Clone this instead of the published repository, and record it. With --adopt: record this instead of the checkout's origin.")
360
- .option('--subdir <path>', "The package's directory inside the repository (monorepos).")
361
- .option('--build <cmd>', 'Run this in the checkout after installing; a failure only warns. Defaults to `linked build`; pass an empty string to build nothing.')
362
- .option('--force', 'Overwrite a symlink pointing outside the checkout directory.')
363
- .option('--no-prune', "Keep the checkout's node_modules as npm installed it. With a package to localize or --adopt, this is recorded in local-packages.json (prune: false), so --relink, --reinstall and the run-time check (--ensure, linked start etc.) leave that checkout alone too; localizing it again without --no-prune turns pruning back on. On --relink or --reinstall alone it applies to that run. By default a checkout's own copy of something the app provides is removed: a localized sibling, react or react-dom, or one of the checkout's own runtime dependencies that the app has at a version satisfying every range that would load it. The checkout then loads the app's copy instead of a second one. A copy the app's version does not satisfy, or whose own dependencies would resolve differently from the app, is kept and reported.")
351
+ .description('Develop an npm dependency from a git checkout in packages-local/, which the app lists in its workspaces so npm links it. Clones each package (the repository comes from its published `repository` field), sets the app up the first time (workspaces glob, lock-at-rest hook, .gitignore and the matching lockfile; commit those), installs git hooks (or, under core.hooksPath, prints the line to add to each), runs one npm install at the app root and builds the new checkouts. The app root is the topmost directory whose package.json has workspaces, so it can run from inside a member. Name packages exactly as npm names them (@_linked/rdfs, lodash). With no names, reports what is localized.')
352
+ .option('--list', 'Report the checkouts (name, directory, branch, version), the parked ones and any drift.')
353
+ .option('--check', 'With --list: print only the drift, and exit 1 when there is any (for CI and scripts).')
354
+ .option('--adopt', 'Use a checkout that is already in packages-local (e.g. packages-local/_linked-foo for @_linked/foo) as it is: no registry lookup and no clone. For a package created locally, or a clone put there by hand.')
355
+ .option('--parked', 'Take back every checkout `linked delocalize` parked, then npm install once.')
356
+ .option('--repo <git-url>', 'Clone this instead of the published repository.')
357
+ .option('--subdir <path>', "The package's directory inside the repository (monorepos). The repository is cloned into packages-local/.repos/ and packages-local/<name> links to the package.")
358
+ .option('--build <cmd>', 'Run this in each new checkout after the install; a failure only warns. Defaults to `linked build` (`npm run build` for @_linked/cli); pass an empty string to build nothing.')
359
+ .option('--dir <path>', 'Where checkouts live. Only packages-local is accepted: the workspaces glob names it.')
360
+ .option('--relink', 'Deprecated, does nothing: npm links the checkouts. Exits 0, so old postinstall scripts keep working.')
361
+ .option('--ensure', 'Deprecated, does nothing but print a hint: drift is reported by --list and before linked start. Exits 0.')
364
362
  .action((packages, options) => __awaiter(void 0, void 0, void 0, function* () {
365
363
  const { runLocalize } = yield import('./commands/localize.js');
366
364
  return runLocalize(packages, options);
367
365
  }));
368
366
  program
369
367
  .command('delocalize [packages...]')
370
- .description('Undo localize: unlink the packages and forget them, keeping the checkout. With no names, undoes every localized package.')
371
- .option('--purge', 'Also delete the checkout.')
372
- .option('--force', 'With --purge, delete even a checkout localize refuses.')
368
+ .description('Park checkouts: move them from packages-local/ to .packages-local.parked/, then reinstall the registry copies (npm ci when no checkout remains and the committed lockfile and package.json are unchanged, else npm install and npm rebuild). `linked localize <name>` or `--parked` takes them back. With no names, parks every checkout.')
369
+ .option('--purge', 'Delete the checkout instead of parking it. Refuses (exit 6) on unsaved work, or when it is not a git repository or git fails.')
370
+ .option('--force', 'With --purge, delete even a checkout with unsaved work (uncommitted changes, commits no remote has, on a branch or a detached HEAD, a stash) or one git cannot check.')
373
371
  .action((packages, options) => __awaiter(void 0, void 0, void 0, function* () {
374
372
  const { runDelocalize } = yield import('./commands/localize.js');
375
373
  return runDelocalize(packages, options);
@@ -457,9 +455,9 @@ program
457
455
  program.command('enable-capacitor').action(() => {
458
456
  addCapacitor();
459
457
  });
460
- // One copy, always (localize/ensure.ts): before a command that runs the app's
461
- // code, remove any localized checkout's own copy of what the app provides.
462
- installOneCopyHook(program);
458
+ // Before a command that runs the app's code, report drift between the
459
+ // localized checkouts and what npm installed (localize/drift.ts). Never fails it.
460
+ installDriftHook(program);
463
461
  const unknownCommand = unknownCommandError(program, process.argv.slice(2));
464
462
  if (unknownCommand) {
465
463
  console.error(chalk.red(unknownCommand));
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA,oHAAoH;AACpH,yCAAyC;;;;;;;;;;AAEzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAA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CAAC,CAAC,CAAC;IACzC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env tsx\n//The line above calls the TSX typescript executer as runtime, which extends node.js and supports running typescript\n// see: https://www.npmjs.com/package/tsx\n\nimport chalk from 'chalk';\nimport {\n addCapacitor,\n buildAll,\n buildPackage,\n buildUpdated,\n checkImports,\n compilePackage,\n createApp,\n createComponent,\n createOntology,\n createPackage,\n createSetComponent,\n createShape,\n depCheck,\n depCheckStaged,\n developPackage,\n executeCommandForEachPackage,\n executeCommandForPackage,\n getLincdPackages,\n getScriptDir,\n publishPackage,\n publishUpdated,\n register,\n runMethod,\n runScript,\n startServer,\n upgradePackages,\n} from './cli-methods.js';\n// import {buildMetadata} from './metadata';\nimport {program, type Command} from 'commander';\nimport {CreatePackageError} from './utils/createPackageLocation.js';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport 'require-extensions';\nimport {unknownCommandError} from './unknown-command.js';\nimport {installOneCopyHook} from './localize/one-copy-hook.js';\n\n/**\n * Run an async command action and report a failure the way the rest of this\n * CLI does — one red message and exit code 1 — instead of letting the rejection\n * escape the action and print a raw unhandled-rejection stack.\n */\nconst runAppCommand = async (run: () => Promise<unknown>): Promise<void> => {\n try {\n await run();\n } catch (error) {\n const message =\n error instanceof Error ? error.message : String(error ?? 'Unknown error');\n console.error(chalk.red(message));\n if (process.env.LINKED_DEBUG && error instanceof Error && error.stack) {\n console.error(error.stack);\n }\n process.exitCode = 1;\n }\n};\n\n/** `--env a,b` → `['a', 'b']`. */\nconst splitEnvOption = (value?: string): string[] =>\n (value || '')\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean);\n\nprogram\n .command('create-app')\n .action((name, options) => {\n return createApp(name, process.cwd(), {\n appName: options.appName,\n appPrefix: options.appPrefix,\n appDomain: options.appDomain,\n skipInstall: options.skipInstall,\n template: options.template,\n }).catch((err) => {\n // Report and fail the process without cutting off pending output.\n console.error(chalk.red(err?.message ?? String(err)));\n process.exitCode = 1;\n });\n })\n .description(\n 'Creates a new folder with all the required files for a Linked app',\n )\n .argument(\n '<name>',\n 'the name of your Linked app. To use spaces, wrap the name in double quotes.',\n )\n .option('--app-name <name>', 'Display name for the app (skip interactive prompt)')\n .option('--app-prefix <prefix>', 'Short code prefix for data files (skip interactive prompt)')\n .option('--app-domain <domain>', 'Domain for the app (skip interactive prompt)')\n .option('--skip-install', 'Skip running npm install after scaffolding')\n .option(\n '--template <template>',\n 'App template: \"web\" (default) or \"react-native\"',\n );\n\nprogram\n .command('start')\n .action(async (options) => {\n const {startWithVite} = await import('./commands/start.js');\n return startWithVite({env: options?.env, apiOnly: options?.apiOnly});\n })\n .option('--env <env>', 'The node environment to use. Default is \"development\"')\n .option(\n '--api-only',\n 'Serve only the backend API: no vite.config, src/App.tsx or src/routes.tsx needed; page requests get a 404',\n )\n .description(\n 'Start the Linked dev server. Vite-backed by default.',\n );\n\nprogram\n .command('call')\n .action((packageName, method, options) => {\n return runMethod(packageName, method, {spawn: options.spawn});\n })\n .option(\n '--spawn',\n 'Start a new server instance instead of using an existing one',\n )\n .option('--env', 'The node environment to use. Default is \"development\"')\n .description(\n 'Start the Linked node.js server but without http server. Instead it immediately calls the specified method of the specified package and exits afterwards',\n )\n .argument(\n '<package>',\n 'the package of the backend provider that contains this method',\n )\n .argument('<method>', 'the name of the method you want to call');\n\nprogram\n .command('script')\n .action((scriptName, options) => {\n return runScript(scriptName, {spawn: options.spawn});\n })\n .option(\n '--spawn',\n 'Start a new server instance instead of using an existing one',\n )\n .option('--env', 'The node environment to use. Default is \"development\"')\n .description(\n 'Start the Linked node.js server but without http server. Instead it immediately runs the specified script and exits afterwards',\n )\n .argument(\n '<scriptName>',\n 'the name of the script file inside the /scripts folder',\n );\n\n/** A refusal of the create-* commands exits 1 with the message, not a stack. */\nconst reportRefusal = (e: unknown) => {\n if (!(e instanceof CreatePackageError)) throw e;\n console.error(chalk.red(e.message));\n process.exitCode = 1;\n};\n\nconst LOCATION_HELP =\n \"packages: part of this app's repository, a workspace member added to its dependencies. packages-local: its own git repository (git init + a first commit), linked and recorded by `linked localize` and not added to the app's dependencies until it is published.\";\nconst REMOTE_HELP =\n \"The new repository's origin; also written to repository.url. Implies --location packages-local.\";\nconst PUSH_HELP = 'Push the first commit to --remote.';\nconst SKIP_INSTALL_HELP = 'Write the files only: no install, no build, no git.';\nconst BASE_URI_HELP =\n \"The root the package's IRIs are minted under: linkedPackage(name, {baseUri}), shapes at <uri>shape/<package>/<Name>, ontology terms at <uri>ont/<slug>/<Term>. Inside an app it defaults to LINKED_BASE_URI from the environment, then the app's .env.local, then its .env; with none of them the package declares no root and falls back to https://linked.cm/.\";\nconst WHERE_HELP =\n \"Inside an app, it goes in packages/ (part of the app's repository) or packages-local/ (its own git repository, linked with `linked localize`); without --location, --remote or --push you are asked, on a terminal.\";\n\n/** The three scaffolding commands share the where-flags; `--kind` is create-package's own. */\nconst withPackageOptions = (command: Command) =>\n command\n .option('--location <where>', LOCATION_HELP)\n .option('--remote <git-url>', REMOTE_HELP)\n .option('--push', PUSH_HELP)\n .option('--skip-install', SKIP_INSTALL_HELP)\n .option('--base-uri <uri>', BASE_URI_HELP);\n\nwithPackageOptions(\n program\n .command('create-package')\n .action(async (name, uriBase, options) => {\n try {\n await createPackage(name, uriBase, process.cwd(), options);\n } catch (e) {\n reportRefusal(e);\n }\n })\n .description(\n 'Create a new Linked package: an ontology package (<name>-ont: one ontology, no shapes), an asset package (<name>-assets: shapes, components and a backend) or both. Without --kind you are asked, on a terminal. A name that already ends in -ont or -assets keeps it (foo-ont stays foo-ont). ' +\n WHERE_HELP,\n )\n .option(\n '--kind <kind>',\n 'ontology, assets or both. `both` creates <name>-ont and <name>-assets; it cannot take --remote (one repository cannot hold two packages).',\n )\n .argument(\n '<name>',\n 'The name of the package, without the kind suffix: the package is named <name>-ont or <name>-assets (a name that already ends in the suffix is kept). An npm scope is kept (@acme/foo → @acme/foo-ont).',\n )\n .argument(\n '[uri_base]',\n \"The namespace of the ontology package's ontology. Leave blank for https://linked.cm/ont/<name>/ (the ontology slug is <name>, without -ont).\",\n ),\n);\n\nwithPackageOptions(\n program\n .command('create-ont-package')\n .action(async (name, uriBase, options) => {\n try {\n await createPackage(name, uriBase, process.cwd(), {...options, kind: 'ontology'});\n } catch (e) {\n reportRefusal(e);\n }\n })\n .description(\n 'Create an ontology package <name>-ont: exactly one ontology (src/ontologies/<name>.ts), no shapes, components or backend. Its ontology slug is <name>, so its terms mint {root}ont/<name>/{Term}. A name that already ends in -ont keeps it. ' +\n WHERE_HELP,\n )\n .argument('<name>', 'The ontology slug; the package is named <name>-ont (foo-ont stays foo-ont).')\n .argument(\n '[uri_base]',\n 'The namespace of the ontology. Leave blank for https://linked.cm/ont/<name>/.',\n ),\n);\n\nwithPackageOptions(\n program\n .command('create-asset-package')\n .action(async (name, options) => {\n try {\n await createPackage(name, undefined, process.cwd(), {...options, kind: 'assets'});\n } catch (e) {\n reportRefusal(e);\n }\n })\n .description(\n 'Create an asset package <name>-assets: shapes, components and a backend (src/shapes, src/components, src/backend.ts), and no ontology. A name that already ends in -assets keeps it. ' +\n WHERE_HELP,\n )\n .argument('<name>', 'The package is named <name>-assets (foo-assets stays foo-assets).'),\n);\n\nprogram\n .command('upgrade-packages')\n .action(() => {\n return upgradePackages();\n })\n .description(\n 'Upgrade all linked packages in the workspace to ESM/CJS dual packages',\n );\n\nprogram\n .command('create-shape')\n .action((name, uriBase) => {\n return createShape(name).catch(reportRefusal);\n })\n .description(\n 'Creates a new ShapeClass file for your package. Execute this from your package folder (packages/<name>), not the app root: an app registers no package.',\n )\n .argument(\n '<name>',\n 'The name of the shape. Will be used for the file name and the class name',\n );\n\nprogram\n .command('create-component')\n .action((name, uriBase) => {\n return createComponent(name).catch(reportRefusal);\n })\n .description(\n 'Creates a new Component file for your package. Execute this from your package folder (packages/<name>), not the app root: an app registers no package.',\n )\n .argument(\n '<name>',\n 'The name of the component. Will be used for the file name and the export name',\n );\n\nprogram\n .command('create-set-component')\n .action((name, uriBase) => {\n return createSetComponent(name).catch(reportRefusal);\n })\n .description(\n 'Creates a new SetComponent file for your package. Execute this from your package folder.',\n )\n .argument(\n '<name>',\n 'The name of the component. Will be used for the file name and the export name',\n );\n\nprogram\n .command('create-ontology')\n .action((prefix, uriBase) => {\n return createOntology(prefix, uriBase).catch(reportRefusal);\n })\n .description(\n 'Creates a new ontology file for your package. Execute this from your package folder.',\n )\n .argument(\n '<suggested-prefix>',\n 'The suggested prefix for your ontology. Also the shorthand code used for the file name and the exported ontology object',\n )\n .argument(\n '[uribase]',\n \"Optional argument to set the URI base for the URI's of all entities in your ontology. Leave blank to use the URI's provided by lincd.org once you register this package\",\n );\n\nprogram.command('app [action]', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-local', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-dev', {hidden: true}).action(() => {\n register('https://dev-registry.lincd.org');\n});\nprogram\n .command('register')\n .action(() => {\n register('https://registry.lincd.org');\n })\n .description(\n 'Register (a new version of) this package to the Linked registry. If successful your package will appear on linked.cm',\n );\n\nprogram\n .command('info')\n .action(() => {\n let localDir = getScriptDir();\n let packageJsonPath = path.join(localDir, 'package.json');\n try {\n var ownPackage = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n } catch (e) {\n console.warn(\n 'Could not read package.json at ' + packageJsonPath + ': ' + e,\n );\n process.exit();\n }\n console.log(ownPackage.version);\n console.log('Running from: ' + localDir);\n })\n .description(\n \"Log the version of this tool and the path that it's running from\",\n );\n\nprogram\n .command('build [target] [target2]', {isDefault: true})\n .action(async (target, target2, options) => {\n const result = await buildPackage(target, target2, process.cwd(), !options?.silent);\n if (result !== true) {\n process.exitCode = 1;\n }\n })\n .option(\n '--silent',\n 'No output to console unless errors occur. The exit code is unaffected: 0 when the build succeeds (warnings included), 1 when it fails',\n );\n\nprogram\n .command('compile-only')\n .action(() => {\n compilePackage();\n })\n .description(\n 'Compile the package without other build steps. Run this command from the package folder',\n );\nprogram.command('build-metadata').action(() => {\n console.log('Needs to be reimplemented');\n // buildMetadata();\n});\nprogram\n .command('build-app')\n .action(async (options) => {\n // Vite is the only app build. An app without a `vite.config.{ts,js,mjs}`\n // is rejected by name rather than falling back to anything.\n await runAppCommand(async () => {\n const {assertViteApp, buildViteApp} = await import(\n './commands/build-app.js'\n );\n assertViteApp();\n await buildViteApp({\n environmentNames: splitEnvOption(options?.env),\n target: options?.target,\n publish: options?.publish === true,\n revision: options?.revision,\n allowDirty: options?.allowDirty === true,\n });\n });\n })\n .option('--env <env>', 'The node environment to use. Default is \"development\"')\n .option('--target <target>', 'Build target: web or capacitor')\n .option(\n '--publish',\n 'Upload the release after a successful web build (off by default; use `linked publish-app`)',\n )\n .option(\n '--revision <sha>',\n 'Revision identifying the release. Defaults to LINKED_RELEASE_REVISION, GITHUB_SHA, then git HEAD',\n )\n .option(\n '--allow-dirty',\n 'Build from a working tree with uncommitted changes; the release revision gets a \"-dirty\" suffix',\n )\n .description(\n 'Build the linked app frontend and backend for production, and write a release manifest. Requires a vite.config in the app root.',\n );\n\nprogram\n .command('publish-app')\n .option('--env <env>', 'The node environment to use')\n .option(\n '--manifest <path>',\n 'Release manifest to publish, relative to the app root. Default public/bundles/linked-release.json',\n )\n .option('--yes', 'Upload the verified release. Without it this is a dry run')\n .action(async (options) => {\n // Retry or inspect an existing release without rebuilding the app.\n await runAppCommand(async () => {\n const {ensureEnvironmentLoaded} = await import('./lifecycle.js');\n const {resolveAppAssetsStore} = await import(\n './app-release/app-assets-store.js'\n );\n const {publishApp} = await import('./commands/publish-app.js');\n await ensureEnvironmentLoaded(splitEnvOption(options?.env));\n // The store is resolved by publishApp, after the manifest is read.\n await publishApp({\n manifestPath: options?.manifest,\n resolveStore: () => resolveAppAssetsStore(),\n yes: options?.yes === true,\n });\n });\n })\n .description(\n 'Validate or retry publishing a previously built release. Defaults to dry run.',\n );\n\nprogram\n .command('serve-app')\n .option('--env <env>', 'The node environment to use')\n .action(async (options) => {\n // Production runtime loads compiled output and never starts Vite/HMR.\n await runAppCommand(async () => {\n const {serveCompiledApp} = await import('./commands/serve-app.js');\n await serveCompiledApp({environmentNames: splitEnvOption(options?.env)});\n });\n })\n .description('Start a compiled Linked app without Vite or HMR.');\n\nprogram.command('publish-updated').action(() => {\n return publishUpdated();\n});\nprogram.command('publish [version]').action((version) => {\n publishPackage(null, false, null, version);\n});\n\nprogram.command('status').action(() => {\n //log which packages need to be published\n return publishUpdated(true).then(() => {\n //log which packages need to be build\n return buildUpdated(undefined, '', '', true);\n });\n});\nprogram\n .command('build-updated [target] [target2]')\n .action((target, target2, options) => {\n const {useGit}: {useGit?: boolean} = options;\n return buildUpdated(1, target, target2, useGit || false);\n })\n .option(\n '--use-git',\n 'Use git commit timestamps to check which packages have been updated since the last build',\n );\nprogram\n .command('build-updated-since [num-commits-back] [target] [target2]')\n .action((back, target, target2) => {\n return buildUpdated(back, target, target2);\n });\nprogram\n .command('build-all')\n .action((options) => {\n buildAll(options);\n })\n .option(\n '--sync',\n 'build each package 1 by 1 - use this if you have build issues due to low available RAM memory',\n )\n .option('--from <char>', 'start from a specific package');\n\nprogram\n .command('build-workspace')\n .description(\n 'Build all linked packages in the current workspace in dependency order',\n )\n .option('-u, --updated', 'Only build updated packages')\n .option(\n '--use-git',\n 'Use git commit timestamps to determine which packages need updating',\n )\n .action(async (options) => {\n if (options.updated) {\n return buildUpdated(1, undefined, undefined, !!options.useGit);\n }\n return buildAll(options);\n });\n\nprogram\n .command('build-package <filepath>')\n .description(\n 'Given a file path, find its package.json and rebuild that package. Use for editor save hooks.',\n )\n .action(async (filepath) => {\n const {buildPackageByPath} = await import(\n './commands/build-package.js'\n );\n return buildPackageByPath(filepath);\n });\n\nprogram\n .command('localize [packages...]')\n .description(\n 'Develop an npm dependency from a git checkout: clone it, install inside the checkout, build it and symlink it into node_modules — without touching package.json or package-lock.json. Name packages exactly as npm names them (@_linked/rdfs, lodash); the repository is read from the published `repository` field. With no names, reports what is localized.',\n )\n .option('--list', 'Report what is localized rather than localizing anything.')\n .option(\n '--adopt',\n 'Link a checkout that is already in packages-local under its localize name (e.g. packages-local/_linked-foo for @_linked/foo): install, build, link and record it, without cloning or asking the registry. For a package created locally, or a clone put there by hand.',\n )\n .option(\n '--check',\n 'With --list: exit 1 when something recorded is not actually linked.',\n )\n .option(\n '--relink',\n 'Recreate the recorded symlinks. This is what a postinstall runs.',\n )\n .option(\n '--ensure',\n \"Remove every localized checkout's own copy of a package the app provides (what --relink would prune), and exit 0. Takes no package names; skips a checkout localized with --no-prune, and with --no-prune does nothing. Never runs npm; prints nothing when there is nothing to remove. For an app's npm pre* scripts (linked start, script, call and build-all already run it).\",\n )\n .option(\n '--reinstall <package>',\n \"npm install inside that package's checkout, then remove its own copies of what the app provides. Use this instead of running npm install in a checkout by hand.\",\n )\n .option('--dir <path>', 'Where checkouts live (default: packages-local).')\n .option(\n '--repo <git-url>',\n \"Clone this instead of the published repository, and record it. With --adopt: record this instead of the checkout's origin.\",\n )\n .option(\n '--subdir <path>',\n \"The package's directory inside the repository (monorepos).\",\n )\n .option(\n '--build <cmd>',\n 'Run this in the checkout after installing; a failure only warns. Defaults to `linked build`; pass an empty string to build nothing.',\n )\n .option(\n '--force',\n 'Overwrite a symlink pointing outside the checkout directory.',\n )\n .option(\n '--no-prune',\n \"Keep the checkout's node_modules as npm installed it. With a package to localize or --adopt, this is recorded in local-packages.json (prune: false), so --relink, --reinstall and the run-time check (--ensure, linked start etc.) leave that checkout alone too; localizing it again without --no-prune turns pruning back on. On --relink or --reinstall alone it applies to that run. By default a checkout's own copy of something the app provides is removed: a localized sibling, react or react-dom, or one of the checkout's own runtime dependencies that the app has at a version satisfying every range that would load it. The checkout then loads the app's copy instead of a second one. A copy the app's version does not satisfy, or whose own dependencies would resolve differently from the app, is kept and reported.\",\n )\n .action(async (packages: string[], options) => {\n const {runLocalize} = await import('./commands/localize.js');\n return runLocalize(packages, options);\n });\n\nprogram\n .command('delocalize [packages...]')\n .description(\n 'Undo localize: unlink the packages and forget them, keeping the checkout. With no names, undoes every localized package.',\n )\n .option('--purge', 'Also delete the checkout.')\n .option('--force', 'With --purge, delete even a checkout localize refuses.')\n .action(async (packages: string[], options) => {\n const {runDelocalize} = await import('./commands/localize.js');\n return runDelocalize(packages, options);\n });\n\nprogram\n .command('app-doctor')\n .description(\n \"Run in an app. Checks how the app uses linked packages: Vite pre-bundle entries that don't resolve (and the fix), linked packages whose dependencies don't support the app's React version (and which to bump), and hand-written entries that are now generated and can be removed. Exits 1 if anything needs fixing.\",\n )\n .action(async () => {\n const {runAppDoctor} = await import('./commands/app-doctor.js');\n return runAppDoctor();\n });\n\nprogram\n .command('setup-publish')\n .description(\n \"Set up the changesets publish pipeline in the current package repo. Writes the pr.yml/publish.yml callers of the shared workflows in the repo's own org .github repo, changesets config, .gitignore entries, and patches package.json.\",\n )\n .option(\n '--configure-github',\n 'Also apply the uniform branch protection on main and enable auto-merge (requires gh CLI installed and authenticated).',\n )\n .option(\n '--dual-branch',\n 'Deprecated and ignored: the main + dev flow and its @next prereleases are retired. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--scope <scope>',\n 'Deprecated and ignored: the npm secret is NPM_AUTH_TOKEN in every org, holding that org\\'s own token. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--grant-team <slug>',\n 'GitHub team slug to grant push access on the repo. Requires gh CLI.',\n )\n .action(async (options) => {\n const {setupPublish} = await import('./commands/setup-publish.js');\n await setupPublish({\n configureGithub: !!options.configureGithub,\n dualBranch: !!options.dualBranch,\n scope: options.scope,\n grantTeam: options.grantTeam,\n });\n });\n\nprogram\n .command('all [action] [filter] [filter-value]')\n .action((command, filter, filterValue) => {\n executeCommandForEachPackage(\n getLincdPackages(),\n command,\n filter,\n filterValue,\n );\n });\n// program.command('all-except [excludedSpaces] [action]').action((excludedSpaces, command) => {\n// executeCommandForEachModule(getLincdModules(), command, null, excludedSpaces);\n// });\n\nprogram.command('dev [target] [mode]').action((target, mode) => {\n developPackage(target, mode);\n});\n\nprogram.command('depcheck').action((target, mode) => {\n depCheck();\n});\nprogram.command('depcheck-staged').action((target, mode) => {\n depCheckStaged();\n});\nprogram\n .command('check-imports')\n .description(\n 'Check the imports of the package in the current folder. Exits 1 when an invalid import is found',\n )\n .action(async () => {\n try {\n await checkImports();\n } catch (report) {\n // checkImports throws the formatted report of every invalid import.\n console.error(typeof report === 'string' ? report : String(report));\n process.exitCode = 1;\n }\n });\n\nprogram\n .command('package')\n .action((name, command, args: string[]) => {\n let fullCommand = command\n ? command +\n ' ' +\n args\n .slice(0, 3)\n .filter((a) => a && true)\n .join(' ')\n : null;\n\n //TODO: call\n // let pkgName = process.argv[1];\n // console.log(pkgName);\n // let restArgs = process.argv.slice(2)\n // program.parse([],{from:'user'});\n // program.parse(['--port', '80'], { from: 'user' })\n\n executeCommandForPackage(name, fullCommand);\n })\n .alias('p')\n .alias('pkg')\n .alias('m')\n .alias('module')\n .description(\n 'Searches for a package in this workspace with a partially matching name and executes a command for that package (without needing to execute it from the folder of the package)',\n )\n .argument('<name>', 'the name of the package. Can be a part of the name.')\n .argument(\n '[command]',\n 'the linked command you want to execute. Like dev or build',\n )\n .argument('[args...]', 'the additional arguments of that command');\n\nprogram.command('enable-capacitor').action(() => {\n addCapacitor();\n});\n\n// One copy, always (localize/ensure.ts): before a command that runs the app's\n// code, remove any localized checkout's own copy of what the app provides.\ninstallOneCopyHook(program);\n\nconst unknownCommand = unknownCommandError(program, process.argv.slice(2));\nif (unknownCommand) {\n console.error(chalk.red(unknownCommand));\n process.exit(1);\n}\nprogram.parse(process.argv);\n"]}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AACA,oHAAoH;AACpH,yCAAyC;;;;;;;;;;AAEzC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,YAAY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CAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env tsx\n//The line above calls the TSX typescript executer as runtime, which extends node.js and supports running typescript\n// see: https://www.npmjs.com/package/tsx\n\nimport chalk from 'chalk';\nimport {\n addCapacitor,\n buildAll,\n buildPackage,\n buildUpdated,\n checkImports,\n compilePackage,\n createApp,\n createComponent,\n createOntology,\n createPackage,\n createSetComponent,\n createShape,\n depCheck,\n depCheckStaged,\n developPackage,\n executeCommandForEachPackage,\n executeCommandForPackage,\n getLincdPackages,\n getScriptDir,\n publishPackage,\n publishUpdated,\n register,\n runMethod,\n runScript,\n startServer,\n upgradePackages,\n} from './cli-methods.js';\n// import {buildMetadata} from './metadata';\nimport {program, type Command} from 'commander';\nimport {CreatePackageError} from './utils/createPackageLocation.js';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport 'require-extensions';\nimport {unknownCommandError} from './unknown-command.js';\nimport {installDriftHook} from './localize/drift-hook.js';\n\n/**\n * Run an async command action and report a failure the way the rest of this\n * CLI does — one red message and exit code 1 — instead of letting the rejection\n * escape the action and print a raw unhandled-rejection stack.\n */\nconst runAppCommand = async (run: () => Promise<unknown>): Promise<void> => {\n try {\n await run();\n } catch (error) {\n const message =\n error instanceof Error ? error.message : String(error ?? 'Unknown error');\n console.error(chalk.red(message));\n if (process.env.LINKED_DEBUG && error instanceof Error && error.stack) {\n console.error(error.stack);\n }\n process.exitCode = 1;\n }\n};\n\n/** `--env a,b` → `['a', 'b']`. */\nconst splitEnvOption = (value?: string): string[] =>\n (value || '')\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean);\n\nprogram\n .command('create-app')\n .action((name, options) => {\n return createApp(name, process.cwd(), {\n appName: options.appName,\n appPrefix: options.appPrefix,\n appDomain: options.appDomain,\n skipInstall: options.skipInstall,\n template: options.template,\n }).catch((err) => {\n // Report and fail the process without cutting off pending output.\n console.error(chalk.red(err?.message ?? String(err)));\n process.exitCode = 1;\n });\n })\n .description(\n 'Creates a new folder with all the required files for a Linked app',\n )\n .argument(\n '<name>',\n 'the name of your Linked app. To use spaces, wrap the name in double quotes.',\n )\n .option('--app-name <name>', 'Display name for the app (skip interactive prompt)')\n .option('--app-prefix <prefix>', 'Short code prefix for data files (skip interactive prompt)')\n .option('--app-domain <domain>', 'Domain for the app (skip interactive prompt)')\n .option('--skip-install', 'Skip running npm install after scaffolding')\n .option(\n '--template <template>',\n 'App template: \"web\" (default) or \"react-native\"',\n );\n\nprogram\n .command('start')\n .action(async (options) => {\n const {startWithVite} = await import('./commands/start.js');\n return startWithVite({env: options?.env, apiOnly: options?.apiOnly});\n })\n .option('--env <env>', 'The node environment to use. Default is \"development\"')\n .option(\n '--api-only',\n 'Serve only the backend API: no vite.config, src/App.tsx or src/routes.tsx needed; page requests get a 404',\n )\n .description(\n 'Start the Linked dev server. Vite-backed by default.',\n );\n\nprogram\n .command('call')\n .action((packageName, method, options) => {\n return runMethod(packageName, method, {spawn: options.spawn});\n })\n .option(\n '--spawn',\n 'Start a new server instance instead of using an existing one',\n )\n .option('--env', 'The node environment to use. Default is \"development\"')\n .description(\n 'Start the Linked node.js server but without http server. Instead it immediately calls the specified method of the specified package and exits afterwards',\n )\n .argument(\n '<package>',\n 'the package of the backend provider that contains this method',\n )\n .argument('<method>', 'the name of the method you want to call');\n\nprogram\n .command('script')\n .action((scriptName, options) => {\n return runScript(scriptName, {spawn: options.spawn});\n })\n .option(\n '--spawn',\n 'Start a new server instance instead of using an existing one',\n )\n .option('--env', 'The node environment to use. Default is \"development\"')\n .description(\n 'Start the Linked node.js server but without http server. Instead it immediately runs the specified script and exits afterwards',\n )\n .argument(\n '<scriptName>',\n 'the name of the script file inside the /scripts folder',\n );\n\n/** A refusal of the create-* commands exits 1 with the message, not a stack. */\nconst reportRefusal = (e: unknown) => {\n if (!(e instanceof CreatePackageError)) throw e;\n console.error(chalk.red(e.message));\n process.exitCode = 1;\n};\n\nconst LOCATION_HELP =\n \"packages: part of this app's repository, a workspace member added to its dependencies. packages-local: its own git repository (git init + a first commit) in packages-local/, which the app gitignores; a workspace member through the app's \\\"packages-local/*\\\" glob, so npm links it (`linked localize --adopt` sets the app up and installs). Not added to the app's dependencies until it is published.\";\nconst REMOTE_HELP =\n \"The new repository's origin; also written to repository.url. Implies --location packages-local.\";\nconst PUSH_HELP = 'Push the first commit to --remote.';\nconst SKIP_INSTALL_HELP = 'Write the files only: no install, no build, no git.';\nconst BASE_URI_HELP =\n \"The root the package's IRIs are minted under: linkedPackage(name, {baseUri}), shapes at <uri>shape/<package>/<Name>, ontology terms at <uri>ont/<slug>/<Term>. Inside an app it defaults to LINKED_BASE_URI from the environment, then the app's .env.local, then its .env; with none of them the package declares no root and falls back to https://linked.cm/.\";\nconst WHERE_HELP =\n \"Inside an app, it goes in packages/ (part of the app's repository) or packages-local/ (its own git repository, linked with `linked localize`); without --location, --remote or --push you are asked, on a terminal.\";\n\n/** The three scaffolding commands share the where-flags; `--kind` is create-package's own. */\nconst withPackageOptions = (command: Command) =>\n command\n .option('--location <where>', LOCATION_HELP)\n .option('--remote <git-url>', REMOTE_HELP)\n .option('--push', PUSH_HELP)\n .option('--skip-install', SKIP_INSTALL_HELP)\n .option('--base-uri <uri>', BASE_URI_HELP);\n\nwithPackageOptions(\n program\n .command('create-package')\n .action(async (name, uriBase, options) => {\n try {\n await createPackage(name, uriBase, process.cwd(), options);\n } catch (e) {\n reportRefusal(e);\n }\n })\n .description(\n 'Create a new Linked package: an ontology package (<name>-ont: one ontology, no shapes), an asset package (<name>-assets: shapes, components and a backend) or both. Without --kind you are asked, on a terminal. A name that already ends in -ont or -assets keeps it (foo-ont stays foo-ont). ' +\n WHERE_HELP,\n )\n .option(\n '--kind <kind>',\n 'ontology, assets or both. `both` creates <name>-ont and <name>-assets; it cannot take --remote (one repository cannot hold two packages).',\n )\n .argument(\n '<name>',\n 'The name of the package, without the kind suffix: the package is named <name>-ont or <name>-assets (a name that already ends in the suffix is kept). An npm scope is kept (@acme/foo → @acme/foo-ont).',\n )\n .argument(\n '[uri_base]',\n \"The namespace of the ontology package's ontology. Leave blank for https://linked.cm/ont/<name>/ (the ontology slug is <name>, without -ont).\",\n ),\n);\n\nwithPackageOptions(\n program\n .command('create-ont-package')\n .action(async (name, uriBase, options) => {\n try {\n await createPackage(name, uriBase, process.cwd(), {...options, kind: 'ontology'});\n } catch (e) {\n reportRefusal(e);\n }\n })\n .description(\n 'Create an ontology package <name>-ont: exactly one ontology (src/ontologies/<name>.ts), no shapes, components or backend. Its ontology slug is <name>, so its terms mint {root}ont/<name>/{Term}. A name that already ends in -ont keeps it. ' +\n WHERE_HELP,\n )\n .argument('<name>', 'The ontology slug; the package is named <name>-ont (foo-ont stays foo-ont).')\n .argument(\n '[uri_base]',\n 'The namespace of the ontology. Leave blank for https://linked.cm/ont/<name>/.',\n ),\n);\n\nwithPackageOptions(\n program\n .command('create-asset-package')\n .action(async (name, options) => {\n try {\n await createPackage(name, undefined, process.cwd(), {...options, kind: 'assets'});\n } catch (e) {\n reportRefusal(e);\n }\n })\n .description(\n 'Create an asset package <name>-assets: shapes, components and a backend (src/shapes, src/components, src/backend.ts), and no ontology. A name that already ends in -assets keeps it. ' +\n WHERE_HELP,\n )\n .argument('<name>', 'The package is named <name>-assets (foo-assets stays foo-assets).'),\n);\n\nprogram\n .command('upgrade-packages')\n .action(() => {\n return upgradePackages();\n })\n .description(\n 'Upgrade all linked packages in the workspace to ESM/CJS dual packages',\n );\n\nprogram\n .command('create-shape')\n .action((name, uriBase) => {\n return createShape(name).catch(reportRefusal);\n })\n .description(\n 'Creates a new ShapeClass file for your package. Execute this from your package folder (packages/<name>), not the app root: an app registers no package.',\n )\n .argument(\n '<name>',\n 'The name of the shape. Will be used for the file name and the class name',\n );\n\nprogram\n .command('create-component')\n .action((name, uriBase) => {\n return createComponent(name).catch(reportRefusal);\n })\n .description(\n 'Creates a new Component file for your package. Execute this from your package folder (packages/<name>), not the app root: an app registers no package.',\n )\n .argument(\n '<name>',\n 'The name of the component. Will be used for the file name and the export name',\n );\n\nprogram\n .command('create-set-component')\n .action((name, uriBase) => {\n return createSetComponent(name).catch(reportRefusal);\n })\n .description(\n 'Creates a new SetComponent file for your package. Execute this from your package folder.',\n )\n .argument(\n '<name>',\n 'The name of the component. Will be used for the file name and the export name',\n );\n\nprogram\n .command('create-ontology')\n .action((prefix, uriBase) => {\n return createOntology(prefix, uriBase).catch(reportRefusal);\n })\n .description(\n 'Creates a new ontology file for your package. Execute this from your package folder.',\n )\n .argument(\n '<suggested-prefix>',\n 'The suggested prefix for your ontology. Also the shorthand code used for the file name and the exported ontology object',\n )\n .argument(\n '[uribase]',\n \"Optional argument to set the URI base for the URI's of all entities in your ontology. Leave blank to use the URI's provided by lincd.org once you register this package\",\n );\n\nprogram.command('app [action]', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-local', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-dev', {hidden: true}).action(() => {\n register('https://dev-registry.lincd.org');\n});\nprogram\n .command('register')\n .action(() => {\n register('https://registry.lincd.org');\n })\n .description(\n 'Register (a new version of) this package to the Linked registry. If successful your package will appear on linked.cm',\n );\n\nprogram\n .command('info')\n .action(() => {\n let localDir = getScriptDir();\n let packageJsonPath = path.join(localDir, 'package.json');\n try {\n var ownPackage = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n } catch (e) {\n console.warn(\n 'Could not read package.json at ' + packageJsonPath + ': ' + e,\n );\n process.exit();\n }\n console.log(ownPackage.version);\n console.log('Running from: ' + localDir);\n })\n .description(\n \"Log the version of this tool and the path that it's running from\",\n );\n\nprogram\n .command('build [target] [target2]', {isDefault: true})\n .action(async (target, target2, options) => {\n const result = await buildPackage(target, target2, process.cwd(), !options?.silent);\n if (result !== true) {\n process.exitCode = 1;\n }\n })\n .option(\n '--silent',\n 'No output to console unless errors occur. The exit code is unaffected: 0 when the build succeeds (warnings included), 1 when it fails',\n );\n\nprogram\n .command('compile-only')\n .action(() => {\n compilePackage();\n })\n .description(\n 'Compile the package without other build steps. Run this command from the package folder',\n );\nprogram.command('build-metadata').action(() => {\n console.log('Needs to be reimplemented');\n // buildMetadata();\n});\nprogram\n .command('build-app')\n .action(async (options) => {\n // Vite is the only app build. An app without a `vite.config.{ts,js,mjs}`\n // is rejected by name rather than falling back to anything.\n await runAppCommand(async () => {\n const {assertViteApp, buildViteApp} = await import(\n './commands/build-app.js'\n );\n assertViteApp();\n await buildViteApp({\n environmentNames: splitEnvOption(options?.env),\n target: options?.target,\n publish: options?.publish === true,\n revision: options?.revision,\n allowDirty: options?.allowDirty === true,\n });\n });\n })\n .option('--env <env>', 'The node environment to use. Default is \"development\"')\n .option('--target <target>', 'Build target: web or capacitor')\n .option(\n '--publish',\n 'Upload the release after a successful web build (off by default; use `linked publish-app`)',\n )\n .option(\n '--revision <sha>',\n 'Revision identifying the release. Defaults to LINKED_RELEASE_REVISION, GITHUB_SHA, then git HEAD',\n )\n .option(\n '--allow-dirty',\n 'Build from a working tree with uncommitted changes; the release revision gets a \"-dirty\" suffix',\n )\n .description(\n 'Build the linked app frontend and backend for production, and write a release manifest. Requires a vite.config in the app root.',\n );\n\nprogram\n .command('publish-app')\n .option('--env <env>', 'The node environment to use')\n .option(\n '--manifest <path>',\n 'Release manifest to publish, relative to the app root. Default public/bundles/linked-release.json',\n )\n .option('--yes', 'Upload the verified release. Without it this is a dry run')\n .action(async (options) => {\n // Retry or inspect an existing release without rebuilding the app.\n await runAppCommand(async () => {\n const {ensureEnvironmentLoaded} = await import('./lifecycle.js');\n const {resolveAppAssetsStore} = await import(\n './app-release/app-assets-store.js'\n );\n const {publishApp} = await import('./commands/publish-app.js');\n await ensureEnvironmentLoaded(splitEnvOption(options?.env));\n // The store is resolved by publishApp, after the manifest is read.\n await publishApp({\n manifestPath: options?.manifest,\n resolveStore: () => resolveAppAssetsStore(),\n yes: options?.yes === true,\n });\n });\n })\n .description(\n 'Validate or retry publishing a previously built release. Defaults to dry run.',\n );\n\nprogram\n .command('serve-app')\n .option('--env <env>', 'The node environment to use')\n .action(async (options) => {\n // Production runtime loads compiled output and never starts Vite/HMR.\n await runAppCommand(async () => {\n const {serveCompiledApp} = await import('./commands/serve-app.js');\n await serveCompiledApp({environmentNames: splitEnvOption(options?.env)});\n });\n })\n .description('Start a compiled Linked app without Vite or HMR.');\n\nprogram.command('publish-updated').action(() => {\n return publishUpdated();\n});\nprogram.command('publish [version]').action((version) => {\n publishPackage(null, false, null, version);\n});\n\nprogram.command('status').action(() => {\n //log which packages need to be published\n return publishUpdated(true).then(() => {\n //log which packages need to be build\n return buildUpdated(undefined, '', '', true);\n });\n});\nprogram\n .command('build-updated [target] [target2]')\n .action((target, target2, options) => {\n const {useGit}: {useGit?: boolean} = options;\n return buildUpdated(1, target, target2, useGit || false);\n })\n .option(\n '--use-git',\n 'Use git commit timestamps to check which packages have been updated since the last build',\n );\nprogram\n .command('build-updated-since [num-commits-back] [target] [target2]')\n .action((back, target, target2) => {\n return buildUpdated(back, target, target2);\n });\nprogram\n .command('build-all')\n .action((options) => {\n return buildAll(options);\n })\n .option(\n '--sync',\n 'build each package 1 by 1 - use this if you have build issues due to low available RAM memory',\n )\n .option('--from <char>', 'start from a specific package');\n\nprogram\n .command('build-workspace')\n .description(\n 'Build all linked packages in the current workspace in dependency order',\n )\n .option('-u, --updated', 'Only build updated packages')\n .option(\n '--use-git',\n 'Use git commit timestamps to determine which packages need updating',\n )\n .action(async (options) => {\n if (options.updated) {\n return buildUpdated(1, undefined, undefined, !!options.useGit);\n }\n return buildAll(options);\n });\n\nprogram\n .command('build-package <filepath>')\n .description(\n 'Given a file path, find its package.json and rebuild that package. Use for editor save hooks.',\n )\n .action(async (filepath) => {\n const {buildPackageByPath} = await import(\n './commands/build-package.js'\n );\n return buildPackageByPath(filepath);\n });\n\nprogram\n .command('localize [packages...]')\n .description(\n 'Develop an npm dependency from a git checkout in packages-local/, which the app lists in its workspaces so npm links it. Clones each package (the repository comes from its published `repository` field), sets the app up the first time (workspaces glob, lock-at-rest hook, .gitignore and the matching lockfile; commit those), installs git hooks (or, under core.hooksPath, prints the line to add to each), runs one npm install at the app root and builds the new checkouts. The app root is the topmost directory whose package.json has workspaces, so it can run from inside a member. Name packages exactly as npm names them (@_linked/rdfs, lodash). With no names, reports what is localized.',\n )\n .option(\n '--list',\n 'Report the checkouts (name, directory, branch, version), the parked ones and any drift.',\n )\n .option(\n '--check',\n 'With --list: print only the drift, and exit 1 when there is any (for CI and scripts).',\n )\n .option(\n '--adopt',\n 'Use a checkout that is already in packages-local (e.g. packages-local/_linked-foo for @_linked/foo) as it is: no registry lookup and no clone. For a package created locally, or a clone put there by hand.',\n )\n .option(\n '--parked',\n 'Take back every checkout `linked delocalize` parked, then npm install once.',\n )\n .option(\n '--repo <git-url>',\n 'Clone this instead of the published repository.',\n )\n .option(\n '--subdir <path>',\n \"The package's directory inside the repository (monorepos). The repository is cloned into packages-local/.repos/ and packages-local/<name> links to the package.\",\n )\n .option(\n '--build <cmd>',\n 'Run this in each new checkout after the install; a failure only warns. Defaults to `linked build` (`npm run build` for @_linked/cli); pass an empty string to build nothing.',\n )\n .option(\n '--dir <path>',\n 'Where checkouts live. Only packages-local is accepted: the workspaces glob names it.',\n )\n .option(\n '--relink',\n 'Deprecated, does nothing: npm links the checkouts. Exits 0, so old postinstall scripts keep working.',\n )\n .option(\n '--ensure',\n 'Deprecated, does nothing but print a hint: drift is reported by --list and before linked start. Exits 0.',\n )\n .action(async (packages: string[], options) => {\n const {runLocalize} = await import('./commands/localize.js');\n return runLocalize(packages, options);\n });\n\nprogram\n .command('delocalize [packages...]')\n .description(\n 'Park checkouts: move them from packages-local/ to .packages-local.parked/, then reinstall the registry copies (npm ci when no checkout remains and the committed lockfile and package.json are unchanged, else npm install and npm rebuild). `linked localize <name>` or `--parked` takes them back. With no names, parks every checkout.',\n )\n .option(\n '--purge',\n 'Delete the checkout instead of parking it. Refuses (exit 6) on unsaved work, or when it is not a git repository or git fails.',\n )\n .option(\n '--force',\n 'With --purge, delete even a checkout with unsaved work (uncommitted changes, commits no remote has, on a branch or a detached HEAD, a stash) or one git cannot check.',\n )\n .action(async (packages: string[], options) => {\n const {runDelocalize} = await import('./commands/localize.js');\n return runDelocalize(packages, options);\n });\n\nprogram\n .command('app-doctor')\n .description(\n \"Run in an app. Checks how the app uses linked packages: Vite pre-bundle entries that don't resolve (and the fix), linked packages whose dependencies don't support the app's React version (and which to bump), and hand-written entries that are now generated and can be removed. Exits 1 if anything needs fixing.\",\n )\n .action(async () => {\n const {runAppDoctor} = await import('./commands/app-doctor.js');\n return runAppDoctor();\n });\n\nprogram\n .command('setup-publish')\n .description(\n \"Set up the changesets publish pipeline in the current package repo. Writes the pr.yml/publish.yml callers of the shared workflows in the repo's own org .github repo, changesets config, .gitignore entries, and patches package.json.\",\n )\n .option(\n '--configure-github',\n 'Also apply the uniform branch protection on main and enable auto-merge (requires gh CLI installed and authenticated).',\n )\n .option(\n '--dual-branch',\n 'Deprecated and ignored: the main + dev flow and its @next prereleases are retired. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--scope <scope>',\n 'Deprecated and ignored: the npm secret is NPM_AUTH_TOKEN in every org, holding that org\\'s own token. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--grant-team <slug>',\n 'GitHub team slug to grant push access on the repo. Requires gh CLI.',\n )\n .action(async (options) => {\n const {setupPublish} = await import('./commands/setup-publish.js');\n await setupPublish({\n configureGithub: !!options.configureGithub,\n dualBranch: !!options.dualBranch,\n scope: options.scope,\n grantTeam: options.grantTeam,\n });\n });\n\nprogram\n .command('all [action] [filter] [filter-value]')\n .action((command, filter, filterValue) => {\n executeCommandForEachPackage(\n getLincdPackages(),\n command,\n filter,\n filterValue,\n );\n });\n// program.command('all-except [excludedSpaces] [action]').action((excludedSpaces, command) => {\n// executeCommandForEachModule(getLincdModules(), command, null, excludedSpaces);\n// });\n\nprogram.command('dev [target] [mode]').action((target, mode) => {\n developPackage(target, mode);\n});\n\nprogram.command('depcheck').action((target, mode) => {\n depCheck();\n});\nprogram.command('depcheck-staged').action((target, mode) => {\n depCheckStaged();\n});\nprogram\n .command('check-imports')\n .description(\n 'Check the imports of the package in the current folder. Exits 1 when an invalid import is found',\n )\n .action(async () => {\n try {\n await checkImports();\n } catch (report) {\n // checkImports throws the formatted report of every invalid import.\n console.error(typeof report === 'string' ? report : String(report));\n process.exitCode = 1;\n }\n });\n\nprogram\n .command('package')\n .action((name, command, args: string[]) => {\n let fullCommand = command\n ? command +\n ' ' +\n args\n .slice(0, 3)\n .filter((a) => a && true)\n .join(' ')\n : null;\n\n //TODO: call\n // let pkgName = process.argv[1];\n // console.log(pkgName);\n // let restArgs = process.argv.slice(2)\n // program.parse([],{from:'user'});\n // program.parse(['--port', '80'], { from: 'user' })\n\n executeCommandForPackage(name, fullCommand);\n })\n .alias('p')\n .alias('pkg')\n .alias('m')\n .alias('module')\n .description(\n 'Searches for a package in this workspace with a partially matching name and executes a command for that package (without needing to execute it from the folder of the package)',\n )\n .argument('<name>', 'the name of the package. Can be a part of the name.')\n .argument(\n '[command]',\n 'the linked command you want to execute. Like dev or build',\n )\n .argument('[args...]', 'the additional arguments of that command');\n\nprogram.command('enable-capacitor').action(() => {\n addCapacitor();\n});\n\n// Before a command that runs the app's code, report drift between the\n// localized checkouts and what npm installed (localize/drift.ts). Never fails it.\ninstallDriftHook(program);\n\nconst unknownCommand = unknownCommandError(program, process.argv.slice(2));\nif (unknownCommand) {\n console.error(chalk.red(unknownCommand));\n process.exit(1);\n}\nprogram.parse(process.argv);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"build-app.d.ts","sourceRoot":"","sources":["../../../src/commands/build-app.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EACL,qBAAqB,EAKtB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAC,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,OAGrD,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,gBAAuB,KAAG,IAQvD,CAAC;AAgBF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,GACvB,UAAS,mBAAwB,EACjC,eAAc,wBAA6B,KAC1C,OAAO,CAAC,wBAAwB,CA2IlC,CAAC"}
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import fs from 'fs';
11
11
  import path from 'path';
12
+ import { importFile } from '../utils/platform.js';
12
13
  import { resolveAppAssetsStore } from '../app-release/app-assets-store.js';
13
14
  import { createReleaseManifest, releaseBaseURL, releaseStaticAccessURL, resolveReleaseIdentity, writeReleaseManifest, } from '../app-release/create-release-manifest.js';
14
15
  import { resolveBuildTarget } from '../app-release/resolve-build-target.js';
@@ -42,7 +43,7 @@ const loadDefaultPublishConfig = (appRoot) => __awaiter(void 0, void 0, void 0,
42
43
  .find((candidate) => fs.existsSync(candidate));
43
44
  if (!configPath)
44
45
  return {};
45
- const loaded = yield import(/* @vite-ignore */ configPath);
46
+ const loaded = yield importFile(configPath);
46
47
  return ((_a = loaded.default) === null || _a === void 0 ? void 0 : _a.publish) || {};
47
48
  });
48
49
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"build-app.js","sourceRoot":"","sources":["../../../src/commands/build-app.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAC,kBAAkB,EAAC,MAAM,wCAAwC,CAAC;AAM1E,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AA+B5C,MAAM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AEF,IAAI,KAAK,EAAE,CAAC;QACV,yEAAyE;QACzE,2EAA2E;QAC3E,yDAAyD;QACzD,OAAO,CAAC,GAAG,CACT,gDAAgD,sBAAsB,CACpE,KAAK,CAAC,SAAS,EACf,QAAQ,CAAC,aAAa,CACvB,EAAE,CACJ,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,OAAO,CAAC,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC;QAC3D,CAAC;aAAM,IAAI,QAAQ,CAAC,WAAW,EAAE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,IAAI,UAAU,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC5C,MAAM,OAAO,CAAC;QACZ,OAAO;QACP,YAAY,EAAE,oBAAoB;QAClC,KAAK;QACL,GAAG,EAAE,IAAI;KACV,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACrD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport type {IFileStore} from '@_linked/core/interfaces/IFileStore';\nimport {resolveAppAssetsStore} from '../app-release/app-assets-store.js';\nimport {\n createReleaseManifest,\n releaseBaseURL,\n releaseStaticAccessURL,\n resolveReleaseIdentity,\n writeReleaseManifest,\n} from '../app-release/create-release-manifest.js';\nimport {resolveBuildTarget} from '../app-release/resolve-build-target.js';\nimport type {\n AppBuildTarget,\n AppPublishConfig,\n LinkedAppReleaseManifest,\n} from '../app-release/types.js';\nimport {publishApp} from './publish-app.js';\n\nexport interface BuildViteAppOptions {\n appRoot?: string;\n environmentNames?: string[];\n target?: AppBuildTarget;\n /**\n * Upload the release straight after building. Off by default: building\n * produces a manifest, `linked publish-app` uploads it.\n */\n publish?: boolean;\n /** `--revision <sha>`: identify the release without asking Git. */\n revision?: string;\n /** `--allow-dirty`: build from a tree with uncommitted changes. */\n allowDirty?: boolean;\n}\n\nexport interface BuildViteAppDependencies {\n loadEnvironment?: () => Promise<void>;\n buildFrontend?: (appRoot: string, base?: string) => Promise<void>;\n buildBackend?: () => Promise<boolean>;\n resolveStore?: () => Promise<IFileStore>;\n loadPublishConfig?: (appRoot: string) => Promise<AppPublishConfig>;\n createManifest?: typeof createReleaseManifest;\n writeManifest?: (\n appRoot: string,\n manifest: LinkedAppReleaseManifest,\n ) => string;\n publish?: typeof publishApp;\n}\n\nconst VITE_CONFIG_FILES = [\n 'vite.config.ts',\n 'vite.config.js',\n 'vite.config.mjs',\n];\n\nexport const hasViteConfig = (appRoot = process.cwd()): boolean =>\n VITE_CONFIG_FILES.some((fileName) =>\n fs.existsSync(path.join(appRoot, fileName)),\n );\n\n/**\n * Vite is the only app build there is. There used to be a webpack fallback for\n * apps without a Vite config; it wrote no release manifest, so every release\n * flag had to be refused on that path. Now the app itself is refused, by name,\n * rather than silently building something that cannot be published.\n */\nexport const assertViteApp = (appRoot = process.cwd()): void => {\n if (hasViteConfig(appRoot)) return;\n throw new Error(\n `[linked build-app] no vite.config.{ts,js,mjs} found in ${appRoot}. ` +\n 'The webpack build has been removed, so an app needs a Vite config to be built. Add one:\\n\\n' +\n \" import {createViteConfig} from '@_linked/cli/vite-config';\\n\" +\n \" export default createViteConfig({port: 4040, cssMode: 'tailwind'});\\n\",\n );\n};\n\nconst loadDefaultPublishConfig = async (\n appRoot: string,\n): Promise<AppPublishConfig> => {\n // App config declares extra public files; Vite bundle files come from its\n // own manifest and do not need to be repeated here.\n const configPath = ['linked.config.js', 'lincd.config.js']\n .map((fileName) => path.join(appRoot, fileName))\n .find((candidate) => fs.existsSync(candidate));\n if (!configPath) return {};\n\n const loaded = await import(/* @vite-ignore */ configPath);\n return loaded.default?.publish || {};\n};\n\n/**\n * Build a Linked app with Vite and write a verified release manifest.\n *\n * Building never uploads on its own — pass `publish` (the `--publish` flag) to\n * chain `publish-app` onto a successful web build. A Capacitor build ships its\n * assets inside the native app, so it writes a local, non-publishable manifest\n * and resolves no file store at all.\n *\n * A web build resolves the store and the release prefix first and hands Vite\n * `base = <accessURL>/<releasePrefix>/public/bundles/`, so every URL the bundle\n * emits for itself resolves under the release prefix on a plain static store —\n * no server rewrite, and two releases can be served side by side.\n */\nexport const buildViteApp = async (\n options: BuildViteAppOptions = {},\n dependencies: BuildViteAppDependencies = {},\n): Promise<LinkedAppReleaseManifest> => {\n const appRoot = options.appRoot || process.cwd();\n const loadEnvironment =\n dependencies.loadEnvironment ||\n (async () => {\n const {ensureEnvironmentLoaded} = await import('../lifecycle.js');\n return ensureEnvironmentLoaded(options.environmentNames);\n });\n console.log('🔄 Loading build environment...');\n await loadEnvironment();\n console.log(\n `✅ Build environment loaded${\n options.environmentNames?.length\n ? `: ${options.environmentNames.join(', ')}`\n : ''\n }`,\n );\n\n const target = resolveBuildTarget({\n target: options.target,\n appEnv: process.env.APP_ENV,\n });\n\n const buildFrontend =\n dependencies.buildFrontend ||\n (async (root: string, base?: string) => {\n const {build} = await import('vite');\n await build(base ? {root, base} : {root});\n });\n const buildBackend =\n dependencies.buildBackend ||\n (async () => {\n const {buildBackend: compileBackend} = await import('../cli-methods.js');\n return compileBackend();\n });\n\n // A publishable build has to know where it will be published *before* the\n // client bundle is built, not just before the manifest is written: the\n // bundle's own URLs for its chunks and assets are baked in at build time, and\n // they have to point under the release prefix.\n let store: IFileStore | undefined;\n if (target === 'web') {\n console.log('🔄 Resolving the appAssets file store...');\n const resolveStore = dependencies.resolveStore || resolveAppAssetsStore;\n store = await resolveStore();\n console.log(`✅ Publishing destination: ${store.accessURL}`);\n } else {\n console.log(\n 'Capacitor build: writing a local manifest. These assets ship inside the native app and are never uploaded.',\n );\n }\n\n const loadPublishConfig =\n dependencies.loadPublishConfig || loadDefaultPublishConfig;\n const publishConfig = await loadPublishConfig(appRoot);\n\n // Resolving the identity now also means a dirty tree or a missing revision\n // fails before a long build rather than after it.\n const identity = resolveReleaseIdentity({\n appRoot,\n releasePrefix: publishConfig.releasePrefix,\n sourceRevision: options.revision,\n allowDirty: options.allowDirty,\n });\n const baseURL = store\n ? releaseBaseURL(store.accessURL, identity.releasePrefix)\n : '';\n if (baseURL) {\n console.log(`✅ Release ${identity.releaseId} will be served from ${baseURL}`);\n }\n\n // The client and backend must both finish before release files are described\n // or any remote storage write is allowed.\n console.log('🔄 Building Vite client bundle...');\n await buildFrontend(appRoot, baseURL || undefined);\n console.log('✅ Vite client bundle complete');\n\n console.log('🔄 Building application backend...');\n const backendBuilt = await buildBackend();\n if (backendBuilt !== true) {\n throw new Error('Backend build did not complete successfully');\n }\n console.log('✅ Application backend build complete');\n\n const createManifest = dependencies.createManifest || createReleaseManifest;\n const writeManifest = dependencies.writeManifest || writeReleaseManifest;\n\n // The release manifest is the hand-off between build and publishing. Only\n // files listed here can be uploaded by the publisher.\n console.log('🔄 Creating verified release manifest...');\n const manifest = createManifest({\n appRoot,\n environmentNames: options.environmentNames || [],\n target,\n accessURL: store ? store.accessURL : null,\n staticAssets: publishConfig.staticAssets,\n releasePrefix: publishConfig.releasePrefix,\n // Reuse the revision the bundle was built against, so the manifest prefix\n // and the baked-in base URL can never disagree.\n sourceRevision: identity.sourceRevision,\n baseURL,\n });\n const manifestPath = writeManifest(appRoot, manifest);\n const relativeManifestPath = path.relative(appRoot, manifestPath);\n console.log(\n `✅ Release manifest ready: ${manifest.files.length} artifacts under ${manifest.destination.releasePrefix} (${relativeManifestPath})`,\n );\n\n if (store) {\n // The bundle's own URLs already carry the prefix (Vite `base`). The HTML\n // entry tags are rendered by the server from STATIC_ACCESS_URL, so this is\n // the one value a deployment sets to serve this release.\n console.log(\n `To serve this release, set STATIC_ACCESS_URL=${releaseStaticAccessURL(\n store.accessURL,\n identity.releasePrefix,\n )}`,\n );\n }\n\n if (!options.publish || !store) {\n if (options.publish && !store) {\n console.log('Nothing to publish for a Capacitor build.');\n } else if (manifest.publishable) {\n console.log('Run `linked publish-app --yes` to upload this release.');\n }\n return manifest;\n }\n\n const publish = dependencies.publish || publishApp;\n console.log('🔄 Publishing the release...');\n await publish({\n appRoot,\n manifestPath: relativeManifestPath,\n store,\n yes: true,\n });\n console.log('✅ Build and release workflow complete');\n return manifest;\n};\n"]}
1
+ {"version":3,"file":"build-app.js","sourceRoot":"","sources":["../../../src/commands/build-app.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAC,qBAAqB,EAAC,MAAM,oCAAoC,CAAC;AACzE,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAC,kBAAkB,EAAC,MAAM,wCAAwC,CAAC;AAM1E,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AA+B5C,MAAM,iBAAiB,GAAG;IACxB,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,EAAW,EAAE,CAChE,iBAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAClC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAC5C,CAAC;AAEJ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,EAAQ,EAAE;IAC7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AO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,IAAI,UAAU,CAAC;IACnD,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;IAC5C,MAAM,OAAO,CAAC;QACZ,OAAO;QACP,YAAY,EAAE,oBAAoB;QAClC,KAAK;QACL,GAAG,EAAE,IAAI;KACV,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;IACrD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport {importFile} from '../utils/platform.js';\nimport type {IFileStore} from '@_linked/core/interfaces/IFileStore';\nimport {resolveAppAssetsStore} from '../app-release/app-assets-store.js';\nimport {\n createReleaseManifest,\n releaseBaseURL,\n releaseStaticAccessURL,\n resolveReleaseIdentity,\n writeReleaseManifest,\n} from '../app-release/create-release-manifest.js';\nimport {resolveBuildTarget} from '../app-release/resolve-build-target.js';\nimport type {\n AppBuildTarget,\n AppPublishConfig,\n LinkedAppReleaseManifest,\n} from '../app-release/types.js';\nimport {publishApp} from './publish-app.js';\n\nexport interface BuildViteAppOptions {\n appRoot?: string;\n environmentNames?: string[];\n target?: AppBuildTarget;\n /**\n * Upload the release straight after building. Off by default: building\n * produces a manifest, `linked publish-app` uploads it.\n */\n publish?: boolean;\n /** `--revision <sha>`: identify the release without asking Git. */\n revision?: string;\n /** `--allow-dirty`: build from a tree with uncommitted changes. */\n allowDirty?: boolean;\n}\n\nexport interface BuildViteAppDependencies {\n loadEnvironment?: () => Promise<void>;\n buildFrontend?: (appRoot: string, base?: string) => Promise<void>;\n buildBackend?: () => Promise<boolean>;\n resolveStore?: () => Promise<IFileStore>;\n loadPublishConfig?: (appRoot: string) => Promise<AppPublishConfig>;\n createManifest?: typeof createReleaseManifest;\n writeManifest?: (\n appRoot: string,\n manifest: LinkedAppReleaseManifest,\n ) => string;\n publish?: typeof publishApp;\n}\n\nconst VITE_CONFIG_FILES = [\n 'vite.config.ts',\n 'vite.config.js',\n 'vite.config.mjs',\n];\n\nexport const hasViteConfig = (appRoot = process.cwd()): boolean =>\n VITE_CONFIG_FILES.some((fileName) =>\n fs.existsSync(path.join(appRoot, fileName)),\n );\n\n/**\n * Vite is the only app build there is. There used to be a webpack fallback for\n * apps without a Vite config; it wrote no release manifest, so every release\n * flag had to be refused on that path. Now the app itself is refused, by name,\n * rather than silently building something that cannot be published.\n */\nexport const assertViteApp = (appRoot = process.cwd()): void => {\n if (hasViteConfig(appRoot)) return;\n throw new Error(\n `[linked build-app] no vite.config.{ts,js,mjs} found in ${appRoot}. ` +\n 'The webpack build has been removed, so an app needs a Vite config to be built. Add one:\\n\\n' +\n \" import {createViteConfig} from '@_linked/cli/vite-config';\\n\" +\n \" export default createViteConfig({port: 4040, cssMode: 'tailwind'});\\n\",\n );\n};\n\nconst loadDefaultPublishConfig = async (\n appRoot: string,\n): Promise<AppPublishConfig> => {\n // App config declares extra public files; Vite bundle files come from its\n // own manifest and do not need to be repeated here.\n const configPath = ['linked.config.js', 'lincd.config.js']\n .map((fileName) => path.join(appRoot, fileName))\n .find((candidate) => fs.existsSync(candidate));\n if (!configPath) return {};\n\n const loaded = await importFile(configPath);\n return loaded.default?.publish || {};\n};\n\n/**\n * Build a Linked app with Vite and write a verified release manifest.\n *\n * Building never uploads on its own — pass `publish` (the `--publish` flag) to\n * chain `publish-app` onto a successful web build. A Capacitor build ships its\n * assets inside the native app, so it writes a local, non-publishable manifest\n * and resolves no file store at all.\n *\n * A web build resolves the store and the release prefix first and hands Vite\n * `base = <accessURL>/<releasePrefix>/public/bundles/`, so every URL the bundle\n * emits for itself resolves under the release prefix on a plain static store —\n * no server rewrite, and two releases can be served side by side.\n */\nexport const buildViteApp = async (\n options: BuildViteAppOptions = {},\n dependencies: BuildViteAppDependencies = {},\n): Promise<LinkedAppReleaseManifest> => {\n const appRoot = options.appRoot || process.cwd();\n const loadEnvironment =\n dependencies.loadEnvironment ||\n (async () => {\n const {ensureEnvironmentLoaded} = await import('../lifecycle.js');\n return ensureEnvironmentLoaded(options.environmentNames);\n });\n console.log('🔄 Loading build environment...');\n await loadEnvironment();\n console.log(\n `✅ Build environment loaded${\n options.environmentNames?.length\n ? `: ${options.environmentNames.join(', ')}`\n : ''\n }`,\n );\n\n const target = resolveBuildTarget({\n target: options.target,\n appEnv: process.env.APP_ENV,\n });\n\n const buildFrontend =\n dependencies.buildFrontend ||\n (async (root: string, base?: string) => {\n const {build} = await import('vite');\n await build(base ? {root, base} : {root});\n });\n const buildBackend =\n dependencies.buildBackend ||\n (async () => {\n const {buildBackend: compileBackend} = await import('../cli-methods.js');\n return compileBackend();\n });\n\n // A publishable build has to know where it will be published *before* the\n // client bundle is built, not just before the manifest is written: the\n // bundle's own URLs for its chunks and assets are baked in at build time, and\n // they have to point under the release prefix.\n let store: IFileStore | undefined;\n if (target === 'web') {\n console.log('🔄 Resolving the appAssets file store...');\n const resolveStore = dependencies.resolveStore || resolveAppAssetsStore;\n store = await resolveStore();\n console.log(`✅ Publishing destination: ${store.accessURL}`);\n } else {\n console.log(\n 'Capacitor build: writing a local manifest. These assets ship inside the native app and are never uploaded.',\n );\n }\n\n const loadPublishConfig =\n dependencies.loadPublishConfig || loadDefaultPublishConfig;\n const publishConfig = await loadPublishConfig(appRoot);\n\n // Resolving the identity now also means a dirty tree or a missing revision\n // fails before a long build rather than after it.\n const identity = resolveReleaseIdentity({\n appRoot,\n releasePrefix: publishConfig.releasePrefix,\n sourceRevision: options.revision,\n allowDirty: options.allowDirty,\n });\n const baseURL = store\n ? releaseBaseURL(store.accessURL, identity.releasePrefix)\n : '';\n if (baseURL) {\n console.log(`✅ Release ${identity.releaseId} will be served from ${baseURL}`);\n }\n\n // The client and backend must both finish before release files are described\n // or any remote storage write is allowed.\n console.log('🔄 Building Vite client bundle...');\n await buildFrontend(appRoot, baseURL || undefined);\n console.log('✅ Vite client bundle complete');\n\n console.log('🔄 Building application backend...');\n const backendBuilt = await buildBackend();\n if (backendBuilt !== true) {\n throw new Error('Backend build did not complete successfully');\n }\n console.log('✅ Application backend build complete');\n\n const createManifest = dependencies.createManifest || createReleaseManifest;\n const writeManifest = dependencies.writeManifest || writeReleaseManifest;\n\n // The release manifest is the hand-off between build and publishing. Only\n // files listed here can be uploaded by the publisher.\n console.log('🔄 Creating verified release manifest...');\n const manifest = createManifest({\n appRoot,\n environmentNames: options.environmentNames || [],\n target,\n accessURL: store ? store.accessURL : null,\n staticAssets: publishConfig.staticAssets,\n releasePrefix: publishConfig.releasePrefix,\n // Reuse the revision the bundle was built against, so the manifest prefix\n // and the baked-in base URL can never disagree.\n sourceRevision: identity.sourceRevision,\n baseURL,\n });\n const manifestPath = writeManifest(appRoot, manifest);\n const relativeManifestPath = path.relative(appRoot, manifestPath);\n console.log(\n `✅ Release manifest ready: ${manifest.files.length} artifacts under ${manifest.destination.releasePrefix} (${relativeManifestPath})`,\n );\n\n if (store) {\n // The bundle's own URLs already carry the prefix (Vite `base`). The HTML\n // entry tags are rendered by the server from STATIC_ACCESS_URL, so this is\n // the one value a deployment sets to serve this release.\n console.log(\n `To serve this release, set STATIC_ACCESS_URL=${releaseStaticAccessURL(\n store.accessURL,\n identity.releasePrefix,\n )}`,\n );\n }\n\n if (!options.publish || !store) {\n if (options.publish && !store) {\n console.log('Nothing to publish for a Capacitor build.');\n } else if (manifest.publishable) {\n console.log('Run `linked publish-app --yes` to upload this release.');\n }\n return manifest;\n }\n\n const publish = dependencies.publish || publishApp;\n console.log('🔄 Publishing the release...');\n await publish({\n appRoot,\n manifestPath: relativeManifestPath,\n store,\n yes: true,\n });\n console.log('✅ Build and release workflow complete');\n return manifest;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"build-package.d.ts","sourceRoot":"","sources":["../../../src/commands/build-package.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDxE"}
1
+ {"version":3,"file":"build-package.d.ts","sourceRoot":"","sources":["../../../src/commands/build-package.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyDxE"}
@@ -52,12 +52,16 @@ export function buildPackageByPath(filePath) {
52
52
  const releases = fs.readdirSync(yarnReleasesDir);
53
53
  if (releases.length > 0) {
54
54
  yarnBin = path.join(yarnReleasesDir, releases[0]);
55
+ // Windows runs no `.cjs` by its shebang: node runs it there.
56
+ if (process.platform === 'win32')
57
+ yarnBin = `"${process.execPath}" "${yarnBin}"`;
55
58
  }
56
59
  }
57
60
  runner = `${yarnBin} exec`;
58
61
  }
59
- const command = `cd ${currentPath} && ${runner} linked build`;
60
- yield execp(command, true, false);
62
+ // The package as cwd, not `cd <dir> &&`: cmd.exe's `cd` does not change
63
+ // drives, and the path may hold a space.
64
+ yield execp(`${runner} linked build`, true, false, { cwd: currentPath });
61
65
  return;
62
66
  }
63
67
  currentPath = path.dirname(currentPath);
@@ -1 +1 @@
1
- {"version":3,"file":"build-package.js","sourceRoot":"","sources":["../../../src/commands/build-package.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,UAAgB,kBAAkB,CAAC,QAAgB;;QACvD,IAAI,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;YACz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AAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;oBACtE,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;wBACnC,MAAM,QAAQ,GAAG,EAAE,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;wBACjD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;4BACxB,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;wBACpD,CAAC;oBACH,CAAC;oBACD,MAAM,GAAG,GAAG,OAAO,OAAO,CAAC;gBAC7B,CAAC;gBAED,MAAM,OAAO,GAAG,MAAM,WAAW,OAAO,MAAM,eAAe,CAAC;gBAC9D,MAAM,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;gBAClC,OAAO;YACT,CAAC;YACD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,yCAAyC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CAAA","sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\nimport {execp} from '../utils.js';\nimport {detectPackageManager} from '../utils/packageManager.js';\nimport {isLinkedPackageJson} from '../installed-packages.js';\n\n/**\n * Given any file or directory path, walk up to find the nearest package.json\n * and run `linked build` in that package's directory. This is the editor-hook\n * variant of build: the caller knows a file path, we figure out the package.\n *\n * Only rebuilds packages flagged `linkedPackage: true`.\n */\nexport async function buildPackageByPath(filePath: string): Promise<void> {\n let currentPath = path.isAbsolute(filePath)\n ? filePath\n : path.resolve(process.cwd(), filePath);\n\n if (fs.existsSync(currentPath) && fs.statSync(currentPath).isFile()) {\n currentPath = path.dirname(currentPath);\n }\n\n while (currentPath !== path.dirname(currentPath)) {\n const pkgJsonPath = path.join(currentPath, 'package.json');\n if (fs.existsSync(pkgJsonPath)) {\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));\n const isLinked = isLinkedPackageJson(pkgJson);\n\n if (!isLinked) {\n console.log(\n chalk.yellow(\n `Package ${pkgJson.name} is not a linked package (no linkedPackage flag). Skipping.`,\n ),\n );\n return;\n }\n\n console.log(chalk.cyan(`Rebuilding ${pkgJson.name}`));\n\n // npm is the default. Only a package that actually lives in a yarn\n // project is built through yarn — that keeps existing yarn monorepos\n // (which may vendor their own yarn release) working.\n //\n // Either way we invoke the `linked` BINARY rather than a script: inner\n // packages don't have a \"linked\" script in package.json.\n let runner = 'npx --no-install';\n if (detectPackageManager(currentPath) === 'yarn') {\n let yarnBin = 'yarn';\n const yarnReleasesDir = path.join(process.cwd(), '.yarn', 'releases');\n if (fs.existsSync(yarnReleasesDir)) {\n const releases = fs.readdirSync(yarnReleasesDir);\n if (releases.length > 0) {\n yarnBin = path.join(yarnReleasesDir, releases[0]);\n }\n }\n runner = `${yarnBin} exec`;\n }\n\n const command = `cd ${currentPath} && ${runner} linked build`;\n await execp(command, true, false);\n return;\n }\n currentPath = path.dirname(currentPath);\n }\n\n console.error(chalk.red(`No package.json found walking up from ${filePath}`));\n process.exit(1);\n}\n"]}
1
+ {"version":3,"file":"build-package.js","sourceRoot":"","sources":["../../../src/commands/build-package.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAClC,OAAO,EAAC,oBAAoB,EAAC,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAC,mBAAmB,EAAC,MAAM,0BAA0B,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,UAAgB,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CAAC;oBACjD,IAAI,OAAO,GAAG,MAAM,CAAC;oBACrB,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;oBACtE,IAAI,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;wBACnC,MAAM,QAAQ,GAAG,EAAE,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;wBACjD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;4BACxB,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;4BAClD,6DAA6D;4BAC7D,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;gCAAE,OAAO,GAAG,IAAI,OAAO,CAAC,QAAQ,MAAM,OAAO,GAAG,CAAC;wBACnF,CAAC;oBACH,CAAC;oBACD,MAAM,GAAG,GAAG,OAAO,OAAO,CAAC;gBAC7B,CAAC;gBAED,wEAAwE;gBACxE,yCAAyC;gBACzC,MAAM,KAAK,CAAC,GAAG,MAAM,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,EAAC,GAAG,EAAE,WAAW,EAAC,CAAC,CAAC;gBACvE,OAAO;YACT,CAAC;YACD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,yCAAyC,QAAQ,EAAE,CAAC,CAAC,CAAC;QAC9E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;CAAA","sourcesContent":["import chalk from 'chalk';\nimport fs from 'fs';\nimport path from 'path';\nimport {execp} from '../utils.js';\nimport {detectPackageManager} from '../utils/packageManager.js';\nimport {isLinkedPackageJson} from '../installed-packages.js';\n\n/**\n * Given any file or directory path, walk up to find the nearest package.json\n * and run `linked build` in that package's directory. This is the editor-hook\n * variant of build: the caller knows a file path, we figure out the package.\n *\n * Only rebuilds packages flagged `linkedPackage: true`.\n */\nexport async function buildPackageByPath(filePath: string): Promise<void> {\n let currentPath = path.isAbsolute(filePath)\n ? filePath\n : path.resolve(process.cwd(), filePath);\n\n if (fs.existsSync(currentPath) && fs.statSync(currentPath).isFile()) {\n currentPath = path.dirname(currentPath);\n }\n\n while (currentPath !== path.dirname(currentPath)) {\n const pkgJsonPath = path.join(currentPath, 'package.json');\n if (fs.existsSync(pkgJsonPath)) {\n const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));\n const isLinked = isLinkedPackageJson(pkgJson);\n\n if (!isLinked) {\n console.log(\n chalk.yellow(\n `Package ${pkgJson.name} is not a linked package (no linkedPackage flag). Skipping.`,\n ),\n );\n return;\n }\n\n console.log(chalk.cyan(`Rebuilding ${pkgJson.name}`));\n\n // npm is the default. Only a package that actually lives in a yarn\n // project is built through yarn — that keeps existing yarn monorepos\n // (which may vendor their own yarn release) working.\n //\n // Either way we invoke the `linked` BINARY rather than a script: inner\n // packages don't have a \"linked\" script in package.json.\n let runner = 'npx --no-install';\n if (detectPackageManager(currentPath) === 'yarn') {\n let yarnBin = 'yarn';\n const yarnReleasesDir = path.join(process.cwd(), '.yarn', 'releases');\n if (fs.existsSync(yarnReleasesDir)) {\n const releases = fs.readdirSync(yarnReleasesDir);\n if (releases.length > 0) {\n yarnBin = path.join(yarnReleasesDir, releases[0]);\n // Windows runs no `.cjs` by its shebang: node runs it there.\n if (process.platform === 'win32') yarnBin = `\"${process.execPath}\" \"${yarnBin}\"`;\n }\n }\n runner = `${yarnBin} exec`;\n }\n\n // The package as cwd, not `cd <dir> &&`: cmd.exe's `cd` does not change\n // drives, and the path may hold a space.\n await execp(`${runner} linked build`, true, false, {cwd: currentPath});\n return;\n }\n currentPath = path.dirname(currentPath);\n }\n\n console.error(chalk.red(`No package.json found walking up from ${filePath}`));\n process.exit(1);\n}\n"]}
@@ -1,27 +1,22 @@
1
- /** The build command `localize` runs inside a fresh checkout by default. */
2
- export declare const DEFAULT_BUILD_COMMAND = "linked build";
1
+ export { DEFAULT_BUILD_COMMAND } from '../localize/index.js';
3
2
  export interface LocalizeCommandOptions {
4
3
  adopt?: boolean;
4
+ parked?: boolean;
5
5
  list?: boolean;
6
6
  check?: boolean;
7
+ /** Deprecated: npm links checkouts now. Exits 0 with no output. */
7
8
  relink?: boolean;
8
- /** Check every checkout for a copy of what the app provides and prune it; exit 0. No names. */
9
+ /** Deprecated: drift is reported before `linked start` and by `--list`. Exits 0 with one hint. */
9
10
  ensure?: boolean;
10
- /** `npm install` in this package's checkout, then prune it. */
11
- reinstall?: string;
12
11
  dir?: string;
13
12
  repo?: string;
14
13
  subdir?: string;
15
14
  build?: string;
16
15
  force?: boolean;
17
16
  purge?: boolean;
18
- /** Commander's `--no-prune` sets this to false; absent means on. */
19
- prune?: boolean;
20
17
  }
21
- /** localize's prune options for a run: on unless explicitly turned off. */
22
- export declare function pruneOptions(prune?: boolean | undefined): {
23
- prune: boolean;
24
- };
18
+ /** What `--ensure` prints, once, on stderr. */
19
+ export declare const ENSURE_HINT: string;
25
20
  /**
26
21
  * `localize` reports failure through an exit code rather than by throwing, so
27
22
  * that a partial run still prints what it did. Mirror that: set `exitCode` and
@@ -30,7 +25,7 @@ export declare function pruneOptions(prune?: boolean | undefined): {
30
25
  export declare function runLocalize(packages?: string[], options?: LocalizeCommandOptions): Promise<void>;
31
26
  /**
32
27
  * Adopt one checkout that already sits in `packages-local/` under its localize
33
- * name: install inside it, build it, link it and record it. This is how
28
+ * name: set the app up, install at the app root and build it. This is how
34
29
  * `create-package` hands a new package with its own repository to localize.
35
30
  *
36
31
  * @returns localize's exit code, rather than setting `process.exitCode`, so the
@@ -38,9 +33,8 @@ export declare function runLocalize(packages?: string[], options?: LocalizeComma
38
33
  */
39
34
  export declare function adoptPackage(name: string, options: {
40
35
  appRoot: string;
41
- build: string;
42
- repo?: string;
36
+ build?: string;
43
37
  }): Promise<number>;
44
- /** `linked delocalize [packages...]` — unlink and forget; no names means all. */
38
+ /** `linked delocalize [packages...]` — park the checkouts; no names means all. */
45
39
  export declare function runDelocalize(packages?: string[], options?: Pick<LocalizeCommandOptions, 'purge' | 'force'>): Promise<void>;
46
40
  //# sourceMappingURL=localize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"localize.d.ts","sourceRoot":"","sources":["../../../src/commands/localize.ts"],"names":[],"mappings":"AAkDA,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,iBAAiB,CAAC;AAEpD,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,+FAA+F;IAC/F,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oEAAoE;IACpE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,KAAK,GAAE,OAAO,GAAG,SAAgB,GAAG;IAC/D,KAAK,EAAE,OAAO,CAAC;CAChB,CAEA;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,GAAE,MAAM,EAAO,EACvB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CA6Ef;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAC,OAA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