create-astrale-domain 0.2.10 → 0.2.12
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 +21 -12
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -857,6 +857,20 @@ function packageRoot(pkg) {
|
|
|
857
857
|
entry.error === void 0 ? void 0 : { cause: entry.error }
|
|
858
858
|
);
|
|
859
859
|
}
|
|
860
|
+
function installedPackageRange(pkg) {
|
|
861
|
+
const manifestPath = join(packageRoot(pkg), "package.json");
|
|
862
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
863
|
+
if (typeof manifest.version !== "string") {
|
|
864
|
+
throw new Error(`Could not determine ${pkg}'s version from ${manifestPath}.`);
|
|
865
|
+
}
|
|
866
|
+
const match = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/.exec(
|
|
867
|
+
manifest.version
|
|
868
|
+
);
|
|
869
|
+
if (!match) {
|
|
870
|
+
throw new Error(`Could not derive a compatibility range for ${pkg}@${manifest.version}.`);
|
|
871
|
+
}
|
|
872
|
+
return `>=${manifest.version} <${Number(match[1]) + 1}.0.0`;
|
|
873
|
+
}
|
|
860
874
|
function templateDir(pkg) {
|
|
861
875
|
return join(packageRoot(pkg), "template");
|
|
862
876
|
}
|
|
@@ -921,8 +935,12 @@ async function materializeAdapter(opts) {
|
|
|
921
935
|
async function setAdapterDep(dir, from, to) {
|
|
922
936
|
const path = join(dir, "package.json");
|
|
923
937
|
const pkg = JSON.parse(await readFile(path, "utf-8"));
|
|
924
|
-
if (!pkg.dependencies || !(from in pkg.dependencies))
|
|
925
|
-
|
|
938
|
+
if (!pkg.dependencies || !(from in pkg.dependencies)) {
|
|
939
|
+
throw new Error(
|
|
940
|
+
`Could not materialize ${to}: the scaffold body does not declare its ${from} dependency.`
|
|
941
|
+
);
|
|
942
|
+
}
|
|
943
|
+
const range = installedPackageRange(to);
|
|
926
944
|
delete pkg.dependencies[from];
|
|
927
945
|
pkg.dependencies[to] = range;
|
|
928
946
|
pkg.dependencies = Object.fromEntries(
|
|
@@ -1073,20 +1091,11 @@ async function main() {
|
|
|
1073
1091
|
xe(`The "${adapter}" adapter is not available yet \u2014 use "astrale" or "cloudflare".`);
|
|
1074
1092
|
return 1;
|
|
1075
1093
|
}
|
|
1076
|
-
|
|
1094
|
+
const instance = flags.instance;
|
|
1077
1095
|
if (instance !== void 0 && !isValidSlug(instance)) {
|
|
1078
1096
|
xe(`Invalid --instance "${instance}". Use lowercase letters, digits, dots and dashes.`);
|
|
1079
1097
|
return 1;
|
|
1080
1098
|
}
|
|
1081
|
-
if (adapter === "astrale" && !instance && !headless) {
|
|
1082
|
-
const answer = await he({
|
|
1083
|
-
message: "Target instance slug (`astrale instance create <slug>` \u2014 empty to set it later)",
|
|
1084
|
-
placeholder: "my-app",
|
|
1085
|
-
validate: (v2) => !v2 || isValidSlug(v2) ? void 0 : "Use lowercase letters, digits, dots and dashes."
|
|
1086
|
-
});
|
|
1087
|
-
if (pD(answer)) return bail();
|
|
1088
|
-
if (answer) instance = answer;
|
|
1089
|
-
}
|
|
1090
1099
|
let pm = flags.pm;
|
|
1091
1100
|
if (!pm) {
|
|
1092
1101
|
const detected = detectPm();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astrale-domain",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
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-
|
|
23
|
-
"@astrale-os/adapter-
|
|
22
|
+
"@astrale-os/adapter-cloudflare": "^0.4.9",
|
|
23
|
+
"@astrale-os/adapter-astrale": "^0.4.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@astrale-os/ox": ">=0.1.0 <1.0.0",
|