create-astrale-domain 0.3.0-beta.21 → 0.3.0-beta.210
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/README.md +54 -3
- package/dist/index.js +371 -135
- package/package.json +17 -12
- package/template/.env.example +9 -8
- package/template/.gitignore.template +8 -2
- package/template/.variants/custom/README.md +19 -9
- package/template/.variants/custom/__tests__/variant.test.ts +4 -4
- package/template/.variants/custom/domain.ts +28 -0
- package/template/.variants/custom/{views/application/app → frontend}/index.html +1 -0
- package/template/.variants/custom/{views/application/app → frontend}/main.ts +1 -1
- package/template/.variants/custom/frontend/package.json +11 -0
- package/template/.variants/custom/frontend/public/favicon.svg +4 -0
- package/template/.variants/custom/frontend/tsconfig.json +17 -0
- package/template/.variants/custom/schema/schema.ts +15 -0
- package/template/.variants/custom/views/application/index.ts +1 -0
- package/template/.variants/custom/views/index.ts +1 -1
- package/template/.variants/custom/vite.config.ts +11 -2
- package/template/.variants/none/README.md +13 -4
- package/template/.variants/none/__tests__/variant.test.ts +3 -3
- package/template/.variants/none/domain.ts +18 -0
- package/template/.variants/none/schema/schema.ts +11 -0
- package/template/.variants/react/README.md +20 -10
- package/template/.variants/react/__tests__/variant.test.ts +4 -4
- package/template/.variants/react/domain.ts +28 -0
- package/template/.variants/react/frontend/index.html +1 -0
- package/template/.variants/react/frontend/package.json +7 -1
- package/template/.variants/react/frontend/public/favicon.svg +4 -0
- package/template/.variants/react/frontend/src/styles.css +1 -1
- package/template/.variants/react/frontend/tsconfig.json +19 -0
- package/template/.variants/react/schema/schema.ts +15 -0
- package/template/.variants/react/vite.config.ts +2 -3
- package/template/CLAUDE.md +43 -5
- package/template/index.ts +1 -1
- package/template/package.json +15 -31
- package/template/pnpm-workspace.yaml +5 -21
- package/template/runtime.ts +1 -2
- package/template/schema/__tests__/schema.test.ts +14 -0
- package/template/schema/index.ts +1 -1
- package/template/tests/datasets/demo.ts +21 -0
- package/template/tests/e2e/domain.test.ts +9 -0
- package/template/tsconfig.json +8 -17
- package/template/.variants/custom/application.ts +0 -9
- package/template/.variants/custom/schema/application/index.ts +0 -8
- package/template/.variants/custom/views/application/__tests__/routes.test.ts +0 -7
- package/template/.variants/custom/views/application/routes.ts +0 -12
- package/template/.variants/none/application.ts +0 -8
- package/template/.variants/none/schema/application/index.ts +0 -5
- package/template/.variants/react/application.ts +0 -9
- package/template/.variants/react/schema/application/index.ts +0 -8
- package/template/.variants/react/views/application/__tests__/routes.test.ts +0 -7
- package/template/.variants/react/views/application/routes.ts +0 -12
- package/template/.variants/react/views/index.ts +0 -1
- package/template/schema/application/__tests__/schema.test.ts +0 -11
- package/template/tests/e2e/application.test.ts +0 -10
- package/template/tsconfig.package.json +0 -29
package/dist/index.js
CHANGED
|
@@ -781,10 +781,241 @@ var Y2 = ({ indicator: t = "dots" } = {}) => {
|
|
|
781
781
|
|
|
782
782
|
// src/index.ts
|
|
783
783
|
import { existsSync as existsSync2 } from "node:fs";
|
|
784
|
-
import {
|
|
784
|
+
import { relative as relative2, resolve as resolve2 } from "node:path";
|
|
785
|
+
|
|
786
|
+
// ../node_modules/.pnpm/@astrale-os+kernel-dsl@1.0.0-beta.27/node_modules/@astrale-os/kernel-dsl/dist/v1/addressing/patterns.js
|
|
787
|
+
var DOMAIN_ORIGIN_PATTERN = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/u;
|
|
788
|
+
var MEMBER_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9_]*$/u;
|
|
789
|
+
var DEPENDENCY_ALIAS_PATTERN = /^[a-z][A-Za-z0-9]*$/u;
|
|
790
|
+
var CORE_SLUG_PATTERN = /^(?=.{1,100}$)[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)*$/u;
|
|
791
|
+
var DOMAIN_REVISION_PATTERN = /^sha256:[0-9a-f]{64}$/u;
|
|
792
|
+
var DOMAIN_REVISION_FULL_MATCH = "sha256:[0-9a-f]{64}";
|
|
793
|
+
var DOMAIN_ORIGIN_FULL_MATCH = "([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?";
|
|
794
|
+
var MEMBER_NAME_FULL_MATCH = "[A-Za-z][A-Za-z0-9_]*";
|
|
795
|
+
var DEPENDENCY_ALIAS_FULL_MATCH = "[a-z][A-Za-z0-9]*";
|
|
796
|
+
var PROPERTY_KEY_FULL_MATCH = "([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\\.)+[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?:class\\.[A-Za-z][A-Za-z0-9_]*\\.property\\.[A-Za-z][A-Za-z0-9_]*";
|
|
797
|
+
var PROPERTY_KEY_PATTERN = new RegExp(`^(?:${PROPERTY_KEY_FULL_MATCH})$`, "u");
|
|
798
|
+
var patterns = Object.freeze({
|
|
799
|
+
coreSlug: CORE_SLUG_PATTERN,
|
|
800
|
+
dependencyAlias: DEPENDENCY_ALIAS_PATTERN,
|
|
801
|
+
dependencyAliasFullMatch: DEPENDENCY_ALIAS_FULL_MATCH,
|
|
802
|
+
memberName: MEMBER_NAME_PATTERN,
|
|
803
|
+
memberNameFullMatch: MEMBER_NAME_FULL_MATCH,
|
|
804
|
+
origin: DOMAIN_ORIGIN_PATTERN,
|
|
805
|
+
originFullMatch: DOMAIN_ORIGIN_FULL_MATCH,
|
|
806
|
+
propertyKey: PROPERTY_KEY_PATTERN,
|
|
807
|
+
propertyKeyFullMatch: PROPERTY_KEY_FULL_MATCH,
|
|
808
|
+
revision: DOMAIN_REVISION_PATTERN,
|
|
809
|
+
revisionFullMatch: DOMAIN_REVISION_FULL_MATCH
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
// ../node_modules/.pnpm/@astrale-os+kernel-dsl@1.0.0-beta.27/node_modules/@astrale-os/kernel-dsl/dist/v1/addressing/definition-ref.js
|
|
813
|
+
var DEFINITION_KINDS = /* @__PURE__ */ new Set([
|
|
814
|
+
"class",
|
|
815
|
+
"function",
|
|
816
|
+
"policy",
|
|
817
|
+
"view",
|
|
818
|
+
"core"
|
|
819
|
+
]);
|
|
820
|
+
function acceptDefinitionRef(input) {
|
|
821
|
+
return readDefinitionRef(input) ?? invalid(input);
|
|
822
|
+
}
|
|
823
|
+
function invalid(input) {
|
|
824
|
+
throw new TypeError(`Invalid DefinitionRef: ${JSON.stringify(input)}.`);
|
|
825
|
+
}
|
|
826
|
+
function readDefinitionRef(input) {
|
|
827
|
+
if (input === null || typeof input !== "object" || Array.isArray(input))
|
|
828
|
+
return void 0;
|
|
829
|
+
const value = input;
|
|
830
|
+
const keys = Reflect.ownKeys(value);
|
|
831
|
+
if (keys.length !== 3 || !keys.every((key) => key === "origin" || key === "kind" || key === "name")) {
|
|
832
|
+
return void 0;
|
|
833
|
+
}
|
|
834
|
+
const { origin, kind, name } = value;
|
|
835
|
+
if (typeof origin !== "string" || !DOMAIN_ORIGIN_PATTERN.test(origin) || typeof kind !== "string" || !DEFINITION_KINDS.has(kind) || typeof name !== "string" || !definitionNameMatches(kind, name)) {
|
|
836
|
+
return void 0;
|
|
837
|
+
}
|
|
838
|
+
return Object.freeze({ origin, kind, name });
|
|
839
|
+
}
|
|
840
|
+
function definitionNameMatches(kind, name) {
|
|
841
|
+
return kind === "core" ? CORE_SLUG_PATTERN.test(name) : MEMBER_NAME_PATTERN.test(name);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// ../node_modules/.pnpm/@astrale-os+kernel-dsl@1.0.0-beta.27/node_modules/@astrale-os/kernel-dsl/dist/v1/addressing/key.js
|
|
845
|
+
var DEFINITION_KEY = /^(?:class|function|policy|view)\.([A-Za-z][A-Za-z0-9_]*)$/u;
|
|
846
|
+
var CORE_KEY = /^core\.((?=.{1,100}$)[a-z][a-z0-9-]*(?:\.[a-z][a-z0-9-]*)*)$/u;
|
|
847
|
+
var MEMBER_KEY = /^class\.([A-Za-z][A-Za-z0-9_]*)\.(property|method)\.([A-Za-z][A-Za-z0-9_]*)$/u;
|
|
848
|
+
var derived = /* @__PURE__ */ new WeakMap();
|
|
849
|
+
function Key(input) {
|
|
850
|
+
if (typeof input !== "string" || !isCanonicalKey(input)) {
|
|
851
|
+
throw new TypeError(`Invalid Key: ${JSON.stringify(input)}.`);
|
|
852
|
+
}
|
|
853
|
+
return input;
|
|
854
|
+
}
|
|
855
|
+
(function(Key2) {
|
|
856
|
+
function of(ref) {
|
|
857
|
+
const object = typeof ref === "object" && ref !== null;
|
|
858
|
+
const known = object ? derived.get(ref) : void 0;
|
|
859
|
+
if (known !== void 0)
|
|
860
|
+
return known;
|
|
861
|
+
const stable = object && immutable(ref);
|
|
862
|
+
const definition = acceptDefinitionRef(ref);
|
|
863
|
+
const key = Key2(`${definition.origin}:${definition.kind}.${definition.name}`);
|
|
864
|
+
if (stable)
|
|
865
|
+
derived.set(ref, key);
|
|
866
|
+
return key;
|
|
867
|
+
}
|
|
868
|
+
Key2.of = of;
|
|
869
|
+
function origin(input) {
|
|
870
|
+
const admitted = Key2(input);
|
|
871
|
+
return admitted.slice(0, admitted.indexOf(":"));
|
|
872
|
+
}
|
|
873
|
+
Key2.origin = origin;
|
|
874
|
+
function is(input) {
|
|
875
|
+
return typeof input === "string" && isCanonicalKey(input);
|
|
876
|
+
}
|
|
877
|
+
Key2.is = is;
|
|
878
|
+
})(Key || (Key = {}));
|
|
879
|
+
function isCanonicalKey(input) {
|
|
880
|
+
const separator = input.indexOf(":");
|
|
881
|
+
return separator > 0 && separator === input.lastIndexOf(":") && DOMAIN_ORIGIN_PATTERN.test(input.slice(0, separator)) && isCanonicalCoordinate(input.slice(separator + 1));
|
|
882
|
+
}
|
|
883
|
+
function isCanonicalCoordinate(input) {
|
|
884
|
+
return DEFINITION_KEY.test(input) || CORE_KEY.test(input) || MEMBER_KEY.test(input);
|
|
885
|
+
}
|
|
886
|
+
function immutable(ref) {
|
|
887
|
+
return Object.isFrozen(ref) && Reflect.ownKeys(ref).every((key) => "value" in Reflect.getOwnPropertyDescriptor(ref, key));
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// ../node_modules/.pnpm/@astrale-os+kernel-dsl@1.0.0-beta.27/node_modules/@astrale-os/kernel-dsl/dist/v1/addressing/class-key.js
|
|
891
|
+
function ClassKey(input) {
|
|
892
|
+
if (!ClassKey.is(input)) {
|
|
893
|
+
throw new TypeError(`Invalid canonical ClassKey: ${JSON.stringify(input)}.`);
|
|
894
|
+
}
|
|
895
|
+
return input;
|
|
896
|
+
}
|
|
897
|
+
(function(ClassKey2) {
|
|
898
|
+
function of(ref2) {
|
|
899
|
+
const key = Key.of(ref2);
|
|
900
|
+
if (!key.slice(key.indexOf(":") + 1).startsWith("class.")) {
|
|
901
|
+
throw new TypeError(`Invalid ClassKey coordinate: ${JSON.stringify(ref2)}.`);
|
|
902
|
+
}
|
|
903
|
+
return key;
|
|
904
|
+
}
|
|
905
|
+
ClassKey2.of = of;
|
|
906
|
+
function is(input) {
|
|
907
|
+
if (typeof input !== "string" || !Key.is(input))
|
|
908
|
+
return false;
|
|
909
|
+
const coordinate = input.slice(input.indexOf(":") + 1);
|
|
910
|
+
return coordinate.startsWith("class.") && !coordinate.includes(".property.") && !coordinate.includes(".method.");
|
|
911
|
+
}
|
|
912
|
+
ClassKey2.is = is;
|
|
913
|
+
function ref(input) {
|
|
914
|
+
const admitted = ClassKey2(input);
|
|
915
|
+
const separator = admitted.indexOf(":");
|
|
916
|
+
return acceptDefinitionRef({
|
|
917
|
+
origin: admitted.slice(0, separator),
|
|
918
|
+
kind: "class",
|
|
919
|
+
name: admitted.slice(separator + ":class.".length)
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
ClassKey2.ref = ref;
|
|
923
|
+
})(ClassKey || (ClassKey = {}));
|
|
924
|
+
|
|
925
|
+
// ../node_modules/.pnpm/@astrale-os+kernel-dsl@1.0.0-beta.27/node_modules/@astrale-os/kernel-dsl/dist/v1/addressing/method-key.js
|
|
926
|
+
function MethodKey(input) {
|
|
927
|
+
if (!MethodKey.is(input)) {
|
|
928
|
+
throw new TypeError(`Invalid canonical MethodKey: ${JSON.stringify(input)}.`);
|
|
929
|
+
}
|
|
930
|
+
return input;
|
|
931
|
+
}
|
|
932
|
+
(function(MethodKey2) {
|
|
933
|
+
function of(owner, name) {
|
|
934
|
+
const admitted = acceptDefinitionRef(owner);
|
|
935
|
+
if (admitted.kind !== "class" || !MEMBER_NAME_PATTERN.test(name)) {
|
|
936
|
+
throw new TypeError(`Invalid MethodKey address: ${JSON.stringify({ owner, name })}.`);
|
|
937
|
+
}
|
|
938
|
+
return Key(`${admitted.origin}:class.${admitted.name}.method.${name}`);
|
|
939
|
+
}
|
|
940
|
+
MethodKey2.of = of;
|
|
941
|
+
function is(input) {
|
|
942
|
+
if (typeof input !== "string" || !Key.is(input))
|
|
943
|
+
return false;
|
|
944
|
+
const [kind, , member] = input.slice(input.indexOf(":") + 1).split(".");
|
|
945
|
+
return kind === "class" && member === "method";
|
|
946
|
+
}
|
|
947
|
+
MethodKey2.is = is;
|
|
948
|
+
function address(input) {
|
|
949
|
+
const admitted = MethodKey2(input);
|
|
950
|
+
const separator = admitted.indexOf(":");
|
|
951
|
+
const coordinate = admitted.slice(separator + ":class.".length);
|
|
952
|
+
const member = coordinate.indexOf(".method.");
|
|
953
|
+
return Object.freeze({
|
|
954
|
+
kind: "method",
|
|
955
|
+
owner: acceptDefinitionRef({
|
|
956
|
+
origin: admitted.slice(0, separator),
|
|
957
|
+
kind: "class",
|
|
958
|
+
name: coordinate.slice(0, member)
|
|
959
|
+
}),
|
|
960
|
+
name: coordinate.slice(member + ".method.".length)
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
MethodKey2.address = address;
|
|
964
|
+
})(MethodKey || (MethodKey = {}));
|
|
965
|
+
|
|
966
|
+
// ../node_modules/.pnpm/@astrale-os+kernel-dsl@1.0.0-beta.27/node_modules/@astrale-os/kernel-dsl/dist/v1/addressing/property-key.js
|
|
967
|
+
function PropertyKey(input) {
|
|
968
|
+
if (!PropertyKey.is(input)) {
|
|
969
|
+
throw new TypeError(`Invalid canonical PropertyKey: ${JSON.stringify(input)}.`);
|
|
970
|
+
}
|
|
971
|
+
return input;
|
|
972
|
+
}
|
|
973
|
+
(function(PropertyKey2) {
|
|
974
|
+
function of(owner, name) {
|
|
975
|
+
const admitted = acceptDefinitionRef(owner);
|
|
976
|
+
if (admitted.kind !== "class" || !MEMBER_NAME_PATTERN.test(name)) {
|
|
977
|
+
throw new TypeError(`Invalid PropertyKey coordinate: ${JSON.stringify({ owner, name })}.`);
|
|
978
|
+
}
|
|
979
|
+
return Key(`${admitted.origin}:class.${admitted.name}.property.${name}`);
|
|
980
|
+
}
|
|
981
|
+
PropertyKey2.of = of;
|
|
982
|
+
function is(input) {
|
|
983
|
+
return typeof input === "string" && Key.is(input) && PROPERTY_KEY_PATTERN.test(input);
|
|
984
|
+
}
|
|
985
|
+
PropertyKey2.is = is;
|
|
986
|
+
function address(input) {
|
|
987
|
+
const admitted = PropertyKey2(input);
|
|
988
|
+
const separator = admitted.indexOf(":");
|
|
989
|
+
const coordinate = admitted.slice(separator + ":class.".length);
|
|
990
|
+
const member = coordinate.indexOf(".property.");
|
|
991
|
+
return Object.freeze({
|
|
992
|
+
owner: acceptDefinitionRef({
|
|
993
|
+
origin: admitted.slice(0, separator),
|
|
994
|
+
kind: "class",
|
|
995
|
+
name: coordinate.slice(0, member)
|
|
996
|
+
}),
|
|
997
|
+
name: coordinate.slice(member + ".property.".length)
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
PropertyKey2.address = address;
|
|
1001
|
+
})(PropertyKey || (PropertyKey = {}));
|
|
1002
|
+
|
|
1003
|
+
// src/naming/index.ts
|
|
1004
|
+
var NPM_NAME_MAX = 214;
|
|
1005
|
+
var DNS_NAME_MAX = 253;
|
|
1006
|
+
function isValidOrigin(value) {
|
|
1007
|
+
return value.length <= DNS_NAME_MAX && patterns.origin.test(value);
|
|
1008
|
+
}
|
|
1009
|
+
function deriveOrigin(slug) {
|
|
1010
|
+
return slug.includes(".") ? slug : `${slug}.example.dev`;
|
|
1011
|
+
}
|
|
1012
|
+
function isValidProjectSlug(value) {
|
|
1013
|
+
return value.length <= NPM_NAME_MAX && isValidOrigin(deriveOrigin(value));
|
|
1014
|
+
}
|
|
1015
|
+
var PROJECT_SLUG_RULE = `Use dot-separated labels of lowercase letters, digits and inner dashes (63 characters per label, ${NPM_NAME_MAX} in total) \u2014 e.g. crm, 1crm, crm.example.dev.`;
|
|
1016
|
+
var ORIGIN_RULE = `Use a lowercase dotted domain with valid DNS labels (63 characters per label, ${DNS_NAME_MAX} in total) \u2014 e.g. crm.example.dev.`;
|
|
785
1017
|
|
|
786
1018
|
// src/scaffold/index.ts
|
|
787
|
-
import { signingIdentity } from "@astrale-os/adapter-cloudflare/build";
|
|
788
1019
|
import { existsSync, readFileSync } from "node:fs";
|
|
789
1020
|
import { cp, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
790
1021
|
import { createRequire } from "node:module";
|
|
@@ -795,7 +1026,7 @@ var HERE = dirname(fileURLToPath(import.meta.url));
|
|
|
795
1026
|
var CREATE_PACKAGE_ROOT = owningPackageRoot(HERE, "create-astrale-domain");
|
|
796
1027
|
var SDK_ROOT = sdkCheckoutRoot(CREATE_PACKAGE_ROOT);
|
|
797
1028
|
var ORIGIN_PLACEHOLDER = "astrale-domain.example.dev";
|
|
798
|
-
var
|
|
1029
|
+
var NAME_PLACEHOLDER = "name: 'Astrale Domain'";
|
|
799
1030
|
var LINK_PACKAGES = /* @__PURE__ */ new Set([
|
|
800
1031
|
"@astrale-os/sdk",
|
|
801
1032
|
"@astrale-os/adapter-cloudflare",
|
|
@@ -879,7 +1110,7 @@ function sdkCheckoutRoot(createRoot) {
|
|
|
879
1110
|
return void 0;
|
|
880
1111
|
}
|
|
881
1112
|
}
|
|
882
|
-
function
|
|
1113
|
+
function installedPackageVersion(pkg) {
|
|
883
1114
|
const manifestPath = join(packageRoot(pkg), "package.json");
|
|
884
1115
|
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
885
1116
|
if (typeof manifest.version !== "string") {
|
|
@@ -889,9 +1120,16 @@ function installedPackageRange(pkg) {
|
|
|
889
1120
|
manifest.version
|
|
890
1121
|
);
|
|
891
1122
|
if (!match) {
|
|
892
|
-
throw new Error(`Could not
|
|
1123
|
+
throw new Error(`Could not read an exact version for ${pkg}@${manifest.version}.`);
|
|
893
1124
|
}
|
|
894
|
-
return
|
|
1125
|
+
return manifest.version;
|
|
1126
|
+
}
|
|
1127
|
+
function packageManagerScript(manager, script, argument) {
|
|
1128
|
+
const suffix = argument === void 0 ? "" : ` ${argument}`;
|
|
1129
|
+
if (manager === "npm") return `npm run ${script}${argument === void 0 ? "" : ` --${suffix}`}`;
|
|
1130
|
+
if (manager === "bun") return `bun run ${script}${argument === void 0 ? "" : ` --${suffix}`}`;
|
|
1131
|
+
if (manager === "pnpm" && script === "deploy") return `pnpm run ${script}${suffix}`;
|
|
1132
|
+
return `${manager} ${script}${suffix}`;
|
|
895
1133
|
}
|
|
896
1134
|
function templateDir(pkg) {
|
|
897
1135
|
return join(packageRoot(pkg), "template");
|
|
@@ -929,16 +1167,21 @@ async function writeProject(opts) {
|
|
|
929
1167
|
await materializeGitignores(opts.dir, opts.frontend);
|
|
930
1168
|
await materializeAdapter(opts);
|
|
931
1169
|
await stampOrigin(opts.dir, opts.origin);
|
|
932
|
-
await
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1170
|
+
await stampName(opts.dir, opts.name);
|
|
1171
|
+
await rewritePackageJson(
|
|
1172
|
+
opts.dir,
|
|
1173
|
+
opts.name,
|
|
1174
|
+
opts.link,
|
|
1175
|
+
opts.packageManager ?? "pnpm",
|
|
1176
|
+
opts.frontend
|
|
1177
|
+
);
|
|
1178
|
+
if (opts.packageManager !== void 0 && opts.packageManager !== "pnpm") {
|
|
1179
|
+
await rm(join(opts.dir, "pnpm-workspace.yaml"), { force: true });
|
|
1180
|
+
}
|
|
1181
|
+
await materializePackageManagerInstructions(opts.dir, opts.packageManager ?? "pnpm");
|
|
939
1182
|
await writeFile(
|
|
940
1183
|
join(opts.dir, ".env.dev"),
|
|
941
|
-
"#
|
|
1184
|
+
"# Development secrets \u2014 `astrale-domain deploy development` binds the ENTIRE file to the\n# deployment it makes. Gitignored. See .env.example.\n"
|
|
942
1185
|
);
|
|
943
1186
|
}
|
|
944
1187
|
async function materializeGitignores(dir, frontend) {
|
|
@@ -965,14 +1208,14 @@ async function materializeFrontend(opts, template) {
|
|
|
965
1208
|
pkg.devDependencies ??= {};
|
|
966
1209
|
pkg.scripts ??= {};
|
|
967
1210
|
if (opts.frontend === "react") {
|
|
968
|
-
Object.assign(pkg.
|
|
969
|
-
"@tanstack/react-router": "1.170.
|
|
1211
|
+
Object.assign(pkg.devDependencies, {
|
|
1212
|
+
"@tanstack/react-router": "1.170.18",
|
|
970
1213
|
react: "^19.2.0",
|
|
971
1214
|
"react-dom": "^19.2.0"
|
|
972
1215
|
});
|
|
973
1216
|
Object.assign(pkg.devDependencies, {
|
|
974
1217
|
"@tailwindcss/vite": "^4.0.6",
|
|
975
|
-
"@tanstack/router-plugin": "1.168.
|
|
1218
|
+
"@tanstack/router-plugin": "1.168.23",
|
|
976
1219
|
"@types/react": "^19.2.0",
|
|
977
1220
|
"@types/react-dom": "^19.2.0",
|
|
978
1221
|
"@vitejs/plugin-react": "^6.0.5",
|
|
@@ -1005,63 +1248,122 @@ function assertSafeToDelete(dir) {
|
|
|
1005
1248
|
}
|
|
1006
1249
|
}
|
|
1007
1250
|
async function stampOrigin(dir, origin) {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1251
|
+
await replaceInFile(join(dir, "schema", "schema.ts"), ORIGIN_PLACEHOLDER, origin);
|
|
1252
|
+
}
|
|
1253
|
+
async function stampName(dir, packageName) {
|
|
1254
|
+
const name = packageName.slice(packageName.lastIndexOf("/") + 1);
|
|
1255
|
+
await replaceInFile(
|
|
1256
|
+
join(dir, "schema", "schema.ts"),
|
|
1257
|
+
NAME_PLACEHOLDER,
|
|
1258
|
+
`name: ${JSON.stringify(name)}`
|
|
1259
|
+
);
|
|
1012
1260
|
}
|
|
1013
1261
|
async function materializeAdapter(opts) {
|
|
1014
1262
|
const config = join(opts.dir, "astrale.config.ts");
|
|
1015
1263
|
await cp(join(templateDir(ADAPTER_PACKAGES[opts.adapter]), "astrale.config.ts"), config);
|
|
1016
|
-
|
|
1017
|
-
await addManagedAdapterDep(opts.dir);
|
|
1018
|
-
if (opts.instance) await replaceInFile(config, `'${INSTANCE_PLACEHOLDER}'`, `'${opts.instance}'`);
|
|
1264
|
+
await addAdapterDependency(opts.dir, ADAPTER_PACKAGES[opts.adapter]);
|
|
1019
1265
|
}
|
|
1020
|
-
async function
|
|
1266
|
+
async function addAdapterDependency(dir, adapter) {
|
|
1021
1267
|
const path = join(dir, "package.json");
|
|
1022
1268
|
const pkg = JSON.parse(await readFile(path, "utf-8"));
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
"Could not materialize @astrale-os/adapter-astrale: the scaffold body does not declare its @astrale-os/adapter-cloudflare Worker runtime dependency."
|
|
1026
|
-
);
|
|
1027
|
-
}
|
|
1028
|
-
pkg.devDependencies["@astrale-os/adapter-astrale"] = installedPackageRange(
|
|
1029
|
-
"@astrale-os/adapter-astrale"
|
|
1030
|
-
);
|
|
1269
|
+
pkg.devDependencies ??= {};
|
|
1270
|
+
pkg.devDependencies[adapter] = installedPackageVersion(adapter);
|
|
1031
1271
|
pkg.devDependencies = Object.fromEntries(
|
|
1032
1272
|
Object.entries(pkg.devDependencies).sort(([a], [b3]) => a.localeCompare(b3))
|
|
1033
1273
|
);
|
|
1034
1274
|
await writeFile(path, JSON.stringify(pkg, null, 2) + "\n");
|
|
1035
1275
|
}
|
|
1036
|
-
|
|
1276
|
+
var PACKAGE_MANAGER_VERSIONS = {
|
|
1277
|
+
// Keep pnpm inside the scaffold's own seven-day release quarantine. Newer
|
|
1278
|
+
// 12.x releases cannot install themselves while minimumReleaseAge is strict.
|
|
1279
|
+
pnpm: "pnpm@12.1.0",
|
|
1280
|
+
npm: "npm@11.19.1",
|
|
1281
|
+
yarn: "yarn@4.18.0",
|
|
1282
|
+
bun: "bun@1.4.4"
|
|
1283
|
+
};
|
|
1284
|
+
var PREPACK_COMMANDS = {
|
|
1285
|
+
pnpm: "pnpm run package",
|
|
1286
|
+
npm: "npm run package",
|
|
1287
|
+
yarn: "yarn package",
|
|
1288
|
+
bun: "bun run package"
|
|
1289
|
+
};
|
|
1290
|
+
var YARN_CONFIGURATION = `nodeLinker: node-modules
|
|
1291
|
+
enableScripts: false
|
|
1292
|
+
npmMinimalAgeGate: 1w
|
|
1293
|
+
npmPreapprovedPackages:
|
|
1294
|
+
- '@astrale-os/*'
|
|
1295
|
+
- '@astrale-domains/*'
|
|
1296
|
+
- '@astrale/*'
|
|
1297
|
+
- '@jsr/astrale__*'
|
|
1298
|
+
- create-astrale-domain
|
|
1299
|
+
`;
|
|
1300
|
+
async function materializePackageManagerInstructions(dir, packageManager) {
|
|
1301
|
+
if (packageManager === "yarn") {
|
|
1302
|
+
await writeFile(join(dir, ".yarnrc.yml"), YARN_CONFIGURATION);
|
|
1303
|
+
}
|
|
1304
|
+
const replacements = [
|
|
1305
|
+
["pnpm run deploy production", packageManagerScript(packageManager, "deploy", "production")],
|
|
1306
|
+
["pnpm run deploy development", packageManagerScript(packageManager, "deploy", "development")],
|
|
1307
|
+
["pnpm deploy production", packageManagerScript(packageManager, "deploy", "production")],
|
|
1308
|
+
["pnpm build", packageManagerScript(packageManager, "build")],
|
|
1309
|
+
["pnpm pack", packageManager === "bun" ? "bun pm pack" : `${packageManager} pack`]
|
|
1310
|
+
];
|
|
1311
|
+
for (const file of ["README.md", "CLAUDE.md", "astrale.config.ts"]) {
|
|
1312
|
+
const target = join(dir, file);
|
|
1313
|
+
if (!existsSync(target)) continue;
|
|
1314
|
+
let content = await readFile(target, "utf8");
|
|
1315
|
+
for (const [from, to] of replacements) content = content.replaceAll(from, to);
|
|
1316
|
+
await writeFile(target, content);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
async function rewritePackageJson(dir, name, link, packageManager, frontend) {
|
|
1037
1320
|
const path = join(dir, "package.json");
|
|
1038
1321
|
const pkg = JSON.parse(await readFile(path, "utf-8"));
|
|
1039
1322
|
pkg.name = name;
|
|
1323
|
+
pkg.packageManager = PACKAGE_MANAGER_VERSIONS[packageManager];
|
|
1324
|
+
if (packageManager === "yarn") {
|
|
1325
|
+
pkg.dependenciesMeta = {
|
|
1326
|
+
...Object.fromEntries(
|
|
1327
|
+
(pkg.trustedDependencies ?? []).map((dependency) => [dependency, { built: true }])
|
|
1328
|
+
),
|
|
1329
|
+
// Optional native acceleration; retain the portable JavaScript fallback.
|
|
1330
|
+
"msgpackr-extract": { built: false }
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
if (pkg.scripts !== void 0) pkg.scripts.prepack = PREPACK_COMMANDS[packageManager];
|
|
1334
|
+
if (packageManager === "pnpm" || frontend === "none") delete pkg.workspaces;
|
|
1335
|
+
else pkg.workspaces = ["frontend"];
|
|
1040
1336
|
if (pkg.imports !== void 0) {
|
|
1041
1337
|
pkg.publishConfig ??= {};
|
|
1042
1338
|
pkg.publishConfig.imports = publishedImports(pkg.imports);
|
|
1043
1339
|
}
|
|
1044
|
-
|
|
1340
|
+
if (pkg.dependencies?.["@astrale-os/sdk"] === void 0) {
|
|
1341
|
+
throw new Error("Template is missing the required @astrale-os/sdk dependency.");
|
|
1342
|
+
}
|
|
1343
|
+
pkg.dependencies["@astrale-os/sdk"] = installedPackageVersion("@astrale-os/sdk");
|
|
1344
|
+
rewriteAstraleDeps(pkg, link, packageManager);
|
|
1045
1345
|
await writeFile(path, JSON.stringify(pkg, null, 2) + "\n");
|
|
1046
1346
|
}
|
|
1047
1347
|
function publishedImports(imports) {
|
|
1048
1348
|
return Object.fromEntries(
|
|
1049
|
-
Object.entries(imports).map(([specifier, target]) => {
|
|
1349
|
+
Object.entries(imports).filter(([specifier]) => specifier === "#schema" || specifier === "#schema/*").map(([specifier, target]) => {
|
|
1050
1350
|
if (!/^\.\/.*\.ts$/u.test(target)) {
|
|
1051
|
-
throw new TypeError(
|
|
1351
|
+
throw new TypeError(
|
|
1352
|
+
`Package import ${specifier} must target one project TypeScript file.`
|
|
1353
|
+
);
|
|
1052
1354
|
}
|
|
1053
1355
|
return [specifier, `./dist/${target.slice(2, -3)}.js`];
|
|
1054
1356
|
})
|
|
1055
1357
|
);
|
|
1056
1358
|
}
|
|
1057
|
-
function rewriteAstraleDeps(pkg, link) {
|
|
1359
|
+
function rewriteAstraleDeps(pkg, link, packageManager = "pnpm") {
|
|
1058
1360
|
if (!link) return false;
|
|
1059
1361
|
let changed = false;
|
|
1060
1362
|
for (const group of [pkg.dependencies, pkg.devDependencies]) {
|
|
1061
1363
|
if (!group) continue;
|
|
1062
1364
|
for (const dep of Object.keys(group)) {
|
|
1063
1365
|
if (!LINK_PACKAGES.has(dep)) continue;
|
|
1064
|
-
const next =
|
|
1366
|
+
const next = `${packageManager === "pnpm" ? "link" : "file"}:${localPackageRoot(dep)}`;
|
|
1065
1367
|
if (group[dep] !== next) {
|
|
1066
1368
|
group[dep] = next;
|
|
1067
1369
|
changed = true;
|
|
@@ -1070,30 +1372,6 @@ function rewriteAstraleDeps(pkg, link) {
|
|
|
1070
1372
|
}
|
|
1071
1373
|
return changed;
|
|
1072
1374
|
}
|
|
1073
|
-
async function writeLinkedZodOverride(dir) {
|
|
1074
|
-
const workspace = join(dir, "pnpm-workspace.yaml");
|
|
1075
|
-
if (!existsSync(workspace)) return;
|
|
1076
|
-
const start = "# create-astrale-domain: linked overrides";
|
|
1077
|
-
const end = "# /create-astrale-domain";
|
|
1078
|
-
const block = `
|
|
1079
|
-
${start}
|
|
1080
|
-
overrides:
|
|
1081
|
-
zod: ${sdkZodVersion()}
|
|
1082
|
-
${end}
|
|
1083
|
-
`;
|
|
1084
|
-
const text = await readFile(workspace, "utf-8");
|
|
1085
|
-
const pattern = new RegExp(`\\n?${escapeRegExp(start)}[\\s\\S]*?${escapeRegExp(end)}\\n?`);
|
|
1086
|
-
await writeFile(workspace, text.replace(pattern, "\n").trimEnd() + block);
|
|
1087
|
-
}
|
|
1088
|
-
function escapeRegExp(value) {
|
|
1089
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1090
|
-
}
|
|
1091
|
-
function sdkZodVersion() {
|
|
1092
|
-
if (SDK_ROOT === void 0) throw new Error("Local SDK checkout is unavailable.");
|
|
1093
|
-
const sdkRequire = createRequire(join(SDK_ROOT, "package.json"));
|
|
1094
|
-
const pkg = sdkRequire("zod/package.json");
|
|
1095
|
-
return pkg.version;
|
|
1096
|
-
}
|
|
1097
1375
|
async function replaceInFile(path, from, to) {
|
|
1098
1376
|
if (!existsSync(path)) return;
|
|
1099
1377
|
const text = await readFile(path, "utf-8");
|
|
@@ -1124,23 +1402,17 @@ function localPackageRoot(dependency) {
|
|
|
1124
1402
|
|
|
1125
1403
|
// src/index.ts
|
|
1126
1404
|
var PMS = ["pnpm", "npm", "yarn", "bun"];
|
|
1127
|
-
var DLX = {
|
|
1128
|
-
pnpm: "pnpm dlx",
|
|
1129
|
-
npm: "npx",
|
|
1130
|
-
yarn: "yarn dlx",
|
|
1131
|
-
bun: "bunx"
|
|
1132
|
-
};
|
|
1133
1405
|
var ADAPTERS = [
|
|
1134
1406
|
{
|
|
1135
1407
|
value: "astrale",
|
|
1136
1408
|
label: "Astrale managed",
|
|
1137
|
-
hint: "
|
|
1409
|
+
hint: "deploys on Admin's Services \u2014 no Cloudflare account",
|
|
1138
1410
|
enabled: true
|
|
1139
1411
|
},
|
|
1140
1412
|
{
|
|
1141
1413
|
value: "cloudflare",
|
|
1142
|
-
label: "Cloudflare
|
|
1143
|
-
hint: "
|
|
1414
|
+
label: "Cloudflare platform namespace",
|
|
1415
|
+
hint: "the platform's dispatch namespace \u2014 platform publishers only",
|
|
1144
1416
|
enabled: true
|
|
1145
1417
|
},
|
|
1146
1418
|
{ value: "custom", label: "Custom", hint: "bring your own adapter (soon)", enabled: false }
|
|
@@ -1149,7 +1421,7 @@ var FRONTENDS = [
|
|
|
1149
1421
|
{
|
|
1150
1422
|
value: "react",
|
|
1151
1423
|
label: "React",
|
|
1152
|
-
hint: "
|
|
1424
|
+
hint: "Vite React application with TanStack Router; Shell integration is optional"
|
|
1153
1425
|
},
|
|
1154
1426
|
{
|
|
1155
1427
|
value: "custom",
|
|
@@ -1184,13 +1456,18 @@ async function main() {
|
|
|
1184
1456
|
const answer = await he({
|
|
1185
1457
|
message: "Domain name (slug)",
|
|
1186
1458
|
placeholder: "crm",
|
|
1187
|
-
validate: (v2) =>
|
|
1459
|
+
validate: (v2) => isValidProjectSlug(v2) ? void 0 : PROJECT_SLUG_RULE
|
|
1188
1460
|
});
|
|
1189
1461
|
if (pD(answer)) return bail();
|
|
1190
1462
|
slug = answer;
|
|
1191
1463
|
}
|
|
1192
|
-
if (!
|
|
1193
|
-
xe(`Invalid slug "${slug}".
|
|
1464
|
+
if (!isValidProjectSlug(slug)) {
|
|
1465
|
+
xe(`Invalid slug "${slug}". ${PROJECT_SLUG_RULE}`);
|
|
1466
|
+
return 1;
|
|
1467
|
+
}
|
|
1468
|
+
const origin = flags.origin ?? deriveOrigin(slug);
|
|
1469
|
+
if (!isValidOrigin(origin)) {
|
|
1470
|
+
xe(`Invalid --origin "${origin}". ${ORIGIN_RULE}`);
|
|
1194
1471
|
return 1;
|
|
1195
1472
|
}
|
|
1196
1473
|
let adapter = flags.adapter;
|
|
@@ -1231,16 +1508,11 @@ async function main() {
|
|
|
1231
1508
|
xe(`Unknown frontend "${frontend}" \u2014 use "react", "custom", or "none".`);
|
|
1232
1509
|
return 1;
|
|
1233
1510
|
}
|
|
1234
|
-
const instance = flags.instance;
|
|
1235
|
-
if (instance !== void 0 && !isValidSlug(instance)) {
|
|
1236
|
-
xe(`Invalid --instance "${instance}". Use lowercase letters, digits, dots and dashes.`);
|
|
1237
|
-
return 1;
|
|
1238
|
-
}
|
|
1239
1511
|
let pm = flags.pm;
|
|
1240
1512
|
if (!pm) {
|
|
1241
|
-
const detected = detectPm();
|
|
1242
1513
|
if (headless) pm = "pnpm";
|
|
1243
1514
|
else {
|
|
1515
|
+
const detected = detectPm();
|
|
1244
1516
|
const answer = await ve({
|
|
1245
1517
|
message: "Package manager",
|
|
1246
1518
|
initialValue: detected ?? "pnpm",
|
|
@@ -1264,13 +1536,6 @@ async function main() {
|
|
|
1264
1536
|
if (pD(go) || !go) return bail();
|
|
1265
1537
|
}
|
|
1266
1538
|
const link = flags.link ?? workspaceAvailable();
|
|
1267
|
-
if (flags.origin !== void 0 && !isValidOrigin(flags.origin)) {
|
|
1268
|
-
xe(
|
|
1269
|
-
`Invalid --origin "${flags.origin}". Use a lowercase dotted domain with valid DNS labels.`
|
|
1270
|
-
);
|
|
1271
|
-
return 1;
|
|
1272
|
-
}
|
|
1273
|
-
const origin = flags.origin ?? (slug.includes(".") ? slug : `${slug}.example.dev`);
|
|
1274
1539
|
const s = Y2();
|
|
1275
1540
|
s.start(`Creating ./${slug}`);
|
|
1276
1541
|
try {
|
|
@@ -1280,7 +1545,7 @@ async function main() {
|
|
|
1280
1545
|
origin,
|
|
1281
1546
|
adapter,
|
|
1282
1547
|
frontend,
|
|
1283
|
-
|
|
1548
|
+
packageManager: pm,
|
|
1284
1549
|
link
|
|
1285
1550
|
});
|
|
1286
1551
|
s.stop(`Created ${dir}`);
|
|
@@ -1295,50 +1560,28 @@ async function main() {
|
|
|
1295
1560
|
const rel = relative2(process.cwd(), dir);
|
|
1296
1561
|
const cdTarget = rel && !rel.startsWith("..") ? rel : dir;
|
|
1297
1562
|
Me(
|
|
1298
|
-
[
|
|
1299
|
-
`cd ${cdTarget}`,
|
|
1300
|
-
`${pm} install`,
|
|
1301
|
-
devStep(pm),
|
|
1302
|
-
installStep(pm),
|
|
1303
|
-
prodStep(pm, adapter, instance)
|
|
1304
|
-
].join("\n"),
|
|
1563
|
+
[`cd ${cdTarget}`, `${pm} install`, ...deploySteps(pm, adapter)].join("\n"),
|
|
1305
1564
|
"Next"
|
|
1306
1565
|
);
|
|
1307
|
-
if (adapter === "astrale" && !instance) {
|
|
1308
|
-
M2.warn(
|
|
1309
|
-
`No target instance set \u2014 put your slug in astrale.config.ts (prod.instance) before \`${pm === "npm" ? "npm run prod" : `${pm} prod`}\`. Create one: astrale instance create <slug>`
|
|
1310
|
-
);
|
|
1311
|
-
}
|
|
1312
1566
|
M2.info(
|
|
1313
1567
|
"AI agent on this project? Install the authoring + ops skills once (user-level):\n npx skills add astrale-os/cli -g # or run `astrale setup`"
|
|
1314
1568
|
);
|
|
1315
1569
|
Se(`\u2713 ${slug} ready`);
|
|
1316
1570
|
return 0;
|
|
1317
1571
|
}
|
|
1318
|
-
var
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
const hint = adapter === "astrale" ? `# managed deploy \u2192 installs on ${instance ? `"${instance}"` : "your instance"}` : "# deploy prod \u2192 prints a URL";
|
|
1322
|
-
return `${cmd} ${hint}`;
|
|
1572
|
+
var DEPLOYMENT_HOSTS = {
|
|
1573
|
+
astrale: "Admin's Services",
|
|
1574
|
+
cloudflare: "the platform's dispatch namespace"
|
|
1323
1575
|
};
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
`${DLX[pm]} @astrale-os/cli domain install <url> --direct`,
|
|
1329
|
-
"# or install it globally: npm i -g @astrale-os/cli"
|
|
1330
|
-
].join("\n");
|
|
1331
|
-
}
|
|
1332
|
-
function astraleOnPath() {
|
|
1333
|
-
const path = process.env.PATH;
|
|
1334
|
-
if (!path) return false;
|
|
1335
|
-
const names = process.platform === "win32" ? ["astrale.cmd", "astrale.exe", "astrale.bat", "astrale"] : ["astrale"];
|
|
1336
|
-
return path.split(delimiter).some((d3) => d3.length > 0 && names.some((n) => existsSync2(join2(d3, n))));
|
|
1337
|
-
}
|
|
1576
|
+
var deploySteps = (pm, adapter) => [
|
|
1577
|
+
`${packageManagerScript(pm, "deploy", "development")} # immutable deployment on ${DEPLOYMENT_HOSTS[adapter]} \u2192 prints its URL`,
|
|
1578
|
+
"astrale domain install <url> -i <instance> # install that URL"
|
|
1579
|
+
];
|
|
1338
1580
|
function detectPm() {
|
|
1339
1581
|
const name = process.env.npm_config_user_agent?.split("/")[0];
|
|
1340
1582
|
return PMS.find((p2) => p2 === name);
|
|
1341
1583
|
}
|
|
1584
|
+
var INSTANCE_REMOVED = "--instance was removed: a scaffolded Environment names no instance. Deploy, then install the URL the deploy prints with `astrale domain install <url> -i <instance>`.";
|
|
1342
1585
|
function parseFlags(argv) {
|
|
1343
1586
|
const flags = { positional: [], force: false, yes: false, help: false };
|
|
1344
1587
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -1353,9 +1596,10 @@ function parseFlags(argv) {
|
|
|
1353
1596
|
else if (a === "--pm") flags.pm = flagValue(argv, ++i, a);
|
|
1354
1597
|
else if (a === "--dir") flags.dir = flagValue(argv, ++i, a);
|
|
1355
1598
|
else if (a === "--origin") flags.origin = flagValue(argv, ++i, a);
|
|
1356
|
-
else if (a === "--instance"
|
|
1599
|
+
else if (a === "--instance" || a.startsWith("--instance="))
|
|
1600
|
+
throw new TypeError(INSTANCE_REMOVED);
|
|
1357
1601
|
else if (a.startsWith("-")) throw new TypeError(`Unknown option "${a}".`);
|
|
1358
|
-
else
|
|
1602
|
+
else flags.positional.push(a);
|
|
1359
1603
|
}
|
|
1360
1604
|
return flags;
|
|
1361
1605
|
}
|
|
@@ -1376,12 +1620,13 @@ Usage:
|
|
|
1376
1620
|
pnpm create astrale-domain <slug> [options]
|
|
1377
1621
|
|
|
1378
1622
|
Arguments:
|
|
1379
|
-
<slug> domain name
|
|
1623
|
+
<slug> domain name \u2014 dot-separated labels of lowercase letters,
|
|
1624
|
+
digits and inner dashes (crm \xB7 1crm \xB7 crm.example.dev)
|
|
1380
1625
|
|
|
1381
1626
|
Options:
|
|
1382
|
-
--adapter <id> deployment adapter \u2014 astrale (managed, default)
|
|
1627
|
+
--adapter <id> deployment adapter \u2014 astrale (managed, default)
|
|
1628
|
+
| cloudflare (platform dispatch namespace)
|
|
1383
1629
|
--frontend <id> react (default) | custom | none
|
|
1384
|
-
--instance <slug> target instance for managed deploys (astrale adapter)
|
|
1385
1630
|
--pm <pm> pnpm | npm | yarn | bun (default: detected, else pnpm)
|
|
1386
1631
|
--dir <path> target directory (default: ./<slug>)
|
|
1387
1632
|
--origin <fqdn> domain identity origin (default: <slug>.example.dev)
|
|
@@ -1396,15 +1641,6 @@ Non-interactive (also auto-enabled without a TTY, e.g. CI):
|
|
|
1396
1641
|
`
|
|
1397
1642
|
);
|
|
1398
1643
|
}
|
|
1399
|
-
function isValidSlug(v2) {
|
|
1400
|
-
return /^[a-z][a-z0-9.-]*$/.test(v2);
|
|
1401
|
-
}
|
|
1402
|
-
function isValidOrigin(value) {
|
|
1403
|
-
if (value.length > 253 || !value.includes(".")) return false;
|
|
1404
|
-
return value.split(".").every(
|
|
1405
|
-
(label) => label.length > 0 && label.length <= 63 && /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/u.test(label)
|
|
1406
|
-
);
|
|
1407
|
-
}
|
|
1408
1644
|
function bail() {
|
|
1409
1645
|
xe("Cancelled.");
|
|
1410
1646
|
return 1;
|