@lunora/cli 1.0.0-alpha.12 → 1.0.0-alpha.14
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.mjs +1 -1
- package/dist/packem_chunks/handler.mjs +2 -2
- package/dist/packem_chunks/handler16.mjs +1 -1
- package/dist/packem_chunks/runInitCommand.mjs +45 -22
- package/dist/packem_shared/{commands-DVr4lduS.mjs → commands-hl0mRqqg.mjs} +34 -1
- package/dist/packem_shared/runAddCommand-vJdgiR5t.mjs +4 -0
- package/dist/packem_shared/{storage-DL9OE4oE.mjs → storage-B7hHSTZP.mjs} +1 -1
- package/package.json +3 -3
- package/dist/packem_shared/runAddCommand-C-NOz8NJ.mjs +0 -4
package/dist/index.mjs
CHANGED
|
@@ -16,4 +16,4 @@ export { createRecordingSpawner, defaultSpawner } from './packem_shared/createRe
|
|
|
16
16
|
export { default as parseManifest } from './packem_shared/parseManifest--vZf2FY1.mjs';
|
|
17
17
|
export { REQUIRED_COMPATIBILITY_DATE, REQUIRED_FLAG, validateWranglerProject as validateWrangler, validateWranglerConfig } from '@lunora/config';
|
|
18
18
|
export { buildRegistryIndex } from './packem_shared/buildRegistryIndex-BcYe607_.mjs';
|
|
19
|
-
export { r as runAddCommand, a as runBuildIndexCommand, b as runRegistryViewCommand } from './packem_shared/commands-
|
|
19
|
+
export { r as runAddCommand, a as runBuildIndexCommand, b as runRegistryViewCommand } from './packem_shared/commands-hl0mRqqg.mjs';
|
|
@@ -3,8 +3,8 @@ import { findWranglerFile } from '@lunora/config';
|
|
|
3
3
|
import { join, basename } from '@visulima/path';
|
|
4
4
|
import { d as defineHandler } from '../packem_shared/command-BC30oSBW.mjs';
|
|
5
5
|
import { t as tuiText, a as tuiSelect } from '../packem_shared/tui-prompts-M6OWsuyw.mjs';
|
|
6
|
-
import { n as normalizeFeature, E as EMAIL_ITEM, s as sanitizeBucketName, d as deriveBucketName, p as promptBucketName, r as resolveTypedDestination, M as MAIL_DESTINATION_PROMPT, a as sanitizeDatabaseName, b as deriveDatabaseName, c as promptDatabaseName, D as DEFAULT_AUTH_ITEM, e as promptAuthProvider, A as AUTH_PROVIDER_OPTIONS, w as withStorageBucketName, f as withMailDestination, g as withAuthDatabaseName } from '../packem_shared/storage-
|
|
7
|
-
import { r as runAddCommand } from '../packem_shared/commands-
|
|
6
|
+
import { n as normalizeFeature, E as EMAIL_ITEM, s as sanitizeBucketName, d as deriveBucketName, p as promptBucketName, r as resolveTypedDestination, M as MAIL_DESTINATION_PROMPT, a as sanitizeDatabaseName, b as deriveDatabaseName, c as promptDatabaseName, D as DEFAULT_AUTH_ITEM, e as promptAuthProvider, A as AUTH_PROVIDER_OPTIONS, w as withStorageBucketName, f as withMailDestination, g as withAuthDatabaseName } from '../packem_shared/storage-B7hHSTZP.mjs';
|
|
7
|
+
import { r as runAddCommand } from '../packem_shared/commands-hl0mRqqg.mjs';
|
|
8
8
|
|
|
9
9
|
const providerToItem = (provider) => {
|
|
10
10
|
const value = provider.trim().toLowerCase();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as defineHandler } from '../packem_shared/command-BC30oSBW.mjs';
|
|
2
|
-
import { r as runAddCommand, b as runRegistryViewCommand, a as runBuildIndexCommand } from '../packem_shared/commands-
|
|
2
|
+
import { r as runAddCommand, b as runRegistryViewCommand, a as runBuildIndexCommand } from '../packem_shared/commands-hl0mRqqg.mjs';
|
|
3
3
|
|
|
4
4
|
const execute = defineHandler(({ argument, cwd, logger, options }) => {
|
|
5
5
|
const subcommand = argument[0];
|
|
@@ -10,11 +10,11 @@ import { d as defineHandler } from '../packem_shared/command-BC30oSBW.mjs';
|
|
|
10
10
|
import { a as detectInstalledManagers, i as installArgsFor } from '../packem_shared/detect-package-manager-DYp7n3mJ.mjs';
|
|
11
11
|
import MagicString from 'magic-string';
|
|
12
12
|
import { Project, SyntaxKind } from 'ts-morph';
|
|
13
|
-
import { c as
|
|
13
|
+
import { c as resolveTagVersions, d as resolveSourceRef, e as resolveDistTag, r as runAddCommand } from '../packem_shared/commands-hl0mRqqg.mjs';
|
|
14
14
|
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-DxI3mebw.mjs';
|
|
15
15
|
import { d as tuiMascot, e as tuiStep, P as PromptCancelledError, f as tuiMoonrise, t as tuiText, g as tuiHeadline, h as tuiInfo, a as tuiSelect, w as withTuiSpinner, b as tuiConfirm, i as tuiNextSteps, j as tuiTasks, k as tuiMultiSelect, l as withTuiBadgeProgress } from '../packem_shared/tui-prompts-M6OWsuyw.mjs';
|
|
16
16
|
import { logStep } from '../packem_shared/createLogger-B40gPzQo.mjs';
|
|
17
|
-
import { E as EMAIL_ITEM, p as promptBucketName, w as withStorageBucketName, M as MAIL_DESTINATION_PROMPT, r as resolveTypedDestination, f as withMailDestination, e as promptAuthProvider, c as promptDatabaseName, g as withAuthDatabaseName } from '../packem_shared/storage-
|
|
17
|
+
import { E as EMAIL_ITEM, p as promptBucketName, w as withStorageBucketName, M as MAIL_DESTINATION_PROMPT, r as resolveTypedDestination, f as withMailDestination, e as promptAuthProvider, c as promptDatabaseName, g as withAuthDatabaseName } from '../packem_shared/storage-B7hHSTZP.mjs';
|
|
18
18
|
import dns from 'node:dns/promises';
|
|
19
19
|
|
|
20
20
|
const GITHUB_CONTENT = `name: Deploy
|
|
@@ -595,12 +595,13 @@ const ensureGitignore = (target) => {
|
|
|
595
595
|
${missing.join("\n")}
|
|
596
596
|
`, "utf8");
|
|
597
597
|
};
|
|
598
|
-
const
|
|
598
|
+
const isLunoraDep$1 = (name) => name === "lunorash" || name.startsWith("@lunora/");
|
|
599
|
+
const stampRange = (name, range, distTag, versions) => isLunoraDep$1(name) ? versions?.get(name) ?? distTag : range;
|
|
599
600
|
const withDependency = (map, name, range, distTag) => {
|
|
600
601
|
return { ...map, [name]: stampRange(name, range, distTag) };
|
|
601
602
|
};
|
|
602
|
-
const restampLunora = (map, distTag) => Object.fromEntries(Object.entries(map).map(([name, range]) => [name, stampRange(name, range, distTag)]));
|
|
603
|
-
const patchPackageJson = (target, name, adapter, distTag) => {
|
|
603
|
+
const restampLunora = (map, distTag, versions) => Object.fromEntries(Object.entries(map).map(([name, range]) => [name, stampRange(name, range, distTag, versions)]));
|
|
604
|
+
const patchPackageJson = async (target, name, adapter, distTag) => {
|
|
604
605
|
const path = join$1(target, "package.json");
|
|
605
606
|
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
606
607
|
let dependencies = withDependency(parsed.dependencies ?? {}, "lunorash", distTag, distTag);
|
|
@@ -614,9 +615,11 @@ const patchPackageJson = (target, name, adapter, distTag) => {
|
|
|
614
615
|
for (const [depName, range] of Object.entries(COMMON_DEV_DEPENDENCIES)) {
|
|
615
616
|
devDependencies = withDependency(devDependencies, depName, range, distTag);
|
|
616
617
|
}
|
|
618
|
+
const lunoraNames = [...Object.keys(dependencies), ...Object.keys(devDependencies)].filter((depName) => isLunoraDep$1(depName));
|
|
619
|
+
const versions = await resolveTagVersions(lunoraNames, distTag);
|
|
617
620
|
parsed.name = name;
|
|
618
|
-
parsed.dependencies = restampLunora(dependencies, distTag);
|
|
619
|
-
parsed.devDependencies = restampLunora(devDependencies, distTag);
|
|
621
|
+
parsed.dependencies = restampLunora(dependencies, distTag, versions);
|
|
622
|
+
parsed.devDependencies = restampLunora(devDependencies, distTag, versions);
|
|
620
623
|
parsed.scripts = { ...parsed.scripts, codegen: "lunora codegen", deploy: "vite build && lunora deploy" };
|
|
621
624
|
writeFileSync(path, `${JSON.stringify(parsed, void 0, 4)}
|
|
622
625
|
`, "utf8");
|
|
@@ -632,7 +635,7 @@ const patchBaseViteConfig = (target, logger) => {
|
|
|
632
635
|
writeFileSync(candidate, result.code, "utf8");
|
|
633
636
|
}
|
|
634
637
|
};
|
|
635
|
-
const applyLunoraOverlay = (options) => {
|
|
638
|
+
const applyLunoraOverlay = async (options) => {
|
|
636
639
|
const { adapter, distTag, logger, name, target } = options;
|
|
637
640
|
const written = [];
|
|
638
641
|
writeFile(target, join$1("lunora", "schema.ts"), LUNORA_SCHEMA, written);
|
|
@@ -644,7 +647,7 @@ const applyLunoraOverlay = (options) => {
|
|
|
644
647
|
writeFile(target, file.path, file.contents, written);
|
|
645
648
|
}
|
|
646
649
|
patchBaseViteConfig(target, logger);
|
|
647
|
-
patchPackageJson(target, name, adapter, distTag);
|
|
650
|
+
await patchPackageJson(target, name, adapter, distTag);
|
|
648
651
|
ensureGitignore(target);
|
|
649
652
|
return written;
|
|
650
653
|
};
|
|
@@ -791,7 +794,27 @@ const isTextFile = (filePath) => {
|
|
|
791
794
|
};
|
|
792
795
|
const substitute = (content, name) => content.replaceAll("{{name}}", name);
|
|
793
796
|
const isLunoraDep = (name) => name === "lunorash" || name.startsWith("@lunora/");
|
|
794
|
-
const
|
|
797
|
+
const resolveLunoraVersions = async (files, distTag) => {
|
|
798
|
+
const names = /* @__PURE__ */ new Set();
|
|
799
|
+
for (const file of files) {
|
|
800
|
+
if (basename(file) !== "package.json") {
|
|
801
|
+
continue;
|
|
802
|
+
}
|
|
803
|
+
try {
|
|
804
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
805
|
+
for (const section of ["dependencies", "devDependencies"]) {
|
|
806
|
+
for (const name of Object.keys(parsed[section] ?? {})) {
|
|
807
|
+
if (isLunoraDep(name)) {
|
|
808
|
+
names.add(name);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
} catch {
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
return resolveTagVersions(names, distTag);
|
|
816
|
+
};
|
|
817
|
+
const stampLunoraDeps = (packageJsonText, distTag, versions) => {
|
|
795
818
|
let parsed;
|
|
796
819
|
try {
|
|
797
820
|
parsed = JSON.parse(packageJsonText);
|
|
@@ -804,7 +827,8 @@ const stampLunoraDeps = (packageJsonText, distTag) => {
|
|
|
804
827
|
if (!isLunoraDep(name)) {
|
|
805
828
|
continue;
|
|
806
829
|
}
|
|
807
|
-
const
|
|
830
|
+
const pin = versions.get(name) ?? distTag;
|
|
831
|
+
const edits = modify(text, [section, name], pin, { formattingOptions: { insertSpaces: true, tabSize: 4 } });
|
|
808
832
|
text = applyEdits(text, edits);
|
|
809
833
|
}
|
|
810
834
|
}
|
|
@@ -817,10 +841,11 @@ const collectFiles = (directory) => {
|
|
|
817
841
|
}
|
|
818
842
|
return out;
|
|
819
843
|
};
|
|
820
|
-
const copyTemplate = (sourceDirectory, target, name) => {
|
|
844
|
+
const copyTemplate = async (sourceDirectory, target, name) => {
|
|
821
845
|
const files = collectFiles(sourceDirectory);
|
|
822
846
|
const written = [];
|
|
823
847
|
const distTag = resolveDistTag();
|
|
848
|
+
const versions = await resolveLunoraVersions(files, distTag);
|
|
824
849
|
for (const source of files) {
|
|
825
850
|
const relativePath = relative(sourceDirectory, source);
|
|
826
851
|
const destination = join$1(target, relativePath);
|
|
@@ -828,7 +853,7 @@ const copyTemplate = (sourceDirectory, target, name) => {
|
|
|
828
853
|
const raw = readFileSync(source);
|
|
829
854
|
let text = isTextFile(source) ? substitute(raw.toString("utf8"), name) : void 0;
|
|
830
855
|
if (text !== void 0 && basename(source) === "package.json") {
|
|
831
|
-
text = stampLunoraDeps(text, distTag);
|
|
856
|
+
text = stampLunoraDeps(text, distTag, versions);
|
|
832
857
|
}
|
|
833
858
|
if (text === void 0) {
|
|
834
859
|
writeFileSync(destination, raw);
|
|
@@ -989,13 +1014,13 @@ const maybeOfferInstall = async (options, target) => {
|
|
|
989
1014
|
await emitStep("deps", `Dependencies installed with ${manager}.`);
|
|
990
1015
|
return manager;
|
|
991
1016
|
};
|
|
992
|
-
const scaffoldFromLocal = (fromRoot, templateType, target, name, logger) => {
|
|
1017
|
+
const scaffoldFromLocal = async (fromRoot, templateType, target, name, logger) => {
|
|
993
1018
|
const templateDirectory = join$1(fromRoot, templateType);
|
|
994
1019
|
if (!existsSync(templateDirectory)) {
|
|
995
1020
|
logger.error(`template not found in local source: ${templateDirectory}`);
|
|
996
1021
|
return { code: 1, files: [], target };
|
|
997
1022
|
}
|
|
998
|
-
const written = copyTemplate(templateDirectory, target, name);
|
|
1023
|
+
const written = await copyTemplate(templateDirectory, target, name);
|
|
999
1024
|
logScaffoldSuccess(logger, written, target);
|
|
1000
1025
|
return { code: 0, files: written, target };
|
|
1001
1026
|
};
|
|
@@ -1023,9 +1048,8 @@ const scaffoldFromRemote = async (options) => {
|
|
|
1023
1048
|
},
|
|
1024
1049
|
{
|
|
1025
1050
|
label: `files copied into ${name}/`,
|
|
1026
|
-
run: () => {
|
|
1027
|
-
written = copyTemplate(stagingDirectory, target, name);
|
|
1028
|
-
return Promise.resolve();
|
|
1051
|
+
run: async () => {
|
|
1052
|
+
written = await copyTemplate(stagingDirectory, target, name);
|
|
1029
1053
|
}
|
|
1030
1054
|
}
|
|
1031
1055
|
],
|
|
@@ -1089,9 +1113,8 @@ const scaffoldViteOverlay = async (options) => {
|
|
|
1089
1113
|
{ label: `create-vite (${adapter.label}) base ready`, run: copyBase },
|
|
1090
1114
|
{
|
|
1091
1115
|
label: `Lunora overlay applied (${adapter.label})`,
|
|
1092
|
-
run: () => {
|
|
1093
|
-
written = applyLunoraOverlay({ adapter, distTag: resolveDistTag(), logger, name, target });
|
|
1094
|
-
return Promise.resolve();
|
|
1116
|
+
run: async () => {
|
|
1117
|
+
written = await applyLunoraOverlay({ adapter, distTag: resolveDistTag(), logger, name, target });
|
|
1095
1118
|
}
|
|
1096
1119
|
}
|
|
1097
1120
|
],
|
|
@@ -1356,7 +1379,7 @@ const scaffoldTemplatePath = async (options, templateType, name, target) => {
|
|
|
1356
1379
|
return { code: 1, files: [], target };
|
|
1357
1380
|
}
|
|
1358
1381
|
if (options.from !== void 0) {
|
|
1359
|
-
return scaffoldFromLocal(options.from, templateType, target, name, options.logger);
|
|
1382
|
+
return await scaffoldFromLocal(options.from, templateType, target, name, options.logger);
|
|
1360
1383
|
}
|
|
1361
1384
|
if (options.source !== void 0 && options.source.length > 0 && !options.allowUnsafeSource && !isSafeSource(options.source)) {
|
|
1362
1385
|
options.logger.error(
|
|
@@ -65,6 +65,39 @@ const resolveDistTag = () => {
|
|
|
65
65
|
const ref = resolveVersionRef(resolveCliVersion());
|
|
66
66
|
return ref === STABLE_BRANCH ? STABLE_DIST_TAG : ref;
|
|
67
67
|
};
|
|
68
|
+
const DEFAULT_REGISTRY = "https://registry.npmjs.org";
|
|
69
|
+
const registryBase = () => {
|
|
70
|
+
const configured = process.env["npm_config_registry"];
|
|
71
|
+
const base = configured !== void 0 && configured.length > 0 ? configured : DEFAULT_REGISTRY;
|
|
72
|
+
return base.endsWith("/") ? base.slice(0, -1) : base;
|
|
73
|
+
};
|
|
74
|
+
const resolveTagVersion = async (packageName, tag) => {
|
|
75
|
+
try {
|
|
76
|
+
const response = await fetch(`${registryBase()}/${packageName.replace("/", "%2F")}`, {
|
|
77
|
+
headers: { accept: "application/vnd.npm.install-v1+json" },
|
|
78
|
+
signal: AbortSignal.timeout(1e4)
|
|
79
|
+
});
|
|
80
|
+
if (!response.ok) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
const packument = await response.json();
|
|
84
|
+
return packument["dist-tags"]?.[tag];
|
|
85
|
+
} catch {
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const resolveTagVersions = async (names, tag) => {
|
|
90
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
91
|
+
await Promise.all(
|
|
92
|
+
[...new Set(names)].map(async (name) => {
|
|
93
|
+
const version = await resolveTagVersion(name, tag);
|
|
94
|
+
if (version !== void 0) {
|
|
95
|
+
resolved.set(name, version);
|
|
96
|
+
}
|
|
97
|
+
})
|
|
98
|
+
);
|
|
99
|
+
return resolved;
|
|
100
|
+
};
|
|
68
101
|
|
|
69
102
|
const resolveDepRange = (range) => {
|
|
70
103
|
if (!range.startsWith("workspace:")) {
|
|
@@ -809,4 +842,4 @@ const runBuildIndexCommand = async (options) => {
|
|
|
809
842
|
return empty;
|
|
810
843
|
};
|
|
811
844
|
|
|
812
|
-
export { runBuildIndexCommand as a, runRegistryViewCommand as b,
|
|
845
|
+
export { runBuildIndexCommand as a, runRegistryViewCommand as b, resolveTagVersions as c, resolveSourceRef as d, resolveDistTag as e, runListCommand as f, runAddCommand as r, setBindingField as s };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/cli",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.14",
|
|
4
4
|
"description": "The Lunora CLI: init, dev, deploy, codegen, run, reset, and migrate commands",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-skills",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@bomb.sh/tab": "0.0.16",
|
|
55
|
-
"@lunora/codegen": "1.0.0-alpha.
|
|
56
|
-
"@lunora/config": "1.0.0-alpha.
|
|
55
|
+
"@lunora/codegen": "1.0.0-alpha.5",
|
|
56
|
+
"@lunora/config": "1.0.0-alpha.7",
|
|
57
57
|
"@lunora/container": "1.0.0-alpha.1",
|
|
58
58
|
"@lunora/d1": "1.0.0-alpha.4",
|
|
59
59
|
"@lunora/seed": "1.0.0-alpha.2",
|