create-flow-os 0.0.1-dev.1771615229 → 0.0.1-dev.1771620274
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/index.ts +20 -4
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { rm, stat } from "node:fs/promises";
|
|
8
|
-
import { join } from "node:path";
|
|
8
|
+
import { join, relative } from "node:path";
|
|
9
9
|
import * as p from "@clack/prompts";
|
|
10
10
|
import pc from "picocolors";
|
|
11
|
-
import { copyWithExclude, transformPackageJson } from "./utils.ts";
|
|
11
|
+
import { copyWithExclude, transformPackageJson, findPackageDir } from "./utils.ts";
|
|
12
12
|
|
|
13
13
|
const argv = process.argv.slice(2);
|
|
14
14
|
const noInstall = argv.includes("--no-install");
|
|
@@ -140,11 +140,27 @@ async function main() {
|
|
|
140
140
|
const finalPkg = (await Bun.file(pkgPath).json()) as { workspaces?: string[]; dependencies?: Record<string, string> };
|
|
141
141
|
delete finalPkg.workspaces;
|
|
142
142
|
if (finalPkg.dependencies) {
|
|
143
|
-
|
|
143
|
+
const isDevFromRepo =
|
|
144
|
+
useDevTag &&
|
|
145
|
+
(await findPackageDir(REPO_ROOT, "@flow-os/client").then((d) => !!d));
|
|
144
146
|
for (const k of Object.keys(finalPkg.dependencies)) {
|
|
145
147
|
if (finalPkg.dependencies[k] === "workspace:*") finalPkg.dependencies[k] = "^0.0.1";
|
|
146
|
-
if (useDevTag && (k === "@flow-os" || k.startsWith("@flow-os/")))
|
|
148
|
+
if (useDevTag && (k === "@flow-os" || k.startsWith("@flow-os/"))) {
|
|
149
|
+
if (isDevFromRepo) {
|
|
150
|
+
const pkgDir = await findPackageDir(REPO_ROOT, k);
|
|
151
|
+
if (pkgDir) {
|
|
152
|
+
const rel = relative(projectPath, pkgDir).replace(/\\/g, "/");
|
|
153
|
+
finalPkg.dependencies[k] = "file:" + (rel.startsWith("..") ? rel : "./" + rel);
|
|
154
|
+
} else {
|
|
155
|
+
finalPkg.dependencies[k] = "dev";
|
|
156
|
+
}
|
|
157
|
+
} else {
|
|
158
|
+
finalPkg.dependencies[k] = "dev";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
147
161
|
}
|
|
162
|
+
delete finalPkg.dependencies["@flow-os"];
|
|
163
|
+
finalPkg.dependencies = Object.fromEntries(Object.entries(finalPkg.dependencies).filter(([key]) => key !== "@flow-os"));
|
|
148
164
|
}
|
|
149
165
|
await Bun.write(pkgPath, JSON.stringify(finalPkg, null, 2));
|
|
150
166
|
|