create-vobase 0.1.1 → 0.1.2

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/dist/index.js +22 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  // index.ts
4
4
  import { downloadTemplate } from "giget";
5
- import { execSync } from "node:child_process";
5
+ import { execFileSync, execSync } from "node:child_process";
6
+ import { readFileSync, writeFileSync } from "node:fs";
6
7
  import { resolve } from "node:path";
7
8
  var name = process.argv[2];
8
9
  if (!name) {
@@ -15,6 +16,26 @@ await downloadTemplate("github:vobase/vobase/packages/template", {
15
16
  dir: dest,
16
17
  force: false
17
18
  });
19
+ var pkgPath = resolve(dest, "package.json");
20
+ var pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
21
+ pkg.name = name;
22
+ delete pkg.private;
23
+ for (const depField of ["dependencies", "devDependencies"]) {
24
+ const deps = pkg[depField];
25
+ if (!deps)
26
+ continue;
27
+ for (const [dep, version] of Object.entries(deps)) {
28
+ if (typeof version === "string" && version.startsWith("workspace:")) {
29
+ const latest = execFileSync("npm", ["view", dep, "version"], {
30
+ encoding: "utf8"
31
+ }).trim();
32
+ deps[dep] = `^${latest}`;
33
+ console.log(` ${dep}: workspace:* → ^${latest}`);
34
+ }
35
+ }
36
+ }
37
+ writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + `
38
+ `);
18
39
  console.log("Installing dependencies...");
19
40
  execSync("bun install", { cwd: dest, stdio: "inherit" });
20
41
  console.log(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vobase",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Create a new vobase project",
5
5
  "repository": {
6
6
  "type": "git",