create-flow-os 0.0.1-dev.1771615498 → 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.
Files changed (2) hide show
  1. package/index.ts +18 -3
  2. 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,9 +140,24 @@ 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
+ const isDevFromRepo =
144
+ useDevTag &&
145
+ (await findPackageDir(REPO_ROOT, "@flow-os/client").then((d) => !!d));
143
146
  for (const k of Object.keys(finalPkg.dependencies)) {
144
147
  if (finalPkg.dependencies[k] === "workspace:*") finalPkg.dependencies[k] = "^0.0.1";
145
- if (useDevTag && (k === "@flow-os" || k.startsWith("@flow-os/"))) finalPkg.dependencies[k] = "dev";
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
+ }
146
161
  }
147
162
  delete finalPkg.dependencies["@flow-os"];
148
163
  finalPkg.dependencies = Object.fromEntries(Object.entries(finalPkg.dependencies).filter(([key]) => key !== "@flow-os"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-flow-os",
3
- "version": "0.0.1-dev.1771615498",
3
+ "version": "0.0.1-dev.1771620274",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "create-flow-os": "./index.ts"