@treeseed/cli 0.1.1 → 0.4.2
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 +27 -26
- package/dist/cli/handlers/auth-login.d.ts +2 -0
- package/dist/cli/handlers/auth-login.js +67 -0
- package/dist/cli/handlers/auth-logout.d.ts +2 -0
- package/dist/cli/handlers/auth-logout.js +20 -0
- package/dist/cli/handlers/auth-whoami.d.ts +2 -0
- package/dist/cli/handlers/auth-whoami.js +24 -0
- package/dist/cli/handlers/close.js +19 -53
- package/dist/cli/handlers/config.js +33 -53
- package/dist/cli/handlers/destroy.js +34 -79
- package/dist/{src/cli/handlers/ship.d.ts → cli/handlers/dev.d.ts} +1 -1
- package/dist/cli/handlers/dev.js +19 -0
- package/dist/cli/handlers/doctor.js +13 -6
- package/dist/cli/handlers/init.js +32 -8
- package/dist/cli/handlers/release.js +21 -53
- package/dist/cli/handlers/rollback.js +8 -8
- package/dist/cli/handlers/save.js +21 -79
- package/dist/cli/handlers/stage.d.ts +2 -0
- package/dist/cli/handlers/stage.js +28 -0
- package/dist/cli/handlers/status.js +35 -26
- package/dist/{src/cli/handlers/deploy.d.ts → cli/handlers/switch.d.ts} +1 -1
- package/dist/cli/handlers/switch.js +29 -0
- package/dist/{src/cli/handlers/next.d.ts → cli/handlers/sync.d.ts} +1 -1
- package/dist/cli/handlers/sync.js +26 -0
- package/dist/cli/handlers/tasks.d.ts +2 -0
- package/dist/cli/handlers/tasks.js +31 -0
- package/dist/cli/handlers/template.d.ts +2 -0
- package/dist/cli/handlers/template.js +27 -0
- package/dist/cli/handlers/workflow.d.ts +6 -0
- package/dist/cli/handlers/workflow.js +71 -0
- package/dist/{src/cli → cli}/help.d.ts +2 -2
- package/dist/cli/help.js +36 -24
- package/dist/cli/main.d.ts +6 -0
- package/dist/cli/main.js +14 -19
- package/dist/cli/operations-help.d.ts +1 -0
- package/dist/cli/operations-help.js +1 -0
- package/dist/cli/operations-parser.d.ts +1 -0
- package/dist/cli/operations-parser.js +1 -0
- package/dist/cli/operations-registry.d.ts +5 -0
- package/dist/cli/operations-registry.js +260 -0
- package/dist/cli/operations-types.d.ts +72 -0
- package/dist/cli/parser.d.ts +3 -0
- package/dist/cli/parser.js +1 -6
- package/dist/cli/registry.d.ts +25 -0
- package/dist/cli/registry.js +28 -416
- package/dist/cli/repair.js +6 -4
- package/dist/cli/runtime.d.ts +31 -0
- package/dist/cli/runtime.js +240 -111
- package/dist/cli/types.d.ts +1 -0
- package/dist/{src/cli → cli}/workflow-state.d.ts +9 -0
- package/dist/cli/workflow-state.js +45 -21
- package/package.json +13 -13
- package/dist/cli/handlers/continue.js +0 -23
- package/dist/cli/handlers/deploy.js +0 -139
- package/dist/cli/handlers/next.js +0 -27
- package/dist/cli/handlers/prepare.js +0 -8
- package/dist/cli/handlers/promote.js +0 -8
- package/dist/cli/handlers/publish.js +0 -8
- package/dist/cli/handlers/setup.js +0 -48
- package/dist/cli/handlers/ship.js +0 -49
- package/dist/cli/handlers/start.js +0 -97
- package/dist/cli/handlers/teardown.js +0 -50
- package/dist/cli/handlers/work.js +0 -85
- package/dist/scripts/aggregate-book.d.ts +0 -1
- package/dist/scripts/aggregate-book.js +0 -121
- package/dist/scripts/assert-release-tag-version.d.ts +0 -1
- package/dist/scripts/assert-release-tag-version.js +0 -21
- package/dist/scripts/build-dist.d.ts +0 -1
- package/dist/scripts/build-dist.js +0 -108
- package/dist/scripts/build-tenant-worker.d.ts +0 -1
- package/dist/scripts/build-tenant-worker.js +0 -36
- package/dist/scripts/cleanup-markdown.d.ts +0 -2
- package/dist/scripts/cleanup-markdown.js +0 -373
- package/dist/scripts/config-runtime-lib.d.ts +0 -122
- package/dist/scripts/config-runtime-lib.js +0 -505
- package/dist/scripts/config-treeseed.d.ts +0 -2
- package/dist/scripts/config-treeseed.js +0 -81
- package/dist/scripts/d1-migration-lib.d.ts +0 -6
- package/dist/scripts/d1-migration-lib.js +0 -90
- package/dist/scripts/deploy-lib.d.ts +0 -127
- package/dist/scripts/deploy-lib.js +0 -841
- package/dist/scripts/ensure-mailpit.d.ts +0 -1
- package/dist/scripts/ensure-mailpit.js +0 -29
- package/dist/scripts/git-workflow-lib.d.ts +0 -25
- package/dist/scripts/git-workflow-lib.js +0 -136
- package/dist/scripts/github-automation-lib.d.ts +0 -156
- package/dist/scripts/github-automation-lib.js +0 -242
- package/dist/scripts/local-dev-lib.d.ts +0 -9
- package/dist/scripts/local-dev-lib.js +0 -84
- package/dist/scripts/local-dev.d.ts +0 -1
- package/dist/scripts/local-dev.js +0 -129
- package/dist/scripts/logs-mailpit.d.ts +0 -1
- package/dist/scripts/logs-mailpit.js +0 -2
- package/dist/scripts/mailpit-runtime.d.ts +0 -4
- package/dist/scripts/mailpit-runtime.js +0 -57
- package/dist/scripts/package-tools.d.ts +0 -22
- package/dist/scripts/package-tools.js +0 -255
- package/dist/scripts/patch-starlight-content-path.d.ts +0 -1
- package/dist/scripts/patch-starlight-content-path.js +0 -172
- package/dist/scripts/paths.d.ts +0 -17
- package/dist/scripts/paths.js +0 -26
- package/dist/scripts/publish-package.d.ts +0 -1
- package/dist/scripts/publish-package.js +0 -19
- package/dist/scripts/release-verify.d.ts +0 -1
- package/dist/scripts/release-verify.js +0 -136
- package/dist/scripts/run-fixture-astro-command.d.ts +0 -1
- package/dist/scripts/run-fixture-astro-command.js +0 -18
- package/dist/scripts/save-deploy-preflight-lib.d.ts +0 -34
- package/dist/scripts/save-deploy-preflight-lib.js +0 -69
- package/dist/scripts/scaffold-site.d.ts +0 -2
- package/dist/scripts/scaffold-site.js +0 -92
- package/dist/scripts/stop-mailpit.d.ts +0 -1
- package/dist/scripts/stop-mailpit.js +0 -5
- package/dist/scripts/sync-dev-vars.d.ts +0 -1
- package/dist/scripts/sync-dev-vars.js +0 -6
- package/dist/scripts/template-registry-lib.d.ts +0 -47
- package/dist/scripts/template-registry-lib.js +0 -137
- package/dist/scripts/tenant-astro-command.d.ts +0 -1
- package/dist/scripts/tenant-astro-command.js +0 -3
- package/dist/scripts/tenant-build.d.ts +0 -1
- package/dist/scripts/tenant-build.js +0 -16
- package/dist/scripts/tenant-check.d.ts +0 -1
- package/dist/scripts/tenant-check.js +0 -7
- package/dist/scripts/tenant-d1-migrate-local.d.ts +0 -1
- package/dist/scripts/tenant-d1-migrate-local.js +0 -11
- package/dist/scripts/tenant-deploy.d.ts +0 -2
- package/dist/scripts/tenant-deploy.js +0 -180
- package/dist/scripts/tenant-destroy.d.ts +0 -2
- package/dist/scripts/tenant-destroy.js +0 -104
- package/dist/scripts/tenant-dev.d.ts +0 -1
- package/dist/scripts/tenant-dev.js +0 -171
- package/dist/scripts/tenant-lint.d.ts +0 -1
- package/dist/scripts/tenant-lint.js +0 -4
- package/dist/scripts/tenant-test.d.ts +0 -1
- package/dist/scripts/tenant-test.js +0 -4
- package/dist/scripts/test-cloudflare-local.d.ts +0 -1
- package/dist/scripts/test-cloudflare-local.js +0 -212
- package/dist/scripts/test-scaffold.d.ts +0 -2
- package/dist/scripts/test-scaffold.js +0 -297
- package/dist/scripts/treeseed.d.ts +0 -2
- package/dist/scripts/treeseed.js +0 -4
- package/dist/scripts/validate-templates.d.ts +0 -2
- package/dist/scripts/validate-templates.js +0 -4
- package/dist/scripts/watch-dev-lib.d.ts +0 -21
- package/dist/scripts/watch-dev-lib.js +0 -277
- package/dist/scripts/workspace-close.d.ts +0 -2
- package/dist/scripts/workspace-close.js +0 -24
- package/dist/scripts/workspace-command-e2e.d.ts +0 -2
- package/dist/scripts/workspace-command-e2e.js +0 -718
- package/dist/scripts/workspace-lint.d.ts +0 -1
- package/dist/scripts/workspace-lint.js +0 -9
- package/dist/scripts/workspace-preflight-lib.d.ts +0 -36
- package/dist/scripts/workspace-preflight-lib.js +0 -179
- package/dist/scripts/workspace-preflight.d.ts +0 -2
- package/dist/scripts/workspace-preflight.js +0 -22
- package/dist/scripts/workspace-publish-changed-packages.d.ts +0 -1
- package/dist/scripts/workspace-publish-changed-packages.js +0 -16
- package/dist/scripts/workspace-release-verify.d.ts +0 -1
- package/dist/scripts/workspace-release-verify.js +0 -81
- package/dist/scripts/workspace-release.d.ts +0 -2
- package/dist/scripts/workspace-release.js +0 -42
- package/dist/scripts/workspace-save-lib.d.ts +0 -42
- package/dist/scripts/workspace-save-lib.js +0 -220
- package/dist/scripts/workspace-save.d.ts +0 -2
- package/dist/scripts/workspace-save.js +0 -124
- package/dist/scripts/workspace-start-warning.js +0 -3
- package/dist/scripts/workspace-start.d.ts +0 -2
- package/dist/scripts/workspace-start.js +0 -71
- package/dist/scripts/workspace-test-unit.d.ts +0 -1
- package/dist/scripts/workspace-test-unit.js +0 -4
- package/dist/scripts/workspace-test.d.ts +0 -1
- package/dist/scripts/workspace-test.js +0 -11
- package/dist/scripts/workspace-tools.d.ts +0 -13
- package/dist/scripts/workspace-tools.js +0 -226
- package/dist/src/cli/handlers/continue.d.ts +0 -2
- package/dist/src/cli/handlers/prepare.d.ts +0 -2
- package/dist/src/cli/handlers/promote.d.ts +0 -2
- package/dist/src/cli/handlers/publish.d.ts +0 -2
- package/dist/src/cli/handlers/setup.d.ts +0 -2
- package/dist/src/cli/handlers/start.d.ts +0 -3
- package/dist/src/cli/handlers/teardown.d.ts +0 -2
- package/dist/src/cli/handlers/work.d.ts +0 -2
- package/dist/src/cli/main.d.ts +0 -6
- package/dist/src/cli/parser.d.ts +0 -3
- package/dist/src/cli/registry.d.ts +0 -27
- package/dist/src/cli/runtime.d.ts +0 -4
- package/dist/src/cli/types.d.ts +0 -71
- /package/dist/{src/cli → cli}/handlers/close.d.ts +0 -0
- /package/dist/{src/cli → cli}/handlers/config.d.ts +0 -0
- /package/dist/{src/cli → cli}/handlers/destroy.d.ts +0 -0
- /package/dist/{src/cli → cli}/handlers/doctor.d.ts +0 -0
- /package/dist/{src/cli → cli}/handlers/init.d.ts +0 -0
- /package/dist/{src/cli → cli}/handlers/release.d.ts +0 -0
- /package/dist/{src/cli → cli}/handlers/rollback.d.ts +0 -0
- /package/dist/{src/cli → cli}/handlers/save.d.ts +0 -0
- /package/dist/{src/cli → cli}/handlers/status.d.ts +0 -0
- /package/dist/{src/cli → cli}/handlers/utils.d.ts +0 -0
- /package/dist/{scripts/workspace-start-warning.d.ts → cli/operations-types.js} +0 -0
- /package/dist/{src/cli → cli}/repair.d.ts +0 -0
- /package/dist/{src/index.d.ts → index.d.ts} +0 -0
package/dist/scripts/paths.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { corePackageRoot, packageRoot } from './package-tools.js';
|
|
5
|
-
const pathsPackageRoot = resolve(fileURLToPath(new URL('..', import.meta.url)));
|
|
6
|
-
export const cliPackageRoot = pathsPackageRoot.endsWith('/dist')
|
|
7
|
-
? resolve(pathsPackageRoot, '..')
|
|
8
|
-
: pathsPackageRoot;
|
|
9
|
-
export { corePackageRoot, packageRoot };
|
|
10
|
-
export const workspaceRoot = resolve(cliPackageRoot, '..');
|
|
11
|
-
function resolveProjectRoot(localPath, workspacePath) {
|
|
12
|
-
return existsSync(localPath) ? localPath : workspacePath;
|
|
13
|
-
}
|
|
14
|
-
export const templatesRoot = resolveProjectRoot(resolve(cliPackageRoot, 'templates'), resolve(workspaceRoot, 'templates'));
|
|
15
|
-
export const examplesRoot = resolveProjectRoot(resolve(cliPackageRoot, 'examples'), resolve(workspaceRoot, 'examples'));
|
|
16
|
-
export const fixturesRoot = resolveProjectRoot(resolve(cliPackageRoot, '.fixtures', 'treeseed-fixtures'), resolve(workspaceRoot, 'fixtures'));
|
|
17
|
-
export const referenceAppsRoot = resolveProjectRoot(resolve(cliPackageRoot, 'reference-apps'), resolve(workspaceRoot, 'reference-apps'));
|
|
18
|
-
export const toolingRoot = resolveProjectRoot(resolve(cliPackageRoot, 'tooling'), resolve(workspaceRoot, 'tooling'));
|
|
19
|
-
export const servicesRoot = resolve(packageRoot, 'services');
|
|
20
|
-
export const mailpitComposeFile = resolve(servicesRoot, 'compose.yml');
|
|
21
|
-
export const fixtureRoot = resolve(corePackageRoot, 'fixture');
|
|
22
|
-
export const fixtureWranglerConfig = resolve(fixtureRoot, 'wrangler.toml');
|
|
23
|
-
export const fixtureMigrationsRoot = resolve(fixtureRoot, 'migrations');
|
|
24
|
-
export const fixtureSrcRoot = resolve(fixtureRoot, 'src');
|
|
25
|
-
export const cliPackageVersion = JSON.parse(readFileSync(resolve(cliPackageRoot, 'package.json'), 'utf8')).version;
|
|
26
|
-
export const corePackageVersion = JSON.parse(readFileSync(resolve(corePackageRoot, 'package.json'), 'utf8')).version;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
const packageRoot = resolve(fileURLToPath(new URL('..', import.meta.url)));
|
|
5
|
-
const extraArgs = process.argv.slice(2);
|
|
6
|
-
const npmArgs = ['publish', '.', '--access', 'public'];
|
|
7
|
-
if (process.env.GITHUB_ACTIONS === 'true')
|
|
8
|
-
npmArgs.push('--provenance');
|
|
9
|
-
npmArgs.push(...extraArgs);
|
|
10
|
-
const result = spawnSync('npm', npmArgs, {
|
|
11
|
-
cwd: packageRoot,
|
|
12
|
-
stdio: 'inherit',
|
|
13
|
-
env: process.env,
|
|
14
|
-
});
|
|
15
|
-
if (result.error) {
|
|
16
|
-
console.error(result.error.message);
|
|
17
|
-
process.exit(1);
|
|
18
|
-
}
|
|
19
|
-
process.exit(result.status ?? 1);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, symlinkSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import { mkdtempSync } from 'node:fs';
|
|
3
|
-
import { tmpdir } from 'node:os';
|
|
4
|
-
import { dirname, extname, join, resolve } from 'node:path';
|
|
5
|
-
import { spawnSync } from 'node:child_process';
|
|
6
|
-
import { agentPackageRoot, corePackageRoot, packageRoot, sdkPackageRoot } from './package-tools.js';
|
|
7
|
-
const textExtensions = new Set(['.js', '.ts', '.mjs', '.cjs', '.d.js', '.json', '.md']);
|
|
8
|
-
const forbiddenPatterns = [
|
|
9
|
-
/['"`]file:[^'"`\n]+['"`]/,
|
|
10
|
-
/['"`]workspace:[^'"`\n]+['"`]/,
|
|
11
|
-
/['"`](?:\.\.\/|\.\/)[^'"`\n]*src\/[^'"`\n]*\.(?:[cm]?js|ts|tsx|json|astro|css)['"`]/,
|
|
12
|
-
/['"`][^'"`\n]*\/packages\/[^'"`\n]*\/src\/[^'"`\n]*['"`]/,
|
|
13
|
-
];
|
|
14
|
-
function run(command, args, cwd = packageRoot, capture = false) {
|
|
15
|
-
const result = spawnSync(command, args, {
|
|
16
|
-
cwd,
|
|
17
|
-
stdio: capture ? 'pipe' : 'inherit',
|
|
18
|
-
encoding: 'utf8',
|
|
19
|
-
env: process.env,
|
|
20
|
-
});
|
|
21
|
-
if (result.status !== 0) {
|
|
22
|
-
throw new Error(result.stderr?.trim() || result.stdout?.trim() || `${command} ${args.join(' ')} failed`);
|
|
23
|
-
}
|
|
24
|
-
return (result.stdout ?? '').trim();
|
|
25
|
-
}
|
|
26
|
-
function walkFiles(root) {
|
|
27
|
-
const files = [];
|
|
28
|
-
for (const entry of readdirSync(root, { withFileTypes: true })) {
|
|
29
|
-
const fullPath = join(root, entry.name);
|
|
30
|
-
if (entry.isDirectory()) {
|
|
31
|
-
files.push(...walkFiles(fullPath));
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
files.push(fullPath);
|
|
35
|
-
}
|
|
36
|
-
return files;
|
|
37
|
-
}
|
|
38
|
-
function scanDirectory(root) {
|
|
39
|
-
for (const filePath of walkFiles(root)) {
|
|
40
|
-
if (!textExtensions.has(extname(filePath)))
|
|
41
|
-
continue;
|
|
42
|
-
const source = readFileSync(filePath, 'utf8');
|
|
43
|
-
for (const pattern of forbiddenPatterns) {
|
|
44
|
-
if (pattern.test(source)) {
|
|
45
|
-
throw new Error(`${filePath} contains forbidden publish reference matching ${pattern}.`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function resolveNodeModulesRoot() {
|
|
51
|
-
let lastCandidate = null;
|
|
52
|
-
let current = packageRoot;
|
|
53
|
-
while (true) {
|
|
54
|
-
const candidate = resolve(current, 'node_modules');
|
|
55
|
-
try {
|
|
56
|
-
readdirSync(candidate);
|
|
57
|
-
lastCandidate = candidate;
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
}
|
|
61
|
-
const parent = resolve(current, '..');
|
|
62
|
-
if (parent === current)
|
|
63
|
-
break;
|
|
64
|
-
current = parent;
|
|
65
|
-
}
|
|
66
|
-
if (lastCandidate) {
|
|
67
|
-
return lastCandidate;
|
|
68
|
-
}
|
|
69
|
-
throw new Error(`Unable to locate node_modules for ${packageRoot}.`);
|
|
70
|
-
}
|
|
71
|
-
function mirrorDependencies(tempRoot) {
|
|
72
|
-
const sharedNodeModules = resolveNodeModulesRoot();
|
|
73
|
-
for (const entry of readdirSync(sharedNodeModules, { withFileTypes: true })) {
|
|
74
|
-
if (entry.name === '.bin') {
|
|
75
|
-
continue;
|
|
76
|
-
}
|
|
77
|
-
if (entry.name === '@treeseed') {
|
|
78
|
-
const sourceScopeRoot = resolve(sharedNodeModules, entry.name);
|
|
79
|
-
const targetScopeRoot = resolve(tempRoot, 'node_modules', entry.name);
|
|
80
|
-
mkdirSync(targetScopeRoot, { recursive: true });
|
|
81
|
-
for (const scopedEntry of readdirSync(sourceScopeRoot, { withFileTypes: true })) {
|
|
82
|
-
if (scopedEntry.name === 'cli') {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
const targetPath = resolve(targetScopeRoot, scopedEntry.name);
|
|
86
|
-
symlinkSync(resolve(sourceScopeRoot, scopedEntry.name), targetPath, scopedEntry.isDirectory() ? 'dir' : 'file');
|
|
87
|
-
}
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
|
-
const targetPath = resolve(tempRoot, 'node_modules', entry.name);
|
|
91
|
-
mkdirSync(dirname(targetPath), { recursive: true });
|
|
92
|
-
symlinkSync(resolve(sharedNodeModules, entry.name), targetPath, entry.isDirectory() ? 'dir' : 'file');
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function pack(root, fallbackName) {
|
|
96
|
-
const output = run('npm', ['pack', '--silent', '--ignore-scripts'], root, true);
|
|
97
|
-
const filename = output
|
|
98
|
-
.split('\n')
|
|
99
|
-
.map((line) => line.trim())
|
|
100
|
-
.filter(Boolean)
|
|
101
|
-
.at(-1) ?? fallbackName;
|
|
102
|
-
return resolve(root, filename);
|
|
103
|
-
}
|
|
104
|
-
function installPackagedPackage(extractRoot, tempRoot, tarballPath, folderName) {
|
|
105
|
-
mkdirSync(resolve(tempRoot, 'node_modules', '@treeseed'), { recursive: true });
|
|
106
|
-
run('tar', ['-xzf', tarballPath, '-C', extractRoot]);
|
|
107
|
-
run('cp', ['-R', resolve(extractRoot, 'package'), resolve(tempRoot, 'node_modules', '@treeseed', folderName)]);
|
|
108
|
-
rmSync(resolve(extractRoot, 'package'), { recursive: true, force: true });
|
|
109
|
-
}
|
|
110
|
-
function hasWorkspacePackageSource(root) {
|
|
111
|
-
return root !== packageRoot && existsSync(resolve(root, 'scripts'));
|
|
112
|
-
}
|
|
113
|
-
run('npm', ['run', 'build']);
|
|
114
|
-
scanDirectory(resolve(packageRoot, 'dist'));
|
|
115
|
-
run('npm', ['test']);
|
|
116
|
-
if (hasWorkspacePackageSource(sdkPackageRoot) && hasWorkspacePackageSource(corePackageRoot) && hasWorkspacePackageSource(agentPackageRoot)) {
|
|
117
|
-
run('npm', ['run', 'test:scaffold']);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
console.log('Skipping scaffold verification because local sdk/core/agent package sources are not available.');
|
|
121
|
-
}
|
|
122
|
-
const stageRoot = mkdtempSync(join(tmpdir(), 'treeseed-cli-release-'));
|
|
123
|
-
const extractRoot = resolve(stageRoot, 'extract');
|
|
124
|
-
const installRoot = resolve(stageRoot, 'install');
|
|
125
|
-
try {
|
|
126
|
-
mkdirSync(extractRoot, { recursive: true });
|
|
127
|
-
const cliTarball = pack(packageRoot, 'treeseed-cli.tgz');
|
|
128
|
-
mirrorDependencies(installRoot);
|
|
129
|
-
installPackagedPackage(extractRoot, installRoot, cliTarball, 'cli');
|
|
130
|
-
writeFileSync(resolve(installRoot, 'package.json'), `${JSON.stringify({ name: 'treeseed-cli-smoke', private: true, type: 'module' }, null, 2)}\n`, 'utf8');
|
|
131
|
-
run(process.execPath, ['node_modules/@treeseed/cli/dist/cli/main.js', '--help'], installRoot);
|
|
132
|
-
console.log('CLI packed-install bin smoke passed.');
|
|
133
|
-
}
|
|
134
|
-
finally {
|
|
135
|
-
rmSync(stageRoot, { recursive: true, force: true });
|
|
136
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { corePackageRoot, fixtureRoot } from './paths.js';
|
|
3
|
-
const [command, ...rest] = process.argv.slice(2);
|
|
4
|
-
if (!command) {
|
|
5
|
-
console.error('Usage: node ./scripts/run-fixture-astro-command.mjs <check|build|preview|dev> [...args]');
|
|
6
|
-
process.exit(1);
|
|
7
|
-
}
|
|
8
|
-
const result = spawnSync('npx', ['astro', command, '--root', fixtureRoot, ...rest], {
|
|
9
|
-
cwd: corePackageRoot,
|
|
10
|
-
stdio: 'inherit',
|
|
11
|
-
env: process.env,
|
|
12
|
-
shell: process.platform === 'win32',
|
|
13
|
-
});
|
|
14
|
-
if (result.error) {
|
|
15
|
-
console.error(result.error.message);
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
process.exit(result.status ?? 1);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export declare function validateSaveAutomationPrerequisites({ cwd }: {
|
|
2
|
-
cwd: any;
|
|
3
|
-
}): {
|
|
4
|
-
ok: boolean;
|
|
5
|
-
mode: string;
|
|
6
|
-
missingEnv: never[];
|
|
7
|
-
preflight: null;
|
|
8
|
-
} | {
|
|
9
|
-
ok: boolean;
|
|
10
|
-
mode: string;
|
|
11
|
-
missingEnv: never[];
|
|
12
|
-
preflight: {
|
|
13
|
-
ok: boolean;
|
|
14
|
-
requireAuth: boolean;
|
|
15
|
-
missingCommands: string[];
|
|
16
|
-
failingAuth: string[];
|
|
17
|
-
checks: {
|
|
18
|
-
commands: {
|
|
19
|
-
[k: string]: {
|
|
20
|
-
installed: boolean;
|
|
21
|
-
path: string | null;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
auth: {};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export declare function runWorkspaceSavePreflight({ cwd }: {
|
|
29
|
-
cwd: any;
|
|
30
|
-
}): void;
|
|
31
|
-
export declare function runTenantDeployPreflight({ cwd, scope }: {
|
|
32
|
-
cwd: any;
|
|
33
|
-
scope?: string | undefined;
|
|
34
|
-
}): void;
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { packageScriptPath } from './package-tools.js';
|
|
3
|
-
import { applyTreeseedEnvironmentToProcess, assertTreeseedCommandEnvironment } from './config-runtime-lib.js';
|
|
4
|
-
import { collectCliPreflight } from './workspace-preflight-lib.js';
|
|
5
|
-
import { getGitHubAutomationMode, requiredGitHubEnvironment } from './github-automation-lib.js';
|
|
6
|
-
function runStep(label, scriptName, { cwd, env } = {}) {
|
|
7
|
-
const result = spawnSync(process.execPath, [packageScriptPath(scriptName)], {
|
|
8
|
-
cwd,
|
|
9
|
-
env: { ...process.env, ...(env ?? {}) },
|
|
10
|
-
stdio: 'inherit',
|
|
11
|
-
});
|
|
12
|
-
if (result.status !== 0) {
|
|
13
|
-
const error = new Error(`${label} failed.`);
|
|
14
|
-
error.kind = `${label}_failed`;
|
|
15
|
-
error.exitCode = result.status ?? 1;
|
|
16
|
-
throw error;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function missingRequiredEnv(requiredKeys) {
|
|
20
|
-
return requiredKeys.filter((key) => {
|
|
21
|
-
const value = process.env[key];
|
|
22
|
-
return typeof value !== 'string' || value.length === 0;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
export function validateSaveAutomationPrerequisites({ cwd }) {
|
|
26
|
-
applyTreeseedEnvironmentToProcess({ tenantRoot: cwd, scope: 'prod' });
|
|
27
|
-
assertTreeseedCommandEnvironment({ tenantRoot: cwd, scope: 'prod', purpose: 'save' });
|
|
28
|
-
if (getGitHubAutomationMode() !== 'real') {
|
|
29
|
-
return {
|
|
30
|
-
ok: true,
|
|
31
|
-
mode: 'stub',
|
|
32
|
-
missingEnv: [],
|
|
33
|
-
preflight: null,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
const preflight = collectCliPreflight({ cwd, requireAuth: true });
|
|
37
|
-
if (!preflight.ok) {
|
|
38
|
-
const error = new Error('Treeseed save prerequisites failed: GitHub/Wrangler auth is not ready.');
|
|
39
|
-
error.kind = 'auth_failed';
|
|
40
|
-
error.details = preflight;
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
const required = requiredGitHubEnvironment(cwd, { scope: 'prod', purpose: 'save' });
|
|
44
|
-
const missingEnv = missingRequiredEnv([...required.secrets, ...required.variables]);
|
|
45
|
-
if (missingEnv.length > 0) {
|
|
46
|
-
const error = new Error(`Treeseed save is missing required environment variables: ${missingEnv.join(', ')}.`);
|
|
47
|
-
error.kind = 'missing_required_env';
|
|
48
|
-
error.missingEnv = missingEnv;
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
ok: true,
|
|
53
|
-
mode: 'real',
|
|
54
|
-
missingEnv: [],
|
|
55
|
-
preflight,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
export function runWorkspaceSavePreflight({ cwd }) {
|
|
59
|
-
runStep('lint', 'workspace-lint', { cwd });
|
|
60
|
-
runStep('test', 'workspace-test', { cwd });
|
|
61
|
-
runStep('build', 'tenant-build', { cwd });
|
|
62
|
-
}
|
|
63
|
-
export function runTenantDeployPreflight({ cwd, scope = 'prod' }) {
|
|
64
|
-
applyTreeseedEnvironmentToProcess({ tenantRoot: cwd, scope });
|
|
65
|
-
assertTreeseedCommandEnvironment({ tenantRoot: cwd, scope, purpose: 'deploy' });
|
|
66
|
-
runStep('lint', 'tenant-lint', { cwd });
|
|
67
|
-
runStep('test', 'tenant-test', { cwd });
|
|
68
|
-
runStep('build', 'tenant-build', { cwd });
|
|
69
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
|
3
|
-
import { basename, join, resolve } from 'node:path';
|
|
4
|
-
import { resolveTemplateDefinition, buildTemplateReplacements, validateAllTemplateDefinitions } from './template-registry-lib.js';
|
|
5
|
-
function parseArgs(argv) {
|
|
6
|
-
const args = {
|
|
7
|
-
target: null,
|
|
8
|
-
template: 'starter-basic',
|
|
9
|
-
name: null,
|
|
10
|
-
slug: null,
|
|
11
|
-
siteUrl: null,
|
|
12
|
-
contactEmail: null,
|
|
13
|
-
repositoryUrl: null,
|
|
14
|
-
discordUrl: 'https://discord.gg/example',
|
|
15
|
-
};
|
|
16
|
-
const rest = [...argv];
|
|
17
|
-
while (rest.length > 0) {
|
|
18
|
-
const current = rest.shift();
|
|
19
|
-
if (!current)
|
|
20
|
-
continue;
|
|
21
|
-
if (!args.target && !current.startsWith('--')) {
|
|
22
|
-
args.target = current;
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
if (current === '--template')
|
|
26
|
-
args.template = rest.shift() ?? args.template;
|
|
27
|
-
else if (current === '--name')
|
|
28
|
-
args.name = rest.shift() ?? null;
|
|
29
|
-
else if (current === '--slug')
|
|
30
|
-
args.slug = rest.shift() ?? null;
|
|
31
|
-
else if (current === '--site-url')
|
|
32
|
-
args.siteUrl = rest.shift() ?? null;
|
|
33
|
-
else if (current === '--contact-email')
|
|
34
|
-
args.contactEmail = rest.shift() ?? null;
|
|
35
|
-
else if (current === '--repo')
|
|
36
|
-
args.repositoryUrl = rest.shift() ?? null;
|
|
37
|
-
else if (current === '--discord')
|
|
38
|
-
args.discordUrl = rest.shift() ?? args.discordUrl;
|
|
39
|
-
else
|
|
40
|
-
throw new Error(`Unknown argument: ${current}`);
|
|
41
|
-
}
|
|
42
|
-
if (!args.target)
|
|
43
|
-
throw new Error('Usage: treeseed init <directory> [--template <starter-id>] [--name <site name>] [--slug <slug>] [--site-url <url>] [--contact-email <email>] [--repo <url>] [--discord <url>]');
|
|
44
|
-
return args;
|
|
45
|
-
}
|
|
46
|
-
function replaceTokens(contents, replacements) {
|
|
47
|
-
return Object.entries(replacements).reduce((acc, [token, value]) => acc.replaceAll(token, value), contents);
|
|
48
|
-
}
|
|
49
|
-
function writeTemplateTree(sourceRoot, targetRoot, replacements) {
|
|
50
|
-
for (const entry of readdirSync(sourceRoot, { withFileTypes: true })) {
|
|
51
|
-
const sourcePath = join(sourceRoot, entry.name);
|
|
52
|
-
const targetPath = join(targetRoot, entry.name);
|
|
53
|
-
if (entry.isDirectory()) {
|
|
54
|
-
mkdirSync(targetPath, { recursive: true });
|
|
55
|
-
writeTemplateTree(sourcePath, targetPath, replacements);
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
const raw = readFileSync(sourcePath, 'utf8');
|
|
59
|
-
writeFileSync(targetPath, replaceTokens(raw, replacements), 'utf8');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
validateAllTemplateDefinitions();
|
|
63
|
-
const options = parseArgs(process.argv.slice(2));
|
|
64
|
-
const targetRoot = resolve(process.cwd(), options.target);
|
|
65
|
-
const definition = resolveTemplateDefinition(options.template, 'starter');
|
|
66
|
-
const replacements = buildTemplateReplacements(definition.manifest, {
|
|
67
|
-
target: basename(targetRoot),
|
|
68
|
-
name: options.name,
|
|
69
|
-
slug: options.slug,
|
|
70
|
-
siteUrl: options.siteUrl,
|
|
71
|
-
contactEmail: options.contactEmail,
|
|
72
|
-
repositoryUrl: options.repositoryUrl,
|
|
73
|
-
discordUrl: options.discordUrl,
|
|
74
|
-
});
|
|
75
|
-
if (existsSync(targetRoot) && readdirSync(targetRoot).length > 0) {
|
|
76
|
-
throw new Error(`Target directory is not empty: ${targetRoot}`);
|
|
77
|
-
}
|
|
78
|
-
mkdirSync(targetRoot, { recursive: true });
|
|
79
|
-
writeTemplateTree(definition.templateRoot, targetRoot, replacements);
|
|
80
|
-
console.log(`Created Treeseed tenant from ${definition.manifest.id} at ${targetRoot}`);
|
|
81
|
-
console.log('Next steps:');
|
|
82
|
-
console.log(` cd ${options.target}`);
|
|
83
|
-
console.log(' npm install');
|
|
84
|
-
console.log(' # set cloudflare.accountId in treeseed.site.yaml (or export CLOUDFLARE_ACCOUNT_ID)');
|
|
85
|
-
console.log(' wrangler login');
|
|
86
|
-
console.log(' treeseed config --environment local');
|
|
87
|
-
console.log(' treeseed config --environment staging --environment prod');
|
|
88
|
-
console.log(' treeseed start feature/my-change');
|
|
89
|
-
console.log(' treeseed deploy --environment staging --dry-run');
|
|
90
|
-
console.log(' treeseed save "describe your change"');
|
|
91
|
-
console.log(' treeseed release --patch');
|
|
92
|
-
console.log(' treeseed destroy --environment staging --dry-run');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { applyTreeseedEnvironmentToProcess, writeTreeseedLocalEnvironmentFiles } from './config-runtime-lib.js';
|
|
2
|
-
const tenantRoot = process.cwd();
|
|
3
|
-
applyTreeseedEnvironmentToProcess({ tenantRoot, scope: 'local' });
|
|
4
|
-
const result = writeTreeseedLocalEnvironmentFiles(tenantRoot);
|
|
5
|
-
console.log(`Wrote ${result.envLocalPath}`);
|
|
6
|
-
console.log(`Wrote ${result.devVarsPath}`);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
export declare const TEMPLATE_CATEGORIES: readonly ["starter", "example", "fixture", "reference-app"];
|
|
2
|
-
export type TemplateCategory = (typeof TEMPLATE_CATEGORIES)[number];
|
|
3
|
-
export interface TemplateVariableDefinition {
|
|
4
|
-
name: string;
|
|
5
|
-
token: string;
|
|
6
|
-
deriveFrom?: string;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
default?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface TemplateManifest {
|
|
11
|
-
id: string;
|
|
12
|
-
displayName: string;
|
|
13
|
-
description: string;
|
|
14
|
-
category: TemplateCategory;
|
|
15
|
-
tags: string[];
|
|
16
|
-
templateApiVersion: number;
|
|
17
|
-
minCliVersion: string;
|
|
18
|
-
variables: TemplateVariableDefinition[];
|
|
19
|
-
postCreate: string[];
|
|
20
|
-
testing: {
|
|
21
|
-
smokeCommand?: string;
|
|
22
|
-
buildCommand?: string;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
export interface ResolvedTemplateDefinition {
|
|
26
|
-
root: string;
|
|
27
|
-
manifestPath: string;
|
|
28
|
-
templateRoot: string;
|
|
29
|
-
manifest: TemplateManifest;
|
|
30
|
-
}
|
|
31
|
-
export interface StarterResolutionInput {
|
|
32
|
-
target: string;
|
|
33
|
-
name?: string | null;
|
|
34
|
-
slug?: string | null;
|
|
35
|
-
siteUrl?: string | null;
|
|
36
|
-
contactEmail?: string | null;
|
|
37
|
-
repositoryUrl?: string | null;
|
|
38
|
-
discordUrl?: string | null;
|
|
39
|
-
}
|
|
40
|
-
export declare function resolveTemplateDefinition(id: string, category?: TemplateCategory): ResolvedTemplateDefinition;
|
|
41
|
-
export declare function validateAllTemplateDefinitions(): {
|
|
42
|
-
root: string;
|
|
43
|
-
manifestPath: string;
|
|
44
|
-
templateRoot: string;
|
|
45
|
-
manifest: TemplateManifest;
|
|
46
|
-
}[];
|
|
47
|
-
export declare function buildTemplateReplacements(manifest: TemplateManifest, input: StarterResolutionInput): Record<string, string>;
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
import { cliPackageVersion, corePackageVersion, examplesRoot, fixturesRoot, referenceAppsRoot, templatesRoot } from './paths.js';
|
|
4
|
-
export const TEMPLATE_CATEGORIES = ['starter', 'example', 'fixture', 'reference-app'];
|
|
5
|
-
function loadJsonFile(filePath) {
|
|
6
|
-
return JSON.parse(readFileSync(filePath, 'utf8'));
|
|
7
|
-
}
|
|
8
|
-
function listTemplateRoots(baseRoot) {
|
|
9
|
-
if (!existsSync(baseRoot)) {
|
|
10
|
-
return [];
|
|
11
|
-
}
|
|
12
|
-
return readdirSync(baseRoot, { withFileTypes: true })
|
|
13
|
-
.filter((entry) => entry.isDirectory())
|
|
14
|
-
.map((entry) => resolve(baseRoot, entry.name))
|
|
15
|
-
.filter((root) => existsSync(resolve(root, 'template.config.json')));
|
|
16
|
-
}
|
|
17
|
-
function validateTemplateManifest(definition) {
|
|
18
|
-
const { manifest, templateRoot, manifestPath } = definition;
|
|
19
|
-
if (!TEMPLATE_CATEGORIES.includes(manifest.category)) {
|
|
20
|
-
throw new Error(`Invalid template category in ${manifestPath}: ${manifest.category}`);
|
|
21
|
-
}
|
|
22
|
-
if (!manifest.id || !manifest.displayName || !manifest.description) {
|
|
23
|
-
throw new Error(`Template manifest ${manifestPath} is missing required metadata fields.`);
|
|
24
|
-
}
|
|
25
|
-
if (!existsSync(templateRoot)) {
|
|
26
|
-
throw new Error(`Template ${manifest.id} is missing template/ at ${templateRoot}.`);
|
|
27
|
-
}
|
|
28
|
-
validateTemplatePlaceholders(definition);
|
|
29
|
-
}
|
|
30
|
-
function listFiles(root) {
|
|
31
|
-
const files = [];
|
|
32
|
-
for (const entry of readdirSync(root, { withFileTypes: true })) {
|
|
33
|
-
const fullPath = resolve(root, entry.name);
|
|
34
|
-
if (entry.isDirectory()) {
|
|
35
|
-
files.push(...listFiles(fullPath));
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
files.push(fullPath);
|
|
39
|
-
}
|
|
40
|
-
return files;
|
|
41
|
-
}
|
|
42
|
-
function validateTemplatePlaceholders(definition) {
|
|
43
|
-
const declaredTokens = new Set(definition.manifest.variables.map((variable) => variable.token));
|
|
44
|
-
const discoveredTokens = new Set();
|
|
45
|
-
for (const filePath of listFiles(definition.templateRoot)) {
|
|
46
|
-
const contents = readFileSync(filePath, 'utf8');
|
|
47
|
-
for (const match of contents.matchAll(/__[A-Z0-9_]+__/g)) {
|
|
48
|
-
discoveredTokens.add(match[0]);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
for (const token of discoveredTokens) {
|
|
52
|
-
if (!declaredTokens.has(token)) {
|
|
53
|
-
throw new Error(`Template ${definition.manifest.id} uses undeclared token ${token}.`);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export function resolveTemplateDefinition(id, category) {
|
|
58
|
-
const roots = [...listTemplateRoots(templatesRoot), ...listTemplateRoots(fixturesRoot), ...listTemplateRoots(examplesRoot), ...listTemplateRoots(referenceAppsRoot)];
|
|
59
|
-
for (const root of roots) {
|
|
60
|
-
const manifestPath = resolve(root, 'template.config.json');
|
|
61
|
-
const manifest = loadJsonFile(manifestPath);
|
|
62
|
-
if (manifest.id !== id) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (category && manifest.category !== category) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
const definition = {
|
|
69
|
-
root,
|
|
70
|
-
manifestPath,
|
|
71
|
-
templateRoot: resolve(root, 'template'),
|
|
72
|
-
manifest,
|
|
73
|
-
};
|
|
74
|
-
validateTemplateManifest(definition);
|
|
75
|
-
return definition;
|
|
76
|
-
}
|
|
77
|
-
throw new Error(`Unable to resolve template "${id}"${category ? ` in category "${category}"` : ''}.`);
|
|
78
|
-
}
|
|
79
|
-
export function validateAllTemplateDefinitions() {
|
|
80
|
-
const roots = [...listTemplateRoots(templatesRoot), ...listTemplateRoots(fixturesRoot), ...listTemplateRoots(examplesRoot), ...listTemplateRoots(referenceAppsRoot)];
|
|
81
|
-
return roots.map((root) => {
|
|
82
|
-
const definition = {
|
|
83
|
-
root,
|
|
84
|
-
manifestPath: resolve(root, 'template.config.json'),
|
|
85
|
-
templateRoot: resolve(root, 'template'),
|
|
86
|
-
manifest: loadJsonFile(resolve(root, 'template.config.json')),
|
|
87
|
-
};
|
|
88
|
-
validateTemplateManifest(definition);
|
|
89
|
-
return definition;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
function toTitleCase(value) {
|
|
93
|
-
return value
|
|
94
|
-
.split(/[-_\s]+/)
|
|
95
|
-
.filter(Boolean)
|
|
96
|
-
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
97
|
-
.join(' ');
|
|
98
|
-
}
|
|
99
|
-
function inferSlug(target, explicitSlug) {
|
|
100
|
-
return (explicitSlug ?? target).toLowerCase().replace(/[^a-z0-9-]+/g, '-');
|
|
101
|
-
}
|
|
102
|
-
function inferName(target, explicitName) {
|
|
103
|
-
return explicitName ?? toTitleCase(target);
|
|
104
|
-
}
|
|
105
|
-
function resolveVariableValue(variable, input) {
|
|
106
|
-
switch (variable.deriveFrom) {
|
|
107
|
-
case 'slug':
|
|
108
|
-
return inferSlug(input.target, input.slug);
|
|
109
|
-
case 'name':
|
|
110
|
-
return inferName(input.target, input.name);
|
|
111
|
-
case 'siteUrl':
|
|
112
|
-
return input.siteUrl ?? variable.default ?? '';
|
|
113
|
-
case 'contactEmail':
|
|
114
|
-
return input.contactEmail ?? variable.default ?? '';
|
|
115
|
-
case 'repositoryUrl':
|
|
116
|
-
return input.repositoryUrl ?? variable.default ?? '';
|
|
117
|
-
case 'discordUrl':
|
|
118
|
-
return input.discordUrl ?? variable.default ?? '';
|
|
119
|
-
case 'cliVersion':
|
|
120
|
-
return `^${cliPackageVersion}`;
|
|
121
|
-
case 'coreVersion':
|
|
122
|
-
return `^${corePackageVersion}`;
|
|
123
|
-
default:
|
|
124
|
-
return variable.default ?? '';
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
export function buildTemplateReplacements(manifest, input) {
|
|
128
|
-
const replacements = {};
|
|
129
|
-
for (const variable of manifest.variables) {
|
|
130
|
-
const value = resolveVariableValue(variable, input);
|
|
131
|
-
if (variable.required && !value) {
|
|
132
|
-
throw new Error(`Template "${manifest.id}" requires a value for "${variable.name}".`);
|
|
133
|
-
}
|
|
134
|
-
replacements[variable.token] = value;
|
|
135
|
-
}
|
|
136
|
-
return replacements;
|
|
137
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { resolveAstroBin, createProductionBuildEnv, packageScriptPath, runNodeBinary, runNodeScript } from './package-tools.js';
|
|
2
|
-
process.env.TREESEED_LOCAL_DEV_MODE = process.env.TREESEED_LOCAL_DEV_MODE ?? 'cloudflare';
|
|
3
|
-
runNodeScript(packageScriptPath('patch-starlight-content-path'), [], { cwd: process.cwd() });
|
|
4
|
-
runNodeScript(packageScriptPath('aggregate-book'), [], { cwd: process.cwd() });
|
|
5
|
-
runNodeBinary(resolveAstroBin(), ['build'], {
|
|
6
|
-
cwd: process.cwd(),
|
|
7
|
-
env: createProductionBuildEnv({
|
|
8
|
-
TREESEED_LOCAL_DEV_MODE: process.env.TREESEED_LOCAL_DEV_MODE,
|
|
9
|
-
}),
|
|
10
|
-
});
|
|
11
|
-
runNodeScript(packageScriptPath('build-tenant-worker'), [], {
|
|
12
|
-
cwd: process.cwd(),
|
|
13
|
-
env: createProductionBuildEnv({
|
|
14
|
-
TREESEED_LOCAL_DEV_MODE: process.env.TREESEED_LOCAL_DEV_MODE,
|
|
15
|
-
}),
|
|
16
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { resolveAstroBin, createProductionBuildEnv, packageScriptPath, runNodeBinary, runNodeScript } from './package-tools.js';
|
|
2
|
-
runNodeScript(packageScriptPath('patch-starlight-content-path'), [], { cwd: process.cwd() });
|
|
3
|
-
runNodeScript(packageScriptPath('aggregate-book'), [], { cwd: process.cwd() });
|
|
4
|
-
runNodeBinary(resolveAstroBin(), ['check'], {
|
|
5
|
-
cwd: process.cwd(),
|
|
6
|
-
env: createProductionBuildEnv(),
|
|
7
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|