@decohere/create 0.0.1-dev.47 → 0.0.1-dev.48
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/pack-builder-tgz.mjs +19 -35
- package/package.json +2 -2
package/pack-builder-tgz.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
3
|
+
* Vendor `@decohere/create` for the builder image: resolve `@decohere/*` from
|
|
4
|
+
* dist/release via `file:` (not `overrides`), `npm install --install-links`,
|
|
5
|
+
* then tar the installed tree including `node_modules`. `--install-links`
|
|
6
|
+
* materializes `file:` packages (and their deps) instead of leaving symlinks
|
|
7
|
+
* whose nested installs live outside the create directory.
|
|
8
8
|
*/
|
|
9
9
|
import { spawnSync } from "node:child_process";
|
|
10
|
-
import { readdirSync, readFileSync,
|
|
10
|
+
import { readdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
11
11
|
import { dirname, join, relative, resolve } from "node:path";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
13
|
|
|
@@ -87,23 +87,6 @@ export function rewriteDecohereDepsToFile(pkg, fromDir, packages) {
|
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
/**
|
|
91
|
-
* @param {Record<string, unknown>} pkg
|
|
92
|
-
* @returns {string[]}
|
|
93
|
-
*/
|
|
94
|
-
export function productionDepNames(pkg) {
|
|
95
|
-
const deps = pkg.dependencies;
|
|
96
|
-
if (deps == null || typeof deps !== "object") return [];
|
|
97
|
-
return Object.keys(deps);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* @param {Record<string, unknown>} pkg
|
|
102
|
-
*/
|
|
103
|
-
export function withBundleDependencies(pkg) {
|
|
104
|
-
return { ...pkg, bundleDependencies: productionDepNames(pkg) };
|
|
105
|
-
}
|
|
106
|
-
|
|
107
90
|
function writeJson(path, value) {
|
|
108
91
|
writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`);
|
|
109
92
|
}
|
|
@@ -118,6 +101,17 @@ function runNpm(cwd, args) {
|
|
|
118
101
|
return result.stdout.trim();
|
|
119
102
|
}
|
|
120
103
|
|
|
104
|
+
function packInstalledTree(outDir, dest) {
|
|
105
|
+
const result = spawnSync(
|
|
106
|
+
"tar",
|
|
107
|
+
["--create", "--gzip", "--dereference", "--file", dest, "-C", outDir, "."],
|
|
108
|
+
{ encoding: "utf8" },
|
|
109
|
+
);
|
|
110
|
+
if (result.status !== 0) {
|
|
111
|
+
throw new Error(`tar failed (exit ${result.status}):\n${result.stderr}${result.stdout}`);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
121
115
|
export function packBuilderTgz(options) {
|
|
122
116
|
const outDir = resolve(options.outDir);
|
|
123
117
|
const workspaceOut = resolve(options.workspaceOut);
|
|
@@ -137,24 +131,14 @@ export function packBuilderTgz(options) {
|
|
|
137
131
|
for (const { path, original } of originals) {
|
|
138
132
|
writeJson(path, rewriteDecohereDepsToFile(original, dirname(path), packages));
|
|
139
133
|
}
|
|
140
|
-
runNpm(outDir, ["install", "--omit=dev", "--ignore-scripts"]);
|
|
134
|
+
runNpm(outDir, ["install", "--omit=dev", "--ignore-scripts", "--install-links"]);
|
|
141
135
|
} finally {
|
|
142
136
|
for (const { path, original } of originals) {
|
|
143
137
|
writeJson(path, original);
|
|
144
138
|
}
|
|
145
139
|
}
|
|
146
140
|
|
|
147
|
-
|
|
148
|
-
try {
|
|
149
|
-
const packed = runNpm(outDir, ["pack", "--pack-destination", dirname(dest)]);
|
|
150
|
-
const tgzName = packed.split(/\r?\n/).at(-1)?.replace(/^.*\//, "");
|
|
151
|
-
if (tgzName == null || tgzName === "") {
|
|
152
|
-
throw new Error(`npm pack did not print a tarball name:\n${packed}`);
|
|
153
|
-
}
|
|
154
|
-
renameSync(join(dirname(dest), tgzName), dest);
|
|
155
|
-
} finally {
|
|
156
|
-
writeJson(packageJsonPath, createOriginal);
|
|
157
|
-
}
|
|
141
|
+
packInstalledTree(outDir, dest);
|
|
158
142
|
return dest;
|
|
159
143
|
}
|
|
160
144
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decohere/create",
|
|
3
|
-
"version": "0.0.1-dev.
|
|
3
|
+
"version": "0.0.1-dev.48",
|
|
4
4
|
"description": "Scaffold a new Decohere project — build with Forge, serve with Flux",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"decohere",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@decohere/nexus": "0.0.1-dev.
|
|
24
|
+
"@decohere/nexus": "0.0.1-dev.48",
|
|
25
25
|
"commander": "^13.1.0",
|
|
26
26
|
"openapi-to-postmanv2": "^5.0.0"
|
|
27
27
|
},
|