@_linked/cli 1.37.0 → 1.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/esm/cli-methods.d.ts +2 -1
- package/lib/esm/cli-methods.d.ts.map +1 -1
- package/lib/esm/cli-methods.js +225 -52
- package/lib/esm/cli-methods.js.map +1 -1
- package/lib/esm/cli.d.ts.map +1 -1
- package/lib/esm/cli.js +18 -5
- package/lib/esm/cli.js.map +1 -1
- package/lib/esm/commands/localize.d.ts +14 -0
- package/lib/esm/commands/localize.d.ts.map +1 -1
- package/lib/esm/commands/localize.js +39 -3
- package/lib/esm/commands/localize.js.map +1 -1
- package/lib/esm/lifecycle.d.ts +8 -1
- package/lib/esm/lifecycle.d.ts.map +1 -1
- package/lib/esm/lifecycle.js +41 -11
- package/lib/esm/lifecycle.js.map +1 -1
- package/lib/esm/utils/createPackageLocation.d.ts +76 -0
- package/lib/esm/utils/createPackageLocation.d.ts.map +1 -0
- package/lib/esm/utils/createPackageLocation.js +157 -0
- package/lib/esm/utils/createPackageLocation.js.map +1 -0
- package/lib/esm/utils/ontologyNamespace.d.ts +21 -0
- package/lib/esm/utils/ontologyNamespace.d.ts.map +1 -0
- package/lib/esm/utils/ontologyNamespace.js +30 -0
- package/lib/esm/utils/ontologyNamespace.js.map +1 -0
- package/package.json +2 -2
package/lib/esm/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";AAsCA,OAAO,oBAAoB,CAAC"}
|
package/lib/esm/cli.js
CHANGED
|
@@ -14,6 +14,7 @@ import chalk from 'chalk';
|
|
|
14
14
|
import { addCapacitor, buildAll, buildPackage, buildUpdated, checkImports, compilePackage, createApp, createComponent, createOntology, createPackage, createSetComponent, createShape, depCheck, depCheckStaged, developPackage, executeCommandForEachPackage, executeCommandForPackage, getLincdPackages, getScriptDir, publishPackage, publishUpdated, register, runMethod, runScript, upgradePackages, } from './cli-methods.js';
|
|
15
15
|
// import {buildMetadata} from './metadata';
|
|
16
16
|
import { program } from 'commander';
|
|
17
|
+
import { CreatePackageError } from './utils/createPackageLocation.js';
|
|
17
18
|
import fs from 'fs-extra';
|
|
18
19
|
import path from 'path';
|
|
19
20
|
import 'require-extensions';
|
|
@@ -94,10 +95,21 @@ program
|
|
|
94
95
|
.argument('<scriptName>', 'the name of the script file inside the /scripts folder');
|
|
95
96
|
program
|
|
96
97
|
.command('create-package')
|
|
97
|
-
.action((name, uriBase) => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
.action((name, uriBase, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
99
|
+
try {
|
|
100
|
+
yield createPackage(name, uriBase, process.cwd(), options);
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
if (!(e instanceof CreatePackageError))
|
|
104
|
+
throw e;
|
|
105
|
+
console.error(chalk.red(e.message));
|
|
106
|
+
process.exitCode = 1;
|
|
107
|
+
}
|
|
108
|
+
}))
|
|
109
|
+
.description("Create a new folder with all the required files for a new Linked package. 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.")
|
|
110
|
+
.option('--location <where>', "packages: part of this app's repository, a workspace member added to its dependencies. packages-local: its own git repository (git init + a first commit), linked and recorded by `linked localize` and not added to the app's dependencies until it is published.")
|
|
111
|
+
.option('--remote <git-url>', "The new repository's origin; also written to repository.url. Implies --location packages-local.")
|
|
112
|
+
.option('--push', 'Push the first commit to --remote.')
|
|
101
113
|
.argument('<name>', 'The name of the package. Will be used as package name in package.json')
|
|
102
114
|
.argument('[uri_base]', 'The base URL used for data of this package. Leave blank to use the URL of your package on lincd.org after you register it');
|
|
103
115
|
program
|
|
@@ -294,10 +306,11 @@ program
|
|
|
294
306
|
.command('localize [packages...]')
|
|
295
307
|
.description('Develop an npm dependency from a git checkout: clone it, install inside the checkout, build it and symlink it into node_modules — without touching package.json or package-lock.json. Name packages exactly as npm names them (@_linked/rdfs, lodash); the repository is read from the published `repository` field. With no names, reports what is localized.')
|
|
296
308
|
.option('--list', 'Report what is localized rather than localizing anything.')
|
|
309
|
+
.option('--adopt', 'Link a checkout that is already in packages-local under its localize name (e.g. packages-local/_linked-foo for @_linked/foo): install, build, link and record it, without cloning or asking the registry. For a package created locally, or a clone put there by hand.')
|
|
297
310
|
.option('--check', 'With --list: exit 1 when something recorded is not actually linked.')
|
|
298
311
|
.option('--relink', 'Recreate the recorded symlinks. This is what a postinstall runs.')
|
|
299
312
|
.option('--dir <path>', 'Where checkouts live (default: packages-local).')
|
|
300
|
-
.option('--repo <git-url>',
|
|
313
|
+
.option('--repo <git-url>', "Clone this instead of the published repository, and record it. With --adopt: record this instead of the checkout's origin.")
|
|
301
314
|
.option('--subdir <path>', "The package's directory inside the repository (monorepos).")
|
|
302
315
|
.option('--build <cmd>', 'Run this in the checkout after installing; a failure only warns. Defaults to `linked build`; pass an empty string to build nothing.')
|
|
303
316
|
.option('--force', 'Overwrite a symlink pointing outside the checkout directory.')
|
package/lib/esm/cli.js.map
CHANGED
|
@@ -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,cAAc,EACd,cAAc,EACd,4BAA4B,EAC5B,wBAAwB,EACxB,gBAAgB,E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AK,CAAC,CAAC,EAAE,CAAC,CAAC;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,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} from 'commander';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport 'require-extensions';\nimport {unknownCommandError} from './unknown-command.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\nprogram\n .command('create-package')\n .action((name, uriBase) => {\n return createPackage(name, uriBase);\n })\n .description(\n 'Create a new folder with all the required files for a new Linked package',\n )\n .argument(\n '<name>',\n 'The name of the package. Will be used as package name in package.json',\n )\n .argument(\n '[uri_base]',\n 'The base URL used for data of this package. Leave blank to use the URL of your package on lincd.org after you register it',\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);\n })\n .description(\n 'Creates a new ShapeClass file for your package. Execute this from your package folder.',\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);\n })\n .description(\n 'Creates a new Component 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-set-component')\n .action((name, uriBase) => {\n return createSetComponent(name);\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);\n })\n .description(\n 'Creates a new ontology file for your package. Execute this from your package folder.',\n )\n .argument(\n '<suggested-prefix>',\n 'The suggested prefix for your ontology. Also the shorthand code used for the file name and the exported ontology object',\n )\n .argument(\n '[uribase]',\n \"Optional argument to set the URI base for the URI's of all entities in your ontology. Leave blank to use the URI's provided by lincd.org once you register this package\",\n );\n\nprogram.command('app [action]', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-local', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-dev', {hidden: true}).action(() => {\n register('https://dev-registry.lincd.org');\n});\nprogram\n .command('register')\n .action(() => {\n register('https://registry.lincd.org');\n })\n .description(\n 'Register (a new version of) this package to the Linked registry. If successful your package will appear on linked.cm',\n );\n\nprogram\n .command('info')\n .action(() => {\n let localDir = getScriptDir();\n let packageJsonPath = path.join(localDir, 'package.json');\n try {\n var ownPackage = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n } catch (e) {\n console.warn(\n 'Could not read package.json at ' + packageJsonPath + ': ' + e,\n );\n process.exit();\n }\n console.log(ownPackage.version);\n console.log('Running from: ' + localDir);\n })\n .description(\n \"Log the version of this tool and the path that it's running from\",\n );\n\nprogram\n .command('build [target] [target2]', {isDefault: true})\n .action(async (target, target2, options) => {\n const result = await buildPackage(target, target2, process.cwd(), !options?.silent);\n if (result !== true) {\n process.exitCode = 1;\n }\n })\n .option(\n '--silent',\n 'No output to console unless errors occur. The exit code is unaffected: 0 when the build succeeds (warnings included), 1 when it fails',\n );\n\nprogram\n .command('compile-only')\n .action(() => {\n compilePackage();\n })\n .description(\n 'Compile the package without other build steps. Run this command from the package folder',\n );\nprogram.command('build-metadata').action(() => {\n console.log('Needs to be reimplemented');\n // buildMetadata();\n});\nprogram\n .command('build-app')\n .action(async (options) => {\n // Vite is the only app build. An app without a `vite.config.{ts,js,mjs}`\n // is rejected by name rather than falling back to anything.\n await runAppCommand(async () => {\n const {assertViteApp, buildViteApp} = await import(\n './commands/build-app.js'\n );\n assertViteApp();\n await buildViteApp({\n environmentNames: splitEnvOption(options?.env),\n target: options?.target,\n publish: options?.publish === true,\n revision: options?.revision,\n allowDirty: options?.allowDirty === true,\n });\n });\n })\n .option('--env <env>', 'The node environment to use. Default is \"development\"')\n .option('--target <target>', 'Build target: web or capacitor')\n .option(\n '--publish',\n 'Upload the release after a successful web build (off by default; use `linked publish-app`)',\n )\n .option(\n '--revision <sha>',\n 'Revision identifying the release. Defaults to LINKED_RELEASE_REVISION, GITHUB_SHA, then git HEAD',\n )\n .option(\n '--allow-dirty',\n 'Build from a working tree with uncommitted changes; the release revision gets a \"-dirty\" suffix',\n )\n .description(\n 'Build the linked app frontend and backend for production, and write a release manifest. Requires a vite.config in the app root.',\n );\n\nprogram\n .command('publish-app')\n .option('--env <env>', 'The node environment to use')\n .option(\n '--manifest <path>',\n 'Release manifest to publish, relative to the app root. Default public/bundles/linked-release.json',\n )\n .option('--yes', 'Upload the verified release. Without it this is a dry run')\n .action(async (options) => {\n // Retry or inspect an existing release without rebuilding the app.\n await runAppCommand(async () => {\n const {ensureEnvironmentLoaded} = await import('./lifecycle.js');\n const {resolveAppAssetsStore} = await import(\n './app-release/app-assets-store.js'\n );\n const {publishApp} = await import('./commands/publish-app.js');\n await ensureEnvironmentLoaded(splitEnvOption(options?.env));\n // The store is resolved by publishApp, after the manifest is read.\n await publishApp({\n manifestPath: options?.manifest,\n resolveStore: () => resolveAppAssetsStore(),\n yes: options?.yes === true,\n });\n });\n })\n .description(\n 'Validate or retry publishing a previously built release. Defaults to dry run.',\n );\n\nprogram\n .command('serve-app')\n .option('--env <env>', 'The node environment to use')\n .action(async (options) => {\n // Production runtime loads compiled output and never starts Vite/HMR.\n await runAppCommand(async () => {\n const {serveCompiledApp} = await import('./commands/serve-app.js');\n await serveCompiledApp({environmentNames: splitEnvOption(options?.env)});\n });\n })\n .description('Start a compiled Linked app without Vite or HMR.');\n\nprogram.command('publish-updated').action(() => {\n return publishUpdated();\n});\nprogram.command('publish [version]').action((version) => {\n publishPackage(null, false, null, version);\n});\n\nprogram.command('status').action(() => {\n //log which packages need to be published\n return publishUpdated(true).then(() => {\n //log which packages need to be build\n return buildUpdated(undefined, '', '', true);\n });\n});\nprogram\n .command('build-updated [target] [target2]')\n .action((target, target2, options) => {\n const {useGit}: {useGit?: boolean} = options;\n return buildUpdated(1, target, target2, useGit || false);\n })\n .option(\n '--use-git',\n 'Use git commit timestamps to check which packages have been updated since the last build',\n );\nprogram\n .command('build-updated-since [num-commits-back] [target] [target2]')\n .action((back, target, target2) => {\n return buildUpdated(back, target, target2);\n });\nprogram\n .command('build-all')\n .action((options) => {\n buildAll(options);\n })\n .option(\n '--sync',\n 'build each package 1 by 1 - use this if you have build issues due to low available RAM memory',\n )\n .option('--from <char>', 'start from a specific package');\n\nprogram\n .command('build-workspace')\n .description(\n 'Build all linked packages in the current workspace in dependency order',\n )\n .option('-u, --updated', 'Only build updated packages')\n .option(\n '--use-git',\n 'Use git commit timestamps to determine which packages need updating',\n )\n .action(async (options) => {\n if (options.updated) {\n return buildUpdated(1, undefined, undefined, !!options.useGit);\n }\n return buildAll(options);\n });\n\nprogram\n .command('build-package <filepath>')\n .description(\n 'Given a file path, find its package.json and rebuild that package. Use for editor save hooks.',\n )\n .action(async (filepath) => {\n const {buildPackageByPath} = await import(\n './commands/build-package.js'\n );\n return buildPackageByPath(filepath);\n });\n\nprogram\n .command('localize [packages...]')\n .description(\n 'Develop an npm dependency from a git checkout: clone it, install inside the checkout, build it and symlink it into node_modules — without touching package.json or package-lock.json. Name packages exactly as npm names them (@_linked/rdfs, lodash); the repository is read from the published `repository` field. With no names, reports what is localized.',\n )\n .option('--list', 'Report what is localized rather than localizing anything.')\n .option(\n '--check',\n 'With --list: exit 1 when something recorded is not actually linked.',\n )\n .option(\n '--relink',\n 'Recreate the recorded symlinks. This is what a postinstall runs.',\n )\n .option('--dir <path>', 'Where checkouts live (default: packages-local).')\n .option(\n '--repo <git-url>',\n 'Clone this instead of the published repository, and record it.',\n )\n .option(\n '--subdir <path>',\n \"The package's directory inside the repository (monorepos).\",\n )\n .option(\n '--build <cmd>',\n 'Run this in the checkout after installing; a failure only warns. Defaults to `linked build`; pass an empty string to build nothing.',\n )\n .option(\n '--force',\n 'Overwrite a symlink pointing outside the checkout directory.',\n )\n .action(async (packages: string[], options) => {\n const {runLocalize} = await import('./commands/localize.js');\n return runLocalize(packages, options);\n });\n\nprogram\n .command('delocalize [packages...]')\n .description(\n 'Undo localize: unlink the packages and forget them, keeping the checkout. With no names, undoes every localized package.',\n )\n .option('--purge', 'Also delete the checkout.')\n .option('--force', 'With --purge, delete even a checkout localize refuses.')\n .action(async (packages: string[], options) => {\n const {runDelocalize} = await import('./commands/localize.js');\n return runDelocalize(packages, options);\n });\n\nprogram\n .command('app-doctor')\n .description(\n \"Run in an app. Checks how the app uses linked packages: Vite pre-bundle entries that don't resolve (and the fix), linked packages whose dependencies don't support the app's React version (and which to bump), and hand-written entries that are now generated and can be removed. Exits 1 if anything needs fixing.\",\n )\n .action(async () => {\n const {runAppDoctor} = await import('./commands/app-doctor.js');\n return runAppDoctor();\n });\n\nprogram\n .command('setup-publish')\n .description(\n \"Set up the changesets publish pipeline in the current package repo. Writes the pr.yml/publish.yml callers of the shared workflows in the repo's own org .github repo, changesets config, .gitignore entries, and patches package.json.\",\n )\n .option(\n '--configure-github',\n 'Also apply the uniform branch protection on main and enable auto-merge (requires gh CLI installed and authenticated).',\n )\n .option(\n '--dual-branch',\n 'Deprecated and ignored: the main + dev flow and its @next prereleases are retired. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--scope <scope>',\n 'Deprecated and ignored: the npm secret is NPM_AUTH_TOKEN in every org, holding that org\\'s own token. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--grant-team <slug>',\n 'GitHub team slug to grant push access on the repo. Requires gh CLI.',\n )\n .action(async (options) => {\n const {setupPublish} = await import('./commands/setup-publish.js');\n await setupPublish({\n configureGithub: !!options.configureGithub,\n dualBranch: !!options.dualBranch,\n scope: options.scope,\n grantTeam: options.grantTeam,\n });\n });\n\nprogram\n .command('all [action] [filter] [filter-value]')\n .action((command, filter, filterValue) => {\n executeCommandForEachPackage(\n getLincdPackages(),\n command,\n filter,\n filterValue,\n );\n });\n// program.command('all-except [excludedSpaces] [action]').action((excludedSpaces, command) => {\n// executeCommandForEachModule(getLincdModules(), command, null, excludedSpaces);\n// });\n\nprogram.command('dev [target] [mode]').action((target, mode) => {\n developPackage(target, mode);\n});\n\nprogram.command('depcheck').action((target, mode) => {\n depCheck();\n});\nprogram.command('depcheck-staged').action((target, mode) => {\n depCheckStaged();\n});\nprogram\n .command('check-imports')\n .description(\n 'Check the imports of the package in the current folder. Exits 1 when an invalid import is found',\n )\n .action(async () => {\n try {\n await checkImports();\n } catch (report) {\n // checkImports throws the formatted report of every invalid import.\n console.error(typeof report === 'string' ? report : String(report));\n process.exitCode = 1;\n }\n });\n\nprogram\n .command('package')\n .action((name, command, args: string[]) => {\n let fullCommand = command\n ? command +\n ' ' +\n args\n .slice(0, 3)\n .filter((a) => a && true)\n .join(' ')\n : null;\n\n //TODO: call\n // let pkgName = process.argv[1];\n // console.log(pkgName);\n // let restArgs = process.argv.slice(2)\n // program.parse([],{from:'user'});\n // program.parse(['--port', '80'], { from: 'user' })\n\n executeCommandForPackage(name, fullCommand);\n })\n .alias('p')\n .alias('pkg')\n .alias('m')\n .alias('module')\n .description(\n 'Searches for a package in this workspace with a partially matching name and executes a command for that package (without needing to execute it from the folder of the package)',\n )\n .argument('<name>', 'the name of the package. Can be a part of the name.')\n .argument(\n '[command]',\n 'the linked command you want to execute. Like dev or build',\n )\n .argument('[args...]', 'the additional arguments of that command');\n\nprogram.command('enable-capacitor').action(() => {\n addCapacitor();\n});\n\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,GAChB,MAAM,kBAAkB,CAAC;AAC1B,4CAA4C;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,aAAa,GAAG,CAAO,GAA2B,EAAiB,EAAE;IACzE,IAAI,CAAC;QACH,MAAM,GAAG,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CA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C,CAAC,OAAO;YACP,GAAG;YACH,IAAI;iBACD,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;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,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} 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';\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\nprogram\n .command('create-package')\n .action(async (name, uriBase, options) => {\n try {\n await createPackage(name, uriBase, process.cwd(), options);\n } catch (e) {\n if (!(e instanceof CreatePackageError)) throw e;\n console.error(chalk.red(e.message));\n process.exitCode = 1;\n }\n })\n .description(\n \"Create a new folder with all the required files for a new Linked package. 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 .option(\n '--location <where>',\n \"packages: part of this app's repository, a workspace member added to its dependencies. packages-local: its own git repository (git init + a first commit), linked and recorded by `linked localize` and not added to the app's dependencies until it is published.\",\n )\n .option(\n '--remote <git-url>',\n \"The new repository's origin; also written to repository.url. Implies --location packages-local.\",\n )\n .option('--push', 'Push the first commit to --remote.')\n .argument(\n '<name>',\n 'The name of the package. Will be used as package name in package.json',\n )\n .argument(\n '[uri_base]',\n 'The base URL used for data of this package. Leave blank to use the URL of your package on lincd.org after you register it',\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);\n })\n .description(\n 'Creates a new ShapeClass file for your package. Execute this from your package folder.',\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);\n })\n .description(\n 'Creates a new Component 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-set-component')\n .action((name, uriBase) => {\n return createSetComponent(name);\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);\n })\n .description(\n 'Creates a new ontology file for your package. Execute this from your package folder.',\n )\n .argument(\n '<suggested-prefix>',\n 'The suggested prefix for your ontology. Also the shorthand code used for the file name and the exported ontology object',\n )\n .argument(\n '[uribase]',\n \"Optional argument to set the URI base for the URI's of all entities in your ontology. Leave blank to use the URI's provided by lincd.org once you register this package\",\n );\n\nprogram.command('app [action]', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-local', {hidden: true}).action(() => {\n register('http://localhost:4101');\n});\nprogram.command('register-dev', {hidden: true}).action(() => {\n register('https://dev-registry.lincd.org');\n});\nprogram\n .command('register')\n .action(() => {\n register('https://registry.lincd.org');\n })\n .description(\n 'Register (a new version of) this package to the Linked registry. If successful your package will appear on linked.cm',\n );\n\nprogram\n .command('info')\n .action(() => {\n let localDir = getScriptDir();\n let packageJsonPath = path.join(localDir, 'package.json');\n try {\n var ownPackage = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));\n } catch (e) {\n console.warn(\n 'Could not read package.json at ' + packageJsonPath + ': ' + e,\n );\n process.exit();\n }\n console.log(ownPackage.version);\n console.log('Running from: ' + localDir);\n })\n .description(\n \"Log the version of this tool and the path that it's running from\",\n );\n\nprogram\n .command('build [target] [target2]', {isDefault: true})\n .action(async (target, target2, options) => {\n const result = await buildPackage(target, target2, process.cwd(), !options?.silent);\n if (result !== true) {\n process.exitCode = 1;\n }\n })\n .option(\n '--silent',\n 'No output to console unless errors occur. The exit code is unaffected: 0 when the build succeeds (warnings included), 1 when it fails',\n );\n\nprogram\n .command('compile-only')\n .action(() => {\n compilePackage();\n })\n .description(\n 'Compile the package without other build steps. Run this command from the package folder',\n );\nprogram.command('build-metadata').action(() => {\n console.log('Needs to be reimplemented');\n // buildMetadata();\n});\nprogram\n .command('build-app')\n .action(async (options) => {\n // Vite is the only app build. An app without a `vite.config.{ts,js,mjs}`\n // is rejected by name rather than falling back to anything.\n await runAppCommand(async () => {\n const {assertViteApp, buildViteApp} = await import(\n './commands/build-app.js'\n );\n assertViteApp();\n await buildViteApp({\n environmentNames: splitEnvOption(options?.env),\n target: options?.target,\n publish: options?.publish === true,\n revision: options?.revision,\n allowDirty: options?.allowDirty === true,\n });\n });\n })\n .option('--env <env>', 'The node environment to use. Default is \"development\"')\n .option('--target <target>', 'Build target: web or capacitor')\n .option(\n '--publish',\n 'Upload the release after a successful web build (off by default; use `linked publish-app`)',\n )\n .option(\n '--revision <sha>',\n 'Revision identifying the release. Defaults to LINKED_RELEASE_REVISION, GITHUB_SHA, then git HEAD',\n )\n .option(\n '--allow-dirty',\n 'Build from a working tree with uncommitted changes; the release revision gets a \"-dirty\" suffix',\n )\n .description(\n 'Build the linked app frontend and backend for production, and write a release manifest. Requires a vite.config in the app root.',\n );\n\nprogram\n .command('publish-app')\n .option('--env <env>', 'The node environment to use')\n .option(\n '--manifest <path>',\n 'Release manifest to publish, relative to the app root. Default public/bundles/linked-release.json',\n )\n .option('--yes', 'Upload the verified release. Without it this is a dry run')\n .action(async (options) => {\n // Retry or inspect an existing release without rebuilding the app.\n await runAppCommand(async () => {\n const {ensureEnvironmentLoaded} = await import('./lifecycle.js');\n const {resolveAppAssetsStore} = await import(\n './app-release/app-assets-store.js'\n );\n const {publishApp} = await import('./commands/publish-app.js');\n await ensureEnvironmentLoaded(splitEnvOption(options?.env));\n // The store is resolved by publishApp, after the manifest is read.\n await publishApp({\n manifestPath: options?.manifest,\n resolveStore: () => resolveAppAssetsStore(),\n yes: options?.yes === true,\n });\n });\n })\n .description(\n 'Validate or retry publishing a previously built release. Defaults to dry run.',\n );\n\nprogram\n .command('serve-app')\n .option('--env <env>', 'The node environment to use')\n .action(async (options) => {\n // Production runtime loads compiled output and never starts Vite/HMR.\n await runAppCommand(async () => {\n const {serveCompiledApp} = await import('./commands/serve-app.js');\n await serveCompiledApp({environmentNames: splitEnvOption(options?.env)});\n });\n })\n .description('Start a compiled Linked app without Vite or HMR.');\n\nprogram.command('publish-updated').action(() => {\n return publishUpdated();\n});\nprogram.command('publish [version]').action((version) => {\n publishPackage(null, false, null, version);\n});\n\nprogram.command('status').action(() => {\n //log which packages need to be published\n return publishUpdated(true).then(() => {\n //log which packages need to be build\n return buildUpdated(undefined, '', '', true);\n });\n});\nprogram\n .command('build-updated [target] [target2]')\n .action((target, target2, options) => {\n const {useGit}: {useGit?: boolean} = options;\n return buildUpdated(1, target, target2, useGit || false);\n })\n .option(\n '--use-git',\n 'Use git commit timestamps to check which packages have been updated since the last build',\n );\nprogram\n .command('build-updated-since [num-commits-back] [target] [target2]')\n .action((back, target, target2) => {\n return buildUpdated(back, target, target2);\n });\nprogram\n .command('build-all')\n .action((options) => {\n buildAll(options);\n })\n .option(\n '--sync',\n 'build each package 1 by 1 - use this if you have build issues due to low available RAM memory',\n )\n .option('--from <char>', 'start from a specific package');\n\nprogram\n .command('build-workspace')\n .description(\n 'Build all linked packages in the current workspace in dependency order',\n )\n .option('-u, --updated', 'Only build updated packages')\n .option(\n '--use-git',\n 'Use git commit timestamps to determine which packages need updating',\n )\n .action(async (options) => {\n if (options.updated) {\n return buildUpdated(1, undefined, undefined, !!options.useGit);\n }\n return buildAll(options);\n });\n\nprogram\n .command('build-package <filepath>')\n .description(\n 'Given a file path, find its package.json and rebuild that package. Use for editor save hooks.',\n )\n .action(async (filepath) => {\n const {buildPackageByPath} = await import(\n './commands/build-package.js'\n );\n return buildPackageByPath(filepath);\n });\n\nprogram\n .command('localize [packages...]')\n .description(\n 'Develop an npm dependency from a git checkout: clone it, install inside the checkout, build it and symlink it into node_modules — without touching package.json or package-lock.json. Name packages exactly as npm names them (@_linked/rdfs, lodash); the repository is read from the published `repository` field. With no names, reports what is localized.',\n )\n .option('--list', 'Report what is localized rather than localizing anything.')\n .option(\n '--adopt',\n 'Link a checkout that is already in packages-local under its localize name (e.g. packages-local/_linked-foo for @_linked/foo): install, build, link and record it, without cloning or asking the registry. For a package created locally, or a clone put there by hand.',\n )\n .option(\n '--check',\n 'With --list: exit 1 when something recorded is not actually linked.',\n )\n .option(\n '--relink',\n 'Recreate the recorded symlinks. This is what a postinstall runs.',\n )\n .option('--dir <path>', 'Where checkouts live (default: packages-local).')\n .option(\n '--repo <git-url>',\n \"Clone this instead of the published repository, and record it. With --adopt: record this instead of the checkout's origin.\",\n )\n .option(\n '--subdir <path>',\n \"The package's directory inside the repository (monorepos).\",\n )\n .option(\n '--build <cmd>',\n 'Run this in the checkout after installing; a failure only warns. Defaults to `linked build`; pass an empty string to build nothing.',\n )\n .option(\n '--force',\n 'Overwrite a symlink pointing outside the checkout directory.',\n )\n .action(async (packages: string[], options) => {\n const {runLocalize} = await import('./commands/localize.js');\n return runLocalize(packages, options);\n });\n\nprogram\n .command('delocalize [packages...]')\n .description(\n 'Undo localize: unlink the packages and forget them, keeping the checkout. With no names, undoes every localized package.',\n )\n .option('--purge', 'Also delete the checkout.')\n .option('--force', 'With --purge, delete even a checkout localize refuses.')\n .action(async (packages: string[], options) => {\n const {runDelocalize} = await import('./commands/localize.js');\n return runDelocalize(packages, options);\n });\n\nprogram\n .command('app-doctor')\n .description(\n \"Run in an app. Checks how the app uses linked packages: Vite pre-bundle entries that don't resolve (and the fix), linked packages whose dependencies don't support the app's React version (and which to bump), and hand-written entries that are now generated and can be removed. Exits 1 if anything needs fixing.\",\n )\n .action(async () => {\n const {runAppDoctor} = await import('./commands/app-doctor.js');\n return runAppDoctor();\n });\n\nprogram\n .command('setup-publish')\n .description(\n \"Set up the changesets publish pipeline in the current package repo. Writes the pr.yml/publish.yml callers of the shared workflows in the repo's own org .github repo, changesets config, .gitignore entries, and patches package.json.\",\n )\n .option(\n '--configure-github',\n 'Also apply the uniform branch protection on main and enable auto-merge (requires gh CLI installed and authenticated).',\n )\n .option(\n '--dual-branch',\n 'Deprecated and ignored: the main + dev flow and its @next prereleases are retired. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--scope <scope>',\n 'Deprecated and ignored: the npm secret is NPM_AUTH_TOKEN in every org, holding that org\\'s own token. Accepted only so stale scripts still set the repo up.',\n )\n .option(\n '--grant-team <slug>',\n 'GitHub team slug to grant push access on the repo. Requires gh CLI.',\n )\n .action(async (options) => {\n const {setupPublish} = await import('./commands/setup-publish.js');\n await setupPublish({\n configureGithub: !!options.configureGithub,\n dualBranch: !!options.dualBranch,\n scope: options.scope,\n grantTeam: options.grantTeam,\n });\n });\n\nprogram\n .command('all [action] [filter] [filter-value]')\n .action((command, filter, filterValue) => {\n executeCommandForEachPackage(\n getLincdPackages(),\n command,\n filter,\n filterValue,\n );\n });\n// program.command('all-except [excludedSpaces] [action]').action((excludedSpaces, command) => {\n// executeCommandForEachModule(getLincdModules(), command, null, excludedSpaces);\n// });\n\nprogram.command('dev [target] [mode]').action((target, mode) => {\n developPackage(target, mode);\n});\n\nprogram.command('depcheck').action((target, mode) => {\n depCheck();\n});\nprogram.command('depcheck-staged').action((target, mode) => {\n depCheckStaged();\n});\nprogram\n .command('check-imports')\n .description(\n 'Check the imports of the package in the current folder. Exits 1 when an invalid import is found',\n )\n .action(async () => {\n try {\n await checkImports();\n } catch (report) {\n // checkImports throws the formatted report of every invalid import.\n console.error(typeof report === 'string' ? report : String(report));\n process.exitCode = 1;\n }\n });\n\nprogram\n .command('package')\n .action((name, command, args: string[]) => {\n let fullCommand = command\n ? command +\n ' ' +\n args\n .slice(0, 3)\n .filter((a) => a && true)\n .join(' ')\n : null;\n\n //TODO: call\n // let pkgName = process.argv[1];\n // console.log(pkgName);\n // let restArgs = process.argv.slice(2)\n // program.parse([],{from:'user'});\n // program.parse(['--port', '80'], { from: 'user' })\n\n executeCommandForPackage(name, fullCommand);\n })\n .alias('p')\n .alias('pkg')\n .alias('m')\n .alias('module')\n .description(\n 'Searches for a package in this workspace with a partially matching name and executes a command for that package (without needing to execute it from the folder of the package)',\n )\n .argument('<name>', 'the name of the package. Can be a part of the name.')\n .argument(\n '[command]',\n 'the linked command you want to execute. Like dev or build',\n )\n .argument('[args...]', 'the additional arguments of that command');\n\nprogram.command('enable-capacitor').action(() => {\n addCapacitor();\n});\n\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,6 +1,7 @@
|
|
|
1
1
|
/** The build command `localize` runs inside a fresh checkout by default. */
|
|
2
2
|
export declare const DEFAULT_BUILD_COMMAND = "linked build";
|
|
3
3
|
export interface LocalizeCommandOptions {
|
|
4
|
+
adopt?: boolean;
|
|
4
5
|
list?: boolean;
|
|
5
6
|
check?: boolean;
|
|
6
7
|
relink?: boolean;
|
|
@@ -17,6 +18,19 @@ export interface LocalizeCommandOptions {
|
|
|
17
18
|
* return, instead of exiting, so pending output is flushed.
|
|
18
19
|
*/
|
|
19
20
|
export declare function runLocalize(packages?: string[], options?: LocalizeCommandOptions): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Adopt one checkout that already sits in `packages-local/` under its localize
|
|
23
|
+
* name: install inside it, build it, link it and record it. This is how
|
|
24
|
+
* `create-package` hands a new package with its own repository to localize.
|
|
25
|
+
*
|
|
26
|
+
* @returns localize's exit code, rather than setting `process.exitCode`, so the
|
|
27
|
+
* caller decides what a failure means.
|
|
28
|
+
*/
|
|
29
|
+
export declare function adoptPackage(name: string, options: {
|
|
30
|
+
appRoot: string;
|
|
31
|
+
build: string;
|
|
32
|
+
repo?: string;
|
|
33
|
+
}): Promise<number>;
|
|
20
34
|
/** `linked delocalize [packages...]` — unlink and forget; no names means all. */
|
|
21
35
|
export declare function runDelocalize(packages?: string[], options?: Pick<LocalizeCommandOptions, 'purge' | 'force'>): Promise<void>;
|
|
22
36
|
//# sourceMappingURL=localize.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localize.d.ts","sourceRoot":"","sources":["../../../src/commands/localize.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"localize.d.ts","sourceRoot":"","sources":["../../../src/commands/localize.ts"],"names":[],"mappings":"AA4BA,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,iBAAiB,CAAC;AAEpD,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,QAAQ,GAAE,MAAM,EAAO,EACvB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CA+Cf;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC,GACvD,OAAO,CAAC,MAAM,CAAC,CASjB;AAED,iFAAiF;AACjF,wBAAsB,aAAa,CACjC,QAAQ,GAAE,MAAM,EAAO,EACvB,OAAO,GAAE,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,OAAO,CAAM,GAC5D,OAAO,CAAC,IAAI,CAAC,CAQf"}
|
|
@@ -27,6 +27,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
27
27
|
* There is no short-name expansion and no org probing: the repository comes
|
|
28
28
|
* from the registry's `repository` field, so a name that npm cannot resolve is
|
|
29
29
|
* an error rather than a guess.
|
|
30
|
+
*
|
|
31
|
+
* `--adopt` is the exception to "clone from the registry": it links a git
|
|
32
|
+
* checkout that is already in `packages-local/` under its localize name, with
|
|
33
|
+
* no clone and no lookup — a package created locally, or a clone put there by
|
|
34
|
+
* hand. It takes no `--subdir`: an adopted checkout is the package itself.
|
|
30
35
|
*/
|
|
31
36
|
import process from 'node:process';
|
|
32
37
|
/** The build command `localize` runs inside a fresh checkout by default. */
|
|
@@ -38,26 +43,57 @@ export const DEFAULT_BUILD_COMMAND = 'linked build';
|
|
|
38
43
|
*/
|
|
39
44
|
export function runLocalize() {
|
|
40
45
|
return __awaiter(this, arguments, void 0, function* (packages = [], options = {}) {
|
|
41
|
-
const { defaultDeps, localize, list, relink } = yield import('@_linked/localize');
|
|
46
|
+
const { defaultDeps, localize, adopt, list, relink } = yield import('@_linked/localize');
|
|
42
47
|
const deps = defaultDeps(process.cwd());
|
|
43
48
|
if (options.relink) {
|
|
44
49
|
process.exitCode = relink(deps);
|
|
45
50
|
return;
|
|
46
51
|
}
|
|
52
|
+
if (options.adopt && packages.length === 0) {
|
|
53
|
+
console.error('[localize] --adopt needs at least one package name.');
|
|
54
|
+
process.exitCode = 2;
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (options.adopt && options.subdir) {
|
|
58
|
+
console.error('[localize] --adopt takes no --subdir: an adopted checkout is the package itself.');
|
|
59
|
+
process.exitCode = 2;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
47
62
|
if (options.list || packages.length === 0) {
|
|
48
63
|
process.exitCode = list({ check: options.check }, deps);
|
|
49
64
|
return;
|
|
50
65
|
}
|
|
66
|
+
// `--build ''` is how you ask for no build at all.
|
|
67
|
+
const build = options.build === undefined ? DEFAULT_BUILD_COMMAND : options.build;
|
|
68
|
+
if (options.adopt) {
|
|
69
|
+
process.exitCode = adopt(packages, { force: options.force, dir: options.dir, repo: options.repo, build }, deps);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
51
72
|
process.exitCode = localize(packages, {
|
|
52
73
|
force: options.force,
|
|
53
74
|
dir: options.dir,
|
|
54
75
|
repo: options.repo,
|
|
55
76
|
subdir: options.subdir,
|
|
56
|
-
|
|
57
|
-
build: options.build === undefined ? DEFAULT_BUILD_COMMAND : options.build,
|
|
77
|
+
build,
|
|
58
78
|
}, deps);
|
|
59
79
|
});
|
|
60
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Adopt one checkout that already sits in `packages-local/` under its localize
|
|
83
|
+
* name: install inside it, build it, link it and record it. This is how
|
|
84
|
+
* `create-package` hands a new package with its own repository to localize.
|
|
85
|
+
*
|
|
86
|
+
* @returns localize's exit code, rather than setting `process.exitCode`, so the
|
|
87
|
+
* caller decides what a failure means.
|
|
88
|
+
*/
|
|
89
|
+
export function adoptPackage(name, options) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const { defaultDeps, adopt } = yield import('@_linked/localize');
|
|
92
|
+
// Exit codes are localize's public contract; EXIT_WARNED (5) is the one a
|
|
93
|
+
// caller usually tolerates, meaning the build failed but the link is in place.
|
|
94
|
+
return adopt([name], { build: options.build, repo: options.repo }, defaultDeps(options.appRoot));
|
|
95
|
+
});
|
|
96
|
+
}
|
|
61
97
|
/** `linked delocalize [packages...]` — unlink and forget; no names means all. */
|
|
62
98
|
export function runDelocalize() {
|
|
63
99
|
return __awaiter(this, arguments, void 0, function* (packages = [], options = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localize.js","sourceRoot":"","sources":["../../../src/commands/localize.ts"],"names":[],"mappings":";;;;;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"localize.js","sourceRoot":"","sources":["../../../src/commands/localize.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAepD;;;;GAIG;AACH,MAAM,UAAgB,WAAW;yDAC/B,WAAqB,EAAE,EACvB,UAAkC,EAAE;QAEpC,MAAM,EAAC,WAAW,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAC,GAChD,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACpC,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAExC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnB,OAAO,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAChC,OAAO;QACT,CAAC;QACD,IAAI,OAAO,CAAC,KAAK,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3C,OAAO,CAAC,KAAK,CAAC,qDAAqD,C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AAC,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAC/D,0EAA0E;QAC1E,+EAA+E;QAC/E,OAAO,KAAK,CACV,CAAC,IAAI,CAAC,EACN,EAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAC,EAC1C,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAC7B,CAAC;IACJ,CAAC;CAAA;AAED,iFAAiF;AACjF,MAAM,UAAgB,aAAa;yDACjC,WAAqB,EAAE,EACvB,UAA2D,EAAE;QAE7D,MAAM,EAAC,WAAW,EAAE,UAAU,EAAC,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACpE,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACxC,OAAO,CAAC,QAAQ,GAAG,UAAU,CAC3B,QAAQ,EACR,EAAC,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAC,EAC5C,IAAI,CACL,CAAC;IACJ,CAAC;CAAA","sourcesContent":["/**\n * `linked localize` / `linked delocalize` — develop an npm dependency from a\n * git checkout.\n *\n * All of the work lives in `@_linked/localize`, which is dependency-free and\n * knows nothing about this framework on purpose: it resolves a package's\n * repository from the registry, clones it, installs inside the checkout and\n * symlinks it into `node_modules`, without touching `package.json` or\n * `package-lock.json`.\n *\n * The one thing it deliberately does not know is how to build what it cloned.\n * That is the seam this module fills: `@_linked/cli` passes `build: 'linked\n * build'`, because in this ecosystem that is what building a package means.\n * A failing build only warns — a package whose build is broken is usually\n * exactly what you localized it to fix.\n *\n * Packages are named exactly as npm names them (`@_linked/rdfs`, `lodash`).\n * There is no short-name expansion and no org probing: the repository comes\n * from the registry's `repository` field, so a name that npm cannot resolve is\n * an error rather than a guess.\n *\n * `--adopt` is the exception to \"clone from the registry\": it links a git\n * checkout that is already in `packages-local/` under its localize name, with\n * no clone and no lookup — a package created locally, or a clone put there by\n * hand. It takes no `--subdir`: an adopted checkout is the package itself.\n */\nimport process from 'node:process';\n\n/** The build command `localize` runs inside a fresh checkout by default. */\nexport const DEFAULT_BUILD_COMMAND = 'linked build';\n\nexport interface LocalizeCommandOptions {\n adopt?: boolean;\n list?: boolean;\n check?: boolean;\n relink?: boolean;\n dir?: string;\n repo?: string;\n subdir?: string;\n build?: string;\n force?: boolean;\n purge?: boolean;\n}\n\n/**\n * `localize` reports failure through an exit code rather than by throwing, so\n * that a partial run still prints what it did. Mirror that: set `exitCode` and\n * return, instead of exiting, so pending output is flushed.\n */\nexport async function runLocalize(\n packages: string[] = [],\n options: LocalizeCommandOptions = {},\n): Promise<void> {\n const {defaultDeps, localize, adopt, list, relink} =\n await import('@_linked/localize');\n const deps = defaultDeps(process.cwd());\n\n if (options.relink) {\n process.exitCode = relink(deps);\n return;\n }\n if (options.adopt && packages.length === 0) {\n console.error('[localize] --adopt needs at least one package name.');\n process.exitCode = 2;\n return;\n }\n if (options.adopt && options.subdir) {\n console.error(\n '[localize] --adopt takes no --subdir: an adopted checkout is the package itself.',\n );\n process.exitCode = 2;\n return;\n }\n if (options.list || packages.length === 0) {\n process.exitCode = list({check: options.check}, deps);\n return;\n }\n // `--build ''` is how you ask for no build at all.\n const build =\n options.build === undefined ? DEFAULT_BUILD_COMMAND : options.build;\n if (options.adopt) {\n process.exitCode = adopt(\n packages,\n {force: options.force, dir: options.dir, repo: options.repo, build},\n deps,\n );\n return;\n }\n process.exitCode = localize(\n packages,\n {\n force: options.force,\n dir: options.dir,\n repo: options.repo,\n subdir: options.subdir,\n build,\n },\n deps,\n );\n}\n\n/**\n * Adopt one checkout that already sits in `packages-local/` under its localize\n * name: install inside it, build it, link it and record it. This is how\n * `create-package` hands a new package with its own repository to localize.\n *\n * @returns localize's exit code, rather than setting `process.exitCode`, so the\n * caller decides what a failure means.\n */\nexport async function adoptPackage(\n name: string,\n options: {appRoot: string; build: string; repo?: string},\n): Promise<number> {\n const {defaultDeps, adopt} = await import('@_linked/localize');\n // Exit codes are localize's public contract; EXIT_WARNED (5) is the one a\n // caller usually tolerates, meaning the build failed but the link is in place.\n return adopt(\n [name],\n {build: options.build, repo: options.repo},\n defaultDeps(options.appRoot),\n );\n}\n\n/** `linked delocalize [packages...]` — unlink and forget; no names means all. */\nexport async function runDelocalize(\n packages: string[] = [],\n options: Pick<LocalizeCommandOptions, 'purge' | 'force'> = {},\n): Promise<void> {\n const {defaultDeps, delocalize} = await import('@_linked/localize');\n const deps = defaultDeps(process.cwd());\n process.exitCode = delocalize(\n packages,\n {purge: options.purge, force: options.force},\n deps,\n );\n}\n"]}
|
package/lib/esm/lifecycle.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface LocalPackage extends PackageDetails {
|
|
|
66
66
|
hasBuildScript: boolean;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
* Directory holding localized checkouts (`
|
|
69
|
+
* Directory holding localized checkouts (`linked localize`). It is
|
|
70
70
|
* deliberately in NO workspace glob — that is the whole point of the design,
|
|
71
71
|
* since npm learning about these checkouts is what made their predecessor
|
|
72
72
|
* under `packages/` a trap — so any walk of `workspaces` alone cannot see it
|
|
@@ -103,6 +103,13 @@ export declare function discoverLocalPackages(rootPath?: string, options?: {
|
|
|
103
103
|
includeLocalPackagesDir?: boolean;
|
|
104
104
|
localPackagesDir?: string;
|
|
105
105
|
}): LocalPackage[];
|
|
106
|
+
/**
|
|
107
|
+
* The package names recorded in the app's `local-packages.json` — what
|
|
108
|
+
* `linked localize` has linked. Read tolerantly: localize owns that file and
|
|
109
|
+
* refuses a malformed one loudly, so here a missing or unreadable file is
|
|
110
|
+
* simply "nothing localized".
|
|
111
|
+
*/
|
|
112
|
+
export declare function localizedPackageNames(appRootPath: string): string[];
|
|
106
113
|
/** A package `build-all` found but will not build, and why not. */
|
|
107
114
|
export interface SkippedPackage {
|
|
108
115
|
packageName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/lifecycle.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,uBAAuB,GAClC,mBAAmB,MAAM,EAAE,KAC1B,OAAO,CAAC,IAAI,CA+Bd,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,GAAI,SAAS;IAC7C,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,KAAG,MAAM,EAeT,CAAC;AAgDF;;;;;GAKG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,GAAG,CAAC,CAyB7D;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAa,SAAQ,cAAc;IAClD,+BAA+B;IAC/B,MAAM,EAAE,WAAW,GAAG,oBAAoB,CAAC;IAC3C,0DAA0D;IAC1D,eAAe,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,KAAK,EAAE,OAAO,CAAC;IACf,0EAA0E;IAC1E,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AAEnD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,SAAgB,GACvB,cAAc,EAAE,CAIlB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,SAAgB,EACxB,OAAO,GAAE;IAAC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAM,GAC3E,YAAY,EAAE,CA4BhB;
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/lifecycle.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAEpD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,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACnC,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,CAkD5E"}
|
package/lib/esm/lifecycle.js
CHANGED
|
@@ -168,7 +168,7 @@ export function loadBackendStorageConfig() {
|
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
|
-
* Directory holding localized checkouts (`
|
|
171
|
+
* Directory holding localized checkouts (`linked localize`). It is
|
|
172
172
|
* deliberately in NO workspace glob — that is the whole point of the design,
|
|
173
173
|
* since npm learning about these checkouts is what made their predecessor
|
|
174
174
|
* under `packages/` a trap — so any walk of `workspaces` alone cannot see it
|
|
@@ -323,14 +323,18 @@ function filterPackagesByDependencyTree(allPackages, appRootPath) {
|
|
|
323
323
|
}
|
|
324
324
|
const relevantPackages = new Map();
|
|
325
325
|
const packagesToCheck = new Set();
|
|
326
|
-
// Start with direct dependencies from app root
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
326
|
+
// Start with direct dependencies from app root, plus everything localized:
|
|
327
|
+
// a package created locally is linked but cannot be declared until it is
|
|
328
|
+
// published (an unpublished range fails `npm install`), and being localized
|
|
329
|
+
// already says this app is developed against it.
|
|
330
|
+
[
|
|
331
|
+
...Object.keys(appPackageJson.dependencies || {}),
|
|
332
|
+
...localizedPackageNames(appRootPath),
|
|
333
|
+
].forEach((dep) => {
|
|
334
|
+
if (allPackages.has(dep)) {
|
|
335
|
+
packagesToCheck.add(dep);
|
|
336
|
+
}
|
|
337
|
+
});
|
|
334
338
|
// Recursively add dependencies
|
|
335
339
|
const processedPackages = new Set();
|
|
336
340
|
while (packagesToCheck.size > 0) {
|
|
@@ -356,6 +360,30 @@ function filterPackagesByDependencyTree(allPackages, appRootPath) {
|
|
|
356
360
|
}
|
|
357
361
|
return relevantPackages;
|
|
358
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* localize's manifest filename (`MANIFEST_FILENAME` in `@_linked/localize`).
|
|
365
|
+
* Repeated rather than imported: that package is ESM-only and loaded lazily,
|
|
366
|
+
* and this runs synchronously while planning a build.
|
|
367
|
+
*/
|
|
368
|
+
const LOCALIZE_MANIFEST = 'local-packages.json';
|
|
369
|
+
/**
|
|
370
|
+
* The package names recorded in the app's `local-packages.json` — what
|
|
371
|
+
* `linked localize` has linked. Read tolerantly: localize owns that file and
|
|
372
|
+
* refuses a malformed one loudly, so here a missing or unreadable file is
|
|
373
|
+
* simply "nothing localized".
|
|
374
|
+
*/
|
|
375
|
+
export function localizedPackageNames(appRootPath) {
|
|
376
|
+
try {
|
|
377
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(appRootPath, LOCALIZE_MANIFEST), 'utf8'));
|
|
378
|
+
const packages = manifest === null || manifest === void 0 ? void 0 : manifest.packages;
|
|
379
|
+
return packages && typeof packages === 'object' && !Array.isArray(packages)
|
|
380
|
+
? Object.keys(packages)
|
|
381
|
+
: [];
|
|
382
|
+
}
|
|
383
|
+
catch (_a) {
|
|
384
|
+
return [];
|
|
385
|
+
}
|
|
386
|
+
}
|
|
359
387
|
/**
|
|
360
388
|
* Decide what `build-all` builds.
|
|
361
389
|
*
|
|
@@ -398,8 +426,10 @@ export function planBuildAll(rootPath = './', appRoot) {
|
|
|
398
426
|
const appPackageJson = getPackageJSON(appRoot);
|
|
399
427
|
const isAppWithLinkedDeps = appPackageJson &&
|
|
400
428
|
appPackageJson.lincd !== true &&
|
|
401
|
-
|
|
402
|
-
|
|
429
|
+
[
|
|
430
|
+
...Object.keys(appPackageJson.dependencies || {}),
|
|
431
|
+
...localizedPackageNames(appRoot),
|
|
432
|
+
].some((dep) => build.has(dep));
|
|
403
433
|
if (isAppWithLinkedDeps) {
|
|
404
434
|
const inTree = filterPackagesByDependencyTree(build, appRoot);
|
|
405
435
|
for (const pkg of buildable) {
|