create-astrale-domain 0.2.12 → 0.2.13

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 +29 -11
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -781,7 +781,7 @@ import { delimiter, join as join2, relative as relative2, resolve as resolve2 }
781
781
 
782
782
  // src/scaffold.ts
783
783
  import { existsSync, readFileSync } from "node:fs";
784
- import { cp, readFile, rm, writeFile } from "node:fs/promises";
784
+ import { cp, readFile, rename, rm, writeFile } from "node:fs/promises";
785
785
  import { createRequire } from "node:module";
786
786
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
787
787
  import { fileURLToPath } from "node:url";
@@ -900,16 +900,28 @@ async function writeProject(opts) {
900
900
  `/${relative(src, s)}`
901
901
  )
902
902
  });
903
+ await materializeGitignores(opts.dir);
903
904
  await materializeAdapter(opts);
904
905
  await stampOrigin(opts.dir, opts.origin);
905
906
  await rewritePackageJson(opts.dir, opts.name, opts.link);
906
907
  await rewriteWorkspaceMember(join(opts.dir, "client", "package.json"), opts.link);
907
- if (!opts.link) await writeReleaseAgePolicy(opts.dir);
908
+ if (opts.link) await writeLinkedZodOverride(opts.dir);
909
+ else await writeReleaseAgePolicy(opts.dir);
908
910
  await writeFile(
909
911
  join(opts.dir, ".env.dev"),
910
912
  "# Dev secrets \u2014 the ENTIRE file is injected into the local runtime by `pnpm dev`.\n# Gitignored. See .env.example.\n"
911
913
  );
912
914
  }
915
+ async function materializeGitignores(dir) {
916
+ for (const path of [join(dir, ".gitignore"), join(dir, "client", ".gitignore")]) {
917
+ const packagedPath = `${path}.template`;
918
+ if (existsSync(packagedPath)) {
919
+ await rename(packagedPath, path);
920
+ } else if (!existsSync(path)) {
921
+ throw new Error(`Template is missing packaged Git ignore file ${packagedPath}.`);
922
+ }
923
+ }
924
+ }
913
925
  function assertSafeToDelete(dir) {
914
926
  const target = resolve(dir);
915
927
  const rel = relative(target, resolve(process.cwd()));
@@ -959,15 +971,6 @@ async function rewritePackageJson(dir, name, link) {
959
971
  const pkg = JSON.parse(await readFile(path, "utf-8"));
960
972
  pkg.name = name;
961
973
  rewriteAstraleDeps(pkg, link);
962
- if (link) {
963
- pkg.pnpm = {
964
- ...pkg.pnpm,
965
- overrides: {
966
- ...pkg.pnpm?.overrides,
967
- zod: sdkZodVersion()
968
- }
969
- };
970
- }
971
974
  await writeFile(path, JSON.stringify(pkg, null, 2) + "\n");
972
975
  }
973
976
  function rewriteAstraleDeps(pkg, link) {
@@ -987,6 +990,21 @@ function rewriteAstraleDeps(pkg, link) {
987
990
  return changed;
988
991
  }
989
992
  var FIRST_PARTY_SCOPES = ["@astrale-domains/*", "@astrale-os/*"];
993
+ async function writeLinkedZodOverride(dir) {
994
+ const workspace = join(dir, "pnpm-workspace.yaml");
995
+ if (!existsSync(workspace)) return;
996
+ const start = "# create-astrale-domain: linked overrides";
997
+ const end = "# /create-astrale-domain";
998
+ const block = `
999
+ ${start}
1000
+ overrides:
1001
+ zod: ${sdkZodVersion()}
1002
+ ${end}
1003
+ `;
1004
+ const text = await readFile(workspace, "utf-8");
1005
+ const pattern = new RegExp(`\\n?${escapeRegExp(start)}[\\s\\S]*?${escapeRegExp(end)}\\n?`);
1006
+ await writeFile(workspace, text.replace(pattern, "\n").trimEnd() + block);
1007
+ }
990
1008
  async function writeReleaseAgePolicy(dir) {
991
1009
  const workspace = join(dir, "pnpm-workspace.yaml");
992
1010
  if (!existsSync(workspace)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astrale-domain",
3
- "version": "0.2.12",
3
+ "version": "0.2.13",
4
4
  "description": "Scaffold a standalone Astrale domain — npm create astrale-domain",
5
5
  "keywords": [
6
6
  "astrale",
@@ -19,8 +19,8 @@
19
19
  "type": "module",
20
20
  "dependencies": {
21
21
  "@clack/prompts": "^0.11.0",
22
- "@astrale-os/adapter-cloudflare": "^0.4.9",
23
- "@astrale-os/adapter-astrale": "^0.4.1"
22
+ "@astrale-os/adapter-astrale": "^0.4.1",
23
+ "@astrale-os/adapter-cloudflare": "^0.4.10"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@astrale-os/ox": ">=0.1.0 <1.0.0",