create-astrale-domain 0.2.3 → 0.2.6
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/dist/index.js +72 -44
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -25,9 +25,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
mod
|
|
26
26
|
));
|
|
27
27
|
|
|
28
|
-
//
|
|
28
|
+
// ../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
29
29
|
var require_src = __commonJS({
|
|
30
|
-
"
|
|
30
|
+
"../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports, module) {
|
|
31
31
|
"use strict";
|
|
32
32
|
var ESC = "\x1B";
|
|
33
33
|
var CSI = `${ESC}[`;
|
|
@@ -81,9 +81,9 @@ var require_src = __commonJS({
|
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
//
|
|
84
|
+
// ../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
85
85
|
var require_picocolors = __commonJS({
|
|
86
|
-
"
|
|
86
|
+
"../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
87
87
|
var p2 = process || {};
|
|
88
88
|
var argv = p2.argv || [];
|
|
89
89
|
var env = p2.env || {};
|
|
@@ -153,10 +153,10 @@ var require_picocolors = __commonJS({
|
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
//
|
|
156
|
+
// ../node_modules/.pnpm/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
|
|
157
157
|
import { stripVTControlCharacters as S2 } from "node:util";
|
|
158
158
|
|
|
159
|
-
//
|
|
159
|
+
// ../node_modules/.pnpm/@clack+core@0.5.0/node_modules/@clack/core/dist/index.mjs
|
|
160
160
|
var import_sisteransi = __toESM(require_src(), 1);
|
|
161
161
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
162
162
|
import { stdin as j, stdout as M } from "node:process";
|
|
@@ -548,7 +548,7 @@ var RD = class extends x {
|
|
|
548
548
|
}
|
|
549
549
|
};
|
|
550
550
|
|
|
551
|
-
//
|
|
551
|
+
// ../node_modules/.pnpm/@clack+prompts@0.11.0/node_modules/@clack/prompts/dist/index.mjs
|
|
552
552
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
553
553
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
554
554
|
import y2 from "node:process";
|
|
@@ -804,47 +804,73 @@ var ADAPTER_PACKAGES = {
|
|
|
804
804
|
astrale: "@astrale-os/adapter-astrale",
|
|
805
805
|
cloudflare: "@astrale-os/adapter-cloudflare"
|
|
806
806
|
};
|
|
807
|
-
function
|
|
808
|
-
const rel = LINK_TARGETS[pkgName];
|
|
809
|
-
if (rel) {
|
|
810
|
-
const local = join(WORKSPACE_ROOT, rel, "package.json");
|
|
811
|
-
if (existsSync(local)) return JSON.parse(readFileSync(local, "utf-8"));
|
|
812
|
-
}
|
|
813
|
-
const direct = tryPackageJson(require2, pkgName);
|
|
814
|
-
if (direct) return direct;
|
|
815
|
-
for (const owner of /* @__PURE__ */ new Set([BODY_PACKAGE, ...Object.values(ADAPTER_PACKAGES)])) {
|
|
816
|
-
const ownerPkgPath = tryResolve(`${owner}/package.json`);
|
|
817
|
-
if (!ownerPkgPath) continue;
|
|
818
|
-
const ownerRequire = createRequire(ownerPkgPath);
|
|
819
|
-
const nested = tryPackageJson(ownerRequire, pkgName);
|
|
820
|
-
if (nested) return nested;
|
|
821
|
-
}
|
|
822
|
-
throw new Error(`Could not read ${pkgName} package.json.`);
|
|
823
|
-
}
|
|
824
|
-
function tryResolve(id) {
|
|
807
|
+
function resolveModule(id) {
|
|
825
808
|
try {
|
|
826
|
-
return require2.resolve(id);
|
|
827
|
-
} catch {
|
|
828
|
-
return
|
|
809
|
+
return { path: require2.resolve(id) };
|
|
810
|
+
} catch (error) {
|
|
811
|
+
return { error };
|
|
829
812
|
}
|
|
830
813
|
}
|
|
831
|
-
function
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
814
|
+
function errorText(err) {
|
|
815
|
+
if (err instanceof Error) return err.message;
|
|
816
|
+
return err === void 0 ? "" : String(err);
|
|
817
|
+
}
|
|
818
|
+
function errorReport(err) {
|
|
819
|
+
if (!(err instanceof Error)) return String(err);
|
|
820
|
+
const cause = err.cause;
|
|
821
|
+
if (cause !== void 0) {
|
|
822
|
+
const causeText = cause instanceof Error ? cause.message : String(cause);
|
|
823
|
+
if (causeText && !err.message.includes(causeText)) {
|
|
824
|
+
return `${err.message}
|
|
825
|
+
\u21B3 caused by: ${causeText}`;
|
|
826
|
+
}
|
|
836
827
|
}
|
|
828
|
+
return err.message;
|
|
837
829
|
}
|
|
838
|
-
function
|
|
839
|
-
const
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
830
|
+
function packageRoot(pkg) {
|
|
831
|
+
const direct = resolveModule(`${pkg}/package.json`);
|
|
832
|
+
if ("path" in direct) return dirname(direct.path);
|
|
833
|
+
const entry = resolveModule(pkg);
|
|
834
|
+
if ("path" in entry) {
|
|
835
|
+
let dir = dirname(entry.path);
|
|
836
|
+
for (; ; ) {
|
|
837
|
+
const candidate = join(dir, "package.json");
|
|
838
|
+
if (existsSync(candidate)) {
|
|
839
|
+
try {
|
|
840
|
+
const parsed = JSON.parse(readFileSync(candidate, "utf-8"));
|
|
841
|
+
if (parsed.name === pkg) return dir;
|
|
842
|
+
} catch {
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
const parent = dirname(dir);
|
|
846
|
+
if (parent === dir) break;
|
|
847
|
+
dir = parent;
|
|
848
|
+
}
|
|
849
|
+
throw new Error(
|
|
850
|
+
`Could not locate the ${pkg} package.json (its entry resolved at ${entry.path}, but no ancestor package.json declares "name": "${pkg}").`
|
|
851
|
+
);
|
|
852
|
+
}
|
|
853
|
+
const reason = errorText(entry.error);
|
|
854
|
+
throw new Error(
|
|
855
|
+
`Could not locate the ${pkg} package \u2014 is it installed? (run your package manager's install)` + (reason ? ` The module resolver failed: ${reason}` : ""),
|
|
856
|
+
entry.error === void 0 ? void 0 : { cause: entry.error }
|
|
857
|
+
);
|
|
843
858
|
}
|
|
844
859
|
function templateDir(pkg) {
|
|
845
|
-
return join(
|
|
860
|
+
return join(packageRoot(pkg), "template");
|
|
846
861
|
}
|
|
847
862
|
async function scaffold(opts) {
|
|
863
|
+
const preExisting = existsSync(opts.dir);
|
|
864
|
+
try {
|
|
865
|
+
await writeProject(opts);
|
|
866
|
+
} catch (err) {
|
|
867
|
+
if (!preExisting && existsSync(opts.dir)) {
|
|
868
|
+
await rm(opts.dir, { recursive: true, force: true });
|
|
869
|
+
}
|
|
870
|
+
throw err;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
async function writeProject(opts) {
|
|
848
874
|
const src = templateDir(BODY_PACKAGE);
|
|
849
875
|
if (!existsSync(src)) {
|
|
850
876
|
throw new Error(`Template not found at ${src}.`);
|
|
@@ -855,7 +881,7 @@ async function scaffold(opts) {
|
|
|
855
881
|
}
|
|
856
882
|
await cp(src, opts.dir, {
|
|
857
883
|
recursive: true,
|
|
858
|
-
filter: (s) => !/\/(node_modules|\.astrale|\.dist|\.domain-studio|dist-client|\.wrangler|pnpm-lock\.yaml|\.DS_Store)(\/|$)/.test(
|
|
884
|
+
filter: (s) => !/\/(node_modules|\.agents|\.astrale|\.dist|\.domain-studio|dist-client|\.wrangler|pnpm-lock\.yaml|\.DS_Store)(\/|$)/.test(
|
|
859
885
|
`/${relative(src, s)}`
|
|
860
886
|
)
|
|
861
887
|
});
|
|
@@ -895,8 +921,9 @@ async function setAdapterDep(dir, from, to) {
|
|
|
895
921
|
const path = join(dir, "package.json");
|
|
896
922
|
const pkg = JSON.parse(await readFile(path, "utf-8"));
|
|
897
923
|
if (!pkg.dependencies || !(from in pkg.dependencies)) return;
|
|
924
|
+
const range = pkg.dependencies[from];
|
|
898
925
|
delete pkg.dependencies[from];
|
|
899
|
-
pkg.dependencies[to] =
|
|
926
|
+
pkg.dependencies[to] = range;
|
|
900
927
|
pkg.dependencies = Object.fromEntries(
|
|
901
928
|
Object.entries(pkg.dependencies).sort(([a], [b3]) => a.localeCompare(b3))
|
|
902
929
|
);
|
|
@@ -925,12 +952,13 @@ async function rewritePackageJson(dir, name, link) {
|
|
|
925
952
|
await writeFile(path, JSON.stringify(pkg, null, 2) + "\n");
|
|
926
953
|
}
|
|
927
954
|
function rewriteAstraleDeps(pkg, link) {
|
|
955
|
+
if (!link) return false;
|
|
928
956
|
let changed = false;
|
|
929
957
|
for (const group of [pkg.dependencies, pkg.devDependencies]) {
|
|
930
958
|
if (!group) continue;
|
|
931
959
|
for (const dep of Object.keys(group)) {
|
|
932
|
-
if (!dep.startsWith("@astrale-os/")) continue;
|
|
933
|
-
const next =
|
|
960
|
+
if (!dep.startsWith("@astrale-os/") || !LINK_TARGETS[dep]) continue;
|
|
961
|
+
const next = `link:${join(WORKSPACE_ROOT, LINK_TARGETS[dep])}`;
|
|
934
962
|
if (group[dep] !== next) {
|
|
935
963
|
group[dep] = next;
|
|
936
964
|
changed = true;
|
|
@@ -1111,7 +1139,7 @@ async function main() {
|
|
|
1111
1139
|
s.stop(`Created ${dir}`);
|
|
1112
1140
|
} catch (err) {
|
|
1113
1141
|
s.stop("Scaffold failed");
|
|
1114
|
-
xe(err
|
|
1142
|
+
xe(errorReport(err));
|
|
1115
1143
|
return 1;
|
|
1116
1144
|
}
|
|
1117
1145
|
if (link) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astrale-domain",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
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-astrale": "^0.
|
|
23
|
-
"@astrale-os/adapter-cloudflare": "^0.3
|
|
22
|
+
"@astrale-os/adapter-astrale": "^0.4.0",
|
|
23
|
+
"@astrale-os/adapter-cloudflare": "^0.4.3"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@astrale-os/ox": ">=0.1.0 <1.0.0",
|