@_linked/cli 1.47.0 → 1.47.2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.47.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#270](https://github.com/linked-fw/cli/pull/270) [`18eadff`](https://github.com/linked-fw/cli/commit/18eadff4a8126cf71758a34cddd6f003f87aab35) Thanks [@flyon](https://github.com/flyon)! - `linked localize` now builds each new checkout with its own `npm run build` when its package.json has a `build` script, and builds nothing otherwise. Localizing an app no longer fails with "is a linkedApp, not a linkedPackage": an app's `build` script runs `linked build-app`.
8
+
9
+ ## 1.47.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#268](https://github.com/linked-fw/cli/pull/268) [`f4db679`](https://github.com/linked-fw/cli/commit/f4db679591afc51ba5f4a8313d37580c18ee62d9) Thanks [@flyon](https://github.com/flyon)! - `linked localize`, `--list` and `delocalize` no longer warn about a leftover `local-packages.json`. The file was never read by the workspace-based localize; delete it if one is still around. `docs/localize.md` drops its one-time migration section.
14
+
3
15
  ## 1.47.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -268,7 +268,10 @@ linked app-doctor # in an app: check optimizeDeps.include and Re
268
268
  member. A hook the app's `postinstall` and `dependencies` scripts run (`hooks/lock-at-rest.cjs`
269
269
  in this package, called through a guard that does nothing where the cli is not installed) puts the
270
270
  committed `package-lock.json` back after every install, so the working tree stays clean and CI, which has no checkouts,
271
- installs from the registry as always. Full guide: [docs/localize.md](docs/localize.md).
271
+ installs from the registry as always. Each new checkout is built with its own build command:
272
+ `npm run build` when it has a `build` script, nothing otherwise (`--build <cmd>` overrides it,
273
+ `--build ''` builds nothing). Full
274
+ guide: [docs/localize.md](docs/localize.md).
272
275
 
273
276
  ```bash
274
277
  linked localize @_linked/rdfs # clone, npm install at the app root, build
@@ -295,10 +298,6 @@ directory whose `package.json` has `workspaces`. It also writes git hooks into t
295
298
  `script`, `call` and `build-all` report a range a checkout misses, a second copy of a localized
296
299
  package, a nested copy of `@_linked/core`/`react`/`server-utils`, and a checkout that is gone.
297
300
 
298
- `--relink` and `--ensure` are deprecated no-ops that exit 0; `local-packages.json` is no longer
299
- read. Localize used to be the separate `@_linked/localize` package (binary `linked-localize`),
300
- which is being retired; `linked localize` replaces it.
301
-
302
301
  ### Registry / dev utilities
303
302
 
304
303
  ```bash
package/lib/esm/cli.js CHANGED
@@ -355,7 +355,7 @@ program
355
355
  .option('--parked', 'Take back every checkout `linked delocalize` parked, then npm install once.')
356
356
  .option('--repo <git-url>', 'Clone this instead of the published repository.')
357
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.')
358
+ .option('--build <cmd>', 'Run this in each new checkout after the install; a failure only warns. Defaults to the checkout\'s own `npm run build` when it has a build script (packages and apps both define one); without one nothing is built. Pass an empty string to build nothing.')
359
359
  .option('--dir <path>', 'Where checkouts live. Only packages-local is accepted: the workspaces glob names it.')
360
360
  .option('--relink', 'Deprecated, does nothing: npm links the checkouts. Exits 0, so old postinstall scripts keep working.')
361
361
  .option('--ensure', 'Deprecated, does nothing but print a hint: drift is reported by --list and before linked start. Exits 0.')
