isolate-package 1.27.0-5 → 1.27.0-6
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/README.md +33 -3
- package/dist/isolate-bin.mjs +10 -10
- package/dist/isolate-bin.mjs.map +1 -1
- package/package.json +1 -1
- package/src/isolate-bin.ts +12 -6
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
- [Usage](#usage)
|
|
7
7
|
- [Troubleshooting](#troubleshooting)
|
|
8
8
|
- [Prerequisites](#prerequisites)
|
|
9
|
+
- [CLI Flags](#cli-flags)
|
|
9
10
|
- [Configuration Options](#configuration-options)
|
|
10
11
|
- [PNPM Patched Dependencies](#pnpm-patched-dependencies)
|
|
11
12
|
- [API](#api)
|
|
@@ -68,14 +69,17 @@ are not using Typescript.
|
|
|
68
69
|
|
|
69
70
|
By default the isolated output will become available at `./isolate`.
|
|
70
71
|
|
|
72
|
+
All [configuration options](#configuration-options) can also be set via
|
|
73
|
+
[CLI flags](#cli-flags), which take precedence over the config file.
|
|
74
|
+
|
|
71
75
|
If you are here to improve your Firebase deployments check out the
|
|
72
76
|
[Firebase quick start guide](./docs/firebase.md#a-quick-start).
|
|
73
77
|
|
|
74
78
|
## Troubleshooting
|
|
75
79
|
|
|
76
|
-
If something is not working as expected,
|
|
77
|
-
|
|
78
|
-
console.
|
|
80
|
+
If something is not working as expected, run `npx isolate --log-level debug` or
|
|
81
|
+
add an `isolate.config.json` file with `"logLevel"` set to `"debug"`. This
|
|
82
|
+
should give you detailed feedback in the console.
|
|
79
83
|
|
|
80
84
|
In addition define an environment variable to debug the configuration being used
|
|
81
85
|
by setting `DEBUG_ISOLATE_CONFIG=true` before you execute `isolate`.
|
|
@@ -170,6 +174,31 @@ You can, however, declare multiple workspace packages directories. Personally, I
|
|
|
170
174
|
prefer to use `["packages/*", "apps/*", "services/*"]`. It is only the structure
|
|
171
175
|
inside them that should be flat.
|
|
172
176
|
|
|
177
|
+
## CLI Flags
|
|
178
|
+
|
|
179
|
+
All configuration options can be passed as CLI flags, which take precedence over
|
|
180
|
+
values in `isolate.config.json`. Run `npx isolate --help` for the full list.
|
|
181
|
+
|
|
182
|
+
| Flag | Short | Type | Config Key |
|
|
183
|
+
| ----------------------------------- | ----- | -------- | ------------------------ |
|
|
184
|
+
| `--build-dir-name <name>` | `-b` | string | `buildDirName` |
|
|
185
|
+
| `--include-dev-dependencies` | `-d` | boolean | `includeDevDependencies` |
|
|
186
|
+
| `--isolate-dir-name <name>` | `-o` | string | `isolateDirName` |
|
|
187
|
+
| `--log-level <level>` | `-l` | string | `logLevel` |
|
|
188
|
+
| `--target-package-path <path>` | `-t` | string | `targetPackagePath` |
|
|
189
|
+
| `--tsconfig-path <path>` | `-c` | string | `tsconfigPath` |
|
|
190
|
+
| `--workspace-packages <glob>` | `-w` | string[] | `workspacePackages` |
|
|
191
|
+
| `--workspace-root <path>` | `-r` | string | `workspaceRoot` |
|
|
192
|
+
| `--force-npm` | | boolean | `forceNpm` |
|
|
193
|
+
| `--pick-from-scripts <name>` | `-p` | string[] | `pickFromScripts` |
|
|
194
|
+
| `--omit-from-scripts <name>` | | string[] | `omitFromScripts` |
|
|
195
|
+
| `--omit-package-manager` | | boolean | `omitPackageManager` |
|
|
196
|
+
|
|
197
|
+
Array flags are repeatable, for example:
|
|
198
|
+
`npx isolate --pick-from-scripts build --pick-from-scripts start`
|
|
199
|
+
|
|
200
|
+
Boolean flags support `--no-` negation, for example: `--no-force-npm`.
|
|
201
|
+
|
|
173
202
|
## Configuration Options
|
|
174
203
|
|
|
175
204
|
For most users no configuration should be necessary.
|
|
@@ -177,6 +206,7 @@ For most users no configuration should be necessary.
|
|
|
177
206
|
You can configure the isolate process by placing a `isolate.config.json` file in
|
|
178
207
|
the package that you want to isolate, except when you're
|
|
179
208
|
[deploying to Firebase from the root of the workspace](#deploying-firebase-from-the-root).
|
|
209
|
+
Alternatively, all options can be set via [CLI flags](#cli-flags).
|
|
180
210
|
|
|
181
211
|
For the config file to be picked up, you will have to execute `isolate` from the
|
|
182
212
|
same location, as it uses the current working directory.
|
package/dist/isolate-bin.mjs
CHANGED
|
@@ -25,10 +25,10 @@ const cli = meow(outdent`
|
|
|
25
25
|
-o, --isolate-dir-name <name> Name of the isolate output directory (default: isolate)
|
|
26
26
|
-l, --log-level <level> Log level: info, debug, warn, error (default: info)
|
|
27
27
|
-t, --target-package-path <path> Path to the target package
|
|
28
|
-
|
|
28
|
+
-c, --tsconfig-path <path> Path to tsconfig.json (default: ./tsconfig.json)
|
|
29
29
|
-w, --workspace-packages <glob> Workspace package globs (repeatable)
|
|
30
30
|
-r, --workspace-root <path> Path to the workspace root (default: ../..)
|
|
31
|
-
|
|
31
|
+
--force-npm Force npm lockfile generation
|
|
32
32
|
-p, --pick-from-scripts <name> Scripts to include (repeatable)
|
|
33
33
|
--omit-from-scripts <name> Scripts to exclude (repeatable)
|
|
34
34
|
--omit-package-manager Omit the packageManager field from the manifest
|
|
@@ -60,7 +60,10 @@ const cli = meow(outdent`
|
|
|
60
60
|
type: "string",
|
|
61
61
|
shortFlag: "t"
|
|
62
62
|
},
|
|
63
|
-
tsconfigPath: {
|
|
63
|
+
tsconfigPath: {
|
|
64
|
+
type: "string",
|
|
65
|
+
shortFlag: "c"
|
|
66
|
+
},
|
|
64
67
|
workspacePackages: {
|
|
65
68
|
type: "string",
|
|
66
69
|
shortFlag: "w",
|
|
@@ -70,10 +73,7 @@ const cli = meow(outdent`
|
|
|
70
73
|
type: "string",
|
|
71
74
|
shortFlag: "r"
|
|
72
75
|
},
|
|
73
|
-
forceNpm: {
|
|
74
|
-
type: "boolean",
|
|
75
|
-
shortFlag: "f"
|
|
76
|
-
},
|
|
76
|
+
forceNpm: { type: "boolean" },
|
|
77
77
|
pickFromScripts: {
|
|
78
78
|
type: "string",
|
|
79
79
|
shortFlag: "p",
|
|
@@ -91,9 +91,9 @@ const cli = meow(outdent`
|
|
|
91
91
|
* returns `false` for unset boolean flags, making it impossible to distinguish
|
|
92
92
|
* "not passed" from "explicitly set to false" via `--no-<flag>`.
|
|
93
93
|
*/
|
|
94
|
-
function wasFlagExplicitlyPassed(flagName) {
|
|
94
|
+
function wasFlagExplicitlyPassed(flagName, shortFlag) {
|
|
95
95
|
const kebab = flagName.replace(/[A-Z]/g, (l) => `-${l.toLowerCase()}`);
|
|
96
|
-
return process.argv.some((arg) => arg === `--${kebab}` || arg === `--no-${kebab}`);
|
|
96
|
+
return process.argv.some((arg) => arg === `--${kebab}` || arg === `--no-${kebab}` || shortFlag !== void 0 && arg === `-${shortFlag}`);
|
|
97
97
|
}
|
|
98
98
|
/** Validate the --log-level value against the allowed levels. */
|
|
99
99
|
function validateLogLevel(value) {
|
|
@@ -116,7 +116,7 @@ const cliOverrides = filterObjectUndefined({
|
|
|
116
116
|
pickFromScripts: cli.flags.pickFromScripts?.length ? cli.flags.pickFromScripts : void 0,
|
|
117
117
|
omitFromScripts: cli.flags.omitFromScripts?.length ? cli.flags.omitFromScripts : void 0,
|
|
118
118
|
...wasFlagExplicitlyPassed("forceNpm") && { forceNpm: cli.flags.forceNpm },
|
|
119
|
-
...wasFlagExplicitlyPassed("includeDevDependencies") && { includeDevDependencies: cli.flags.includeDevDependencies },
|
|
119
|
+
...wasFlagExplicitlyPassed("includeDevDependencies", "d") && { includeDevDependencies: cli.flags.includeDevDependencies },
|
|
120
120
|
...wasFlagExplicitlyPassed("omitPackageManager") && { omitPackageManager: cli.flags.omitPackageManager }
|
|
121
121
|
});
|
|
122
122
|
const mergedConfig = {
|
package/dist/isolate-bin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isolate-bin.mjs","names":["validLogLevels: LogLevel[]","cliOverrides: IsolateConfig"],"sources":["../src/isolate-bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport console from \"node:console\";\nimport meow from \"meow\";\nimport { outdent } from \"outdent\";\nimport sourceMaps from \"source-map-support\";\nimport { isolate } from \"./isolate\";\nimport type { IsolateConfig } from \"./lib/config\";\nimport { loadConfigFromFile } from \"./lib/config\";\nimport type { LogLevel } from \"./lib/logger\";\nimport { filterObjectUndefined } from \"./lib/utils/filter-object-undefined\";\n\nsourceMaps.install();\n\nconst validLogLevels: LogLevel[] = [\"info\", \"debug\", \"warn\", \"error\"];\n\nconst cli = meow(\n outdent`\n Isolate a monorepo workspace package into a self-contained directory.\n\n Usage\n $ isolate [options]\n\n Options\n -b, --build-dir-name <name> Build output directory name\n -d, --include-dev-dependencies Include devDependencies in the isolated package\n -o, --isolate-dir-name <name> Name of the isolate output directory (default: isolate)\n -l, --log-level <level> Log level: info, debug, warn, error (default: info)\n -t, --target-package-path <path> Path to the target package\n
|
|
1
|
+
{"version":3,"file":"isolate-bin.mjs","names":["validLogLevels: LogLevel[]","cliOverrides: IsolateConfig"],"sources":["../src/isolate-bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport console from \"node:console\";\nimport meow from \"meow\";\nimport { outdent } from \"outdent\";\nimport sourceMaps from \"source-map-support\";\nimport { isolate } from \"./isolate\";\nimport type { IsolateConfig } from \"./lib/config\";\nimport { loadConfigFromFile } from \"./lib/config\";\nimport type { LogLevel } from \"./lib/logger\";\nimport { filterObjectUndefined } from \"./lib/utils/filter-object-undefined\";\n\nsourceMaps.install();\n\nconst validLogLevels: LogLevel[] = [\"info\", \"debug\", \"warn\", \"error\"];\n\nconst cli = meow(\n outdent`\n Isolate a monorepo workspace package into a self-contained directory.\n\n Usage\n $ isolate [options]\n\n Options\n -b, --build-dir-name <name> Build output directory name\n -d, --include-dev-dependencies Include devDependencies in the isolated package\n -o, --isolate-dir-name <name> Name of the isolate output directory (default: isolate)\n -l, --log-level <level> Log level: info, debug, warn, error (default: info)\n -t, --target-package-path <path> Path to the target package\n -c, --tsconfig-path <path> Path to tsconfig.json (default: ./tsconfig.json)\n -w, --workspace-packages <glob> Workspace package globs (repeatable)\n -r, --workspace-root <path> Path to the workspace root (default: ../..)\n --force-npm Force npm lockfile generation\n -p, --pick-from-scripts <name> Scripts to include (repeatable)\n --omit-from-scripts <name> Scripts to exclude (repeatable)\n --omit-package-manager Omit the packageManager field from the manifest\n\n Examples\n $ isolate --log-level debug\n $ isolate --force-npm --workspace-root ../..\n $ isolate --pick-from-scripts build --pick-from-scripts start\n `,\n {\n importMeta: import.meta,\n flags: {\n buildDirName: {\n type: \"string\",\n shortFlag: \"b\",\n },\n includeDevDependencies: {\n type: \"boolean\",\n shortFlag: \"d\",\n },\n isolateDirName: {\n type: \"string\",\n shortFlag: \"o\",\n },\n logLevel: {\n type: \"string\",\n shortFlag: \"l\",\n },\n targetPackagePath: {\n type: \"string\",\n shortFlag: \"t\",\n },\n tsconfigPath: {\n type: \"string\",\n shortFlag: \"c\",\n },\n workspacePackages: {\n type: \"string\",\n shortFlag: \"w\",\n isMultiple: true,\n },\n workspaceRoot: {\n type: \"string\",\n shortFlag: \"r\",\n },\n forceNpm: {\n type: \"boolean\",\n },\n pickFromScripts: {\n type: \"string\",\n shortFlag: \"p\",\n isMultiple: true,\n },\n omitFromScripts: {\n type: \"string\",\n isMultiple: true,\n },\n omitPackageManager: {\n type: \"boolean\",\n },\n },\n }\n);\n\n/**\n * Check if a boolean flag was explicitly passed on the command line. meow\n * returns `false` for unset boolean flags, making it impossible to distinguish\n * \"not passed\" from \"explicitly set to false\" via `--no-<flag>`.\n */\nfunction wasFlagExplicitlyPassed(\n flagName: string,\n shortFlag?: string\n): boolean {\n const kebab = flagName.replace(/[A-Z]/g, (l) => `-${l.toLowerCase()}`);\n return process.argv.some(\n (arg) =>\n arg === `--${kebab}` ||\n arg === `--no-${kebab}` ||\n (shortFlag !== undefined && arg === `-${shortFlag}`)\n );\n}\n\n/** Validate the --log-level value against the allowed levels. */\nfunction validateLogLevel(value: string | undefined): LogLevel | undefined {\n if (value === undefined) {\n return undefined;\n }\n\n if (!validLogLevels.includes(value as LogLevel)) {\n console.error(\n `Invalid log level: \"${value}\". Must be one of: ${validLogLevels.join(\", \")}`\n );\n process.exit(1);\n }\n\n return value as LogLevel;\n}\n\nconst validatedLogLevel = validateLogLevel(cli.flags.logLevel);\n\nconst cliOverrides: IsolateConfig = filterObjectUndefined({\n buildDirName: cli.flags.buildDirName,\n isolateDirName: cli.flags.isolateDirName,\n logLevel: validatedLogLevel,\n targetPackagePath: cli.flags.targetPackagePath,\n tsconfigPath: cli.flags.tsconfigPath,\n workspaceRoot: cli.flags.workspaceRoot,\n workspacePackages: cli.flags.workspacePackages?.length\n ? cli.flags.workspacePackages\n : undefined,\n pickFromScripts: cli.flags.pickFromScripts?.length\n ? cli.flags.pickFromScripts\n : undefined,\n omitFromScripts: cli.flags.omitFromScripts?.length\n ? cli.flags.omitFromScripts\n : undefined,\n ...(wasFlagExplicitlyPassed(\"forceNpm\") && {\n forceNpm: cli.flags.forceNpm,\n }),\n ...(wasFlagExplicitlyPassed(\"includeDevDependencies\", \"d\") && {\n includeDevDependencies: cli.flags.includeDevDependencies,\n }),\n ...(wasFlagExplicitlyPassed(\"omitPackageManager\") && {\n omitPackageManager: cli.flags.omitPackageManager,\n }),\n}) as IsolateConfig;\n\nconst fileConfig = loadConfigFromFile();\nconst mergedConfig = { ...fileConfig, ...cliOverrides };\n\nasync function run() {\n await isolate(mergedConfig);\n}\n\nrun().catch((err) => {\n if (err instanceof Error) {\n console.error(err.stack);\n process.exit(1);\n } else {\n console.error(err);\n }\n});\n"],"mappings":";;;;;;;;AAWA,WAAW,SAAS;AAEpB,MAAMA,iBAA6B;CAAC;CAAQ;CAAS;CAAQ;CAAQ;AAErE,MAAM,MAAM,KACV,OAAO;;;;;;;;;;;;;;;;;;;;;;;;KAyBP;CACE,YAAY,OAAO;CACnB,OAAO;EACL,cAAc;GACZ,MAAM;GACN,WAAW;GACZ;EACD,wBAAwB;GACtB,MAAM;GACN,WAAW;GACZ;EACD,gBAAgB;GACd,MAAM;GACN,WAAW;GACZ;EACD,UAAU;GACR,MAAM;GACN,WAAW;GACZ;EACD,mBAAmB;GACjB,MAAM;GACN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,MAAM,wBACnC;CACD,GAAI,wBAAwB,qBAAqB,IAAI,EACnD,oBAAoB,IAAI,MAAM,oBAC/B;CACF,CAAC;AAGF,MAAM,eAAe;CAAE,GADJ,oBAAoB;CACD,GAAG;CAAc;AAEvD,eAAe,MAAM;AACnB,OAAM,QAAQ,aAAa;;AAG7B,KAAK,CAAC,OAAO,QAAQ;AACnB,KAAI,eAAe,OAAO;AACxB,UAAQ,MAAM,IAAI,MAAM;AACxB,UAAQ,KAAK,EAAE;OAEf,SAAQ,MAAM,IAAI;EAEpB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isolate-package",
|
|
3
|
-
"version": "1.27.0-
|
|
3
|
+
"version": "1.27.0-6",
|
|
4
4
|
"description": "Isolate a monorepo package with its shared dependencies to form a self-contained directory, compatible with Firebase deploy",
|
|
5
5
|
"author": "Thijs Koerselman",
|
|
6
6
|
"license": "MIT",
|
package/src/isolate-bin.ts
CHANGED
|
@@ -26,10 +26,10 @@ const cli = meow(
|
|
|
26
26
|
-o, --isolate-dir-name <name> Name of the isolate output directory (default: isolate)
|
|
27
27
|
-l, --log-level <level> Log level: info, debug, warn, error (default: info)
|
|
28
28
|
-t, --target-package-path <path> Path to the target package
|
|
29
|
-
|
|
29
|
+
-c, --tsconfig-path <path> Path to tsconfig.json (default: ./tsconfig.json)
|
|
30
30
|
-w, --workspace-packages <glob> Workspace package globs (repeatable)
|
|
31
31
|
-r, --workspace-root <path> Path to the workspace root (default: ../..)
|
|
32
|
-
|
|
32
|
+
--force-npm Force npm lockfile generation
|
|
33
33
|
-p, --pick-from-scripts <name> Scripts to include (repeatable)
|
|
34
34
|
--omit-from-scripts <name> Scripts to exclude (repeatable)
|
|
35
35
|
--omit-package-manager Omit the packageManager field from the manifest
|
|
@@ -64,6 +64,7 @@ const cli = meow(
|
|
|
64
64
|
},
|
|
65
65
|
tsconfigPath: {
|
|
66
66
|
type: "string",
|
|
67
|
+
shortFlag: "c",
|
|
67
68
|
},
|
|
68
69
|
workspacePackages: {
|
|
69
70
|
type: "string",
|
|
@@ -76,7 +77,6 @@ const cli = meow(
|
|
|
76
77
|
},
|
|
77
78
|
forceNpm: {
|
|
78
79
|
type: "boolean",
|
|
79
|
-
shortFlag: "f",
|
|
80
80
|
},
|
|
81
81
|
pickFromScripts: {
|
|
82
82
|
type: "string",
|
|
@@ -99,10 +99,16 @@ const cli = meow(
|
|
|
99
99
|
* returns `false` for unset boolean flags, making it impossible to distinguish
|
|
100
100
|
* "not passed" from "explicitly set to false" via `--no-<flag>`.
|
|
101
101
|
*/
|
|
102
|
-
function wasFlagExplicitlyPassed(
|
|
102
|
+
function wasFlagExplicitlyPassed(
|
|
103
|
+
flagName: string,
|
|
104
|
+
shortFlag?: string
|
|
105
|
+
): boolean {
|
|
103
106
|
const kebab = flagName.replace(/[A-Z]/g, (l) => `-${l.toLowerCase()}`);
|
|
104
107
|
return process.argv.some(
|
|
105
|
-
(arg) =>
|
|
108
|
+
(arg) =>
|
|
109
|
+
arg === `--${kebab}` ||
|
|
110
|
+
arg === `--no-${kebab}` ||
|
|
111
|
+
(shortFlag !== undefined && arg === `-${shortFlag}`)
|
|
106
112
|
);
|
|
107
113
|
}
|
|
108
114
|
|
|
@@ -143,7 +149,7 @@ const cliOverrides: IsolateConfig = filterObjectUndefined({
|
|
|
143
149
|
...(wasFlagExplicitlyPassed("forceNpm") && {
|
|
144
150
|
forceNpm: cli.flags.forceNpm,
|
|
145
151
|
}),
|
|
146
|
-
...(wasFlagExplicitlyPassed("includeDevDependencies") && {
|
|
152
|
+
...(wasFlagExplicitlyPassed("includeDevDependencies", "d") && {
|
|
147
153
|
includeDevDependencies: cli.flags.includeDevDependencies,
|
|
148
154
|
}),
|
|
149
155
|
...(wasFlagExplicitlyPassed("omitPackageManager") && {
|