monocrate 0.4.0 → 0.6.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/README.md +72 -149
- package/dist/collect-package-locations.d.ts +7 -43
- package/dist/collect-package-locations.d.ts.map +1 -1
- package/dist/collect-package-locations.js +23 -19
- package/dist/collect-package-locations.js.map +1 -1
- package/dist/compute-package-closure.d.ts +2 -1
- package/dist/compute-package-closure.d.ts.map +1 -1
- package/dist/compute-package-closure.js +37 -12
- package/dist/compute-package-closure.js.map +1 -1
- package/dist/file-copier.d.ts +4 -4
- package/dist/file-copier.d.ts.map +1 -1
- package/dist/file-copier.js +5 -6
- package/dist/file-copier.js.map +1 -1
- package/dist/get-files-to-pack.d.ts +3 -1
- package/dist/get-files-to-pack.d.ts.map +1 -1
- package/dist/get-files-to-pack.js +7 -33
- package/dist/get-files-to-pack.js.map +1 -1
- package/dist/import-rewriter.d.ts +4 -4
- package/dist/import-rewriter.d.ts.map +1 -1
- package/dist/import-rewriter.js +5 -7
- package/dist/import-rewriter.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mirror-sources.d.ts +11 -0
- package/dist/mirror-sources.d.ts.map +1 -0
- package/dist/mirror-sources.js +90 -0
- package/dist/mirror-sources.js.map +1 -0
- package/dist/monocrate-cli.d.ts.map +1 -1
- package/dist/monocrate-cli.js +74 -38
- package/dist/monocrate-cli.js.map +1 -1
- package/dist/monocrate-options.d.ts +67 -0
- package/dist/monocrate-options.d.ts.map +1 -0
- package/dist/monocrate-options.js +2 -0
- package/dist/monocrate-options.js.map +1 -0
- package/dist/monocrate-result.d.ts +18 -0
- package/dist/monocrate-result.d.ts.map +1 -0
- package/dist/monocrate-result.js +2 -0
- package/dist/monocrate-result.js.map +1 -0
- package/dist/monocrate.d.ts +6 -32
- package/dist/monocrate.d.ts.map +1 -1
- package/dist/monocrate.js +64 -18
- package/dist/monocrate.js.map +1 -1
- package/dist/name-mangler.d.ts +2 -0
- package/dist/name-mangler.d.ts.map +1 -0
- package/dist/name-mangler.js +4 -0
- package/dist/name-mangler.js.map +1 -0
- package/dist/npm-client.d.ts +29 -0
- package/dist/npm-client.d.ts.map +1 -0
- package/dist/npm-client.js +83 -0
- package/dist/npm-client.js.map +1 -0
- package/dist/package-assembler.d.ts +16 -0
- package/dist/package-assembler.d.ts.map +1 -0
- package/dist/package-assembler.js +52 -0
- package/dist/package-assembler.js.map +1 -0
- package/dist/package-closure.d.ts +1 -1
- package/dist/package-closure.d.ts.map +1 -1
- package/dist/{package-map.d.ts → package-location.d.ts} +9 -10
- package/dist/package-location.d.ts.map +1 -0
- package/dist/package-location.js +2 -0
- package/dist/package-location.js.map +1 -0
- package/dist/paths.d.ts +37 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +59 -0
- package/dist/paths.js.map +1 -0
- package/dist/publish.d.ts +3 -1
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +2 -6
- package/dist/publish.js.map +1 -1
- package/dist/repo-explorer.d.ts +23 -0
- package/dist/repo-explorer.d.ts.map +1 -0
- package/dist/repo-explorer.js +121 -0
- package/dist/repo-explorer.js.map +1 -0
- package/dist/resolve-version.d.ts +4 -1
- package/dist/resolve-version.d.ts.map +1 -1
- package/dist/resolve-version.js +31 -33
- package/dist/resolve-version.js.map +1 -1
- package/dist/rewrite-package-json.d.ts +2 -1
- package/dist/rewrite-package-json.d.ts.map +1 -1
- package/dist/rewrite-package-json.js.map +1 -1
- package/dist/run-npm.d.ts +36 -0
- package/dist/run-npm.d.ts.map +1 -0
- package/dist/run-npm.js +35 -0
- package/dist/run-npm.js.map +1 -0
- package/package.json +10 -3
- package/dist/assemble.d.ts +0 -4
- package/dist/assemble.d.ts.map +0 -1
- package/dist/assemble.js +0 -21
- package/dist/assemble.js.map +0 -1
- package/dist/monorepo.d.ts +0 -9
- package/dist/monorepo.d.ts.map +0 -1
- package/dist/monorepo.js +0 -82
- package/dist/monorepo.js.map +0 -1
- package/dist/package-map.d.ts.map +0 -1
- package/dist/package-map.js +0 -2
- package/dist/package-map.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,193 +1,116 @@
|
|
|
1
1
|
# Monocrate
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
From monorepo to npm in one command.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Why
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Publishing from a monorepo breaks when your package depends on internal packages. npm doesn't understand workspace references like `@myorg/utils`. You're forced to either publish every internal package separately, manually copy and merge files, or bundle everything into a single file (losing module structure and type declarations).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Monocrate gives you:
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
- **One command** — point at your package, done
|
|
12
|
+
- **Self-contained output** — internal dependencies are included, nothing else to publish
|
|
13
|
+
- **Preserved module structure** — no flattening into a single file, tree-shaking works
|
|
14
|
+
- **Type declarations included** — `.d.ts` files just work
|
|
15
|
+
- **Open-source mirroring** — `--mirror-to` copies sources to a public repo alongside publishing
|
|
14
16
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
Monocrate takes a different approach: it bundles your package and all its in-repo dependencies into a single publishable directory, preserving the original module structure. Third-party dependencies are collected from all packages and merged into a single package.json.
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
monorepo/
|
|
21
|
-
packages/
|
|
22
|
-
app/ <-- You want to publish this
|
|
23
|
-
utils/ <-- app depends on this
|
|
24
|
-
core/ <-- utils depends on this
|
|
25
|
-
|
|
26
|
-
$ monocrate bundle @myorg/app --output ./publish
|
|
27
|
-
|
|
28
|
-
publish/
|
|
29
|
-
index.js <-- app's compiled code
|
|
30
|
-
_deps/
|
|
31
|
-
_myorg_utils/ <-- utils' compiled code
|
|
32
|
-
_myorg_core/ <-- core's compiled code
|
|
33
|
-
package.json <-- Merged dependencies from all packages
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Installation
|
|
17
|
+
## Install
|
|
37
18
|
|
|
38
19
|
```bash
|
|
39
20
|
npm install -g monocrate
|
|
40
21
|
```
|
|
41
22
|
|
|
42
|
-
|
|
23
|
+
## Usage
|
|
43
24
|
|
|
44
25
|
```bash
|
|
45
|
-
|
|
26
|
+
# Prepare for inspection without publishing
|
|
27
|
+
monocrate prepare packages/my-app
|
|
28
|
+
|
|
29
|
+
# Publish directly to npm
|
|
30
|
+
monocrate publish packages/my-app --bump patch
|
|
46
31
|
```
|
|
47
32
|
|
|
48
|
-
|
|
33
|
+
### Commands
|
|
49
34
|
|
|
50
|
-
|
|
35
|
+
**`prepare <packages...>`** — Assemble packages but don't publish. Useful for inspecting output or manual publishing.
|
|
51
36
|
|
|
52
|
-
|
|
53
|
-
# Ensure all packages have been compiled to their dist/ directories
|
|
54
|
-
npm run build --workspaces
|
|
55
|
-
```
|
|
37
|
+
**`publish <packages...>`** — Assemble and publish to npm.
|
|
56
38
|
|
|
57
|
-
|
|
39
|
+
### Options
|
|
58
40
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
41
|
+
| Flag | Description |
|
|
42
|
+
|------|-------------|
|
|
43
|
+
| `-b, --bump` | Version bump: `patch`, `minor`, `major`, or explicit version like `1.2.3`. Defaults to `minor`. |
|
|
44
|
+
| `-o, --output` | Output directory. Defaults to a temp directory. |
|
|
45
|
+
| `-r, --root` | Monorepo root. Auto-detected if omitted. |
|
|
46
|
+
| `-m, --mirror-to` | Mirror source files to another directory (for open-source mirrors). |
|
|
47
|
+
| `--report` | Write the resolved version to a file instead of stdout. |
|
|
62
48
|
|
|
63
|
-
|
|
49
|
+
### Examples
|
|
64
50
|
|
|
65
51
|
```bash
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## Programmatic API
|
|
52
|
+
# Bump patch version and publish
|
|
53
|
+
monocrate publish packages/cli --bump patch
|
|
70
54
|
|
|
71
|
-
|
|
55
|
+
# Publish multiple packages with synchronized versions
|
|
56
|
+
monocrate publish packages/core packages/cli
|
|
72
57
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const result = await bundle({
|
|
77
|
-
packagePath: '/path/to/monorepo/packages/my-app',
|
|
78
|
-
monorepoRoot: '/path/to/monorepo',
|
|
79
|
-
outputDir: '/tmp/my-app-bundle',
|
|
80
|
-
});
|
|
58
|
+
# Prepare to a specific directory for inspection
|
|
59
|
+
monocrate prepare packages/app --output ./publish-staging
|
|
81
60
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
console.log('Included packages:', result.includedPackages);
|
|
85
|
-
console.log('Dependencies:', result.mergedDependencies);
|
|
86
|
-
} else {
|
|
87
|
-
console.error('Bundle failed:', result.error);
|
|
88
|
-
console.error('Details:', result.details);
|
|
89
|
-
}
|
|
61
|
+
# Mirror sources to a public repo after publishing
|
|
62
|
+
monocrate publish packages/sdk --mirror-to ../public-repo/packages
|
|
90
63
|
```
|
|
91
64
|
|
|
92
|
-
|
|
65
|
+
## How It Works
|
|
93
66
|
|
|
94
|
-
|
|
67
|
+
1. Discovers all packages in the monorepo via workspace configuration
|
|
68
|
+
2. Builds a dependency graph starting from your target package
|
|
69
|
+
3. Copies each package's `dist/` directory to the output
|
|
70
|
+
4. Rewrites import statements from package names to relative paths
|
|
71
|
+
5. Generates a `package.json` with merged third-party dependencies
|
|
95
72
|
|
|
96
|
-
|
|
97
|
-
import { bundlePackage } from 'monocrate';
|
|
73
|
+
### Output Structure
|
|
98
74
|
|
|
99
|
-
// Automatically discovers packages from workspace configuration
|
|
100
|
-
const result = await bundlePackage('@myorg/app', '/tmp/bundle');
|
|
101
75
|
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
### Version Conflict Strategies
|
|
117
|
-
|
|
118
|
-
When multiple packages depend on the same third-party package with different versions:
|
|
119
|
-
|
|
120
|
-
- **`'highest'`** - Silently use the highest semver-compatible version
|
|
121
|
-
- **`'warn'`** - Use highest version, but log a warning
|
|
122
|
-
- **`'error'`** - Fail the bundle operation
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
const result = await bundle({
|
|
126
|
-
// ...
|
|
127
|
-
versionConflictStrategy: 'error', // Strict mode
|
|
128
|
-
});
|
|
76
|
+
monorepo/
|
|
77
|
+
packages/
|
|
78
|
+
app/ ← you want to publish this
|
|
79
|
+
utils/ ← app depends on this
|
|
80
|
+
core/ ← utils depends on this
|
|
81
|
+
|
|
82
|
+
output/
|
|
83
|
+
package.json ← merged deps, in-repo refs removed
|
|
84
|
+
dist/ ← app's compiled code
|
|
85
|
+
deps/
|
|
86
|
+
packages/
|
|
87
|
+
utils/dist/ ← utils' compiled code (imports rewritten)
|
|
88
|
+
core/dist/ ← core's compiled code (imports rewritten)
|
|
129
89
|
```
|
|
130
90
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
1. **Discover packages** - Reads workspace configuration (npm, yarn, or pnpm) to find all packages in the monorepo
|
|
134
|
-
|
|
135
|
-
2. **Build dependency graph** - Starting from your target package, recursively finds all in-repo dependencies and builds a topologically-sorted graph
|
|
136
|
-
|
|
137
|
-
3. **Validate builds** - Ensures all packages have been compiled (have a `dist/` directory)
|
|
138
|
-
|
|
139
|
-
4. **Assemble bundle** - Copies compiled code:
|
|
140
|
-
- Root package's `dist/` goes to output root
|
|
141
|
-
- Dependencies' `dist/` go to `_deps/<package-name>/`
|
|
142
|
-
|
|
143
|
-
5. **Transform package.json** - Generates a publish-ready package.json:
|
|
144
|
-
- Removes workspace-specific fields (`workspaces`, `private`, `devDependencies`)
|
|
145
|
-
- Removes in-repo dependencies
|
|
146
|
-
- Merges third-party dependencies from all included packages
|
|
147
|
-
|
|
148
|
-
## Bundle Result
|
|
149
|
-
|
|
150
|
-
The `bundle()` function returns a discriminated union:
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
// Success
|
|
154
|
-
{
|
|
155
|
-
success: true,
|
|
156
|
-
outputPath: string, // Path to the bundle
|
|
157
|
-
packageJson: PackageJson, // Generated package.json
|
|
158
|
-
mergedDependencies: object, // All third-party deps
|
|
159
|
-
includedPackages: string[], // List of bundled packages
|
|
160
|
-
versionConflicts: VersionConflict[], // Any conflicts found
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Failure
|
|
164
|
-
{
|
|
165
|
-
success: false,
|
|
166
|
-
error: string, // Error message
|
|
167
|
-
details?: string, // Additional context
|
|
168
|
-
cause?: Error, // Underlying error
|
|
169
|
-
}
|
|
170
|
-
```
|
|
91
|
+
Entry points (`main`, `types`, `exports`) work unchanged because the `dist/` directory stays in the same relative position.
|
|
171
92
|
|
|
172
93
|
## Requirements
|
|
173
94
|
|
|
174
|
-
-
|
|
175
|
-
-
|
|
176
|
-
-
|
|
95
|
+
- Node.js 20+
|
|
96
|
+
- All packages must be compiled (have a `dist/` directory)
|
|
97
|
+
- Monorepo must use npm, yarn, or pnpm workspaces
|
|
177
98
|
|
|
178
|
-
##
|
|
179
|
-
|
|
180
|
-
Monocrate automatically detects your package manager from:
|
|
99
|
+
## Programmatic API
|
|
181
100
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
- Lock files (`pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`)
|
|
101
|
+
```typescript
|
|
102
|
+
import { monocrate } from 'monocrate';
|
|
185
103
|
|
|
186
|
-
|
|
104
|
+
const result = await monocrate({
|
|
105
|
+
pathToSubjectPackages: ['packages/my-app'],
|
|
106
|
+
cwd: process.cwd(),
|
|
107
|
+
publish: false,
|
|
108
|
+
bump: 'minor',
|
|
109
|
+
});
|
|
187
110
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
111
|
+
console.log(result.resolvedVersion); // "1.3.0"
|
|
112
|
+
console.log(result.outputDir); // "/tmp/monocrate-xyz/my-app"
|
|
113
|
+
```
|
|
191
114
|
|
|
192
115
|
## License
|
|
193
116
|
|
|
@@ -1,48 +1,12 @@
|
|
|
1
|
-
import type { PackageLocation } from './package-
|
|
1
|
+
import type { PackageLocation } from './package-location.js';
|
|
2
2
|
import type { PackageClosure } from './package-closure.js';
|
|
3
|
+
import { AbsolutePath } from './paths.js';
|
|
4
|
+
import type { PackageJson } from './package-json.js';
|
|
5
|
+
import type { NpmClient } from './npm-client.js';
|
|
3
6
|
/**
|
|
4
|
-
* Resolves an import specifier to a
|
|
7
|
+
* Resolves an import specifier to a package-relative path using Node.js resolution semantics.
|
|
5
8
|
* Handles both bare imports (subpath='') and subpath imports (subpath='utils/helper').
|
|
6
9
|
*/
|
|
7
|
-
export declare function resolveImport(
|
|
8
|
-
export declare function collectPackageLocations(closure: PackageClosure,
|
|
9
|
-
name: string;
|
|
10
|
-
packageDir: string;
|
|
11
|
-
outputPrefix: string;
|
|
12
|
-
filesToCopy: string[];
|
|
13
|
-
packageJson: {
|
|
14
|
-
[x: string]: unknown;
|
|
15
|
-
name: string;
|
|
16
|
-
version?: string | undefined;
|
|
17
|
-
main?: string | undefined;
|
|
18
|
-
source?: string | undefined;
|
|
19
|
-
types?: string | undefined;
|
|
20
|
-
dependencies?: Partial<Record<string, string>> | undefined;
|
|
21
|
-
devDependencies?: Partial<Record<string, string>> | undefined;
|
|
22
|
-
peerDependencies?: Partial<Record<string, string>> | undefined;
|
|
23
|
-
description?: string | undefined;
|
|
24
|
-
keywords?: string[] | undefined;
|
|
25
|
-
author?: string | {
|
|
26
|
-
name: string;
|
|
27
|
-
email?: string | undefined;
|
|
28
|
-
} | undefined;
|
|
29
|
-
license?: string | undefined;
|
|
30
|
-
repository?: string | {
|
|
31
|
-
type: string;
|
|
32
|
-
url: string;
|
|
33
|
-
} | undefined;
|
|
34
|
-
homepage?: string | undefined;
|
|
35
|
-
bugs?: string | {
|
|
36
|
-
url?: string | undefined;
|
|
37
|
-
email?: string | undefined;
|
|
38
|
-
} | undefined;
|
|
39
|
-
engines?: Partial<Record<string, string>> | undefined;
|
|
40
|
-
bin?: string | Partial<Record<string, string>> | undefined;
|
|
41
|
-
type?: "module" | "commonjs" | undefined;
|
|
42
|
-
workspaces?: string[] | {
|
|
43
|
-
packages: string[];
|
|
44
|
-
} | undefined;
|
|
45
|
-
files?: string[] | undefined;
|
|
46
|
-
};
|
|
47
|
-
}[]>;
|
|
10
|
+
export declare function resolveImport(packageJson: PackageJson, subpath: string): string;
|
|
11
|
+
export declare function collectPackageLocations(npmClient: NpmClient, closure: PackageClosure, outputDir: AbsolutePath): Promise<PackageLocation[]>;
|
|
48
12
|
//# sourceMappingURL=collect-package-locations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-package-locations.d.ts","sourceRoot":"","sources":["../src/collect-package-locations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"collect-package-locations.d.ts","sourceRoot":"","sources":["../src/collect-package-locations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAG1D,OAAO,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAwB/E;AAwBD,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,YAAY,GACtB,OAAO,CAAC,eAAe,EAAE,CAAC,CAa5B"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
2
|
import * as ResolveExports from 'resolve.exports';
|
|
3
3
|
import { getFilesToPack } from './get-files-to-pack.js';
|
|
4
|
+
import { AbsolutePath, RelativePath } from './paths.js';
|
|
4
5
|
/**
|
|
5
|
-
* Resolves an import specifier to a
|
|
6
|
+
* Resolves an import specifier to a package-relative path using Node.js resolution semantics.
|
|
6
7
|
* Handles both bare imports (subpath='') and subpath imports (subpath='utils/helper').
|
|
7
8
|
*/
|
|
8
|
-
export function resolveImport(
|
|
9
|
+
export function resolveImport(packageJson, subpath) {
|
|
9
10
|
const entry = subpath === '' ? '.' : `./${subpath}`;
|
|
10
11
|
// Try exports field resolution (resolve.exports only handles the exports field, not main)
|
|
11
|
-
const resolved = ResolveExports.resolve(
|
|
12
|
+
const resolved = ResolveExports.resolve(packageJson, entry);
|
|
12
13
|
if (resolved) {
|
|
13
14
|
// The exports field can map to an array of fallback paths. Node.js tries them in order and uses
|
|
14
15
|
// the first "processable" path (e.g., skips unsupported protocols), but does NOT fall back if the
|
|
@@ -16,34 +17,37 @@ export function resolveImport(location, subpath) {
|
|
|
16
17
|
// See: https://nodejs.org/api/packages.html#package-entry-points
|
|
17
18
|
const resolvedPath = Array.isArray(resolved) ? resolved[0] : resolved;
|
|
18
19
|
if (resolvedPath !== undefined) {
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
return path.join(location.outputPrefix, cleanPath);
|
|
20
|
+
// If the resolved path starts with './', remove it
|
|
21
|
+
return resolvedPath.startsWith('./') ? resolvedPath.slice(2) : resolvedPath;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
//
|
|
24
|
+
// Otherwise (no exports field or no matching export) -
|
|
25
25
|
if (subpath === '') {
|
|
26
26
|
// Bare import (e.g., import ... from '@myorg/pkg'): use main field, then index.js (Node.js default)
|
|
27
|
-
return
|
|
27
|
+
return packageJson.main ?? 'index.js';
|
|
28
28
|
}
|
|
29
29
|
// Subpath import (e.g., import ... from '@myorg/pkg/utils/helper'): subpath relative to package root
|
|
30
|
-
return
|
|
30
|
+
return `${subpath}.js`;
|
|
31
31
|
}
|
|
32
|
-
async function createPackageLocation(pkg,
|
|
33
|
-
const filesToCopy = await getFilesToPack(pkg.
|
|
32
|
+
async function createPackageLocation(npmClient, pkg, directoryInOutput) {
|
|
33
|
+
const filesToCopy = await getFilesToPack(npmClient, pkg.fromDir);
|
|
34
|
+
// Add .npmrc if it exists (npm pack doesn't include it since it's a config file)
|
|
35
|
+
const npmrcPath = AbsolutePath.join(pkg.fromDir, RelativePath('.npmrc'));
|
|
36
|
+
if (fs.existsSync(npmrcPath)) {
|
|
37
|
+
filesToCopy.push('.npmrc');
|
|
38
|
+
}
|
|
34
39
|
return {
|
|
35
40
|
name: pkg.name,
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
fromDir: pkg.fromDir,
|
|
42
|
+
toDir: directoryInOutput,
|
|
38
43
|
filesToCopy,
|
|
39
44
|
packageJson: pkg.packageJson,
|
|
40
45
|
};
|
|
41
46
|
}
|
|
42
|
-
function
|
|
43
|
-
return path.join('deps', path.relative(monorepoRoot, dep.path));
|
|
44
|
-
}
|
|
45
|
-
export async function collectPackageLocations(closure, monorepoRoot) {
|
|
47
|
+
export async function collectPackageLocations(npmClient, closure, outputDir) {
|
|
46
48
|
// TODO(imaman): use promises()
|
|
47
|
-
return Promise.all(closure.members.map((dep) => createPackageLocation(dep, dep.name === closure.subjectPackageName
|
|
49
|
+
return Promise.all(closure.members.map((dep) => createPackageLocation(npmClient, dep, dep.name === closure.subjectPackageName
|
|
50
|
+
? outputDir
|
|
51
|
+
: AbsolutePath.join(outputDir, RelativePath('deps'), dep.pathInRepo))));
|
|
48
52
|
}
|
|
49
53
|
//# sourceMappingURL=collect-package-locations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collect-package-locations.js","sourceRoot":"","sources":["../src/collect-package-locations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"collect-package-locations.js","sourceRoot":"","sources":["../src/collect-package-locations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,KAAK,cAAc,MAAM,iBAAiB,CAAA;AAIjD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAIvD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,WAAwB,EAAE,OAAe;IACrE,MAAM,KAAK,GAAG,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE,CAAA;IAEnD,0FAA0F;IAC1F,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;IAC3D,IAAI,QAAQ,EAAE,CAAC;QACb,gGAAgG;QAChG,kGAAkG;QAClG,qEAAqE;QACrE,iEAAiE;QACjE,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;QACrE,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;YAC/B,mDAAmD;YACnD,OAAO,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAA;QAC7E,CAAC;IACH,CAAC;IAED,uDAAuD;IACvD,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,oGAAoG;QACpG,OAAO,WAAW,CAAC,IAAI,IAAI,UAAU,CAAA;IACvC,CAAC;IACD,qGAAqG;IACrG,OAAO,GAAG,OAAO,KAAK,CAAA;AACxB,CAAC;AAED,KAAK,UAAU,qBAAqB,CAClC,SAAoB,EACpB,GAAoB,EACpB,iBAA+B;IAE/B,MAAM,WAAW,GAAG,MAAM,cAAc,CAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAEhE,iFAAiF;IACjF,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAA;IACxE,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC5B,CAAC;IAED,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,KAAK,EAAE,iBAAiB;QACxB,WAAW;QACX,WAAW,EAAE,GAAG,CAAC,WAAW;KAC7B,CAAA;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,SAAoB,EACpB,OAAuB,EACvB,SAAuB;IAEvB,+BAA+B;IAC/B,OAAO,OAAO,CAAC,GAAG,CAChB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC1B,qBAAqB,CACnB,SAAS,EACT,GAAG,EACH,GAAG,CAAC,IAAI,KAAK,OAAO,CAAC,kBAAkB;QACrC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,UAAU,CAAC,CACvE,CACF,CACF,CAAA;AACH,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RepoExplorer } from './repo-explorer.js';
|
|
1
2
|
import type { PackageClosure } from './package-closure.js';
|
|
2
|
-
export declare function computePackageClosure(
|
|
3
|
+
export declare function computePackageClosure(pkgName: string, repoExplorer: RepoExplorer): PackageClosure;
|
|
3
4
|
//# sourceMappingURL=compute-package-closure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute-package-closure.d.ts","sourceRoot":"","sources":["../src/compute-package-closure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compute-package-closure.d.ts","sourceRoot":"","sources":["../src/compute-package-closure.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAgC1D,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GAAG,cAAc,CAiDjG"}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
function detectVersionConflicts(versionsByDep) {
|
|
2
|
+
const conflicts = {};
|
|
3
|
+
for (const [depName, versionInfos] of versionsByDep.entries()) {
|
|
4
|
+
const uniqueVersions = [...new Set(versionInfos.map((v) => v.version))];
|
|
5
|
+
if (uniqueVersions.length > 1) {
|
|
6
|
+
conflicts[depName] = versionInfos.map((v) => `${v.version} (by ${v.requiredBy})`);
|
|
7
|
+
}
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
+
return conflicts;
|
|
10
|
+
}
|
|
11
|
+
function formatConflictError(conflicts) {
|
|
12
|
+
const lines = ['Third-party dependency version conflicts detected:'];
|
|
13
|
+
for (const [depName, versions] of Object.entries(conflicts)) {
|
|
14
|
+
if (versions) {
|
|
15
|
+
lines.push(` - ${depName}: ${versions.join(', ')}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return lines.join('\n');
|
|
19
|
+
}
|
|
20
|
+
export function computePackageClosure(pkgName, repoExplorer) {
|
|
21
|
+
const subjectPackage = repoExplorer.getPackage(pkgName);
|
|
22
|
+
const versionsByDep = new Map();
|
|
9
23
|
const visited = new Map();
|
|
10
24
|
function collectDeps(pkg) {
|
|
11
25
|
if (visited.has(pkg.name)) {
|
|
@@ -16,20 +30,31 @@ export async function computePackageClosure(sourceDir, monorepoRoot) {
|
|
|
16
30
|
if (!depVersion) {
|
|
17
31
|
throw new Error(`no version for dep ${depName} in ${pkg.name}`);
|
|
18
32
|
}
|
|
19
|
-
const depPackage =
|
|
33
|
+
const depPackage = repoExplorer.lookupPackage(depName);
|
|
20
34
|
if (depPackage) {
|
|
21
35
|
// Is an in-repo dep
|
|
22
36
|
collectDeps(depPackage);
|
|
23
37
|
}
|
|
24
38
|
else {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
39
|
+
const existing = versionsByDep.get(depName) ?? [];
|
|
40
|
+
existing.push({ version: depVersion, requiredBy: pkg.name });
|
|
41
|
+
versionsByDep.set(depName, existing);
|
|
29
42
|
}
|
|
30
43
|
}
|
|
31
44
|
}
|
|
32
45
|
collectDeps(subjectPackage);
|
|
46
|
+
const conflicts = detectVersionConflicts(versionsByDep);
|
|
47
|
+
if (Object.keys(conflicts).length > 0) {
|
|
48
|
+
throw new Error(formatConflictError(conflicts));
|
|
49
|
+
}
|
|
50
|
+
const allThirdPartyDeps = {};
|
|
51
|
+
for (const [depName, versionInfos] of versionsByDep.entries()) {
|
|
52
|
+
const first = versionInfos[0];
|
|
53
|
+
if (!first) {
|
|
54
|
+
throw new Error(`Internal error: no version info for ${depName}`);
|
|
55
|
+
}
|
|
56
|
+
allThirdPartyDeps[depName] = first.version;
|
|
57
|
+
}
|
|
33
58
|
return {
|
|
34
59
|
subjectPackageName: subjectPackage.name,
|
|
35
60
|
members: [...visited.values()],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compute-package-closure.js","sourceRoot":"","sources":["../src/compute-package-closure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compute-package-closure.js","sourceRoot":"","sources":["../src/compute-package-closure.ts"],"names":[],"mappings":"AASA,SAAS,sBAAsB,C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CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC;QAC9D,MAAM,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;QAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,uCAAuC,OAAO,EAAE,CAAC,CAAA;QACnE,CAAC;QACD,iBAAiB,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,OAAO,CAAA;IAC5C,CAAC;IAED,OAAO;QACL,kBAAkB,EAAE,cAAc,CAAC,IAAI;QACvC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAC9B,iBAAiB;KAClB,CAAA;AACH,CAAC"}
|
package/dist/file-copier.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { PackageMap } from './package-
|
|
1
|
+
import type { PackageMap } from './package-location.js';
|
|
2
|
+
import { AbsolutePath } from './paths.js';
|
|
2
3
|
export declare class FileCopier {
|
|
3
4
|
private packageMap;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
copy(): Promise<string[]>;
|
|
5
|
+
constructor(packageMap: PackageMap);
|
|
6
|
+
copy(): Promise<AbsolutePath[]>;
|
|
7
7
|
private collectCopyOperations;
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=file-copier.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-copier.d.ts","sourceRoot":"","sources":["../src/file-copier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"file-copier.d.ts","sourceRoot":"","sources":["../src/file-copier.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAgB,MAAM,YAAY,CAAA;AAOvD,qBAAa,UAAU;IACT,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,UAAU;IAEpC,IAAI,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAkBrC,OAAO,CAAC,qBAAqB;CAc9B"}
|
package/dist/file-copier.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as fsPromises from 'node:fs/promises';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
|
+
import { AbsolutePath, RelativePath } from './paths.js';
|
|
3
4
|
export class FileCopier {
|
|
4
5
|
packageMap;
|
|
5
|
-
|
|
6
|
-
constructor(packageMap, outputDir) {
|
|
6
|
+
constructor(packageMap) {
|
|
7
7
|
this.packageMap = packageMap;
|
|
8
|
-
this.outputDir = outputDir;
|
|
9
8
|
}
|
|
10
9
|
async copy() {
|
|
11
10
|
const operations = this.collectCopyOperations();
|
|
@@ -25,10 +24,10 @@ export class FileCopier {
|
|
|
25
24
|
collectCopyOperations() {
|
|
26
25
|
const operations = [];
|
|
27
26
|
for (const location of this.packageMap.values()) {
|
|
28
|
-
for (const
|
|
27
|
+
for (const at of location.filesToCopy) {
|
|
29
28
|
operations.push({
|
|
30
|
-
source:
|
|
31
|
-
destination:
|
|
29
|
+
source: AbsolutePath.join(location.fromDir, RelativePath(at)),
|
|
30
|
+
destination: AbsolutePath.join(location.toDir, RelativePath(at)),
|
|
32
31
|
});
|
|
33
32
|
}
|
|
34
33
|
}
|
package/dist/file-copier.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-copier.js","sourceRoot":"","sources":["../src/file-copier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"file-copier.js","sourceRoot":"","sources":["../src/file-copier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,OAAO,EAAE,YAAY,EAAE,YAAY,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,EAAE,CAAC,CAAC;iBACjE,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAA;IACnB,CAAC;CACF"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AbsolutePath } from './paths.js';
|
|
2
|
+
import type { NpmClient } from './npm-client.js';
|
|
1
3
|
/**
|
|
2
4
|
* Gets the list of files that npm would include in a package tarball.
|
|
3
5
|
* Uses `npm pack --dry-run --json` to get npm's exact file selection.
|
|
@@ -6,5 +8,5 @@
|
|
|
6
8
|
* @returns Array of relative file paths that npm would include
|
|
7
9
|
* @example getFilesToPack("/home/user/my-package") => ["dist/index.js", "README.md", "package.json"]
|
|
8
10
|
*/
|
|
9
|
-
export declare function getFilesToPack(packageDir:
|
|
11
|
+
export declare function getFilesToPack(npmClient: NpmClient, packageDir: AbsolutePath): Promise<string[]>;
|
|
10
12
|
//# sourceMappingURL=get-files-to-pack.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-files-to-pack.d.ts","sourceRoot":"","sources":["../src/get-files-to-pack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-files-to-pack.d.ts","sourceRoot":"","sources":["../src/get-files-to-pack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAYtG"}
|