@stacksjs/actions 0.70.258 → 0.70.259
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/action.js +1 -80
- package/dist/actions.js +1 -2
- package/dist/add.js +1 -20
- package/dist/ai/request-model-access.js +1 -10
- package/dist/auth/client.js +2 -44
- package/dist/auth/prune.js +1 -35
- package/dist/auth/setup.js +33 -153
- package/dist/auth/token.js +1 -10
- package/dist/blog-admin.js +3 -151
- package/dist/blog.js +33 -271
- package/dist/build/cli.js +1 -6
- package/dist/build/component-library.js +1 -36
- package/dist/build/component-libs.js +1 -2
- package/dist/build/core.js +1 -55
- package/dist/build/desktop.js +4 -61
- package/dist/build/dmg.js +4 -68
- package/dist/build/docs.js +1 -5
- package/dist/build/frontend-static.js +6 -122
- package/dist/build/server.js +1 -6
- package/dist/build/stacks.js +1 -8
- package/dist/build/views.js +1 -16
- package/dist/build-web-component-lib.js +1 -2
- package/dist/build.js +1 -57
- package/dist/bump.js +9 -210
- package/dist/changelog.js +1 -27
- package/dist/check/ports.js +1 -16
- package/dist/clean.js +1 -4
- package/dist/commit.js +1 -12
- package/dist/copy-types.js +1 -9
- package/dist/database/seed.js +1 -26
- package/dist/deploy/create-receipt-rule.js +1 -36
- package/dist/deploy/index.js +29 -1306
- package/dist/dev/api.js +3 -94
- package/dist/dev/components.js +1 -7
- package/dist/dev/csrf.js +1 -28
- package/dist/dev/dashboard-request-routing.js +1 -10
- package/dist/dev/dashboard-utils.js +1 -380
- package/dist/dev/dashboard.js +7 -422
- package/dist/dev/desktop.js +1 -1
- package/dist/dev/docs.js +1 -24
- package/dist/dev/exit-with-parent.d.ts +6 -0
- package/dist/dev/exit-with-parent.js +1 -0
- package/dist/dev/index.js +1 -29
- package/dist/dev/migrate-watcher.js +1 -74
- package/dist/dev/system-tray.js +2 -172
- package/dist/dev/views.js +1 -169
- package/dist/discover-packages.js +1 -32
- package/dist/domains/add.js +1 -61
- package/dist/domains/purchase.js +1 -66
- package/dist/domains/remove.js +1 -24
- package/dist/examples.js +1 -34
- package/dist/find-projects.js +1 -16
- package/dist/fresh.js +1 -17
- package/dist/generate/action-types.js +3 -9
- package/dist/generate/component-meta.js +1 -9
- package/dist/generate/custom-cli-file.js +2 -20
- package/dist/generate/env-files.js +5 -46
- package/dist/generate/ide-helpers.js +1 -8
- package/dist/generate/images.js +1 -26
- package/dist/generate/index.js +1 -166
- package/dist/generate/lib-entries.js +1 -16
- package/dist/generate/pantry-file.js +1 -46
- package/dist/generate/symlink-core.js +1 -2
- package/dist/generate/types.js +1 -3
- package/dist/generate/vschema.js +2 -47
- package/dist/generate/vscode-custom-data.js +1 -9
- package/dist/helpers/api-host.js +1 -7
- package/dist/helpers/component-meta.js +5 -295
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/lib-entries.js +3 -73
- package/dist/helpers/package-json.js +2 -34
- package/dist/helpers/utils.js +1 -130
- package/dist/helpers/vscode-custom-data.js +3 -57
- package/dist/index.js +1 -51
- package/dist/key-generate.js +1 -24
- package/dist/lint/fix.js +1 -4
- package/dist/lint/index.js +1 -4
- package/dist/lint/lint.js +1 -34
- package/dist/lint/stx-gate.js +3 -175
- package/dist/make-command.js +4 -55
- package/dist/make-job.js +3 -29
- package/dist/make-policy.js +4 -53
- package/dist/make-resource.js +3 -33
- package/dist/make.js +7 -323
- package/dist/migrate/database.js +1 -16
- package/dist/migrate/fresh.js +1 -36
- package/dist/prepublish.js +1 -16
- package/dist/queue/clear.js +1 -42
- package/dist/queue/dlq-purge.js +1 -28
- package/dist/queue/dlq-retry.js +1 -35
- package/dist/queue/dlq.js +4 -55
- package/dist/queue/failed.js +4 -69
- package/dist/queue/flush.js +2 -49
- package/dist/queue/inspect.js +7 -154
- package/dist/queue/list.js +4 -69
- package/dist/queue/monitor.js +5 -94
- package/dist/queue/pause.js +1 -28
- package/dist/queue/quarantine.js +2 -42
- package/dist/queue/resume.js +1 -27
- package/dist/queue/retry.js +1 -41
- package/dist/queue/schedule-list.js +4 -33
- package/dist/queue/schedule.js +1 -12
- package/dist/queue/status.js +4 -68
- package/dist/queue/table.js +1 -10
- package/dist/queue/unquarantine.js +1 -27
- package/dist/queue/work.js +1 -57
- package/dist/release-preflight.js +3 -61
- package/dist/release.js +1 -29
- package/dist/route/list.js +2 -78
- package/dist/run-action.js +1 -1
- package/dist/saas/setup.js +1 -9
- package/dist/scaffold-crud.js +12 -137
- package/dist/schedule/run.js +1 -7
- package/dist/search/flush.js +1 -10
- package/dist/search/import.js +1 -10
- package/dist/search/settings-list.js +1 -10
- package/dist/search/settings.js +1 -9
- package/dist/serve/api.js +1 -37
- package/dist/setup/index.js +1 -1
- package/dist/setup/ssl.js +2 -268
- package/dist/stacks.js +1 -316
- package/dist/templates.js +20 -40
- package/dist/test/feature.js +1 -2
- package/dist/test/index.js +1 -2
- package/dist/test/runner.js +1 -38
- package/dist/test/runner.test.js +1 -29
- package/dist/test/ui.js +1 -2
- package/dist/test/unit.js +1 -2
- package/dist/typecheck.js +1 -4
- package/dist/types.js +1 -16
- package/dist/upgrade/binary.js +1 -29
- package/dist/upgrade/framework-hooks.js +1 -40
- package/dist/upgrade/framework-utils.js +2 -259
- package/dist/upgrade/framework.js +11 -484
- package/dist/upgrade/index.js +1 -17
- package/dist/upgrade/package-project.js +1 -150
- package/dist/upgrade/packages.js +17 -243
- package/dist/upgrade/shell.js +3 -40
- package/dist/upgrade.js +1 -38
- package/package.json +18 -18
package/dist/bump.js
CHANGED
|
@@ -1,211 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { generateChangelog, loadLogsmithConfig } from "@stacksjs/logsmith";
|
|
5
|
-
import { existsSync, readdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
6
|
-
import { join, relative } from "node:path";
|
|
7
|
-
const options = parseOptions(), allowedBumps = new Set(["patch", "minor", "major", "prepatch", "preminor", "premajor", "prerelease"]), rawBump = options?.bump?.toString(), bumpArg = rawBump ? allowedBumps.has(rawBump) || /^\d+\.\d+\.\d+(?:-[\w.]+)?$/.test(rawBump) ? rawBump : null : null;
|
|
8
|
-
if (rawBump && !bumpArg)
|
|
9
|
-
log.warn(`Ignoring invalid --bump "${rawBump}"; expected one of patch|minor|major or x.y.z`);
|
|
10
|
-
const isDryRun = options?.dryRun === !0, isVerbose = options?.verbose === !0;
|
|
11
|
-
async function readPackage(file) {
|
|
12
|
-
if (!existsSync(file))
|
|
13
|
-
return;
|
|
14
|
-
return await Bun.file(file).json();
|
|
15
|
-
}
|
|
16
|
-
const rootManifest = p.projectPath("package.json"), rootPkg = await readPackage(rootManifest), isFrameworkRelease = rootPkg?.name === "stacks" && existsSync(p.frameworkPath("core/package.json")), bumpCwd = isFrameworkRelease ? p.frameworkPath("core") : p.projectPath(), primaryManifest = isFrameworkRelease ? p.frameworkPath("core/package.json") : rootManifest;
|
|
17
|
-
async function resolveBumpArg(bump) {
|
|
18
|
-
if (!bump || /^\d+\.\d+\.\d+(?:-[\w.]+)?$/.test(bump))
|
|
19
|
-
return bump;
|
|
20
|
-
if (!["patch", "minor", "major"].includes(bump))
|
|
21
|
-
return bump;
|
|
22
|
-
const match = (await readPackage(primaryManifest))?.version?.match(/^(\d+)\.(\d+)\.(\d+)$/);
|
|
23
|
-
if (!match)
|
|
24
|
-
return bump;
|
|
25
|
-
const major = Number(match[1]), minor = Number(match[2]), patch = Number(match[3]);
|
|
26
|
-
if (bump === "major")
|
|
27
|
-
return `${major + 1}.0.0`;
|
|
28
|
-
if (bump === "minor")
|
|
29
|
-
return `${major}.${minor + 1}.0`;
|
|
30
|
-
return `${major}.${minor}.${patch + 1}`;
|
|
31
|
-
}
|
|
32
|
-
const resolvedBumpArg = await resolveBumpArg(bumpArg);
|
|
33
|
-
async function git(args, cwd = p.projectPath(), options = {}) {
|
|
34
|
-
return await execSync(["git", ...args], {
|
|
35
|
-
cwd,
|
|
36
|
-
stdin: "inherit",
|
|
37
|
-
stderr: "pipe",
|
|
38
|
-
throwOnError: options.throwOnError ?? !0
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
async function readVersion(file) {
|
|
42
|
-
const pkg = await readPackage(file);
|
|
43
|
-
if (!pkg?.version || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(pkg.version))
|
|
44
|
-
throw Error(`Invalid version in ${file}: ${pkg?.version ?? "<missing>"}`);
|
|
45
|
-
return pkg.version;
|
|
46
|
-
}
|
|
47
|
-
async function packageFilesFor(pattern, cwd) {
|
|
48
|
-
const glob = new Bun.Glob(pattern), files = [];
|
|
49
|
-
for await (const file of glob.scan({ cwd, absolute: !0, onlyFiles: !0 })) {
|
|
50
|
-
if (file.includes("/node_modules/") || file.includes("/dist/") || file.includes("/pantry/"))
|
|
51
|
-
continue;
|
|
52
|
-
files.push(`./${relative(bumpCwd, file)}`);
|
|
53
|
-
}
|
|
54
|
-
return files;
|
|
55
|
-
}
|
|
56
|
-
async function existingPackageFiles(files) {
|
|
57
|
-
const existing = [];
|
|
58
|
-
for (const file of files) {
|
|
59
|
-
const absolutePath = join(bumpCwd, file);
|
|
60
|
-
if (await Bun.file(absolutePath).exists())
|
|
61
|
-
existing.push(file);
|
|
62
|
-
}
|
|
63
|
-
return existing;
|
|
64
|
-
}
|
|
65
|
-
async function frameworkBumpFiles() {
|
|
66
|
-
return Array.from(new Set([
|
|
67
|
-
...await packageFilesFor("package.json", bumpCwd),
|
|
68
|
-
...await packageFilesFor("*/package.json", bumpCwd),
|
|
69
|
-
...await packageFilesFor("*/*/package.json", bumpCwd),
|
|
70
|
-
...await existingPackageFiles([
|
|
71
|
-
"../package.json",
|
|
72
|
-
"../defaults/ide/vscode/package.json",
|
|
73
|
-
"../api/package.json",
|
|
74
|
-
"../cloud/package.json",
|
|
75
|
-
"../docs/package.json",
|
|
76
|
-
"../orm/package.json",
|
|
77
|
-
"../server/package.json"
|
|
78
|
-
]),
|
|
79
|
-
...await packageFilesFor("../libs/**/package.json", bumpCwd)
|
|
80
|
-
]));
|
|
81
|
-
}
|
|
82
|
-
const bumpFiles = isFrameworkRelease ? await frameworkBumpFiles() : ["./package.json"];
|
|
83
|
-
log.debug(`Release mode: ${isFrameworkRelease ? "framework monorepo" : "consumer app"} (${rootPkg?.name ?? "unknown"})`);
|
|
84
|
-
log.debug(`Bumping ${bumpFiles.length} package manifest(s) in ${bumpCwd}`);
|
|
85
|
-
await versionBump({
|
|
86
|
-
release: resolvedBumpArg ?? void 0,
|
|
87
|
-
files: bumpFiles,
|
|
88
|
-
cwd: bumpCwd,
|
|
89
|
-
recursive: !1,
|
|
90
|
-
commit: !1,
|
|
91
|
-
tag: !1,
|
|
92
|
-
push: !1,
|
|
93
|
-
changelog: !1,
|
|
94
|
-
noGitCheck: !0,
|
|
95
|
-
dryRun: isDryRun,
|
|
96
|
-
yes: Boolean(resolvedBumpArg),
|
|
97
|
-
verbose: isVerbose
|
|
98
|
-
});
|
|
99
|
-
const nextVersion = isDryRun && resolvedBumpArg && /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(resolvedBumpArg) ? resolvedBumpArg : await readVersion(primaryManifest), latestTag = (await git(["describe", "--abbrev=0", "--tags"], p.projectPath(), { throwOnError: !1 }).catch(() => "")).trim();
|
|
100
|
-
async function writeChangelog() {
|
|
101
|
-
const config = await loadLogsmithConfig({
|
|
102
|
-
dir: p.projectPath(),
|
|
103
|
-
from: latestTag || void 0,
|
|
104
|
-
to: "HEAD",
|
|
105
|
-
output: isDryRun ? !1 : "CHANGELOG.md",
|
|
106
|
-
theme: "github",
|
|
107
|
-
verbose: isVerbose
|
|
108
|
-
}), result = await generateChangelog(config);
|
|
109
|
-
if (isDryRun) {
|
|
110
|
-
log.info(result.content);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const changelogPath = p.projectPath("CHANGELOG.md");
|
|
114
|
-
if (!existsSync(changelogPath))
|
|
115
|
-
return;
|
|
116
|
-
let content = readFileSync(changelogPath, "utf-8");
|
|
117
|
-
const versionSeen = new RegExp(`\\bv?${nextVersion.replace(/\./g, "\\.")}\\b`);
|
|
118
|
-
if (/\/compare\/[^)\s]+\.\.\.HEAD\)/.test(content))
|
|
119
|
-
content = content.replace(/(\/compare\/[^)\s]+\.\.\.)HEAD(\))/, `$1v${nextVersion}$2`);
|
|
120
|
-
else if (!versionSeen.test(content.split(`
|
|
121
|
-
`).slice(0, 4).join(`
|
|
122
|
-
`)))
|
|
123
|
-
content = content.replace(/^(#\s.*\n+)?/, (match) => `${match ?? ""}## v${nextVersion}
|
|
1
|
+
import{execSync,log,parseOptions}from"@stacksjs/cli";import{path as p}from"@stacksjs/path";import{versionBump}from"@stacksjs/bumpx";import{generateChangelog,loadLogsmithConfig}from"@stacksjs/logsmith";import{existsSync,readdirSync,readFileSync,unlinkSync,writeFileSync}from"node:fs";import{join,relative}from"node:path";const options=parseOptions(),allowedBumps=new Set(["patch","minor","major","prepatch","preminor","premajor","prerelease"]),rawBump=options?.bump?.toString(),bumpArg=rawBump?allowedBumps.has(rawBump)||/^\d+\.\d+\.\d+(?:-[\w.]+)?$/.test(rawBump)?rawBump:null:null;if(rawBump&&!bumpArg)log.warn(`Ignoring invalid --bump "${rawBump}"; expected one of patch|minor|major or x.y.z`);const isDryRun=options?.dryRun===!0,isVerbose=options?.verbose===!0;async function readPackage(file){if(!existsSync(file))return;return await Bun.file(file).json()}const rootManifest=p.projectPath("package.json"),rootPkg=await readPackage(rootManifest),isFrameworkRelease=rootPkg?.name==="stacks"&&existsSync(p.frameworkPath("core/package.json")),bumpCwd=isFrameworkRelease?p.frameworkPath("core"):p.projectPath(),primaryManifest=isFrameworkRelease?p.frameworkPath("core/package.json"):rootManifest;async function resolveBumpArg(bump){if(!bump||/^\d+\.\d+\.\d+(?:-[\w.]+)?$/.test(bump))return bump;if(!["patch","minor","major"].includes(bump))return bump;const match=(await readPackage(primaryManifest))?.version?.match(/^(\d+)\.(\d+)\.(\d+)$/);if(!match)return bump;const major=Number(match[1]),minor=Number(match[2]),patch=Number(match[3]);if(bump==="major")return`${major+1}.0.0`;if(bump==="minor")return`${major}.${minor+1}.0`;return`${major}.${minor}.${patch+1}`}const resolvedBumpArg=await resolveBumpArg(bumpArg);async function git(args,cwd=p.projectPath(),options={}){return await execSync(["git",...args],{cwd,stdin:"inherit",stderr:"pipe",throwOnError:options.throwOnError??!0})}async function readVersion(file){const pkg=await readPackage(file);if(!pkg?.version||!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(pkg.version))throw Error(`Invalid version in ${file}: ${pkg?.version??"<missing>"}`);return pkg.version}async function packageFilesFor(pattern,cwd){const glob=new Bun.Glob(pattern),files=[];for await(const file of glob.scan({cwd,absolute:!0,onlyFiles:!0})){if(file.includes("/node_modules/")||file.includes("/dist/")||file.includes("/pantry/"))continue;files.push(`./${relative(bumpCwd,file)}`)}return files}async function existingPackageFiles(files){const existing=[];for(const file of files){const absolutePath=join(bumpCwd,file);if(await Bun.file(absolutePath).exists())existing.push(file)}return existing}async function frameworkBumpFiles(){return Array.from(new Set([...await packageFilesFor("package.json",bumpCwd),...await packageFilesFor("*/package.json",bumpCwd),...await packageFilesFor("*/*/package.json",bumpCwd),...await existingPackageFiles(["../package.json","../defaults/ide/vscode/package.json","../api/package.json","../cloud/package.json","../docs/package.json","../orm/package.json","../server/package.json"]),...await packageFilesFor("../libs/**/package.json",bumpCwd)]))}const bumpFiles=isFrameworkRelease?await frameworkBumpFiles():["./package.json"];log.debug(`Release mode: ${isFrameworkRelease?"framework monorepo":"consumer app"} (${rootPkg?.name??"unknown"})`);log.debug(`Bumping ${bumpFiles.length} package manifest(s) in ${bumpCwd}`);await versionBump({release:resolvedBumpArg??void 0,files:bumpFiles,cwd:bumpCwd,recursive:!1,commit:!1,tag:!1,push:!1,changelog:!1,noGitCheck:!0,dryRun:isDryRun,yes:Boolean(resolvedBumpArg),verbose:isVerbose});const nextVersion=isDryRun&&resolvedBumpArg&&/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/.test(resolvedBumpArg)?resolvedBumpArg:await readVersion(primaryManifest),latestTag=(await git(["describe","--abbrev=0","--tags"],p.projectPath(),{throwOnError:!1}).catch(()=>"")).trim();async function writeChangelog(){const config=await loadLogsmithConfig({dir:p.projectPath(),from:latestTag||void 0,to:"HEAD",output:isDryRun?!1:"CHANGELOG.md",theme:"github",verbose:isVerbose}),result=await generateChangelog(config);if(isDryRun){log.info(result.content);return}const changelogPath=p.projectPath("CHANGELOG.md");if(!existsSync(changelogPath))return;let content=readFileSync(changelogPath,"utf-8");const versionSeen=new RegExp(`\\bv?${nextVersion.replace(/\./g,"\\.")}\\b`);if(/\/compare\/[^)\s]+\.\.\.HEAD\)/.test(content))content=content.replace(/(\/compare\/[^)\s]+\.\.\.)HEAD(\))/,`$1v${nextVersion}$2`);else if(!versionSeen.test(content.split(`
|
|
2
|
+
`).slice(0,4).join(`
|
|
3
|
+
`)))content=content.replace(/^(#\s.*\n+)?/,(match)=>`${match??""}## v${nextVersion}
|
|
124
4
|
|
|
125
|
-
`);
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if (!isDryRun && existsSync(p.projectPath("bun.lock"))) {
|
|
132
|
-
const lockPath = p.projectPath("bun.lock"), previousLock = readFileSync(lockPath);
|
|
133
|
-
unlinkSync(lockPath);
|
|
134
|
-
try {
|
|
135
|
-
await execSync(["bun", "install", "--lockfile-only"], {
|
|
136
|
-
cwd: p.projectPath(),
|
|
137
|
-
stdin: "inherit"
|
|
138
|
-
});
|
|
139
|
-
} catch (error) {
|
|
140
|
-
writeFileSync(lockPath, previousLock);
|
|
141
|
-
throw error;
|
|
142
|
-
}
|
|
143
|
-
const expectedLockfileVersion = 1, versionMatch = readFileSync(lockPath, "utf8").match(/"lockfileVersion"\s*:\s*(\d+)/), producedVersion = versionMatch ? Number(versionMatch[1]) : null;
|
|
144
|
-
if (producedVersion !== expectedLockfileVersion) {
|
|
145
|
-
writeFileSync(lockPath, previousLock);
|
|
146
|
-
throw Error(`Release aborted: regenerating bun.lock produced lockfileVersion ${producedVersion ?? "unknown"}, but CI's Bun (1.3.x) requires v${expectedLockfileVersion}. You are releasing with a newer Bun (1.4.x writes v2). Re-run the release with Bun 1.3.x (e.g. via \`bunx bun@1.3.14\`) so CI can parse the lockfile.`);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
function lockstepPackages(version) {
|
|
150
|
-
const names = new Set;
|
|
151
|
-
for (const entry of readdirSync(p.frameworkPath("core"), { withFileTypes: !0 })) {
|
|
152
|
-
if (!entry.isDirectory())
|
|
153
|
-
continue;
|
|
154
|
-
const manifest = p.frameworkPath(`core/${entry.name}/package.json`);
|
|
155
|
-
if (!existsSync(manifest))
|
|
156
|
-
continue;
|
|
157
|
-
const pkg = JSON.parse(readFileSync(manifest, "utf-8"));
|
|
158
|
-
if (pkg.name?.startsWith("@stacksjs/") && pkg.version === version)
|
|
159
|
-
names.add(pkg.name);
|
|
160
|
-
}
|
|
161
|
-
return names;
|
|
162
|
-
}
|
|
163
|
-
function pinLockstepDeps(version) {
|
|
164
|
-
const lockstep = lockstepPackages(version), next = `^${version}`, manifests = [
|
|
165
|
-
p.frameworkPath("core/package.json"),
|
|
166
|
-
...readdirSync(p.frameworkPath("core"), { withFileTypes: !0 }).filter((entry) => entry.isDirectory()).map((entry) => p.frameworkPath(`core/${entry.name}/package.json`)).filter((path) => existsSync(path))
|
|
167
|
-
];
|
|
168
|
-
let pinned = 0;
|
|
169
|
-
for (const manifestPath of manifests) {
|
|
170
|
-
const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
|
|
171
|
-
let changed = !1;
|
|
172
|
-
for (const field of ["dependencies", "devDependencies"]) {
|
|
173
|
-
const deps = manifest[field];
|
|
174
|
-
if (!deps)
|
|
175
|
-
continue;
|
|
176
|
-
for (const name of Object.keys(deps)) {
|
|
177
|
-
if (!lockstep.has(name) || deps[name].startsWith("workspace:") || deps[name] === next)
|
|
178
|
-
continue;
|
|
179
|
-
deps[name] = next;
|
|
180
|
-
changed = !0;
|
|
181
|
-
pinned++;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
if (changed)
|
|
185
|
-
writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
186
|
-
`);
|
|
187
|
-
}
|
|
188
|
-
if (pinned > 0)
|
|
189
|
-
log.debug(`Pinned ${pinned} lockstep core dep(s) to ^${version}`);
|
|
190
|
-
}
|
|
191
|
-
async function stageReleaseArtifacts() {
|
|
192
|
-
const pathspecs = [":(glob)**/package.json", "package.json"];
|
|
193
|
-
for (const file of ["CHANGELOG.md", "bun.lock"])
|
|
194
|
-
if (existsSync(p.projectPath(file)))
|
|
195
|
-
pathspecs.push(file);
|
|
196
|
-
await git(["add", "--", ...pathspecs]);
|
|
197
|
-
const leftover = (await git(["status", "--porcelain"])).split(`
|
|
198
|
-
`).map((line) => line.trimEnd()).filter((line) => line && !line.startsWith("A ") && !line.startsWith("M "));
|
|
199
|
-
if (leftover.length)
|
|
200
|
-
log.warn(`Kept ${leftover.length} change(s) out of the release commit:
|
|
201
|
-
${leftover.slice(0, 20).join(`
|
|
202
|
-
`)}${leftover.length > 20 ? `
|
|
203
|
-
\u2026 and ${leftover.length - 20} more` : ""}`);
|
|
204
|
-
}
|
|
205
|
-
if (!isDryRun) {
|
|
206
|
-
await stageReleaseArtifacts();
|
|
207
|
-
await git(["commit", "-m", `chore: release v${nextVersion}`]);
|
|
208
|
-
await git(["tag", `v${nextVersion}`]);
|
|
209
|
-
await git(["push"]);
|
|
210
|
-
await git(["push", "origin", `v${nextVersion}`]);
|
|
211
|
-
}
|
|
5
|
+
`);writeFileSync(changelogPath,content)}await writeChangelog();if(!isDryRun&&isFrameworkRelease)pinLockstepDeps(nextVersion);if(!isDryRun&&existsSync(p.projectPath("bun.lock"))){const lockPath=p.projectPath("bun.lock"),previousLock=readFileSync(lockPath);unlinkSync(lockPath);try{await execSync(["bun","install","--lockfile-only"],{cwd:p.projectPath(),stdin:"inherit"})}catch(error){writeFileSync(lockPath,previousLock);throw error}const expectedLockfileVersion=1,versionMatch=readFileSync(lockPath,"utf8").match(/"lockfileVersion"\s*:\s*(\d+)/),producedVersion=versionMatch?Number(versionMatch[1]):null;if(producedVersion!==expectedLockfileVersion){writeFileSync(lockPath,previousLock);throw Error(`Release aborted: regenerating bun.lock produced lockfileVersion ${producedVersion??"unknown"}, but CI's Bun (1.3.x) requires v${expectedLockfileVersion}. You are releasing with a newer Bun (1.4.x writes v2). Re-run the release with Bun 1.3.x (e.g. via \`bunx bun@1.3.14\`) so CI can parse the lockfile.`)}}function lockstepPackages(version){const names=new Set;for(const entry of readdirSync(p.frameworkPath("core"),{withFileTypes:!0})){if(!entry.isDirectory())continue;const manifest=p.frameworkPath(`core/${entry.name}/package.json`);if(!existsSync(manifest))continue;const pkg=JSON.parse(readFileSync(manifest,"utf-8"));if(pkg.name?.startsWith("@stacksjs/")&&pkg.version===version)names.add(pkg.name)}return names}function pinLockstepDeps(version){const lockstep=lockstepPackages(version),next=`^${version}`,manifests=[p.frameworkPath("core/package.json"),...readdirSync(p.frameworkPath("core"),{withFileTypes:!0}).filter((entry)=>entry.isDirectory()).map((entry)=>p.frameworkPath(`core/${entry.name}/package.json`)).filter((path)=>existsSync(path))];let pinned=0;for(const manifestPath of manifests){const manifest=JSON.parse(readFileSync(manifestPath,"utf-8"));let changed=!1;for(const field of["dependencies","devDependencies"]){const deps=manifest[field];if(!deps)continue;for(const name of Object.keys(deps)){if(!lockstep.has(name)||deps[name].startsWith("workspace:")||deps[name]===next)continue;deps[name]=next;changed=!0;pinned++}}if(changed)writeFileSync(manifestPath,`${JSON.stringify(manifest,null,2)}
|
|
6
|
+
`)}if(pinned>0)log.debug(`Pinned ${pinned} lockstep core dep(s) to ^${version}`)}async function stageReleaseArtifacts(){const pathspecs=[":(glob)**/package.json","package.json"];for(const file of["CHANGELOG.md","bun.lock"])if(existsSync(p.projectPath(file)))pathspecs.push(file);await git(["add","--",...pathspecs]);const leftover=(await git(["status","--porcelain"])).split(`
|
|
7
|
+
`).map((line)=>line.trimEnd()).filter((line)=>line&&!line.startsWith("A ")&&!line.startsWith("M "));if(leftover.length)log.warn(`Kept ${leftover.length} change(s) out of the release commit:
|
|
8
|
+
${leftover.slice(0,20).join(`
|
|
9
|
+
`)}${leftover.length>20?`
|
|
10
|
+
\u2026 and ${leftover.length-20} more`:""}`)}if(!isDryRun){await stageReleaseArtifacts();await git(["commit","-m",`chore: release v${nextVersion}`]);await git(["tag",`v${nextVersion}`]);await git(["push"]);await git(["push","origin",`v${nextVersion}`])}
|
package/dist/changelog.js
CHANGED
|
@@ -1,27 +1 @@
|
|
|
1
|
-
import { execSync, log,
|
|
2
|
-
import { projectPath } from "@stacksjs/path";
|
|
3
|
-
import { generateChangelog, loadLogsmithConfig } from "@stacksjs/logsmith";
|
|
4
|
-
const sanitizeRevision = (revision) => {
|
|
5
|
-
const value = revision.trim();
|
|
6
|
-
if (!/^[A-Za-z0-9._/-]+$/.test(value))
|
|
7
|
-
throw Error(`Invalid git revision: ${value}`);
|
|
8
|
-
return value;
|
|
9
|
-
};
|
|
10
|
-
log.debug("Generating changelog");
|
|
11
|
-
const options = parseOptions(), fromRevision = sanitizeRevision(options?.from?.toString() ?? await execSync("git describe --abbrev=0 --tags HEAD^").catch(() => ""));
|
|
12
|
-
log.debug("FromRevision", fromRevision);
|
|
13
|
-
const toRevision = sanitizeRevision(options?.to?.toString() ?? "HEAD");
|
|
14
|
-
log.debug("ToRevision", toRevision);
|
|
15
|
-
log.debug("Changelog Options", options);
|
|
16
|
-
if (options?.version ?? options?.r)
|
|
17
|
-
log.debug("Ignoring --version: logsmith headers the section from the from\u2026to range");
|
|
18
|
-
const isDryRun = options?.dryRun === !0, config = await loadLogsmithConfig({
|
|
19
|
-
dir: projectPath(),
|
|
20
|
-
from: fromRevision || void 0,
|
|
21
|
-
to: toRevision,
|
|
22
|
-
output: isDryRun ? !1 : "CHANGELOG.md",
|
|
23
|
-
theme: "github",
|
|
24
|
-
verbose: options?.verbose === !0
|
|
25
|
-
}), result = await generateChangelog(config);
|
|
26
|
-
if (isDryRun && !options?.quiet)
|
|
27
|
-
log.info(result.content);
|
|
1
|
+
import{execSync,log,parseOptions}from"@stacksjs/cli";import{projectPath}from"@stacksjs/path";import{generateChangelog,loadLogsmithConfig}from"@stacksjs/logsmith";const sanitizeRevision=(revision)=>{const value=revision.trim();if(!/^[A-Za-z0-9._/-]+$/.test(value))throw Error(`Invalid git revision: ${value}`);return value};log.debug("Generating changelog");const options=parseOptions(),fromRevision=sanitizeRevision(options?.from?.toString()??await execSync("git describe --abbrev=0 --tags HEAD^").catch(()=>""));log.debug("FromRevision",fromRevision);const toRevision=sanitizeRevision(options?.to?.toString()??"HEAD");log.debug("ToRevision",toRevision);log.debug("Changelog Options",options);if(options?.version??options?.r)log.debug("Ignoring --version: logsmith headers the section from the from\u2026to range");const isDryRun=options?.dryRun===!0,config=await loadLogsmithConfig({dir:projectPath(),from:fromRevision||void 0,to:toRevision,output:isDryRun?!1:"CHANGELOG.md",theme:"github",verbose:options?.verbose===!0}),result=await generateChangelog(config);if(isDryRun&&!options?.quiet)log.info(result.content);
|
package/dist/check/ports.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import process from "node:process";
|
|
3
|
-
import { log } from "@stacksjs/logging";
|
|
4
|
-
import { findStacksProjects } from "@stacksjs/utils";
|
|
5
|
-
const projects = await findStacksProjects(void 0, { quiet: !0 });
|
|
6
|
-
log.debug("Running `buddy ports`");
|
|
7
|
-
log.debug(`Found ${projects.length} projects`);
|
|
8
|
-
log.debug("Projects:", projects);
|
|
9
|
-
for (const project of projects) {
|
|
10
|
-
log.debug("Running `buddy ports`");
|
|
11
|
-
log.debug("Project:", project);
|
|
12
|
-
$.cwd(project);
|
|
13
|
-
const ports = await $`./buddy ports --project ${project} --quiet`.text();
|
|
14
|
-
log.debug("ports", ports);
|
|
15
|
-
}
|
|
16
|
-
process.exit(0);
|
|
1
|
+
import{$}from"bun";import process from"node:process";import{log}from"@stacksjs/logging";import{findStacksProjects}from"@stacksjs/utils";const projects=await findStacksProjects(void 0,{quiet:!0});log.debug("Running `buddy ports`");log.debug(`Found ${projects.length} projects`);log.debug("Projects:",projects);for(const project of projects){log.debug("Running `buddy ports`");log.debug("Project:",project);$.cwd(project);const ports=await $`./buddy ports --project ${project} --quiet`.text();log.debug("ports",ports)}process.exit(0);
|
package/dist/clean.js
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { cleanProject } from "@stacksjs/utils";
|
|
3
|
-
log.info("Running clean command...");
|
|
4
|
-
await cleanProject();
|
|
1
|
+
import{log}from"@stacksjs/logging";import{cleanProject}from"@stacksjs/utils";log.info("Running clean command...");await cleanProject();
|
package/dist/commit.js
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { log } from "@stacksjs/logging";
|
|
3
|
-
import { projectPath } from "@stacksjs/path";
|
|
4
|
-
import { runNpmScript } from "@stacksjs/utils";
|
|
5
|
-
export async function invoke(options) {
|
|
6
|
-
log.info("Committing...");
|
|
7
|
-
await runNpmScript(NpmScript.Commit, { cwd: projectPath(), ...options });
|
|
8
|
-
log.success("Committed");
|
|
9
|
-
}
|
|
10
|
-
export async function commit(options) {
|
|
11
|
-
return await invoke(options);
|
|
12
|
-
}
|
|
1
|
+
import{NpmScript}from"@stacksjs/enums";import{log}from"@stacksjs/logging";import{projectPath}from"@stacksjs/path";import{runNpmScript}from"@stacksjs/utils";export async function invoke(options){log.info("Committing...");await runNpmScript(NpmScript.Commit,{cwd:projectPath(),...options});log.success("Committed")}export async function commit(options){return await invoke(options)}
|
package/dist/copy-types.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { copyFolder } from "@stacksjs/storage";
|
|
3
|
-
const destinations = [
|
|
4
|
-
[frameworkPath("dist/types/components"), frameworkPath("defaults/resources/components/web/dist/types")],
|
|
5
|
-
[frameworkPath("dist/types/functions"), frameworkPath("defaults/functions/dist/types")]
|
|
6
|
-
];
|
|
7
|
-
destinations.forEach(([src, dest]) => {
|
|
8
|
-
copyFolder(src, dest);
|
|
9
|
-
});
|
|
1
|
+
import{frameworkPath}from"@stacksjs/path";import{copyFolder}from"@stacksjs/storage";const destinations=[[frameworkPath("dist/types/components"),frameworkPath("defaults/resources/components/web/dist/types")],[frameworkPath("dist/types/functions"),frameworkPath("defaults/functions/dist/types")]];destinations.forEach(([src,dest])=>{copyFolder(src,dest)});
|
package/dist/database/seed.js
CHANGED
|
@@ -1,26 +1 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import { log } from "@stacksjs/cli";
|
|
3
|
-
import { seed } from "@stacksjs/database";
|
|
4
|
-
const argv = process.argv.slice(2), allowProtected = argv.includes("--allow-protected") || argv.includes("--allowProtected"), fresh = argv.includes("--fresh"), startTime = Date.now();
|
|
5
|
-
try {
|
|
6
|
-
const result = await seed({ verbose: !0, fresh, allowProtected }), duration = Date.now() - startTime;
|
|
7
|
-
if (result.failed > 0) {
|
|
8
|
-
log.warn("");
|
|
9
|
-
log.warn(`Seeding completed with ${result.failed} failure(s):`);
|
|
10
|
-
for (const r of result.results)
|
|
11
|
-
if (!r.success)
|
|
12
|
-
log.error(` - ${r.model}: ${r.error}`);
|
|
13
|
-
log.info("");
|
|
14
|
-
log.info("Note: Failed models may have schema mismatches or invalid factory functions.");
|
|
15
|
-
log.info("Tip: Run `./buddy migrate:fresh` to ensure schema is up to date.");
|
|
16
|
-
}
|
|
17
|
-
log.info("");
|
|
18
|
-
log.success(`Seeding completed in ${duration}ms`);
|
|
19
|
-
log.info(` Total models: ${result.total}`);
|
|
20
|
-
log.info(` Successful: ${result.successful}`);
|
|
21
|
-
log.info(` Failed: ${result.failed}`);
|
|
22
|
-
process.exit(0);
|
|
23
|
-
} catch (err) {
|
|
24
|
-
log.error("Seeding failed catastrophically:", err);
|
|
25
|
-
process.exit(1);
|
|
26
|
-
}
|
|
1
|
+
import process from"node:process";import{log}from"@stacksjs/cli";import{seed}from"@stacksjs/database";const argv=process.argv.slice(2),allowProtected=argv.includes("--allow-protected")||argv.includes("--allowProtected"),fresh=argv.includes("--fresh"),startTime=Date.now();try{const result=await seed({verbose:!0,fresh,allowProtected}),duration=Date.now()-startTime;if(result.failed>0){log.warn("");log.warn(`Seeding completed with ${result.failed} failure(s):`);for(const r of result.results)if(!r.success)log.error(` - ${r.model}: ${r.error}`);log.info("");log.info("Note: Failed models may have schema mismatches or invalid factory functions.");log.info("Tip: Run `./buddy migrate:fresh` to ensure schema is up to date.")}log.info("");log.success(`Seeding completed in ${duration}ms`);log.info(` Total models: ${result.total}`);log.info(` Successful: ${result.successful}`);log.info(` Failed: ${result.failed}`);process.exit(0)}catch(err){log.error("Seeding failed catastrophically:",err);process.exit(1)}
|
|
@@ -1,36 +1 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import { S3Client, SESClient } from "@stacksjs/ts-cloud";
|
|
3
|
-
import { log } from "@stacksjs/cli";
|
|
4
|
-
import { ExitCode } from "@stacksjs/types";
|
|
5
|
-
const ses = new SESClient, s3 = new S3Client;
|
|
6
|
-
let bucketName;
|
|
7
|
-
const data = await s3.listBuckets();
|
|
8
|
-
if (data.Buckets)
|
|
9
|
-
bucketName = data.Buckets.find((bucket) => bucket.Name?.includes("-email-"))?.Name;
|
|
10
|
-
console.log("Bucket Name:", bucketName);
|
|
11
|
-
if (!bucketName) {
|
|
12
|
-
console.log("Stacks Email Bucket not found");
|
|
13
|
-
process.exit(ExitCode.FatalError);
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
await ses.createReceiptRule({
|
|
17
|
-
RuleSetName: "your-rule-set-name",
|
|
18
|
-
Rule: {
|
|
19
|
-
Name: "Inbound",
|
|
20
|
-
Enabled: !0,
|
|
21
|
-
ScanEnabled: !0,
|
|
22
|
-
TlsPolicy: "Require",
|
|
23
|
-
Actions: [
|
|
24
|
-
{
|
|
25
|
-
S3Action: {
|
|
26
|
-
BucketName: bucketName,
|
|
27
|
-
ObjectKeyPrefix: "tmp/email_in"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
log.info("Success: Receipt rule created");
|
|
34
|
-
} catch (error) {
|
|
35
|
-
console.error(error);
|
|
36
|
-
}
|
|
1
|
+
import process from"node:process";import{S3Client,SESClient}from"@stacksjs/ts-cloud";import{log}from"@stacksjs/cli";import{ExitCode}from"@stacksjs/types";const ses=new SESClient,s3=new S3Client;let bucketName;const data=await s3.listBuckets();if(data.Buckets)bucketName=data.Buckets.find((bucket)=>bucket.Name?.includes("-email-"))?.Name;console.log("Bucket Name:",bucketName);if(!bucketName){console.log("Stacks Email Bucket not found");process.exit(ExitCode.FatalError)}try{await ses.createReceiptRule({RuleSetName:"your-rule-set-name",Rule:{Name:"Inbound",Enabled:!0,ScanEnabled:!0,TlsPolicy:"Require",Actions:[{S3Action:{BucketName:bucketName,ObjectKeyPrefix:"tmp/email_in"}}]}});log.info("Success: Receipt rule created")}catch(error){console.error(error)}
|