@@ -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,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,SAAS,EACT,eAAe,EACf,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,cA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iBACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC;iBACxB,IAAI,CAAC,GAAG,CAAC;QACd,CAAC,CAAC,IAAI,CAAC;IAET,YAAY;IACZ,iCAAiC;IACjC,wBAAwB;IACxB,uCAAuC;IACvC,mCAAmC;IACnC,oDAAoD;IAEpD,wBAAwB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAC9C,CAAC,CAAC;KACD,KAAK,CAAC,GAAG,CAAC;KACV,KAAK,CAAC,KAAK,CAAC;KACZ,KAAK,CAAC,GAAG,CAAC;KACV,KAAK,CAAC,QAAQ,CAAC;KACf,WAAW,CACV,gLAAgL,CACjL;KACA,QAAQ,CAAC,QAAQ,EAAE,qDAAqD,CAAC;KACzE,QAAQ,CACP,WAAW,EACX,2DAA2D,CAC5D;KACA,QAAQ,CAAC,WAAW,EAAE,0CAA0C,CAAC,CAAC;AAErE,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE;IAC9C,YAAY,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,sEAAsE;AACtE,kFAAkF;AAClF,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAE1B,MAAM,cAAc,GAAG,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3E,IAAI,cAAc,EAAE,CAAC;IACnB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,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 {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
+ {"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,EACZ,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,SAAS,EACT,eAAe,EACf,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,QAAQ,EACR,cAAc,EACd,cAAc,EACd,4BAA4B,EAC5B,wBAAwB,EACxB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EAET,eAAe,G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AAY;IACZ,iCAAiC;IACjC,wBAAwB;IACxB,uCAAuC;IACvC,mCAAmC;IACnC,oDAAoD;IAEpD,wBAAwB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAC9C,CAAC,CAAC;KACD,KAAK,CAAC,GAAG,CAAC;KACV,KAAK,CAAC,KAAK,CAAC;KACZ,KAAK,CAAC,GAAG,CAAC;KACV,KAAK,CAAC,QAAQ,CAAC;KACf,WAAW,CACV,gLAAgL,CACjL;KACA,QAAQ,CAAC,QAAQ,EAAE,qDAAqD,CAAC;KACzE,QAAQ,CACP,WAAW,EACX,2DAA2D,CAC5D;KACA,QAAQ,CAAC,WAAW,EAAE,0CAA0C,CAAC,CAAC;AAErE,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE;IAC9C,YAAY,EAAE,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,sEAAsE;AACtE,kFAAkF;AAClF,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAE1B,MAAM,cAAc,GAAG,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3E,IAAI,cAAc,EAAE,CAAC;IACnB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,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 {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 the checkout\\'s own `npm run build` when it has a build script (packages and apps both define one); without one nothing is built. 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":"delocalize.d.ts","sourceRoot":"","sources":["../../../src/localize/delocalize.ts"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,UAAU,CAAC;AAEnC,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAC,EACxC,IAAI,EAAE,IAAI,GACT,MAAM,CAoCR"}
1
+ {"version":3,"file":"delocalize.d.ts","sourceRoot":"","sources":["../../../src/localize/delocalize.ts"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,UAAU,CAAC;AAEnC,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAC,EACxC,IAAI,EAAE,IAAI,GACT,MAAM,CAmCR"}
@@ -26,10 +26,9 @@ import fs from 'node:fs';
26
26
  import path from 'node:path';
27
27
  import { EXIT_INSTALL_FAILED, EXIT_REFUSED, EXIT_WARNED } from './errors.js';
28
28
  import { checkoutRepoRoot, existsOrLink, isInside, isSymlink, moveEntry, } from './fsops.js';
29
- import { INSTALL_ARGS, LOCKFILE, legacyManifestHint, reportError, restoreSetAside, tail, } from './localize.js';
29
+ import { INSTALL_ARGS, LOCKFILE, reportError, restoreSetAside, tail, } from './localize.js';
30
30
  import { LOCAL_DIR, PARKED_DIR, localMembers, parkedMembers } from './members.js';
31
31
  export function delocalize(names, opts, deps) {
32
- legacyManifestHint(deps);
33
32
  try {
34
33
  restoreSetAside(deps);
35
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"delocalize.js","sourceRoot":"","sources":["../../../src/localize/delocalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,mBAAmB,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAC3E,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAIhF,MAAM,UAAU,UAAU,CACxB,KAAe,EACf,IAAwC,EACxC,IAAU;IAEV,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACzB,IAAI,CAAC;QACH,eAAe,CAAC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AAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACnB,MAAM,GAAG,GACP,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;YACrE,OAAO,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,cAAc,GAAG,kCAAkC,CAAC;QACpF,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QAC9D,IAAI,CAAC;YAAE,OAAO,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,6EAA6E;AAC7E,SAAS,UAAU,CAAC,IAAY,EAAE,OAAiB;IACjD,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IACnD,IAAI,KAAK;QAAE,OAAO,KAAK,CAAC;IACxB,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC,CAAC;IACtE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC","sourcesContent":["/**\n * `delocalize` -- go back to the registry copy WITHOUT losing work.\n *\n * A checkout is parked: moved to `.packages-local.parked/<dir>`, outside the\n * `packages-local/*` glob, so npm installs the registry copy again and\n * `linked localize <name>` (or `--parked`) takes it back as it was. With no\n * names, every checkout is parked.\n *\n * Then the install that swaps the links for registry copies:\n *\n * - no checkout left, `package-lock.json` tracked by git, and it and\n * `package.json` unchanged from HEAD: `npm ci`, which installs exactly the\n * committed lockfile;\n * - otherwise (some checkouts left -- `npm ci` refuses a lockfile that lists\n * members it does not -- an untracked lockfile, or a manifest being\n * changed): `npm install`, then `npm rebuild <names>` -- an install that\n * replaces a link with the registry copy leaves that package's bin without\n * its execute bit (measured), and a rebuild relinks it.\n *\n * `--purge` deletes the checkout instead of parking it. It fails closed:\n * unless `--force`, it refuses (exit 6) when the checkout is not a git\n * repository, when any git call fails, and on uncommitted changes, commits\n * that no remote has (on any branch or a detached HEAD), or a stash.\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport {EXIT_INSTALL_FAILED, EXIT_REFUSED, EXIT_WARNED} from './errors.js';\nimport {\n checkoutRepoRoot,\n existsOrLink,\n isInside,\n isSymlink,\n moveEntry,\n} from './fsops.js';\nimport {\n INSTALL_ARGS,\n LOCKFILE,\n legacyManifestHint,\n reportError,\n restoreSetAside,\n tail,\n} from './localize.js';\nimport {LOCAL_DIR, PARKED_DIR, localMembers, parkedMembers} from './members.js';\nimport type {Member} from './members.js';\nimport type {Deps} from './run.js';\n\nexport function delocalize(\n names: string[],\n opts: {purge?: boolean; force?: boolean},\n deps: Deps,\n): number {\n legacyManifestHint(deps);\n try {\n restoreSetAside(deps);\n } catch (e) {\n return reportError(e, deps);\n }\n const members = localMembers(deps.appRoot);\n let code = 0;\n const targets: Member[] = [];\n for (const name of names.length ? names : members.map((m) => m.name)) {\n const member = findMember(name, members);\n if (member) {\n targets.push(member);\n continue;\n }\n const parked = findMember(name, parkedMembers(deps.appRoot));\n deps.warn(\n parked\n ? `[localize] ${parked.name} is already parked in ${parked.dir}.`\n : `[localize] ${name} is not localized -- nothing in ${LOCAL_DIR}/ is named that.`,\n );\n code = Math.max(code, EXIT_WARNED);\n }\n\n const done: string[] = [];\n for (const member of targets) {\n if (opts.purge) {\n // A purge that is refused is a guard refusing: nothing is deleted.\n if (purge(member, opts, deps) === 'done') done.push(member.name);\n else code = Math.max(code, EXIT_REFUSED);\n } else if (park(member, deps) === 'done') done.push(member.name);\n else code = Math.max(code, EXIT_WARNED);\n }\n if (!done.length) return code;\n return Math.max(code, reinstall(done, deps));\n}\n\nfunction park(member: Member, deps: Deps): 'done' | 'refused' {\n const to = `${PARKED_DIR}/${path.basename(member.dir)}`;\n if (existsOrLink(path.join(deps.appRoot, to))) {\n deps.warn(\n `[localize] ${member.name}: ${to} already exists, so ${member.dir} was not parked. Move ` +\n `one of them out of the way.`,\n );\n return 'refused';\n }\n moveEntry(path.join(deps.appRoot, member.dir), path.join(deps.appRoot, to));\n deps.log(\n `[localize] parked ${member.name}: ${member.dir} -> ${to} (\\`linked localize ${member.name}\\` takes it back)`,\n );\n return 'done';\n}\n\nfunction purge(\n member: Member,\n opts: {force?: boolean},\n deps: Deps,\n): 'done' | 'refused' {\n const entry = path.join(deps.appRoot, member.dir);\n const repo = checkoutRepoRoot(entry, deps.appRoot);\n const refusal = repo\n ? purgeRefusal(repo, deps)\n : 'it is not a git checkout (no .git), so nothing says its work is saved elsewhere';\n if (refusal && !opts.force) {\n deps.warn(\n `[localize] ${member.dir}: not deleting -- ${refusal}. Pass --force to delete it anyway.`,\n );\n return 'refused';\n }\n if (refusal)\n deps.warn(`[localize] --force: deleting ${member.dir} although ${refusal}`);\n\n if (isSymlink(entry)) {\n // A package inside a cloned monorepo: the clone goes too, unless another\n // checkout or parked checkout still links into it.\n fs.unlinkSync(entry);\n if (repo && !linkedFromElsewhere(repo, deps)) {\n fs.rmSync(repo, {recursive: true, force: true});\n deps.log(\n `[localize] removed ${member.dir} and ${path.relative(deps.appRoot, repo)}`,\n );\n return 'done';\n }\n } else {\n fs.rmSync(entry, {recursive: true, force: true});\n }\n deps.log(`[localize] removed ${member.dir}`);\n return 'done';\n}\n\n/** Does any remaining checkout, here or parked, live inside `repo`? */\nfunction linkedFromElsewhere(repo: string, deps: Deps): boolean {\n return [...localMembers(deps.appRoot), ...parkedMembers(deps.appRoot)].some(\n (m) => {\n try {\n return isInside(fs.realpathSync(path.join(deps.appRoot, m.dir)), repo);\n } catch {\n return false;\n }\n },\n );\n}\n\n/** The install after parking or purging: see the module header. */\nfunction reinstall(names: string[], deps: Deps): number {\n const why = ciRefusal(deps);\n const ci = why === null;\n const args = ci ? ['ci', '--no-audit', '--no-fund'] : INSTALL_ARGS;\n const reason = ci ? `the committed ${LOCKFILE}, unchanged` : why;\n deps.log(`[localize] npm ${args.join(' ')} (app root; ${reason})`);\n const r = deps.run('npm', args, {cwd: deps.appRoot});\n if (r.status !== 0) {\n deps.error(\n `[localize] npm ${args[0]} failed at the app root; node_modules may still link the ` +\n `checkout${names.length === 1 ? '' : 's'}. Fix the cause and run \\`npm install\\`.\\n` +\n tail(r.stderr || r.stdout),\n );\n return EXIT_INSTALL_FAILED;\n }\n if (ci) return 0;\n const rebuild = deps.run('npm', ['rebuild', ...names], {cwd: deps.appRoot});\n if (rebuild.status !== 0) {\n deps.warn(\n `[localize] npm rebuild ${names.join(' ')} failed; a registry copy's bin may not be ` +\n `executable until it runs.\\n${tail(rebuild.stderr || rebuild.stdout)}`,\n );\n return EXIT_WARNED;\n }\n return 0;\n}\n\n/**\n * Why the reinstall cannot be `npm ci`, or null when it can: no checkout is\n * left, git tracks the lockfile, and neither it nor `package.json` differs\n * from HEAD. A git call that fails counts as a reason: `npm install` is the\n * safe choice.\n */\nfunction ciRefusal(deps: Deps): string | null {\n if (localMembers(deps.appRoot).length)\n return `checkouts remain in ${LOCAL_DIR}/`;\n const git = (args: string[]) =>\n deps.run('git', args, {cwd: deps.appRoot}).status === 0;\n if (!git(['ls-files', '--error-unmatch', '--', LOCKFILE]))\n return `${LOCKFILE} is not tracked by git`;\n if (!git(['diff', '--quiet', 'HEAD', '--', 'package.json', LOCKFILE]))\n return `package.json or ${LOCKFILE} differs from HEAD`;\n return null;\n}\n\n/**\n * @returns the reason a purge must be refused, or null. Fails closed: a git\n * call that fails is a reason, since a check that cannot look must not let\n * a delete through.\n */\nfunction purgeRefusal(repo: string, deps: Deps): string | null {\n const checks: {args: string[]; what: (n: number) => string}[] = [\n {\n args: ['status', '--porcelain'],\n what: (n) => `${n} uncommitted change${n === 1 ? '' : 's'}`,\n },\n {\n // HEAD (a detached one has no branch) and every local branch, against every remote.\n args: ['log', '--oneline', 'HEAD', '--branches', '--not', '--remotes'],\n what: (n) => `${n} commit${n === 1 ? '' : 's'} no remote has`,\n },\n {\n args: ['stash', 'list'],\n what: (n) => `${n} stash entr${n === 1 ? 'y' : 'ies'}`,\n },\n ];\n for (const {args, what} of checks) {\n const r = deps.run('git', args, {cwd: repo});\n if (r.status !== 0) {\n const why =\n (r.stderr || r.stdout).trim().split('\\n')[0] || `exit ${r.status}`;\n return `\\`git ${args.join(' ')}\\` failed (${why}), so its work cannot be checked`;\n }\n const n = r.stdout.split('\\n').filter((l) => l.trim()).length;\n if (n) return `it has ${what(n)}`;\n }\n return null;\n}\n\n/** By full name, or by the part after the scope when that is unambiguous. */\nfunction findMember(name: string, members: Member[]): Member | undefined {\n const exact = members.find((m) => m.name === name);\n if (exact) return exact;\n const short = members.filter((m) => m.name.split('/').pop() === name);\n return short.length === 1 ? short[0] : undefined;\n}\n"]}
1
+ {"version":3,"file":"delocalize.js","sourceRoot":"","sources":["../../../src/localize/delocalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,mBAAmB,EAAE,YAAY,EAAE,WAAW,EAAC,MAAM,aAAa,CAAC;AAC3E,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,YAAY,EACZ,QAA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,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC","sourcesContent":["/**\n * `delocalize` -- go back to the registry copy WITHOUT losing work.\n *\n * A checkout is parked: moved to `.packages-local.parked/<dir>`, outside the\n * `packages-local/*` glob, so npm installs the registry copy again and\n * `linked localize <name>` (or `--parked`) takes it back as it was. With no\n * names, every checkout is parked.\n *\n * Then the install that swaps the links for registry copies:\n *\n * - no checkout left, `package-lock.json` tracked by git, and it and\n * `package.json` unchanged from HEAD: `npm ci`, which installs exactly the\n * committed lockfile;\n * - otherwise (some checkouts left -- `npm ci` refuses a lockfile that lists\n * members it does not -- an untracked lockfile, or a manifest being\n * changed): `npm install`, then `npm rebuild <names>` -- an install that\n * replaces a link with the registry copy leaves that package's bin without\n * its execute bit (measured), and a rebuild relinks it.\n *\n * `--purge` deletes the checkout instead of parking it. It fails closed:\n * unless `--force`, it refuses (exit 6) when the checkout is not a git\n * repository, when any git call fails, and on uncommitted changes, commits\n * that no remote has (on any branch or a detached HEAD), or a stash.\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport {EXIT_INSTALL_FAILED, EXIT_REFUSED, EXIT_WARNED} from './errors.js';\nimport {\n checkoutRepoRoot,\n existsOrLink,\n isInside,\n isSymlink,\n moveEntry,\n} from './fsops.js';\nimport {\n INSTALL_ARGS,\n LOCKFILE,\n reportError,\n restoreSetAside,\n tail,\n} from './localize.js';\nimport {LOCAL_DIR, PARKED_DIR, localMembers, parkedMembers} from './members.js';\nimport type {Member} from './members.js';\nimport type {Deps} from './run.js';\n\nexport function delocalize(\n names: string[],\n opts: {purge?: boolean; force?: boolean},\n deps: Deps,\n): number {\n try {\n restoreSetAside(deps);\n } catch (e) {\n return reportError(e, deps);\n }\n const members = localMembers(deps.appRoot);\n let code = 0;\n const targets: Member[] = [];\n for (const name of names.length ? names : members.map((m) => m.name)) {\n const member = findMember(name, members);\n if (member) {\n targets.push(member);\n continue;\n }\n const parked = findMember(name, parkedMembers(deps.appRoot));\n deps.warn(\n parked\n ? `[localize] ${parked.name} is already parked in ${parked.dir}.`\n : `[localize] ${name} is not localized -- nothing in ${LOCAL_DIR}/ is named that.`,\n );\n code = Math.max(code, EXIT_WARNED);\n }\n\n const done: string[] = [];\n for (const member of targets) {\n if (opts.purge) {\n // A purge that is refused is a guard refusing: nothing is deleted.\n if (purge(member, opts, deps) === 'done') done.push(member.name);\n else code = Math.max(code, EXIT_REFUSED);\n } else if (park(member, deps) === 'done') done.push(member.name);\n else code = Math.max(code, EXIT_WARNED);\n }\n if (!done.length) return code;\n return Math.max(code, reinstall(done, deps));\n}\n\nfunction park(member: Member, deps: Deps): 'done' | 'refused' {\n const to = `${PARKED_DIR}/${path.basename(member.dir)}`;\n if (existsOrLink(path.join(deps.appRoot, to))) {\n deps.warn(\n `[localize] ${member.name}: ${to} already exists, so ${member.dir} was not parked. Move ` +\n `one of them out of the way.`,\n );\n return 'refused';\n }\n moveEntry(path.join(deps.appRoot, member.dir), path.join(deps.appRoot, to));\n deps.log(\n `[localize] parked ${member.name}: ${member.dir} -> ${to} (\\`linked localize ${member.name}\\` takes it back)`,\n );\n return 'done';\n}\n\nfunction purge(\n member: Member,\n opts: {force?: boolean},\n deps: Deps,\n): 'done' | 'refused' {\n const entry = path.join(deps.appRoot, member.dir);\n const repo = checkoutRepoRoot(entry, deps.appRoot);\n const refusal = repo\n ? purgeRefusal(repo, deps)\n : 'it is not a git checkout (no .git), so nothing says its work is saved elsewhere';\n if (refusal && !opts.force) {\n deps.warn(\n `[localize] ${member.dir}: not deleting -- ${refusal}. Pass --force to delete it anyway.`,\n );\n return 'refused';\n }\n if (refusal)\n deps.warn(`[localize] --force: deleting ${member.dir} although ${refusal}`);\n\n if (isSymlink(entry)) {\n // A package inside a cloned monorepo: the clone goes too, unless another\n // checkout or parked checkout still links into it.\n fs.unlinkSync(entry);\n if (repo && !linkedFromElsewhere(repo, deps)) {\n fs.rmSync(repo, {recursive: true, force: true});\n deps.log(\n `[localize] removed ${member.dir} and ${path.relative(deps.appRoot, repo)}`,\n );\n return 'done';\n }\n } else {\n fs.rmSync(entry, {recursive: true, force: true});\n }\n deps.log(`[localize] removed ${member.dir}`);\n return 'done';\n}\n\n/** Does any remaining checkout, here or parked, live inside `repo`? */\nfunction linkedFromElsewhere(repo: string, deps: Deps): boolean {\n return [...localMembers(deps.appRoot), ...parkedMembers(deps.appRoot)].some(\n (m) => {\n try {\n return isInside(fs.realpathSync(path.join(deps.appRoot, m.dir)), repo);\n } catch {\n return false;\n }\n },\n );\n}\n\n/** The install after parking or purging: see the module header. */\nfunction reinstall(names: string[], deps: Deps): number {\n const why = ciRefusal(deps);\n const ci = why === null;\n const args = ci ? ['ci', '--no-audit', '--no-fund'] : INSTALL_ARGS;\n const reason = ci ? `the committed ${LOCKFILE}, unchanged` : why;\n deps.log(`[localize] npm ${args.join(' ')} (app root; ${reason})`);\n const r = deps.run('npm', args, {cwd: deps.appRoot});\n if (r.status !== 0) {\n deps.error(\n `[localize] npm ${args[0]} failed at the app root; node_modules may still link the ` +\n `checkout${names.length === 1 ? '' : 's'}. Fix the cause and run \\`npm install\\`.\\n` +\n tail(r.stderr || r.stdout),\n );\n return EXIT_INSTALL_FAILED;\n }\n if (ci) return 0;\n const rebuild = deps.run('npm', ['rebuild', ...names], {cwd: deps.appRoot});\n if (rebuild.status !== 0) {\n deps.warn(\n `[localize] npm rebuild ${names.join(' ')} failed; a registry copy's bin may not be ` +\n `executable until it runs.\\n${tail(rebuild.stderr || rebuild.stdout)}`,\n );\n return EXIT_WARNED;\n }\n return 0;\n}\n\n/**\n * Why the reinstall cannot be `npm ci`, or null when it can: no checkout is\n * left, git tracks the lockfile, and neither it nor `package.json` differs\n * from HEAD. A git call that fails counts as a reason: `npm install` is the\n * safe choice.\n */\nfunction ciRefusal(deps: Deps): string | null {\n if (localMembers(deps.appRoot).length)\n return `checkouts remain in ${LOCAL_DIR}/`;\n const git = (args: string[]) =>\n deps.run('git', args, {cwd: deps.appRoot}).status === 0;\n if (!git(['ls-files', '--error-unmatch', '--', LOCKFILE]))\n return `${LOCKFILE} is not tracked by git`;\n if (!git(['diff', '--quiet', 'HEAD', '--', 'package.json', LOCKFILE]))\n return `package.json or ${LOCKFILE} differs from HEAD`;\n return null;\n}\n\n/**\n * @returns the reason a purge must be refused, or null. Fails closed: a git\n * call that fails is a reason, since a check that cannot look must not let\n * a delete through.\n */\nfunction purgeRefusal(repo: string, deps: Deps): string | null {\n const checks: {args: string[]; what: (n: number) => string}[] = [\n {\n args: ['status', '--porcelain'],\n what: (n) => `${n} uncommitted change${n === 1 ? '' : 's'}`,\n },\n {\n // HEAD (a detached one has no branch) and every local branch, against every remote.\n args: ['log', '--oneline', 'HEAD', '--branches', '--not', '--remotes'],\n what: (n) => `${n} commit${n === 1 ? '' : 's'} no remote has`,\n },\n {\n args: ['stash', 'list'],\n what: (n) => `${n} stash entr${n === 1 ? 'y' : 'ies'}`,\n },\n ];\n for (const {args, what} of checks) {\n const r = deps.run('git', args, {cwd: repo});\n if (r.status !== 0) {\n const why =\n (r.stderr || r.stdout).trim().split('\\n')[0] || `exit ${r.status}`;\n return `\\`git ${args.join(' ')}\\` failed (${why}), so its work cannot be checked`;\n }\n const n = r.stdout.split('\\n').filter((l) => l.trim()).length;\n if (n) return `it has ${what(n)}`;\n }\n return null;\n}\n\n/** By full name, or by the part after the scope when that is unambiguous. */\nfunction findMember(name: string, members: Member[]): Member | undefined {\n const exact = members.find((m) => m.name === name);\n if (exact) return exact;\n const short = members.filter((m) => m.name.split('/').pop() === name);\n return short.length === 1 ? short[0] : undefined;\n}\n"]}
@@ -7,7 +7,7 @@
7
7
  * caller can point it at another root or capture its output. `defaultDeps()`
8
8
  * builds the normal one.
9
9
  */
10
- export { localize, DEFAULT_BUILD_COMMAND } from './localize.js';
10
+ export { localize, defaultBuildCommand, DEFAULT_BUILD_COMMAND, } from './localize.js';
11
11
  export type { LocalizeOptions } from './localize.js';
12
12
  export { adopt, localizeParked } from './adopt.js';
13
13
  export { delocalize } from './delocalize.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/localize/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAC,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACxC,YAAY,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,EAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AACnE,YAAY,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAChF,YAAY,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAE,eAAe,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAC9E,YAAY,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,UAAU,CAAC;AAC9C,YAAY,EAAC,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAC/D,OAAO,EACL,aAAa,EACb,UAAU,EACV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U,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * caller can point it at another root or capture its output. `defaultDeps()`
8
8
  * builds the normal one.
9
9
  */
10
- export { localize, DEFAULT_BUILD_COMMAND } from './localize.js';
10
+ export { localize, defaultBuildCommand, DEFAULT_BUILD_COMMAND, } from './localize.js';
11
11
  export { adopt, localizeParked } from './adopt.js';
12
12
  export { delocalize } from './delocalize.js';
13
13
  export { list, collect } from './list.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/localize/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAC,QAAQ,EAAE,qBAAqB,EAAC,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AAExC,OAAO,EAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAEnE,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAEhF,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAE,eAAe,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,UAAU,CAAC;AAE9C,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,mBAAmB,GACpB,MAAM,aAAa,CAAC","sourcesContent":["/**\n * localize's programmatic API: `linked localize` / `linked delocalize` (see\n * `commands/localize.ts`, the commander adapter) and `create-package`'s adopt\n * reach it through here.\n *\n * Every command takes `deps` -- `{appRoot, run, log, warn, error}` -- so a\n * caller can point it at another root or capture its output. `defaultDeps()`\n * builds the normal one.\n */\nexport {localize, DEFAULT_BUILD_COMMAND} from './localize.js';\nexport type {LocalizeOptions} from './localize.js';\nexport {adopt, localizeParked} from './adopt.js';\nexport {delocalize} from './delocalize.js';\nexport {list, collect} from './list.js';\nexport type {ListRow} from './list.js';\nexport {driftProblems, describeDrift, satisfies} from './drift.js';\nexport type {Drift} from './drift.js';\nexport {LOCAL_DIR, PARKED_DIR, localMembers, parkedMembers} from './members.js';\nexport type {Member} from './members.js';\nexport {ensureAppSetup} from './app-setup.js';\nexport type {SetupChange} from './app-setup.js';\nexport {findAppRoot} from './app-root.js';\nexport {resolvePackage, normalizeGitUrl, checkoutNameFor} from './resolve.js';\nexport type {Resolved} from './resolve.js';\nexport {defaultDeps, makeRun} from './run.js';\nexport type {Deps, Run, RunOptions, RunResult} from './run.js';\nexport {\n LocalizeError,\n EXIT_DRIFT,\n EXIT_USAGE,\n EXIT_NOT_FOUND,\n EXIT_WARNED,\n EXIT_REFUSED,\n EXIT_INSTALL_FAILED,\n} from './errors.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/localize/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EACL,QAAQ,EACR,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AAExC,OAAO,EAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAEnE,OAAO,EAAC,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAEhF,OAAO,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAE,eAAe,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,UAAU,CAAC;AAE9C,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,mBAAmB,GACpB,MAAM,aAAa,CAAC","sourcesContent":["/**\n * localize's programmatic API: `linked localize` / `linked delocalize` (see\n * `commands/localize.ts`, the commander adapter) and `create-package`'s adopt\n * reach it through here.\n *\n * Every command takes `deps` -- `{appRoot, run, log, warn, error}` -- so a\n * caller can point it at another root or capture its output. `defaultDeps()`\n * builds the normal one.\n */\nexport {\n localize,\n defaultBuildCommand,\n DEFAULT_BUILD_COMMAND,\n} from './localize.js';\nexport type {LocalizeOptions} from './localize.js';\nexport {adopt, localizeParked} from './adopt.js';\nexport {delocalize} from './delocalize.js';\nexport {list, collect} from './list.js';\nexport type {ListRow} from './list.js';\nexport {driftProblems, describeDrift, satisfies} from './drift.js';\nexport type {Drift} from './drift.js';\nexport {LOCAL_DIR, PARKED_DIR, localMembers, parkedMembers} from './members.js';\nexport type {Member} from './members.js';\nexport {ensureAppSetup} from './app-setup.js';\nexport type {SetupChange} from './app-setup.js';\nexport {findAppRoot} from './app-root.js';\nexport {resolvePackage, normalizeGitUrl, checkoutNameFor} from './resolve.js';\nexport type {Resolved} from './resolve.js';\nexport {defaultDeps, makeRun} from './run.js';\nexport type {Deps, Run, RunOptions, RunResult} from './run.js';\nexport {\n LocalizeError,\n EXIT_DRIFT,\n EXIT_USAGE,\n EXIT_NOT_FOUND,\n EXIT_WARNED,\n EXIT_REFUSED,\n EXIT_INSTALL_FAILED,\n} from './errors.js';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/localize/list.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAStC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,UAAU,CAAC;AAEnC,2BAA2B;AAC3B,MAAM,WAAW,OAAQ,SAAQ,MAAM;IACrC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG;IAAC,IAAI,EAAE,OAAO,EAAE,CAAC;IAAC,KAAK,EAAE,KAAK,EAAE,CAAA;CAAC,CAarE;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAuChE"}
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/localize/list.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAQtC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,UAAU,CAAC;AAEnC,2BAA2B;AAC3B,MAAM,WAAW,OAAQ,SAAQ,MAAM;IACrC,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG;IAAC,IAAI,EAAE,OAAO,EAAE,CAAC;IAAC,KAAK,EAAE,KAAK,EAAE,CAAA;CAAC,CAarE;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,CAsChE"}
@@ -14,7 +14,7 @@
14
14
  import path from 'node:path';
15
15
  import { describeDrift, driftProblems } from './drift.js';
16
16
  import { EXIT_DRIFT } from './errors.js';
17
- import { currentBranch, legacyManifestHint, reportError, restoreSetAside, } from './localize.js';
17
+ import { currentBranch, reportError, restoreSetAside, } from './localize.js';
18
18
  import { localMembers, parkedMembers } from './members.js';
19
19
  export function collect(deps) {
20
20
  const row = (m, state) => (Object.assign(Object.assign({}, m), { state, branch: currentBranch(path.join(deps.appRoot, m.dir), deps) }));
@@ -27,7 +27,6 @@ export function collect(deps) {
27
27
  };
28
28
  }
29
29
  export function list(opts, deps) {
30
- legacyManifestHint(deps);
31
30
  try {
32
31
  restoreSetAside(deps);
33
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/localize/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAExD,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAUzD,MAAM,UAAU,OAAO,CAAC,IAAU;IAChC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,KAAuB,EAAW,EAAE,CAAC,iCACxD,CAAC,KACJ,KAAK,EACL,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,IAC3D,CAAC;IACH,OAAO;QACL,IAAI,EAAE;YACJ,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAA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,SAAS,CAAC,CAAC;IAC7D,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAChE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5B,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["/**\n * `--list` -- what is localized, what is parked, and the drift (drift.ts).\n *\n * The record is the directories: every checkout in `packages-local/` is a\n * workspace member, every one in `.packages-local.parked/` is parked. A row\n * per checkout -- name, directory, branch, version -- then one line per drift.\n *\n * `--check` is for CI and scripts: it prints only the drift (nothing when\n * there is none) and exits 1 when there is any. (The lock-at-rest hook reports\n * drift itself, with `hooks/drift.cjs`.) It writes nothing, except that\n * checkouts an interrupted set-up left in `packages-local/.setup-aside/` are\n * moved back first, as `localize` and `delocalize` do.\n */\nimport path from 'node:path';\n\nimport {describeDrift, driftProblems} from './drift.js';\nimport type {Drift} from './drift.js';\nimport {EXIT_DRIFT} from './errors.js';\nimport {\n currentBranch,\n legacyManifestHint,\n reportError,\n restoreSetAside,\n} from './localize.js';\nimport {localMembers, parkedMembers} from './members.js';\nimport type {Member} from './members.js';\nimport type {Deps} from './run.js';\n\n/** One row of `--list`. */\nexport interface ListRow extends Member {\n state: 'localized' | 'parked';\n branch: string;\n}\n\nexport function collect(deps: Deps): {rows: ListRow[]; drift: Drift[]} {\n const row = (m: Member, state: ListRow['state']): ListRow => ({\n ...m,\n state,\n branch: currentBranch(path.join(deps.appRoot, m.dir), deps),\n });\n return {\n rows: [\n ...localMembers(deps.appRoot).map((m) => row(m, 'localized')),\n ...parkedMembers(deps.appRoot).map((m) => row(m, 'parked')),\n ],\n drift: driftProblems(deps.appRoot),\n };\n}\n\nexport function list(opts: {check?: boolean}, deps: Deps): number {\n legacyManifestHint(deps);\n try {\n restoreSetAside(deps);\n } catch (e) {\n return reportError(e, deps);\n }\n if (opts.check) {\n const drift = driftProblems(deps.appRoot);\n for (const d of drift) deps.warn(`[localize] drift: ${describeDrift(d)}`);\n return drift.length ? EXIT_DRIFT : 0;\n }\n\n const {rows, drift} = collect(deps);\n if (!rows.length && !drift.length) return 0; // nothing localized, nothing to say\n\n if (rows.length) {\n const nameW = Math.max(...rows.map((r) => r.name.length)) + 2;\n const dirW = Math.max(...rows.map((r) => r.dir.length)) + 2;\n const branchW = Math.max(...rows.map((r) => r.branch.length)) + 2;\n for (const r of rows) {\n deps.log(\n r.name.padEnd(nameW) +\n r.dir.padEnd(dirW) +\n r.branch.padEnd(branchW) +\n (r.version || '—') +\n (r.state === 'parked' ? ' (parked)' : ''),\n );\n }\n }\n for (const d of drift) deps.log(`drift: ${describeDrift(d)}`);\n\n const count = (s: ListRow['state']) =>\n rows.filter((r) => r.state === s).length;\n const parts = [`${count('localized')} localized`];\n if (count('parked')) parts.push(`${count('parked')} parked`);\n parts.push(drift.length ? `${drift.length} drift` : 'no drift');\n deps.log(parts.join(' · '));\n return 0;\n}\n"]}
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/localize/list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AAExD,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,GAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,cAAc,CAAC;AAUzD,MAAM,UAAU,OAAO,CAAC,IAAU;IAChC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,KAAuB,EAAW,EAAE,CAAC,iCACxD,CAAC,KACJ,KAAK,EACL,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO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WAAW,CAAC,YAAY,CAAC,CAAC;IAClD,IAAI,KAAK,CAAC,QAAQ,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC7D,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAChE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5B,OAAO,CAAC,CAAC;AACX,CAAC","sourcesContent":["/**\n * `--list` -- what is localized, what is parked, and the drift (drift.ts).\n *\n * The record is the directories: every checkout in `packages-local/` is a\n * workspace member, every one in `.packages-local.parked/` is parked. A row\n * per checkout -- name, directory, branch, version -- then one line per drift.\n *\n * `--check` is for CI and scripts: it prints only the drift (nothing when\n * there is none) and exits 1 when there is any. (The lock-at-rest hook reports\n * drift itself, with `hooks/drift.cjs`.) It writes nothing, except that\n * checkouts an interrupted set-up left in `packages-local/.setup-aside/` are\n * moved back first, as `localize` and `delocalize` do.\n */\nimport path from 'node:path';\n\nimport {describeDrift, driftProblems} from './drift.js';\nimport type {Drift} from './drift.js';\nimport {EXIT_DRIFT} from './errors.js';\nimport {\n currentBranch,\n reportError,\n restoreSetAside,\n} from './localize.js';\nimport {localMembers, parkedMembers} from './members.js';\nimport type {Member} from './members.js';\nimport type {Deps} from './run.js';\n\n/** One row of `--list`. */\nexport interface ListRow extends Member {\n state: 'localized' | 'parked';\n branch: string;\n}\n\nexport function collect(deps: Deps): {rows: ListRow[]; drift: Drift[]} {\n const row = (m: Member, state: ListRow['state']): ListRow => ({\n ...m,\n state,\n branch: currentBranch(path.join(deps.appRoot, m.dir), deps),\n });\n return {\n rows: [\n ...localMembers(deps.appRoot).map((m) => row(m, 'localized')),\n ...parkedMembers(deps.appRoot).map((m) => row(m, 'parked')),\n ],\n drift: driftProblems(deps.appRoot),\n };\n}\n\nexport function list(opts: {check?: boolean}, deps: Deps): number {\n try {\n restoreSetAside(deps);\n } catch (e) {\n return reportError(e, deps);\n }\n if (opts.check) {\n const drift = driftProblems(deps.appRoot);\n for (const d of drift) deps.warn(`[localize] drift: ${describeDrift(d)}`);\n return drift.length ? EXIT_DRIFT : 0;\n }\n\n const {rows, drift} = collect(deps);\n if (!rows.length && !drift.length) return 0; // nothing localized, nothing to say\n\n if (rows.length) {\n const nameW = Math.max(...rows.map((r) => r.name.length)) + 2;\n const dirW = Math.max(...rows.map((r) => r.dir.length)) + 2;\n const branchW = Math.max(...rows.map((r) => r.branch.length)) + 2;\n for (const r of rows) {\n deps.log(\n r.name.padEnd(nameW) +\n r.dir.padEnd(dirW) +\n r.branch.padEnd(branchW) +\n (r.version || '—') +\n (r.state === 'parked' ? ' (parked)' : ''),\n );\n }\n }\n for (const d of drift) deps.log(`drift: ${describeDrift(d)}`);\n\n const count = (s: ListRow['state']) =>\n rows.filter((r) => r.state === s).length;\n const parts = [`${count('localized')} localized`];\n if (count('parked')) parts.push(`${count('parked')} parked`);\n parts.push(drift.length ? `${drift.length} drift` : 'no drift');\n deps.log(parts.join(' · '));\n return 0;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import type { Member } from './members.js';
2
2
  import type { Deps } from './run.js';
3
- /** What a new checkout is built with when `--build` does not say. */
4
- export declare const DEFAULT_BUILD_COMMAND = "linked build";
3
+ /** A checkout's own build, run when its package.json has a `build` script. */
4
+ export declare const DEFAULT_BUILD_COMMAND = "npm run build";
5
5
  /** The one install a run makes, at the app root. */
6
6
  export declare const INSTALL_ARGS: string[];
7
7
  /** The app's lockfile, kept clean of checkouts. */
@@ -51,10 +51,15 @@ export declare function unpark(member: Member, deps: Deps): Prepared;
51
51
  */
52
52
  export declare function restoreSetAside(deps: Pick<Deps, 'appRoot' | 'log'>): void;
53
53
  /**
54
- * One line when an app still has the retired record. It is ignored: the
55
- * record now is the directories in `packages-local/`.
54
+ * What a checkout is built with when `--build` does not say: its own `build`
55
+ * script (`npm run build`, which also runs a `prebuild`), else `''`, nothing.
56
+ * Packages and apps both define one (`linked build`, `linked build-app`), so
57
+ * localize never needs to know which kind it is. `pkg` is the checkout's
58
+ * package.json, null when unreadable.
56
59
  */
57
- export declare function legacyManifestHint(deps: Pick<Deps, 'appRoot' | 'warn'>): void;
60
+ export declare function defaultBuildCommand(pkg: {
61
+ scripts?: Record<string, unknown>;
62
+ } | null): string;
58
63
  export declare function reportError(e: unknown, deps: Pick<Deps, 'error'>): number;
59
64
  /**
60
65
  * The checked-out branch, or `HEAD` when detached. `symbolic-ref` first,
@@ -1 +1 @@
1
- {"version":3,"file":"localize.d.ts","sourceRoot":"","sources":["../../../src/localize/localize.ts"],"names":[],"mappings":"AA2DA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAC,IAAI,EAAY,MAAM,UAAU,CAAC;AAG9C,qEAAqE;AACrE,eAAO,MAAM,qBAAqB,iBAAiB,CAAC;AAIpD,oDAAoD;AACpD,eAAO,MAAM,YAAY,UAAyC,CAAC;AAUnE,mDAAmD;AACnD,eAAO,MAAM,QAAQ,sBAAsB,CAAC;AAI5C,MAAM,WAAW,eAAe;IAC9B,4FAA4F;IAC5F,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wCAAwC;AACxC,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,kGAAkG;IAClG,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,8FAA8F;AAC9F,MAAM,MAAM,OAAO,GAAG,CACpB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,eAAe,EACrB,IA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eAAe,EAAE,OAAO,CAAC,EACpC,IAAI,EAAE,IAAI,EACV,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAiCR;AAuGD,+FAA+F;AAC/F,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,QAAQ,CAuB3D;AAyGD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,GAAG,KAAK,CAAC,GAAG,IAAI,CA8BzE;AAwHD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAC,GAAG,IAAI,GAC9C,MAAM,CAER;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,MAAM,CAMzE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,GACtB,MAAM,CAUR;AAED,2FAA2F;AAC3F,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,MAAM,CAEvD"}
@@ -24,12 +24,12 @@
24
24
  * `core.hooksPath`;
25
25
  * 5. ONE `npm install` at the app root -- a checkout's dependencies arrive
26
26
  * with it, so it comes before any build;
27
- * 6. build each new checkout: `--build`, else `linked build`, else for the
28
- * cli its own `npm run build` (the cli is what `linked build` runs, and a
29
- * fresh cli checkout has no `lib/` yet). The cli builds first and then
30
- * gets its bin linked (`npm rebuild`), since the others' `linked build`
31
- * runs it. A failing build warns: a package whose build is broken is
32
- * usually what you localized it to fix.
27
+ * 6. build each new checkout: `--build`, else its own `npm run build` when
28
+ * its package.json has a `build` script, else nothing
29
+ * (`defaultBuildCommand`). The cli builds
30
+ * first and then gets its bin linked (`npm rebuild`), since the others'
31
+ * builds run `linked`. A failing build warns: a package whose build is
32
+ * broken is usually what you localized it to fix.
33
33
  *
34
34
  * `adopt` (adopt.ts) replaces step 3 with "the checkout is already there", and
35
35
  * `--parked` with "every parked checkout". Steps 1, 2 and 4-6 are `runLocalize`.
@@ -46,15 +46,14 @@ import { describeDrift, driftProblems } from './drift.js';
46
46
  import { EXIT_INSTALL_FAILED, EXIT_REFUSED, EXIT_USAGE, EXIT_WARNED, LocalizeError, } from './errors.js';
47
47
  import { existsOrLink, moveEntry, readJson } from './fsops.js';
48
48
  import { installGitHooks } from './git-hooks.js';
49
- import { LOCAL_DIR, localMembers, parkedMembers, PARKED_DIR } from './members.js';
49
+ import { LOCAL_DIR, localMembers, parkedMembers } from './members.js';
50
50
  import { setupLockfileByEdit } from './setup-lockfile.js';
51
51
  import { checkoutNameFor, resolvePackage } from './resolve.js';
52
52
  import { linkDirectory } from '../utils/platform.js';
53
- /** What a new checkout is built with when `--build` does not say. */
54
- export const DEFAULT_BUILD_COMMAND = 'linked build';
55
- /** The cli builds itself: `linked build` IS the cli, and a fresh checkout of it has no `lib/`. */
53
+ /** A checkout's own build, run when its package.json has a `build` script. */
54
+ export const DEFAULT_BUILD_COMMAND = 'npm run build';
55
+ /** Built first, then its bin linked: the others' builds run `linked`, which is the cli. */
56
56
  const CLI_PACKAGE = '@_linked/cli';
57
- const CLI_BUILD_COMMAND = 'npm run build';
58
57
  /** The one install a run makes, at the app root. */
59
58
  export const INSTALL_ARGS = ['install', '--no-audit', '--no-fund'];
60
59
  /** Where a cloned monorepo lives, inside `packages-local/` but outside its glob. */
@@ -68,8 +67,6 @@ const REPOS_DIR = `${LOCAL_DIR}/.repos`;
68
67
  const SETUP_ASIDE_DIR = `${LOCAL_DIR}/.setup-aside`;
69
68
  /** The app's lockfile, kept clean of checkouts. */
70
69
  export const LOCKFILE = 'package-lock.json';
71
- /** What an app recorded checkouts in before they were workspace members. */
72
- const LEGACY_MANIFEST = 'local-packages.json';
73
70
  /**
74
71
  * @param names full npm package names
75
72
  * @returns the process exit code: the highest of the per-name codes and the
@@ -84,7 +81,6 @@ export function localize(names, opts, deps) {
84
81
  */
85
82
  export function runLocalize(names, opts, deps, prepare) {
86
83
  var _a, _b;
87
- legacyManifestHint(deps);
88
84
  let setupLock;
89
85
  try {
90
86
  restoreSetAside(deps);
@@ -151,7 +147,7 @@ export function installAndBuild(prepared, opts, deps, setupLock) {
151
147
  return EXIT_INSTALL_FAILED;
152
148
  }
153
149
  let code = 0;
154
- // The cli first: the other builds run `linked build`, which is the cli.
150
+ // The cli first: the other builds run `linked`, which is the cli.
155
151
  const ordered = [
156
152
  ...prepared.filter((p) => p.name === CLI_PACKAGE),
157
153
  ...prepared.filter((p) => p.name !== CLI_PACKAGE),
@@ -436,25 +432,20 @@ function reportHooks(hooks, deps) {
436
432
  `repository. They act only in a work tree whose ${LOCAL_DIR}/ has checkouts.`);
437
433
  }
438
434
  }
439
- /**
440
- * One line when an app still has the retired record. It is ignored: the
441
- * record now is the directories in `packages-local/`.
442
- */
443
- export function legacyManifestHint(deps) {
444
- if (!fs.existsSync(path.join(deps.appRoot, LEGACY_MANIFEST)))
445
- return;
446
- deps.warn(`[localize] ${LEGACY_MANIFEST} is no longer read: every directory in ${LOCAL_DIR}/ is ` +
447
- `localized, ${PARKED_DIR}/ holds parked ones. Delete the file.`);
448
- }
449
435
  /**
450
436
  * Run the build for one new checkout. `opts.build` wins, including `''` for
451
- * no build; otherwise the cli builds itself and everything else gets
452
- * `linked build`.
437
+ * no build; otherwise `defaultBuildCommand` reads the checkout's package.json.
453
438
  */
454
439
  function runBuild(p, pkgDir, opts, deps) {
455
- const cmd = buildCommandFor(p.name, opts);
456
- if (!cmd)
440
+ var _a;
441
+ if (opts.build === '')
457
442
  return 'skipped';
443
+ const cmd = (_a = opts.build) !== null && _a !== void 0 ? _a : defaultBuildCommand(readJson(path.join(pkgDir, 'package.json')));
444
+ if (!cmd) {
445
+ deps.log(`[localize] ${p.dir}: no \`build\` script, so nothing is built; pass --build <cmd> ` +
446
+ `to build it.`);
447
+ return 'skipped';
448
+ }
458
449
  deps.log(`[localize] ${p.dir}: ${cmd}`);
459
450
  const r = deps.run(cmd, [], { cwd: pkgDir, shell: true });
460
451
  if (r.status !== 0) {
@@ -465,10 +456,16 @@ function runBuild(p, pkgDir, opts, deps) {
465
456
  }
466
457
  return 'ok';
467
458
  }
468
- function buildCommandFor(name, opts) {
469
- if (opts.build !== undefined)
470
- return opts.build;
471
- return name === CLI_PACKAGE ? CLI_BUILD_COMMAND : DEFAULT_BUILD_COMMAND;
459
+ /**
460
+ * What a checkout is built with when `--build` does not say: its own `build`
461
+ * script (`npm run build`, which also runs a `prebuild`), else `''`, nothing.
462
+ * Packages and apps both define one (`linked build`, `linked build-app`), so
463
+ * localize never needs to know which kind it is. `pkg` is the checkout's
464
+ * package.json, null when unreadable.
465
+ */
466
+ export function defaultBuildCommand(pkg) {
467
+ var _a;
468
+ return typeof ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.scripts) === null || _a === void 0 ? void 0 : _a.build) === 'string' ? DEFAULT_BUILD_COMMAND : '';
472
469
  }
473
470
  export function reportError(e, deps) {
474
471
  if (e instanceof LocalizeError) {
@@ -1 +1 @@
1
- {"version":3,"file":"localize.js","sourceRoot":"","sources":["../../../src/localize/localize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,oBAAoB,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,YA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AAgB,EAChB,IAAuB;IAEvB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE;QACrE,GAAG,EAAE,QAAQ;KACd,CAAC,CAAC;IACH,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACpE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE;QAC/D,GAAG,EAAE,QAAQ;KACd,CAAC,CAAC;IACH,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC1B,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC1C,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,IAAI,CAAC,MAAc,EAAE,KAAK,GAAG,EAAE;IAC7C,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/**\n * `localize` -- turn an npm-installed dependency into an editable git checkout\n * that npm itself links.\n *\n * A checkout in `packages-local/` is a workspace member: the app's\n * `workspaces` holds `\"packages-local/*\"`, so `npm install` links\n * `node_modules/<name>` to it and dedupes everything below it like any other\n * member. The committed `package-lock.json` is put back after every install by\n * `hooks/lock-at-rest.cjs`, so the working tree stays clean.\n *\n * One run, for every name at once:\n *\n * 1. refuse an `overrides` key naming a package being localized or already\n * in `packages-local/` (npm fails with `EOVERRIDE` on a member's name);\n * nothing is changed then;\n * 2. the one-time app setup (app-setup.ts), reported line by line so the\n * developer commits it; when it changed `package.json`, the lockfile\n * that goes with it is made now, before anything is cloned, and written\n * back after the install (`captureSetupLockfile`);\n * 3. per name: a parked checkout (`linked delocalize`) moves back; an\n * existing directory is refused with an `--adopt` hint; anything else is\n * resolved through the registry's `repository` (or `--repo`) and cloned;\n * 4. the git hooks (git-hooks.ts), or the lines to add under\n * `core.hooksPath`;\n * 5. ONE `npm install` at the app root -- a checkout's dependencies arrive\n * with it, so it comes before any build;\n * 6. build each new checkout: `--build`, else `linked build`, else for the\n * cli its own `npm run build` (the cli is what `linked build` runs, and a\n * fresh cli checkout has no `lib/` yet). The cli builds first and then\n * gets its bin linked (`npm rebuild`), since the others' `linked build`\n * runs it. A failing build warns: a package whose build is broken is\n * usually what you localized it to fix.\n *\n * `adopt` (adopt.ts) replaces step 3 with \"the checkout is already there\", and\n * `--parked` with \"every parked checkout\". Steps 1, 2 and 4-6 are `runLocalize`.\n *\n * A package inside a monorepo (`--subdir`, or a registry `repository.directory`)\n * is cloned whole into `packages-local/.repos/<checkout>` -- a dot directory,\n * which the `packages-local/*` glob skips -- and `packages-local/<checkout>` is\n * a link to the package inside it. npm follows the link like a directory.\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport {conflictingOverrides, ensureAppSetup} from './app-setup.js';\nimport type {SetupChange} from './app-setup.js';\nimport {describeDrift, driftProblems} from './drift.js';\nimport {\n EXIT_INSTALL_FAILED,\n EXIT_REFUSED,\n EXIT_USAGE,\n EXIT_WARNED,\n LocalizeError,\n} from './errors.js';\nimport {existsOrLink, moveEntry, readJson} from './fsops.js';\nimport {installGitHooks} from './git-hooks.js';\nimport type {HookInstall} from './git-hooks.js';\nimport {LOCAL_DIR, localMembers, parkedMembers, PARKED_DIR} from './members.js';\nimport {setupLockfileByEdit} from './setup-lockfile.js';\nimport type {Member} from './members.js';\nimport {checkoutNameFor, resolvePackage} from './resolve.js';\nimport type {Deps, RunResult} from './run.js';\nimport {linkDirectory} from '../utils/platform.js';\n\n/** What a new checkout is built with when `--build` does not say. */\nexport const DEFAULT_BUILD_COMMAND = 'linked build';\n/** The cli builds itself: `linked build` IS the cli, and a fresh checkout of it has no `lib/`. */\nconst CLI_PACKAGE = '@_linked/cli';\nconst CLI_BUILD_COMMAND = 'npm run build';\n/** The one install a run makes, at the app root. */\nexport const INSTALL_ARGS = ['install', '--no-audit', '--no-fund'];\n/** Where a cloned monorepo lives, inside `packages-local/` but outside its glob. */\nconst REPOS_DIR = `${LOCAL_DIR}/.repos`;\n/**\n * Where the set-up's lockfile run puts the checkouts while npm makes it:\n * inside the gitignored `packages-local/`, outside its glob (npm skips dot\n * directories). A run interrupted there leaves them in it; the next\n * `localize`, `delocalize` or `--list` moves them back (`restoreSetAside`).\n */\nconst SETUP_ASIDE_DIR = `${LOCAL_DIR}/.setup-aside`;\n/** The app's lockfile, kept clean of checkouts. */\nexport const LOCKFILE = 'package-lock.json';\n/** What an app recorded checkouts in before they were workspace members. */\nconst LEGACY_MANIFEST = 'local-packages.json';\n\nexport interface LocalizeOptions {\n /** Where checkouts live. Only `packages-local` is accepted: the workspace glob names it. */\n dir?: string;\n repo?: string;\n subdir?: string;\n /** Run in each new checkout after the install. Absent: the default; empty: no build. */\n build?: string;\n}\n\n/** A checkout ready for the install. */\nexport interface Prepared {\n name: string;\n /** App-relative, `/`-separated: `packages-local/_linked-core`. */\n dir: string;\n /** Build it after the install: a new clone or an adopted checkout, not a returning parked one. */\n build: boolean;\n}\n\n/** How one name becomes a checkout in `packages-local/`; null when there is nothing to do. */\nexport type Prepare = (\n name: string,\n opts: LocalizeOptions,\n deps: Deps,\n) => Prepared | null;\n\n/**\n * @param names full npm package names\n * @returns the process exit code: the highest of the per-name codes and the\n * install's, since a failure on name 2 does not undo name 1.\n */\nexport function localize(\n names: string[],\n opts: LocalizeOptions,\n deps: Deps,\n): number {\n return runLocalize(names, opts, deps, prepareClone);\n}\n\n/**\n * The run `localize`, `adopt` and `--parked` share: everything except how a\n * name becomes a checkout. See the module header for the steps.\n */\nexport function runLocalize(\n names: string[],\n opts: LocalizeOptions,\n deps: Deps,\n prepare: Prepare,\n): number {\n legacyManifestHint(deps);\n let setupLock: string | undefined;\n try {\n restoreSetAside(deps);\n checkDir(opts.dir);\n // The checkouts already there count too: the one install below covers them all.\n const localized = new Set([\n ...names,\n ...localMembers(deps.appRoot).map((m) => m.name),\n ]);\n const conflicts = conflictingOverrides(deps.appRoot, [...localized]);\n if (conflicts.length) {\n throw new LocalizeError(\n `package.json \"overrides\" names a localized package: ${conflicts\n .map((k) => `\"${k}\"`)\n .join(', ')}.\\n` +\n `npm refuses an override on a workspace member's name (EOVERRIDE), and a nested one ` +\n `would replace the checkout. Remove ${conflicts.length === 1 ? 'that key' : 'those keys'} ` +\n `from \"overrides\", then run this again. Nothing was changed.`,\n EXIT_REFUSED,\n );\n }\n const workspacesBefore = readJson(\n path.join(deps.appRoot, 'package.json'),\n )?.workspaces;\n const changes = ensureAppSetup(deps.appRoot);\n reportSetup(changes, deps);\n if (changes.some((c) => c.file === 'package.json'))\n setupLock =\n captureSetupLockfile(changes, workspacesBefore, deps) ?? undefined;\n } catch (e) {\n return reportError(e, deps);\n }\n\n let code = 0;\n const prepared: Prepared[] = [];\n for (const name of names) {\n try {\n const p = prepare(name, opts, deps);\n if (p) prepared.push(p);\n } catch (e) {\n code = Math.max(code, reportError(e, deps));\n }\n }\n if (!prepared.length) {\n // Nothing was installed: the work tree holds the set-up's lockfile as captured.\n if (setupLock !== undefined) commitHint(deps);\n return code;\n }\n return Math.max(code, installAndBuild(prepared, opts, deps, setupLock));\n}\n\n/**\n * Steps 4-6: git hooks, one root install, then the builds. `setupLock` is the\n * lockfile the set-up captured (see `captureSetupLockfile`), written back\n * over what the install left.\n */\nexport function installAndBuild(\n prepared: Prepared[],\n opts: Pick<LocalizeOptions, 'build'>,\n deps: Deps,\n setupLock?: string,\n): number {\n reportHooks(installGitHooks(deps.appRoot), deps);\n\n deps.log(`[localize] npm ${INSTALL_ARGS.join(' ')} (app root)`);\n const install = deps.run('npm', INSTALL_ARGS, {cwd: deps.appRoot});\n if (setupLock !== undefined) restoreSetupLockfile(setupLock, deps);\n if (install.status !== 0) {\n deps.error(\n `[localize] npm install failed at the app root. The checkout${prepared.length === 1 ? ' stays' : 's stay'} ` +\n `in ${LOCAL_DIR}/; fix the cause and run \\`npm install\\`.\\n` +\n tail(install.stderr || install.stdout),\n );\n return EXIT_INSTALL_FAILED;\n }\n\n let code = 0;\n // The cli first: the other builds run `linked build`, which is the cli.\n const ordered = [\n ...prepared.filter((p) => p.name === CLI_PACKAGE),\n ...prepared.filter((p) => p.name !== CLI_PACKAGE),\n ];\n for (const p of ordered) {\n const pkgDir = path.join(deps.appRoot, p.dir);\n const built = p.build ? runBuild(p, pkgDir, opts, deps) : 'skipped';\n if (built === 'failed') code = EXIT_WARNED;\n if (built === 'ok' && p.name === CLI_PACKAGE) linkCliBin(deps);\n deps.log(\n `[localize] ${p.name} -> ${p.dir} (branch ${currentBranch(pkgDir, deps)})`,\n );\n }\n for (const d of driftProblems(deps.appRoot))\n deps.warn(`[localize] drift: ${describeDrift(d)}`);\n return code;\n}\n\n/**\n * npm links a package's bin only when its target exists, and a fresh cli\n * checkout has no `lib/` at install time: without this, `node_modules/.bin/linked`\n * is missing after the build, and `npx linked` would fetch the unrelated npm\n * package named `linked`. `--ignore-scripts`: only the bin links are wanted.\n */\nfunction linkCliBin(deps: Deps): void {\n const r = deps.run('npm', ['rebuild', CLI_PACKAGE, '--ignore-scripts'], {\n cwd: deps.appRoot,\n });\n if (r.status !== 0) {\n deps.warn(\n `[localize] npm rebuild ${CLI_PACKAGE} failed, so \\`linked\\` may not be on the app's ` +\n `bin path. Run it yourself.\\n` +\n tail(r.stderr || r.stdout),\n );\n }\n}\n\n/** Step 3 for `localize`: take back a parked checkout, else clone. */\nfunction prepareClone(\n name: string,\n opts: LocalizeOptions,\n deps: Deps,\n): Prepared | null {\n const parked = parkedMembers(deps.appRoot).find((m) => m.name === name);\n if (parked) return unpark(parked, deps);\n\n const member = localMembers(deps.appRoot).find((m) => m.name === name);\n if (member) {\n throw new LocalizeError(\n `${name} is already in ${member.dir}. To install and build it as it is:\\n` +\n ` linked localize ${name} --adopt`,\n EXIT_REFUSED,\n );\n }\n\n const relDir = `${LOCAL_DIR}/${checkoutNameFor(name)}`;\n const target = path.join(deps.appRoot, relDir);\n if (existsOrLink(target)) {\n throw new LocalizeError(\n `${relDir} already exists. localize never clones over a directory. If it is ${name}'s ` +\n `checkout, install and build it as it is:\\n linked localize ${name} --adopt`,\n EXIT_REFUSED,\n );\n }\n\n const resolved = resolvePackage(\n name,\n deps,\n opts.repo ? {repo: opts.repo, subdir: opts.subdir} : undefined,\n );\n\n // A monorepo is cloned whole outside the glob; the member is a link to the package.\n const relClone = resolved.subdir\n ? `${REPOS_DIR}/${checkoutNameFor(name)}`\n : relDir;\n const clone = path.join(deps.appRoot, relClone);\n if (existsOrLink(clone)) {\n throw new LocalizeError(\n `${relClone} already exists. Remove it, or move it out of the way, and run this again.`,\n EXIT_REFUSED,\n );\n }\n fs.mkdirSync(path.dirname(clone), {recursive: true});\n deps.log(`[localize] cloning ${resolved.repo} -> ${relClone}`);\n const r = deps.run('git', ['clone', '--', resolved.repo, clone]);\n if (r.status !== 0) {\n throw new LocalizeError(\n `git clone ${resolved.repo} failed:\\n${(r.stderr || r.stdout).trim()}`,\n EXIT_REFUSED,\n );\n }\n\n const pkgDir = resolved.subdir ? path.join(clone, resolved.subdir) : clone;\n const relPkg = resolved.subdir ? `${relClone}/${resolved.subdir}` : relClone;\n // A clone that is not the package must not stay: in packages-local/ it\n // would be a workspace member under the wrong name.\n const declared = readJson(path.join(pkgDir, 'package.json'))?.name;\n if (declared !== name) {\n fs.rmSync(clone, {recursive: true, force: true});\n const where = resolved.subdir\n ? `The registry's repository.directory for \"${name}\" points at the wrong place.`\n : `${resolved.repo} looks like a monorepo. Say where the package lives:\\n` +\n ` linked localize ${name} --repo ${resolved.repo} --subdir <path-inside-the-repo>`;\n throw new LocalizeError(\n (declared\n ? `${relPkg} declares itself as \"${declared}\", not \"${name}\".\\n`\n : `${relPkg} has no package.json naming it, so it is not the package \"${name}\".\\n`) +\n `${where}\\nThe clone was removed.`,\n EXIT_REFUSED,\n );\n }\n\n if (resolved.subdir) {\n linkDirectory(pkgDir, target);\n deps.log(`[localize] ${relDir} -> ${relPkg}`);\n }\n return {name, dir: relDir, build: true};\n}\n\n/** Move a parked checkout back into `packages-local/`. No clone, no build: it is as it was. */\nexport function unpark(member: Member, deps: Deps): Prepared {\n const entry = path.basename(member.dir);\n const relDir = `${LOCAL_DIR}/${entry}`;\n const to = path.join(deps.appRoot, relDir);\n if (existsOrLink(to)) {\n throw new LocalizeError(\n `${member.name} is parked in ${member.dir}, but ${relDir} already exists. Move one of ` +\n `them out of the way and run this again.`,\n EXIT_REFUSED,\n );\n }\n // npm refuses two workspace members of one name, so the install would fail.\n const same = localMembers(deps.appRoot).find((m) => m.name === member.name);\n if (same) {\n throw new LocalizeError(\n `${member.name} is parked in ${member.dir}, but ${same.dir} is ${member.name} already. ` +\n `Keep one: delete or move the other out of the way, and run this again.`,\n EXIT_REFUSED,\n );\n }\n moveEntry(path.join(deps.appRoot, member.dir), to);\n deps.log(`[localize] ${member.dir} -> ${relDir}`);\n return {name: member.name, dir: relDir, build: false};\n}\n\n/** `--dir` is kept for scripts that pass the default; anything else is not a workspace member. */\nfunction checkDir(dir: string | undefined): void {\n if (dir === undefined || dir.replace(/\\/+$/, '') === LOCAL_DIR) return;\n throw new LocalizeError(\n `--dir ${dir}: checkouts live in ${LOCAL_DIR}/, the directory the app's ` +\n `\"workspaces\" glob and the lock-at-rest hook name. Move them there.`,\n EXIT_USAGE,\n );\n}\n\nfunction reportSetup(changes: SetupChange[], deps: Deps): void {\n if (!changes.length) return;\n deps.log(`[localize] set up this app for checkouts (commit these):`);\n for (const c of changes) deps.log(` ${c.file}: ${c.what}`);\n}\n\n/** What `captureSetupLockfile` runs: the lockfile for the new `package.json`, nothing installed. */\nconst SETUP_LOCK_ARGS = [\n 'install',\n '--package-lock-only',\n '--ignore-scripts',\n '--no-audit',\n '--no-fund',\n];\n\n/**\n * The set-up changed `package.json`, so the lockfile must change with it\n * (the root entry's `workspaces`) -- and it must be a lockfile with no\n * checkout in it, which the install below cannot give: it lists them, and\n * lock-at-rest leaves it so while `package.json` differs from HEAD. So,\n * before anything is cloned, make that lockfile, keep it, and write it back\n * after the install. When the root entry already has `workspaces` and\n * `hasInstallScript`, it is an edit of that entry (setup-lockfile.ts: exact,\n * offline); otherwise npm makes the lockfile alone, with checkouts already in\n * `packages-local/` (an adopted one) moved into `SETUP_ASIDE_DIR` for that\n * one call.\n *\n * @returns the lockfile to write back, or null when it could not be made (the\n * manual steps are printed instead).\n */\nfunction captureSetupLockfile(\n changes: SetupChange[],\n workspacesBefore: unknown,\n deps: Deps,\n): string | null {\n const lockfile = path.join(deps.appRoot, LOCKFILE);\n const edited = editedSetupLockfile(lockfile, workspacesBefore, deps);\n if (edited !== null) return edited;\n const moveAside = localMembers(deps.appRoot).length > 0;\n deps.log(\n `[localize] npm ${SETUP_LOCK_ARGS.join(' ')} (the set-up's lockfile)`,\n );\n if (moveAside) setAside(deps);\n let r: RunResult;\n try {\n r = deps.run('npm', SETUP_LOCK_ARGS, {cwd: deps.appRoot});\n } finally {\n if (moveAside) moveBack(deps);\n }\n let text: string | null = null;\n try {\n text = fs.readFileSync(lockfile, 'utf8');\n } catch {\n /* none written */\n }\n if (r.status !== 0 || text === null) {\n manualSetupSteps(\n changes,\n r.status !== 0\n ? `npm could not write it:\\n${tail(r.stderr || r.stdout)}`\n : `npm wrote no ${LOCKFILE}`,\n deps,\n );\n return null;\n }\n return text;\n}\n\n/**\n * Every entry of `packages-local/` but the dot directories, moved into\n * `SETUP_ASIDE_DIR` as it is (a link keeps its text and works again once back).\n */\nfunction setAside(deps: Pick<Deps, 'appRoot'>): void {\n const local = path.join(deps.appRoot, LOCAL_DIR);\n const aside = path.join(deps.appRoot, SETUP_ASIDE_DIR);\n fs.mkdirSync(aside, {recursive: true});\n for (const entry of fs.readdirSync(local)) {\n if (entry.startsWith('.')) continue;\n fs.renameSync(path.join(local, entry), path.join(aside, entry));\n }\n}\n\n/** Everything in `SETUP_ASIDE_DIR` back into `packages-local/`; the directory goes. */\nfunction moveBack(deps: Pick<Deps, 'appRoot'>): number {\n const local = path.join(deps.appRoot, LOCAL_DIR);\n const aside = path.join(deps.appRoot, SETUP_ASIDE_DIR);\n const entries = fs.readdirSync(aside);\n for (const entry of entries)\n fs.renameSync(path.join(aside, entry), path.join(local, entry));\n fs.rmdirSync(aside);\n return entries.length;\n}\n\n/**\n * A set-up run that was interrupted while the checkouts were in\n * `SETUP_ASIDE_DIR` left them there, where npm does not see them: move them\n * back, saying so. Refuses, moving nothing, when `packages-local/` already\n * has an entry of the same name.\n */\nexport function restoreSetAside(deps: Pick<Deps, 'appRoot' | 'log'>): void {\n const aside = path.join(deps.appRoot, SETUP_ASIDE_DIR);\n if (!existsOrLink(aside)) return;\n let entries: string[];\n try {\n entries = fs.readdirSync(aside);\n } catch {\n throw new LocalizeError(\n `${SETUP_ASIDE_DIR} is not a directory. Remove it and run this again.`,\n EXIT_REFUSED,\n );\n }\n const clashes = entries.filter((e) =>\n existsOrLink(path.join(deps.appRoot, LOCAL_DIR, e)),\n );\n if (clashes.length) {\n throw new LocalizeError(\n `${SETUP_ASIDE_DIR}/ holds checkouts an interrupted set-up left there, but ` +\n `${clashes.map((e) => `${LOCAL_DIR}/${e}`).join(', ')} now exist${clashes.length === 1 ? 's' : ''} ` +\n `too. Keep one of each, move the other out of ${LOCAL_DIR}/, and run this again. ` +\n `Nothing was moved.`,\n EXIT_REFUSED,\n );\n }\n const n = moveBack(deps);\n if (n)\n deps.log(\n `[localize] moved ${n} checkout${n === 1 ? '' : 's'} back from ${SETUP_ASIDE_DIR}/ into ` +\n `${LOCAL_DIR}/, where an interrupted set-up left ${n === 1 ? 'it' : 'them'}.`,\n );\n}\n\n/** The set-up's lockfile as an edit of the root entry, written now; null when npm must make it. */\nfunction editedSetupLockfile(\n lockfile: string,\n workspacesBefore: unknown,\n deps: Deps,\n): string | null {\n let current: string;\n try {\n current = fs.readFileSync(lockfile, 'utf8');\n } catch {\n return null;\n }\n const text = setupLockfileByEdit(\n current,\n readJson(path.join(deps.appRoot, 'package.json')),\n workspacesBefore,\n );\n if (text === null) return null;\n fs.writeFileSync(lockfile, text);\n deps.log(\n `[localize] ${LOCKFILE}: the root entry's \"workspaces\" now matches package.json (the set-up's lockfile)`,\n );\n return text;\n}\n\n/** Put the captured set-up lockfile back after the install rewrote it. */\nfunction restoreSetupLockfile(text: string, deps: Deps): void {\n fs.writeFileSync(path.join(deps.appRoot, LOCKFILE), text);\n deps.log(\n `[localize] ${LOCKFILE}: put back the set-up's lockfile, which lists no checkout (any ` +\n `lock-at-rest warning above was about the one the install wrote).`,\n );\n commitHint(deps);\n}\n\nfunction commitHint(deps: Deps): void {\n deps.log(\n `[localize] commit the set-up now -- package.json, ${LOCKFILE}, .gitignore:\\n` +\n ` git add package.json ${LOCKFILE} .gitignore && git commit -m \"chore: set up linked localize\"`,\n );\n}\n\n/** The set-up's lockfile could not be made in one step: how to make it by hand. */\nfunction manualSetupSteps(\n changes: SetupChange[],\n why: string,\n deps: Deps,\n): void {\n const files = [...new Set([...changes.map((c) => c.file), LOCKFILE])];\n deps.warn(\n `[localize] could not make the set-up's ${LOCKFILE} in one step: ${why}\\n` +\n `Commit the set-up with a lockfile from an install with no checkout present:\\n` +\n ` npx linked delocalize\\n` +\n ` npm install\\n` +\n ` git add ${files.join(' ')} && git commit -m \"chore: set up linked localize\"\\n` +\n ` npx linked localize --parked`,\n );\n}\n\n/** Tell the developer what `installGitHooks` did not do. */\nfunction reportHooks(hooks: HookInstall, deps: Deps): void {\n for (const file of hooks.skipped) {\n deps.warn(\n `[localize] ${path.relative(deps.appRoot, file)} is not ours, so it was left alone. Without ` +\n `the localize hook there, run \\`npm install\\` yourself after a pull or branch switch that ` +\n `changes dependencies.`,\n );\n }\n if (hooks.hooksPath !== null) {\n deps.warn(\n `[localize] core.hooksPath is set (${hooks.hooksPath}), so no git hooks were written. Add ` +\n `each line below to the hook named before it, an \\`sh\\` script (not, say, a Python hook ` +\n `the pre-commit framework writes); they do nothing where the cli is not installed:`,\n );\n for (const m of hooks.manual) deps.warn(` ${m.file}:\\n ${m.line}`);\n }\n if (hooks.sharedWithWorktrees) {\n deps.warn(\n `[localize] this is a linked worktree: git hooks are shared by every worktree of the ` +\n `repository. They act only in a work tree whose ${LOCAL_DIR}/ has checkouts.`,\n );\n }\n}\n\n/**\n * One line when an app still has the retired record. It is ignored: the\n * record now is the directories in `packages-local/`.\n */\nexport function legacyManifestHint(deps: Pick<Deps, 'appRoot' | 'warn'>): void {\n if (!fs.existsSync(path.join(deps.appRoot, LEGACY_MANIFEST))) return;\n deps.warn(\n `[localize] ${LEGACY_MANIFEST} is no longer read: every directory in ${LOCAL_DIR}/ is ` +\n `localized, ${PARKED_DIR}/ holds parked ones. Delete the file.`,\n );\n}\n\n/**\n * Run the build for one new checkout. `opts.build` wins, including `''` for\n * no build; otherwise the cli builds itself and everything else gets\n * `linked build`.\n */\nfunction runBuild(\n p: Prepared,\n pkgDir: string,\n opts: Pick<LocalizeOptions, 'build'>,\n deps: Deps,\n): 'skipped' | 'ok' | 'failed' {\n const cmd = buildCommandFor(p.name, opts);\n if (!cmd) return 'skipped';\n deps.log(`[localize] ${p.dir}: ${cmd}`);\n const r = deps.run(cmd, [], {cwd: pkgDir, shell: true});\n if (r.status !== 0) {\n deps.warn(\n `[localize] ${p.dir}: \\`${cmd}\\` failed. It is installed and linked anyway -- a package ` +\n `whose build is broken is usually what you localized it to fix.\\n` +\n tail(r.stderr || r.stdout),\n );\n return 'failed';\n }\n return 'ok';\n}\n\nfunction buildCommandFor(\n name: string,\n opts: Pick<LocalizeOptions, 'build'>,\n): string {\n if (opts.build !== undefined) return opts.build;\n return name === CLI_PACKAGE ? CLI_BUILD_COMMAND : DEFAULT_BUILD_COMMAND;\n}\n\nexport function reportError(e: unknown, deps: Pick<Deps, 'error'>): number {\n if (e instanceof LocalizeError) {\n deps.error(`[localize] ${e.message}`);\n return e.code;\n }\n throw e;\n}\n\n/**\n * The checked-out branch, or `HEAD` when detached. `symbolic-ref` first,\n * because it also names the branch of a repository with no commits yet --\n * `rev-parse --abbrev-ref` fails there, and `create-package` adopts a fresh\n * `git init` before its first commit.\n */\nexport function currentBranch(\n checkout: string,\n deps: Pick<Deps, 'run'>,\n): string {\n const sym = deps.run('git', ['symbolic-ref', '--short', '-q', 'HEAD'], {\n cwd: checkout,\n });\n if (sym.status === 0 && sym.stdout.trim()) return sym.stdout.trim();\n const r = deps.run('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {\n cwd: checkout,\n });\n const b = r.stdout.trim();\n return r.status === 0 && b ? b : 'HEAD';\n}\n\n/** The last lines of a subprocess's output: enough to see the error, not the whole log. */\nexport function tail(output: string, lines = 20): string {\n return output.trim().split('\\n').slice(-lines).join('\\n');\n}\n"]}
1
+ {"version":3,"file":"localize.js","sourceRoot":"","sources":["../../../src/localize/localize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,oBAAoB,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AAEpE,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,YAAY,CAAC;AACxD,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EACV,WAAW,EACX,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAC,SAAS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EAAE,CAAC;IACpE,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE;QAC/D,GAAG,EAAE,QAAQ;KACd,CAAC,CAAC;IACH,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IAC1B,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;AAC1C,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,IAAI,CAAC,MAAc,EAAE,KAAK,GAAG,EAAE;IAC7C,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/**\n * `localize` -- turn an npm-installed dependency into an editable git checkout\n * that npm itself links.\n *\n * A checkout in `packages-local/` is a workspace member: the app's\n * `workspaces` holds `\"packages-local/*\"`, so `npm install` links\n * `node_modules/<name>` to it and dedupes everything below it like any other\n * member. The committed `package-lock.json` is put back after every install by\n * `hooks/lock-at-rest.cjs`, so the working tree stays clean.\n *\n * One run, for every name at once:\n *\n * 1. refuse an `overrides` key naming a package being localized or already\n * in `packages-local/` (npm fails with `EOVERRIDE` on a member's name);\n * nothing is changed then;\n * 2. the one-time app setup (app-setup.ts), reported line by line so the\n * developer commits it; when it changed `package.json`, the lockfile\n * that goes with it is made now, before anything is cloned, and written\n * back after the install (`captureSetupLockfile`);\n * 3. per name: a parked checkout (`linked delocalize`) moves back; an\n * existing directory is refused with an `--adopt` hint; anything else is\n * resolved through the registry's `repository` (or `--repo`) and cloned;\n * 4. the git hooks (git-hooks.ts), or the lines to add under\n * `core.hooksPath`;\n * 5. ONE `npm install` at the app root -- a checkout's dependencies arrive\n * with it, so it comes before any build;\n * 6. build each new checkout: `--build`, else its own `npm run build` when\n * its package.json has a `build` script, else nothing\n * (`defaultBuildCommand`). The cli builds\n * first and then gets its bin linked (`npm rebuild`), since the others'\n * builds run `linked`. A failing build warns: a package whose build is\n * broken is usually what you localized it to fix.\n *\n * `adopt` (adopt.ts) replaces step 3 with \"the checkout is already there\", and\n * `--parked` with \"every parked checkout\". Steps 1, 2 and 4-6 are `runLocalize`.\n *\n * A package inside a monorepo (`--subdir`, or a registry `repository.directory`)\n * is cloned whole into `packages-local/.repos/<checkout>` -- a dot directory,\n * which the `packages-local/*` glob skips -- and `packages-local/<checkout>` is\n * a link to the package inside it. npm follows the link like a directory.\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport {conflictingOverrides, ensureAppSetup} from './app-setup.js';\nimport type {SetupChange} from './app-setup.js';\nimport {describeDrift, driftProblems} from './drift.js';\nimport {\n EXIT_INSTALL_FAILED,\n EXIT_REFUSED,\n EXIT_USAGE,\n EXIT_WARNED,\n LocalizeError,\n} from './errors.js';\nimport {existsOrLink, moveEntry, readJson} from './fsops.js';\nimport {installGitHooks} from './git-hooks.js';\nimport type {HookInstall} from './git-hooks.js';\nimport {LOCAL_DIR, localMembers, parkedMembers} from './members.js';\nimport {setupLockfileByEdit} from './setup-lockfile.js';\nimport type {Member} from './members.js';\nimport {checkoutNameFor, resolvePackage} from './resolve.js';\nimport type {Deps, RunResult} from './run.js';\nimport {linkDirectory} from '../utils/platform.js';\n\n/** A checkout's own build, run when its package.json has a `build` script. */\nexport const DEFAULT_BUILD_COMMAND = 'npm run build';\n/** Built first, then its bin linked: the others' builds run `linked`, which is the cli. */\nconst CLI_PACKAGE = '@_linked/cli';\n/** The one install a run makes, at the app root. */\nexport const INSTALL_ARGS = ['install', '--no-audit', '--no-fund'];\n/** Where a cloned monorepo lives, inside `packages-local/` but outside its glob. */\nconst REPOS_DIR = `${LOCAL_DIR}/.repos`;\n/**\n * Where the set-up's lockfile run puts the checkouts while npm makes it:\n * inside the gitignored `packages-local/`, outside its glob (npm skips dot\n * directories). A run interrupted there leaves them in it; the next\n * `localize`, `delocalize` or `--list` moves them back (`restoreSetAside`).\n */\nconst SETUP_ASIDE_DIR = `${LOCAL_DIR}/.setup-aside`;\n/** The app's lockfile, kept clean of checkouts. */\nexport const LOCKFILE = 'package-lock.json';\n\nexport interface LocalizeOptions {\n /** Where checkouts live. Only `packages-local` is accepted: the workspace glob names it. */\n dir?: string;\n repo?: string;\n subdir?: string;\n /** Run in each new checkout after the install. Absent: the default; empty: no build. */\n build?: string;\n}\n\n/** A checkout ready for the install. */\nexport interface Prepared {\n name: string;\n /** App-relative, `/`-separated: `packages-local/_linked-core`. */\n dir: string;\n /** Build it after the install: a new clone or an adopted checkout, not a returning parked one. */\n build: boolean;\n}\n\n/** How one name becomes a checkout in `packages-local/`; null when there is nothing to do. */\nexport type Prepare = (\n name: string,\n opts: LocalizeOptions,\n deps: Deps,\n) => Prepared | null;\n\n/**\n * @param names full npm package names\n * @returns the process exit code: the highest of the per-name codes and the\n * install's, since a failure on name 2 does not undo name 1.\n */\nexport function localize(\n names: string[],\n opts: LocalizeOptions,\n deps: Deps,\n): number {\n return runLocalize(names, opts, deps, prepareClone);\n}\n\n/**\n * The run `localize`, `adopt` and `--parked` share: everything except how a\n * name becomes a checkout. See the module header for the steps.\n */\nexport function runLocalize(\n names: string[],\n opts: LocalizeOptions,\n deps: Deps,\n prepare: Prepare,\n): number {\n let setupLock: string | undefined;\n try {\n restoreSetAside(deps);\n checkDir(opts.dir);\n // The checkouts already there count too: the one install below covers them all.\n const localized = new Set([\n ...names,\n ...localMembers(deps.appRoot).map((m) => m.name),\n ]);\n const conflicts = conflictingOverrides(deps.appRoot, [...localized]);\n if (conflicts.length) {\n throw new LocalizeError(\n `package.json \"overrides\" names a localized package: ${conflicts\n .map((k) => `\"${k}\"`)\n .join(', ')}.\\n` +\n `npm refuses an override on a workspace member's name (EOVERRIDE), and a nested one ` +\n `would replace the checkout. Remove ${conflicts.length === 1 ? 'that key' : 'those keys'} ` +\n `from \"overrides\", then run this again. Nothing was changed.`,\n EXIT_REFUSED,\n );\n }\n const workspacesBefore = readJson(\n path.join(deps.appRoot, 'package.json'),\n )?.workspaces;\n const changes = ensureAppSetup(deps.appRoot);\n reportSetup(changes, deps);\n if (changes.some((c) => c.file === 'package.json'))\n setupLock =\n captureSetupLockfile(changes, workspacesBefore, deps) ?? undefined;\n } catch (e) {\n return reportError(e, deps);\n }\n\n let code = 0;\n const prepared: Prepared[] = [];\n for (const name of names) {\n try {\n const p = prepare(name, opts, deps);\n if (p) prepared.push(p);\n } catch (e) {\n code = Math.max(code, reportError(e, deps));\n }\n }\n if (!prepared.length) {\n // Nothing was installed: the work tree holds the set-up's lockfile as captured.\n if (setupLock !== undefined) commitHint(deps);\n return code;\n }\n return Math.max(code, installAndBuild(prepared, opts, deps, setupLock));\n}\n\n/**\n * Steps 4-6: git hooks, one root install, then the builds. `setupLock` is the\n * lockfile the set-up captured (see `captureSetupLockfile`), written back\n * over what the install left.\n */\nexport function installAndBuild(\n prepared: Prepared[],\n opts: Pick<LocalizeOptions, 'build'>,\n deps: Deps,\n setupLock?: string,\n): number {\n reportHooks(installGitHooks(deps.appRoot), deps);\n\n deps.log(`[localize] npm ${INSTALL_ARGS.join(' ')} (app root)`);\n const install = deps.run('npm', INSTALL_ARGS, {cwd: deps.appRoot});\n if (setupLock !== undefined) restoreSetupLockfile(setupLock, deps);\n if (install.status !== 0) {\n deps.error(\n `[localize] npm install failed at the app root. The checkout${prepared.length === 1 ? ' stays' : 's stay'} ` +\n `in ${LOCAL_DIR}/; fix the cause and run \\`npm install\\`.\\n` +\n tail(install.stderr || install.stdout),\n );\n return EXIT_INSTALL_FAILED;\n }\n\n let code = 0;\n // The cli first: the other builds run `linked`, which is the cli.\n const ordered = [\n ...prepared.filter((p) => p.name === CLI_PACKAGE),\n ...prepared.filter((p) => p.name !== CLI_PACKAGE),\n ];\n for (const p of ordered) {\n const pkgDir = path.join(deps.appRoot, p.dir);\n const built = p.build ? runBuild(p, pkgDir, opts, deps) : 'skipped';\n if (built === 'failed') code = EXIT_WARNED;\n if (built === 'ok' && p.name === CLI_PACKAGE) linkCliBin(deps);\n deps.log(\n `[localize] ${p.name} -> ${p.dir} (branch ${currentBranch(pkgDir, deps)})`,\n );\n }\n for (const d of driftProblems(deps.appRoot))\n deps.warn(`[localize] drift: ${describeDrift(d)}`);\n return code;\n}\n\n/**\n * npm links a package's bin only when its target exists, and a fresh cli\n * checkout has no `lib/` at install time: without this, `node_modules/.bin/linked`\n * is missing after the build, and `npx linked` would fetch the unrelated npm\n * package named `linked`. `--ignore-scripts`: only the bin links are wanted.\n */\nfunction linkCliBin(deps: Deps): void {\n const r = deps.run('npm', ['rebuild', CLI_PACKAGE, '--ignore-scripts'], {\n cwd: deps.appRoot,\n });\n if (r.status !== 0) {\n deps.warn(\n `[localize] npm rebuild ${CLI_PACKAGE} failed, so \\`linked\\` may not be on the app's ` +\n `bin path. Run it yourself.\\n` +\n tail(r.stderr || r.stdout),\n );\n }\n}\n\n/** Step 3 for `localize`: take back a parked checkout, else clone. */\nfunction prepareClone(\n name: string,\n opts: LocalizeOptions,\n deps: Deps,\n): Prepared | null {\n const parked = parkedMembers(deps.appRoot).find((m) => m.name === name);\n if (parked) return unpark(parked, deps);\n\n const member = localMembers(deps.appRoot).find((m) => m.name === name);\n if (member) {\n throw new LocalizeError(\n `${name} is already in ${member.dir}. To install and build it as it is:\\n` +\n ` linked localize ${name} --adopt`,\n EXIT_REFUSED,\n );\n }\n\n const relDir = `${LOCAL_DIR}/${checkoutNameFor(name)}`;\n const target = path.join(deps.appRoot, relDir);\n if (existsOrLink(target)) {\n throw new LocalizeError(\n `${relDir} already exists. localize never clones over a directory. If it is ${name}'s ` +\n `checkout, install and build it as it is:\\n linked localize ${name} --adopt`,\n EXIT_REFUSED,\n );\n }\n\n const resolved = resolvePackage(\n name,\n deps,\n opts.repo ? {repo: opts.repo, subdir: opts.subdir} : undefined,\n );\n\n // A monorepo is cloned whole outside the glob; the member is a link to the package.\n const relClone = resolved.subdir\n ? `${REPOS_DIR}/${checkoutNameFor(name)}`\n : relDir;\n const clone = path.join(deps.appRoot, relClone);\n if (existsOrLink(clone)) {\n throw new LocalizeError(\n `${relClone} already exists. Remove it, or move it out of the way, and run this again.`,\n EXIT_REFUSED,\n );\n }\n fs.mkdirSync(path.dirname(clone), {recursive: true});\n deps.log(`[localize] cloning ${resolved.repo} -> ${relClone}`);\n const r = deps.run('git', ['clone', '--', resolved.repo, clone]);\n if (r.status !== 0) {\n throw new LocalizeError(\n `git clone ${resolved.repo} failed:\\n${(r.stderr || r.stdout).trim()}`,\n EXIT_REFUSED,\n );\n }\n\n const pkgDir = resolved.subdir ? path.join(clone, resolved.subdir) : clone;\n const relPkg = resolved.subdir ? `${relClone}/${resolved.subdir}` : relClone;\n // A clone that is not the package must not stay: in packages-local/ it\n // would be a workspace member under the wrong name.\n const declared = readJson(path.join(pkgDir, 'package.json'))?.name;\n if (declared !== name) {\n fs.rmSync(clone, {recursive: true, force: true});\n const where = resolved.subdir\n ? `The registry's repository.directory for \"${name}\" points at the wrong place.`\n : `${resolved.repo} looks like a monorepo. Say where the package lives:\\n` +\n ` linked localize ${name} --repo ${resolved.repo} --subdir <path-inside-the-repo>`;\n throw new LocalizeError(\n (declared\n ? `${relPkg} declares itself as \"${declared}\", not \"${name}\".\\n`\n : `${relPkg} has no package.json naming it, so it is not the package \"${name}\".\\n`) +\n `${where}\\nThe clone was removed.`,\n EXIT_REFUSED,\n );\n }\n\n if (resolved.subdir) {\n linkDirectory(pkgDir, target);\n deps.log(`[localize] ${relDir} -> ${relPkg}`);\n }\n return {name, dir: relDir, build: true};\n}\n\n/** Move a parked checkout back into `packages-local/`. No clone, no build: it is as it was. */\nexport function unpark(member: Member, deps: Deps): Prepared {\n const entry = path.basename(member.dir);\n const relDir = `${LOCAL_DIR}/${entry}`;\n const to = path.join(deps.appRoot, relDir);\n if (existsOrLink(to)) {\n throw new LocalizeError(\n `${member.name} is parked in ${member.dir}, but ${relDir} already exists. Move one of ` +\n `them out of the way and run this again.`,\n EXIT_REFUSED,\n );\n }\n // npm refuses two workspace members of one name, so the install would fail.\n const same = localMembers(deps.appRoot).find((m) => m.name === member.name);\n if (same) {\n throw new LocalizeError(\n `${member.name} is parked in ${member.dir}, but ${same.dir} is ${member.name} already. ` +\n `Keep one: delete or move the other out of the way, and run this again.`,\n EXIT_REFUSED,\n );\n }\n moveEntry(path.join(deps.appRoot, member.dir), to);\n deps.log(`[localize] ${member.dir} -> ${relDir}`);\n return {name: member.name, dir: relDir, build: false};\n}\n\n/** `--dir` is kept for scripts that pass the default; anything else is not a workspace member. */\nfunction checkDir(dir: string | undefined): void {\n if (dir === undefined || dir.replace(/\\/+$/, '') === LOCAL_DIR) return;\n throw new LocalizeError(\n `--dir ${dir}: checkouts live in ${LOCAL_DIR}/, the directory the app's ` +\n `\"workspaces\" glob and the lock-at-rest hook name. Move them there.`,\n EXIT_USAGE,\n );\n}\n\nfunction reportSetup(changes: SetupChange[], deps: Deps): void {\n if (!changes.length) return;\n deps.log(`[localize] set up this app for checkouts (commit these):`);\n for (const c of changes) deps.log(` ${c.file}: ${c.what}`);\n}\n\n/** What `captureSetupLockfile` runs: the lockfile for the new `package.json`, nothing installed. */\nconst SETUP_LOCK_ARGS = [\n 'install',\n '--package-lock-only',\n '--ignore-scripts',\n '--no-audit',\n '--no-fund',\n];\n\n/**\n * The set-up changed `package.json`, so the lockfile must change with it\n * (the root entry's `workspaces`) -- and it must be a lockfile with no\n * checkout in it, which the install below cannot give: it lists them, and\n * lock-at-rest leaves it so while `package.json` differs from HEAD. So,\n * before anything is cloned, make that lockfile, keep it, and write it back\n * after the install. When the root entry already has `workspaces` and\n * `hasInstallScript`, it is an edit of that entry (setup-lockfile.ts: exact,\n * offline); otherwise npm makes the lockfile alone, with checkouts already in\n * `packages-local/` (an adopted one) moved into `SETUP_ASIDE_DIR` for that\n * one call.\n *\n * @returns the lockfile to write back, or null when it could not be made (the\n * manual steps are printed instead).\n */\nfunction captureSetupLockfile(\n changes: SetupChange[],\n workspacesBefore: unknown,\n deps: Deps,\n): string | null {\n const lockfile = path.join(deps.appRoot, LOCKFILE);\n const edited = editedSetupLockfile(lockfile, workspacesBefore, deps);\n if (edited !== null) return edited;\n const moveAside = localMembers(deps.appRoot).length > 0;\n deps.log(\n `[localize] npm ${SETUP_LOCK_ARGS.join(' ')} (the set-up's lockfile)`,\n );\n if (moveAside) setAside(deps);\n let r: RunResult;\n try {\n r = deps.run('npm', SETUP_LOCK_ARGS, {cwd: deps.appRoot});\n } finally {\n if (moveAside) moveBack(deps);\n }\n let text: string | null = null;\n try {\n text = fs.readFileSync(lockfile, 'utf8');\n } catch {\n /* none written */\n }\n if (r.status !== 0 || text === null) {\n manualSetupSteps(\n changes,\n r.status !== 0\n ? `npm could not write it:\\n${tail(r.stderr || r.stdout)}`\n : `npm wrote no ${LOCKFILE}`,\n deps,\n );\n return null;\n }\n return text;\n}\n\n/**\n * Every entry of `packages-local/` but the dot directories, moved into\n * `SETUP_ASIDE_DIR` as it is (a link keeps its text and works again once back).\n */\nfunction setAside(deps: Pick<Deps, 'appRoot'>): void {\n const local = path.join(deps.appRoot, LOCAL_DIR);\n const aside = path.join(deps.appRoot, SETUP_ASIDE_DIR);\n fs.mkdirSync(aside, {recursive: true});\n for (const entry of fs.readdirSync(local)) {\n if (entry.startsWith('.')) continue;\n fs.renameSync(path.join(local, entry), path.join(aside, entry));\n }\n}\n\n/** Everything in `SETUP_ASIDE_DIR` back into `packages-local/`; the directory goes. */\nfunction moveBack(deps: Pick<Deps, 'appRoot'>): number {\n const local = path.join(deps.appRoot, LOCAL_DIR);\n const aside = path.join(deps.appRoot, SETUP_ASIDE_DIR);\n const entries = fs.readdirSync(aside);\n for (const entry of entries)\n fs.renameSync(path.join(aside, entry), path.join(local, entry));\n fs.rmdirSync(aside);\n return entries.length;\n}\n\n/**\n * A set-up run that was interrupted while the checkouts were in\n * `SETUP_ASIDE_DIR` left them there, where npm does not see them: move them\n * back, saying so. Refuses, moving nothing, when `packages-local/` already\n * has an entry of the same name.\n */\nexport function restoreSetAside(deps: Pick<Deps, 'appRoot' | 'log'>): void {\n const aside = path.join(deps.appRoot, SETUP_ASIDE_DIR);\n if (!existsOrLink(aside)) return;\n let entries: string[];\n try {\n entries = fs.readdirSync(aside);\n } catch {\n throw new LocalizeError(\n `${SETUP_ASIDE_DIR} is not a directory. Remove it and run this again.`,\n EXIT_REFUSED,\n );\n }\n const clashes = entries.filter((e) =>\n existsOrLink(path.join(deps.appRoot, LOCAL_DIR, e)),\n );\n if (clashes.length) {\n throw new LocalizeError(\n `${SETUP_ASIDE_DIR}/ holds checkouts an interrupted set-up left there, but ` +\n `${clashes.map((e) => `${LOCAL_DIR}/${e}`).join(', ')} now exist${clashes.length === 1 ? 's' : ''} ` +\n `too. Keep one of each, move the other out of ${LOCAL_DIR}/, and run this again. ` +\n `Nothing was moved.`,\n EXIT_REFUSED,\n );\n }\n const n = moveBack(deps);\n if (n)\n deps.log(\n `[localize] moved ${n} checkout${n === 1 ? '' : 's'} back from ${SETUP_ASIDE_DIR}/ into ` +\n `${LOCAL_DIR}/, where an interrupted set-up left ${n === 1 ? 'it' : 'them'}.`,\n );\n}\n\n/** The set-up's lockfile as an edit of the root entry, written now; null when npm must make it. */\nfunction editedSetupLockfile(\n lockfile: string,\n workspacesBefore: unknown,\n deps: Deps,\n): string | null {\n let current: string;\n try {\n current = fs.readFileSync(lockfile, 'utf8');\n } catch {\n return null;\n }\n const text = setupLockfileByEdit(\n current,\n readJson(path.join(deps.appRoot, 'package.json')),\n workspacesBefore,\n );\n if (text === null) return null;\n fs.writeFileSync(lockfile, text);\n deps.log(\n `[localize] ${LOCKFILE}: the root entry's \"workspaces\" now matches package.json (the set-up's lockfile)`,\n );\n return text;\n}\n\n/** Put the captured set-up lockfile back after the install rewrote it. */\nfunction restoreSetupLockfile(text: string, deps: Deps): void {\n fs.writeFileSync(path.join(deps.appRoot, LOCKFILE), text);\n deps.log(\n `[localize] ${LOCKFILE}: put back the set-up's lockfile, which lists no checkout (any ` +\n `lock-at-rest warning above was about the one the install wrote).`,\n );\n commitHint(deps);\n}\n\nfunction commitHint(deps: Deps): void {\n deps.log(\n `[localize] commit the set-up now -- package.json, ${LOCKFILE}, .gitignore:\\n` +\n ` git add package.json ${LOCKFILE} .gitignore && git commit -m \"chore: set up linked localize\"`,\n );\n}\n\n/** The set-up's lockfile could not be made in one step: how to make it by hand. */\nfunction manualSetupSteps(\n changes: SetupChange[],\n why: string,\n deps: Deps,\n): void {\n const files = [...new Set([...changes.map((c) => c.file), LOCKFILE])];\n deps.warn(\n `[localize] could not make the set-up's ${LOCKFILE} in one step: ${why}\\n` +\n `Commit the set-up with a lockfile from an install with no checkout present:\\n` +\n ` npx linked delocalize\\n` +\n ` npm install\\n` +\n ` git add ${files.join(' ')} && git commit -m \"chore: set up linked localize\"\\n` +\n ` npx linked localize --parked`,\n );\n}\n\n/** Tell the developer what `installGitHooks` did not do. */\nfunction reportHooks(hooks: HookInstall, deps: Deps): void {\n for (const file of hooks.skipped) {\n deps.warn(\n `[localize] ${path.relative(deps.appRoot, file)} is not ours, so it was left alone. Without ` +\n `the localize hook there, run \\`npm install\\` yourself after a pull or branch switch that ` +\n `changes dependencies.`,\n );\n }\n if (hooks.hooksPath !== null) {\n deps.warn(\n `[localize] core.hooksPath is set (${hooks.hooksPath}), so no git hooks were written. Add ` +\n `each line below to the hook named before it, an \\`sh\\` script (not, say, a Python hook ` +\n `the pre-commit framework writes); they do nothing where the cli is not installed:`,\n );\n for (const m of hooks.manual) deps.warn(` ${m.file}:\\n ${m.line}`);\n }\n if (hooks.sharedWithWorktrees) {\n deps.warn(\n `[localize] this is a linked worktree: git hooks are shared by every worktree of the ` +\n `repository. They act only in a work tree whose ${LOCAL_DIR}/ has checkouts.`,\n );\n }\n}\n\n/**\n * Run the build for one new checkout. `opts.build` wins, including `''` for\n * no build; otherwise `defaultBuildCommand` reads the checkout's package.json.\n */\nfunction runBuild(\n p: Prepared,\n pkgDir: string,\n opts: Pick<LocalizeOptions, 'build'>,\n deps: Deps,\n): 'skipped' | 'ok' | 'failed' {\n if (opts.build === '') return 'skipped';\n const cmd =\n opts.build ??\n defaultBuildCommand(readJson(path.join(pkgDir, 'package.json')));\n if (!cmd) {\n deps.log(\n `[localize] ${p.dir}: no \\`build\\` script, so nothing is built; pass --build <cmd> ` +\n `to build it.`,\n );\n return 'skipped';\n }\n deps.log(`[localize] ${p.dir}: ${cmd}`);\n const r = deps.run(cmd, [], {cwd: pkgDir, shell: true});\n if (r.status !== 0) {\n deps.warn(\n `[localize] ${p.dir}: \\`${cmd}\\` failed. It is installed and linked anyway -- a package ` +\n `whose build is broken is usually what you localized it to fix.\\n` +\n tail(r.stderr || r.stdout),\n );\n return 'failed';\n }\n return 'ok';\n}\n\n/**\n * What a checkout is built with when `--build` does not say: its own `build`\n * script (`npm run build`, which also runs a `prebuild`), else `''`, nothing.\n * Packages and apps both define one (`linked build`, `linked build-app`), so\n * localize never needs to know which kind it is. `pkg` is the checkout's\n * package.json, null when unreadable.\n */\nexport function defaultBuildCommand(\n pkg: {scripts?: Record<string, unknown>} | null,\n): string {\n return typeof pkg?.scripts?.build === 'string' ? DEFAULT_BUILD_COMMAND : '';\n}\n\nexport function reportError(e: unknown, deps: Pick<Deps, 'error'>): number {\n if (e instanceof LocalizeError) {\n deps.error(`[localize] ${e.message}`);\n return e.code;\n }\n throw e;\n}\n\n/**\n * The checked-out branch, or `HEAD` when detached. `symbolic-ref` first,\n * because it also names the branch of a repository with no commits yet --\n * `rev-parse --abbrev-ref` fails there, and `create-package` adopts a fresh\n * `git init` before its first commit.\n */\nexport function currentBranch(\n checkout: string,\n deps: Pick<Deps, 'run'>,\n): string {\n const sym = deps.run('git', ['symbolic-ref', '--short', '-q', 'HEAD'], {\n cwd: checkout,\n });\n if (sym.status === 0 && sym.stdout.trim()) return sym.stdout.trim();\n const r = deps.run('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {\n cwd: checkout,\n });\n const b = r.stdout.trim();\n return r.status === 0 && b ? b : 'HEAD';\n}\n\n/** The last lines of a subprocess's output: enough to see the error, not the whole log. */\nexport function tail(output: string, lines = 20): string {\n return output.trim().split('\\n').slice(-lines).join('\\n');\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@_linked/cli",
3
- "version": "1.47.0",
3
+ "version": "1.47.2",
4
4
  "packageManager": "npm@12.2.0",
5
5
  "description": "Command line tools for the @_linked/* packages and apps",
6
6
  "main": "lib/esm/index.js",