@stacksjs/actions 0.59.11 → 0.61.0
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/add.js +29 -0
- package/dist/build/component-libs.js +9 -0
- package/dist/build/core.js +21 -0
- package/dist/build/stacks.js +8 -0
- package/dist/build.js +317 -0
- package/dist/bump.js +16 -0
- package/dist/changelog.js +17 -0
- package/dist/clean.js +6 -0
- package/dist/commit.js +17 -0
- package/dist/copy-types.js +14 -0
- package/dist/database/seed.js +8 -0
- package/dist/deploy/index.js +31 -0
- package/dist/dev/components.js +11 -0
- package/dist/dev/docs.js +7 -0
- package/dist/dev/index.js +112 -0
- package/dist/examples.js +43 -0
- package/dist/fresh.js +19 -0
- package/dist/generate/component-meta.js +59 -0
- package/dist/generate/ide-helpers.js +96 -0
- package/dist/generate/index.js +251 -0
- package/dist/generate/lib-entries.js +175 -0
- package/dist/generate/vscode-custom-data.js +96 -0
- package/dist/helpers/component-meta.js +50 -0
- package/dist/helpers/lib-entries.js +166 -0
- package/dist/helpers/package-json.js +146 -0
- package/dist/helpers/utils.js +67 -0
- package/dist/helpers/vscode-custom-data.js +88 -0
- package/dist/index.js +676 -0
- package/dist/key-generate.js +10 -0
- package/dist/lint/fix.js +12 -0
- package/dist/lint/index.js +16 -0
- package/dist/make.js +319 -0
- package/dist/prepublish.js +17 -0
- package/dist/release.js +646 -0
- package/dist/test/coverage.js +9 -0
- package/dist/test/feature.js +9 -0
- package/dist/test/ui.js +6 -0
- package/dist/test/unit.js +6 -0
- package/dist/test.js +6 -0
- package/dist/typecheck.js +6 -0
- package/dist/types.js +21 -0
- package/dist/upgrade/dependencies.js +6 -0
- package/dist/upgrade/framework.js +1 -0
- package/dist/upgrade/index.js +78 -0
- package/dist/upgrade.js +46 -0
- package/package.json +5 -5
- package/src/action.ts +1 -0
- package/src/actions.ts +2 -2
- package/src/add.ts +3 -6
- package/src/ai/request-model-access.ts +10 -7
- package/src/build/component-libs.ts +5 -2
- package/src/build/core.ts +1 -2
- package/src/build/stacks.ts +8 -5
- package/src/build.ts +11 -25
- package/src/bump.ts +0 -2
- package/src/check/ports.ts +2 -3
- package/src/commit.ts +2 -2
- package/src/copy-types.ts +1 -1
- package/src/database/seed.ts +8 -4
- package/src/deploy/create-receipt-rule.ts +3 -7
- package/src/deploy/index.ts +2 -1
- package/src/dev/api.ts +4 -4
- package/src/dev/components.ts +3 -5
- package/src/dev/index.ts +2 -2
- package/src/domains/add.ts +8 -6
- package/src/domains/purchase.ts +26 -24
- package/src/domains/remove.ts +5 -7
- package/src/examples.ts +9 -13
- package/src/find-projects.ts +4 -6
- package/src/fresh.ts +2 -1
- package/src/generate/action-types.ts +5 -7
- package/src/generate/component-meta.ts +2 -5
- package/src/generate/custom-cli-file.ts +4 -3
- package/src/generate/env-files.ts +38 -43
- package/src/generate/ide-helpers.ts +1 -2
- package/src/generate/index.ts +16 -40
- package/src/generate/lib-entries.ts +4 -7
- package/src/generate/pkgx-file.ts +6 -11
- package/src/generate/vscode-custom-data.ts +1 -3
- package/src/helpers/component-meta.ts +6 -11
- package/src/helpers/index.ts +5 -0
- package/src/helpers/lib-entries.ts +30 -25
- package/src/helpers/package-json.ts +13 -16
- package/src/helpers/utils.ts +56 -13
- package/src/helpers/vscode-custom-data.ts +1 -2
- package/src/index.ts +2 -1
- package/src/key-generate.ts +3 -4
- package/src/lint/fix.ts +10 -2
- package/src/lint/index.ts +6 -8
- package/src/make.ts +79 -77
- package/src/migrate/database.ts +22 -1
- package/src/migrate/fresh.ts +20 -0
- package/src/orm/base.ts +0 -0
- package/src/orm/generate-model.ts +1177 -0
- package/src/{generate/model-classes.ts → orm/user.ts} +33 -48
- package/src/prepublish.ts +5 -2
- package/src/release.ts +15 -11
- package/src/test/coverage.ts +5 -2
- package/src/test/feature.ts +5 -2
- package/src/test/ui.ts +1 -1
- package/src/test/unit.ts +1 -1
- package/src/test.ts +1 -1
- package/src/typecheck.ts +1 -1
- package/src/types.ts +2 -2
- package/src/upgrade/binary.ts +3 -5
- package/src/upgrade/index.ts +4 -8
- package/src/upgrade/shell.ts +10 -10
- package/src/upgrade.ts +28 -25
- package/dist/action.d.ts +0 -36
- package/dist/add.d.ts +0 -6
- package/dist/build/component-libs.d.ts +0 -1
- package/dist/build/core.d.ts +0 -1
- package/dist/build/stacks.d.ts +0 -1
- package/dist/build.d.ts +0 -9
- package/dist/bump.d.ts +0 -1
- package/dist/changelog.d.ts +0 -1
- package/dist/clean.d.ts +0 -1
- package/dist/commit.d.ts +0 -3
- package/dist/copy-types.d.ts +0 -5
- package/dist/database/seed.d.ts +0 -1
- package/dist/deploy/index.d.ts +0 -1
- package/dist/dev/components.d.ts +0 -1
- package/dist/dev/docs.d.ts +0 -1
- package/dist/dev/index.d.ts +0 -10
- package/dist/examples.d.ts +0 -5
- package/dist/fresh.d.ts +0 -1
- package/dist/generate/component-meta.d.ts +0 -5
- package/dist/generate/ide-helpers.d.ts +0 -6
- package/dist/generate/index.d.ts +0 -13
- package/dist/generate/lib-entries.d.ts +0 -2
- package/dist/generate/vscode-custom-data.d.ts +0 -6
- package/dist/helpers/component-meta.d.ts +0 -22
- package/dist/helpers/lib-entries.d.ts +0 -13
- package/dist/helpers/package-json.d.ts +0 -3
- package/dist/helpers/utils.d.ts +0 -18
- package/dist/helpers/vscode-custom-data.d.ts +0 -2
- package/dist/index.d.ts +0 -7
- package/dist/key-generate.d.ts +0 -1
- package/dist/lint/fix.d.ts +0 -1
- package/dist/lint/index.d.ts +0 -1
- package/dist/make.d.ts +0 -20
- package/dist/prepublish.d.ts +0 -1
- package/dist/release.d.ts +0 -2
- package/dist/test/coverage.d.ts +0 -1
- package/dist/test/feature.d.ts +0 -1
- package/dist/test/ui.d.ts +0 -1
- package/dist/test/unit.d.ts +0 -1
- package/dist/test.d.ts +0 -1
- package/dist/tinker.d.ts +0 -1
- package/dist/typecheck.d.ts +0 -1
- package/dist/types.d.ts +0 -3
- package/dist/upgrade/dependencies.d.ts +0 -1
- package/dist/upgrade/framework.d.ts +0 -1
- package/dist/upgrade/index.d.ts +0 -1
- package/dist/upgrade.d.ts +0 -4
- package/src/database/fields.ts +0 -111
- package/src/database/migration-mysql.ts +0 -72
- package/src/database/migration-sqlite.ts +0 -67
- package/src/database/migration.ts +0 -10
- package/src/database/user-migration.ts +0 -20
- package/src/generate/model-generate.ts +0 -12
- package/src/migrate/dns.ts +0 -3
- package/src/tinker.ts +0 -10
package/dist/add.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/add.ts
|
|
3
|
+
import {installPackage} from "@stacksjs/cli";
|
|
4
|
+
async function invoke(options) {
|
|
5
|
+
if (options?.table)
|
|
6
|
+
await addTable();
|
|
7
|
+
if (options?.calendar)
|
|
8
|
+
await addCalendar();
|
|
9
|
+
}
|
|
10
|
+
async function add(options) {
|
|
11
|
+
return invoke(options);
|
|
12
|
+
}
|
|
13
|
+
async function addTable() {
|
|
14
|
+
await installPackage("@stacksjs/table");
|
|
15
|
+
}
|
|
16
|
+
async function addCalendar() {
|
|
17
|
+
await installPackage("@stacksjs/calendar");
|
|
18
|
+
}
|
|
19
|
+
async function installPackages(names) {
|
|
20
|
+
for (const name of names)
|
|
21
|
+
await installPackage(name);
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
invoke,
|
|
25
|
+
installPackages,
|
|
26
|
+
addTable,
|
|
27
|
+
addCalendar,
|
|
28
|
+
add
|
|
29
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/build/component-libs.ts
|
|
3
|
+
import {runCommand} from "@stacksjs/cli";
|
|
4
|
+
import {NpmScript} from "@stacksjs/enums";
|
|
5
|
+
import {frameworkPath} from "@stacksjs/path";
|
|
6
|
+
await runCommand(NpmScript.BuildComponents, {
|
|
7
|
+
cwd: frameworkPath(),
|
|
8
|
+
verbose: true
|
|
9
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/build/core.ts
|
|
3
|
+
import process from "process";
|
|
4
|
+
import {dim, italic, log} from "@stacksjs/cli";
|
|
5
|
+
import {corePath} from "@stacksjs/path";
|
|
6
|
+
import {glob} from "@stacksjs/storage";
|
|
7
|
+
import {ExitCode} from "@stacksjs/types";
|
|
8
|
+
var {$ } = globalThis.Bun;
|
|
9
|
+
log.info("Building core packages");
|
|
10
|
+
var dirs = (await glob([corePath("*")], { onlyDirectories: true })).sort();
|
|
11
|
+
if (dirs.length === 0) {
|
|
12
|
+
log.info("No core packages found");
|
|
13
|
+
process.exit(ExitCode.FatalError);
|
|
14
|
+
}
|
|
15
|
+
for (const folder of dirs) {
|
|
16
|
+
log.info(`\uD83C\uDFD7\uFE0F Building ${italic(dim(folder))}`);
|
|
17
|
+
$.cwd(folder);
|
|
18
|
+
await $`bun run build`;
|
|
19
|
+
log.success(`${italic(dim(folder))} built`);
|
|
20
|
+
console.log(``);
|
|
21
|
+
}
|
package/dist/build.js
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/helpers/utils.ts
|
|
3
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
4
|
+
import {err} from "@stacksjs/error-handling";
|
|
5
|
+
import {log} from "@stacksjs/logging";
|
|
6
|
+
import * as p from "@stacksjs/path";
|
|
7
|
+
import {glob} from "@stacksjs/storage";
|
|
8
|
+
var {Glob } = globalThis.Bun;
|
|
9
|
+
async function runAction(action, options) {
|
|
10
|
+
const glob2 = new Glob("**/*.ts");
|
|
11
|
+
const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true };
|
|
12
|
+
for await (const file of glob2.scan(scanOptions)) {
|
|
13
|
+
log.debug("file", file);
|
|
14
|
+
if (file === `${action}.ts` || file.endsWith(`${action}.ts`))
|
|
15
|
+
return (await import(p.userActionsPath(file))).default.handle();
|
|
16
|
+
const a = await import(p.userActionsPath(file));
|
|
17
|
+
if (a.name === action)
|
|
18
|
+
return await a.handle();
|
|
19
|
+
}
|
|
20
|
+
const opts = buddyOptions();
|
|
21
|
+
const path = p.relativeActionsPath(`src/${action}.ts`);
|
|
22
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
23
|
+
const optionsWithCwd = {
|
|
24
|
+
cwd: options?.cwd || p.projectPath(),
|
|
25
|
+
...options
|
|
26
|
+
};
|
|
27
|
+
log.debug("runAction:", cmd);
|
|
28
|
+
log.debug("action options:", optionsWithCwd);
|
|
29
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
30
|
+
}
|
|
31
|
+
async function runActions(actions, options) {
|
|
32
|
+
log.debug("runActions:", actions, options);
|
|
33
|
+
if (!actions.length)
|
|
34
|
+
return err("No actions were specified");
|
|
35
|
+
for (const action of actions) {
|
|
36
|
+
log.debug(`running action "${action}"`);
|
|
37
|
+
if (!hasAction(action))
|
|
38
|
+
return err(`The specified action "${action}" does not exist`);
|
|
39
|
+
}
|
|
40
|
+
const opts = buddyOptions();
|
|
41
|
+
const o = {
|
|
42
|
+
cwd: options?.cwd || p.projectPath(),
|
|
43
|
+
...options
|
|
44
|
+
};
|
|
45
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`src/${action}.ts`)} ${opts}`);
|
|
46
|
+
log.debug("commands:", commands);
|
|
47
|
+
return await runCommands(commands, o);
|
|
48
|
+
}
|
|
49
|
+
function hasAction(action) {
|
|
50
|
+
const userActionPatterns = [
|
|
51
|
+
`${action}.ts`,
|
|
52
|
+
`${action}`,
|
|
53
|
+
`Dashboard/${action}.ts`,
|
|
54
|
+
`Dashboard/${action}`,
|
|
55
|
+
`Buddy/${action}.ts`,
|
|
56
|
+
`Buddy/${action}`
|
|
57
|
+
];
|
|
58
|
+
const actionPatterns = [`src/${action}.ts`, `src/${action}`, `${action}.ts`, `${action}`];
|
|
59
|
+
const userActionFiles = glob.sync(userActionPatterns.map((pattern) => p.userActionsPath(pattern)));
|
|
60
|
+
const actionFiles = glob.sync(actionPatterns.map((pattern) => p.actionsPath(pattern)));
|
|
61
|
+
return userActionFiles.length > 0 || actionFiles.length > 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/helpers/vscode-custom-data.ts
|
|
65
|
+
import {log as log2} from "@stacksjs/logging";
|
|
66
|
+
import {customElementsDataPath} from "@stacksjs/path";
|
|
67
|
+
import {writeTextFile} from "@stacksjs/storage";
|
|
68
|
+
|
|
69
|
+
// ../../../../config/library.ts
|
|
70
|
+
var library_default = {
|
|
71
|
+
name: "hello-world",
|
|
72
|
+
owner: "@stacksjs",
|
|
73
|
+
repository: "stacksjs/stacks",
|
|
74
|
+
license: "MIT",
|
|
75
|
+
author: "Chris Breuer",
|
|
76
|
+
contributors: ["Chris Breuer <chris@stacksjs.org>"],
|
|
77
|
+
defaultLanguage: "en",
|
|
78
|
+
releaseable: true,
|
|
79
|
+
vueComponents: {
|
|
80
|
+
name: "hello-world-vue",
|
|
81
|
+
description: "Your Vue component library description",
|
|
82
|
+
keywords: ["component", "library", "vue", "vite", "typescript", "javascript"],
|
|
83
|
+
tags: [
|
|
84
|
+
{
|
|
85
|
+
name: ["HelloWorld", "AppHelloWorld"],
|
|
86
|
+
description: "The Hello World custom element, built via this framework.",
|
|
87
|
+
attributes: [
|
|
88
|
+
{
|
|
89
|
+
name: "greeting",
|
|
90
|
+
description: "The greeting."
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
webComponents: {
|
|
97
|
+
name: "hello-world-elements",
|
|
98
|
+
description: "Your framework agnostic web component library description.",
|
|
99
|
+
keywords: ["custom-elements", "web-components", "library", "framework-agnostic", "typescript", "javascript"],
|
|
100
|
+
tags: [
|
|
101
|
+
{
|
|
102
|
+
name: ["HelloWorld", "AppHelloWorld"],
|
|
103
|
+
description: "The Hello World custom element, built via this framework.",
|
|
104
|
+
attributes: [
|
|
105
|
+
{
|
|
106
|
+
name: "greeting",
|
|
107
|
+
description: "The greeting."
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
functions: {
|
|
114
|
+
name: "hello-world-fx",
|
|
115
|
+
description: "Your function library description.",
|
|
116
|
+
keywords: ["functions", "composables", "library", "typescript", "javascript"],
|
|
117
|
+
shouldGenerateSourcemap: false,
|
|
118
|
+
files: ["counter", "dark"]
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// src/helpers/vscode-custom-data.ts
|
|
123
|
+
async function generateVsCodeCustomData() {
|
|
124
|
+
try {
|
|
125
|
+
log2.info("Generating custom-elements.json...");
|
|
126
|
+
await writeTextFile({
|
|
127
|
+
path: customElementsDataPath(),
|
|
128
|
+
data: generateComponentInfoData()
|
|
129
|
+
});
|
|
130
|
+
log2.success("Generated custom-elements.json for IDEs.");
|
|
131
|
+
} catch (err2) {
|
|
132
|
+
log2.error("There was an error generating the custom-elements.json file.", err2);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async function generateWebTypes() {
|
|
136
|
+
log2.info("Generating web-types.json...");
|
|
137
|
+
log2.info("This feature is not yet implemented.");
|
|
138
|
+
}
|
|
139
|
+
var generateComponentInfoData = function() {
|
|
140
|
+
const componentsData = JSON.stringify(library_default.vueComponents?.tags);
|
|
141
|
+
return `{
|
|
142
|
+
"version": 1.1,
|
|
143
|
+
"tags": ${componentsData}
|
|
144
|
+
}
|
|
145
|
+
`;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/generate/index.ts
|
|
149
|
+
import process from "process";
|
|
150
|
+
import {runCommand as runCommand2} from "@stacksjs/cli";
|
|
151
|
+
import {Action, NpmScript} from "@stacksjs/enums";
|
|
152
|
+
import {log as log3} from "@stacksjs/logging";
|
|
153
|
+
import {frameworkPath, projectPath as projectPath2} from "@stacksjs/path";
|
|
154
|
+
import {runNpmScript} from "@stacksjs/utils";
|
|
155
|
+
async function invoke(options) {
|
|
156
|
+
if (options?.types)
|
|
157
|
+
await generateTypes(options);
|
|
158
|
+
else if (options?.entries)
|
|
159
|
+
await generateLibEntries(options);
|
|
160
|
+
else if (options?.webTypes)
|
|
161
|
+
await generateWebTypes2(options);
|
|
162
|
+
else if (options?.customData)
|
|
163
|
+
await generateVsCodeCustomData2(options);
|
|
164
|
+
else if (options?.ideHelpers)
|
|
165
|
+
await generateIdeHelpers(options);
|
|
166
|
+
else if (options?.componentMeta)
|
|
167
|
+
await generateComponentMeta(options);
|
|
168
|
+
else if (options?.coreSymlink)
|
|
169
|
+
await generateCoreSymlink();
|
|
170
|
+
}
|
|
171
|
+
function generate(options) {
|
|
172
|
+
return invoke(options);
|
|
173
|
+
}
|
|
174
|
+
async function generateLibEntries(options) {
|
|
175
|
+
const result = await runAction(Action.GenerateLibraryEntries, {
|
|
176
|
+
...options,
|
|
177
|
+
cwd: projectPath2()
|
|
178
|
+
});
|
|
179
|
+
if (result.isErr()) {
|
|
180
|
+
log3.error("There was an error generating your library entry points", result.error);
|
|
181
|
+
process.exit();
|
|
182
|
+
}
|
|
183
|
+
log3.success("Library entry points generated successfully");
|
|
184
|
+
}
|
|
185
|
+
async function generateWebTypes2(options) {
|
|
186
|
+
const result = await runNpmScript(NpmScript.GenerateWebTypes, options);
|
|
187
|
+
if (result.isErr()) {
|
|
188
|
+
log3.error("There was an error generating the web-types.json file.", result.error);
|
|
189
|
+
process.exit();
|
|
190
|
+
}
|
|
191
|
+
log3.success("Successfully generated the web-types.json file");
|
|
192
|
+
}
|
|
193
|
+
async function generateVsCodeCustomData2(options) {
|
|
194
|
+
const result = await generateVsCodeCustomData();
|
|
195
|
+
if (result.isErr()) {
|
|
196
|
+
log3.error("There was an error generating the custom-elements.json file.", result.error);
|
|
197
|
+
process.exit();
|
|
198
|
+
}
|
|
199
|
+
await runAction(Action.LintFix, { verbose: true });
|
|
200
|
+
log3.success("Successfully generated the custom-elements.json file");
|
|
201
|
+
}
|
|
202
|
+
async function generateIdeHelpers(options) {
|
|
203
|
+
const result = await runNpmScript(NpmScript.GenerateIdeHelpers, options);
|
|
204
|
+
if (result.isErr()) {
|
|
205
|
+
log3.error("There was an error generating IDE helpers.", result.error);
|
|
206
|
+
process.exit();
|
|
207
|
+
}
|
|
208
|
+
await runAction(Action.LintFix, { verbose: true });
|
|
209
|
+
log3.success("Successfully generated IDE helpers");
|
|
210
|
+
}
|
|
211
|
+
async function generateComponentMeta(options) {
|
|
212
|
+
const result = await generateVsCodeCustomData();
|
|
213
|
+
if (result.isErr()) {
|
|
214
|
+
log3.error("There was an error generating your component meta information.", result.error);
|
|
215
|
+
process.exit();
|
|
216
|
+
}
|
|
217
|
+
await runAction(Action.LintFix, { verbose: true });
|
|
218
|
+
log3.success("Successfully generated component meta information");
|
|
219
|
+
}
|
|
220
|
+
async function generateTypes(options) {
|
|
221
|
+
const result = await runNpmScript(NpmScript.GenerateTypes, {
|
|
222
|
+
cwd: frameworkPath(),
|
|
223
|
+
...options
|
|
224
|
+
});
|
|
225
|
+
if (result.isErr()) {
|
|
226
|
+
log3.error("There was an error generating your types.", result.error);
|
|
227
|
+
process.exit();
|
|
228
|
+
}
|
|
229
|
+
log3.success("Types were generated successfully");
|
|
230
|
+
}
|
|
231
|
+
function generatePkgxConfig() {
|
|
232
|
+
log3.success("Successfully generated `./pkgx.yaml` based on your config");
|
|
233
|
+
}
|
|
234
|
+
async function generateSeeder() {
|
|
235
|
+
}
|
|
236
|
+
async function generateCoreSymlink() {
|
|
237
|
+
await runCommand2(`ln -s ${frameworkPath()} ${projectPath2(".stacks")}`);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// src/build.ts
|
|
241
|
+
import {NpmScript as NpmScript2} from "@stacksjs/enums";
|
|
242
|
+
import {log as log4} from "@stacksjs/logging";
|
|
243
|
+
import {hasComponents, hasFunctions} from "@stacksjs/storage";
|
|
244
|
+
import {runNpmScript as runNpmScript2} from "@stacksjs/utils";
|
|
245
|
+
async function invoke2(options) {
|
|
246
|
+
if (options.components)
|
|
247
|
+
await componentLibraries(options);
|
|
248
|
+
else if (options.vueComponents)
|
|
249
|
+
await vueComponentLibrary(options);
|
|
250
|
+
else if (options.webComponents || options.elements)
|
|
251
|
+
await webComponentLibrary(options);
|
|
252
|
+
else if (options.functions)
|
|
253
|
+
await functionsLibrary(options);
|
|
254
|
+
else if (options.docs)
|
|
255
|
+
await docs(options);
|
|
256
|
+
else if (options.stacks)
|
|
257
|
+
await stacks(options);
|
|
258
|
+
await generateTypes();
|
|
259
|
+
}
|
|
260
|
+
async function build(options) {
|
|
261
|
+
return invoke2(options);
|
|
262
|
+
}
|
|
263
|
+
async function componentLibraries(options) {
|
|
264
|
+
await runNpmScript2(NpmScript2.GenerateEntries, options);
|
|
265
|
+
await vueComponentLibrary(options);
|
|
266
|
+
await webComponentLibrary(options);
|
|
267
|
+
}
|
|
268
|
+
async function vueComponentLibrary(options) {
|
|
269
|
+
if (hasComponents()) {
|
|
270
|
+
log4.info("Building your component library...");
|
|
271
|
+
await runNpmScript2(NpmScript2.BuildComponents, options);
|
|
272
|
+
log4.success("Your component library was built successfully");
|
|
273
|
+
} else {
|
|
274
|
+
log4.warn("No components found.");
|
|
275
|
+
log4.info("Before you can build components,");
|
|
276
|
+
log4.info("you need to have created some in the ./components folder.");
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
async function webComponentLibrary(options) {
|
|
280
|
+
log4.info("Building your component library for production use & npm/CDN distribution...");
|
|
281
|
+
if (hasComponents()) {
|
|
282
|
+
await runNpmScript2(NpmScript2.BuildWebComponents, options);
|
|
283
|
+
log4.success("Your Web Component library was built successfully");
|
|
284
|
+
} else {
|
|
285
|
+
log4.info("No components found.");
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
async function docs(options) {
|
|
289
|
+
log4.info("Building the documentation site...");
|
|
290
|
+
await runNpmScript2(NpmScript2.BuildDocs, options);
|
|
291
|
+
log4.success("Docs built successfully");
|
|
292
|
+
}
|
|
293
|
+
async function stacks(options) {
|
|
294
|
+
log4.info("Building the Stacks Framework...");
|
|
295
|
+
await runNpmScript2(NpmScript2.BuildStacks, options);
|
|
296
|
+
log4.success("Stacks built successfully");
|
|
297
|
+
}
|
|
298
|
+
async function functionsLibrary(options) {
|
|
299
|
+
if (hasFunctions()) {
|
|
300
|
+
log4.info("Building your functions library for production usages...");
|
|
301
|
+
log4.info("Production usages include: manual npm distribution and/or CDN distribution");
|
|
302
|
+
await runNpmScript2(NpmScript2.BuildFunctions, options);
|
|
303
|
+
log4.success("Functions library built successfully");
|
|
304
|
+
} else {
|
|
305
|
+
log4.info("No functions found");
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
export {
|
|
309
|
+
webComponentLibrary,
|
|
310
|
+
vueComponentLibrary,
|
|
311
|
+
stacks,
|
|
312
|
+
invoke2 as invoke,
|
|
313
|
+
functionsLibrary,
|
|
314
|
+
docs,
|
|
315
|
+
componentLibraries,
|
|
316
|
+
build
|
|
317
|
+
};
|
package/dist/bump.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/bump.ts
|
|
3
|
+
import {parseOptions, runCommand} from "@stacksjs/cli";
|
|
4
|
+
import {path as p} from "@stacksjs/path";
|
|
5
|
+
var options = parseOptions();
|
|
6
|
+
var changelogCommand = options?.dryRun ? "buddy changelog --quiet --dry-run" : "buddy changelog --quiet";
|
|
7
|
+
await runCommand(changelogCommand, {
|
|
8
|
+
cwd: p.projectPath()
|
|
9
|
+
});
|
|
10
|
+
var bumpCommand = options?.dryRun ? "bunx bumpp ./package.json ./**/package.json ../ide/vscode/package.json --no-push" : "bunx bumpp ./package.json ./**/package.json ../ide/vscode/package.json --all";
|
|
11
|
+
console.log(`Running: ${bumpCommand}`);
|
|
12
|
+
console.log(`In frameworkPath: ${p.frameworkPath()}`);
|
|
13
|
+
await runCommand(bumpCommand, {
|
|
14
|
+
cwd: p.frameworkPath("core"),
|
|
15
|
+
stdin: "inherit"
|
|
16
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/changelog.ts
|
|
3
|
+
import {execSync, log, parseOptions, runCommand} from "@stacksjs/cli";
|
|
4
|
+
import {projectPath} from "@stacksjs/path";
|
|
5
|
+
log.debug("Generating changelog");
|
|
6
|
+
var fromRevision = await execSync("git describe --abbrev=0 --tags HEAD^");
|
|
7
|
+
log.debug("FromRevision", fromRevision);
|
|
8
|
+
var toRevision = await execSync("git describe");
|
|
9
|
+
log.debug("ToRevision", toRevision);
|
|
10
|
+
var options = parseOptions();
|
|
11
|
+
log.debug("Changelog Options", options);
|
|
12
|
+
var command = options?.dryRun ? `bunx changelogen --no-output --from ${fromRevision} --to ${toRevision}` : `bunx changelogen --output CHANGELOG.md --from ${fromRevision} --to ${toRevision}`;
|
|
13
|
+
await runCommand(command, {
|
|
14
|
+
cwd: projectPath(),
|
|
15
|
+
quiet: options?.quiet,
|
|
16
|
+
verbose: options?.verbose
|
|
17
|
+
});
|
package/dist/clean.js
ADDED
package/dist/commit.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/commit.ts
|
|
3
|
+
import {NpmScript} from "@stacksjs/enums";
|
|
4
|
+
import {log} from "@stacksjs/logging";
|
|
5
|
+
import {runNpmScript} from "@stacksjs/utils";
|
|
6
|
+
async function invoke(options) {
|
|
7
|
+
log.info("Committing...");
|
|
8
|
+
await runNpmScript(NpmScript.Commit, options);
|
|
9
|
+
log.success("Committed");
|
|
10
|
+
}
|
|
11
|
+
async function commit(options) {
|
|
12
|
+
return invoke(options);
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
invoke,
|
|
16
|
+
commit
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
|
|
4
|
+
// src/copy-types.ts
|
|
5
|
+
import {frameworkPath} from "@stacksjs/path";
|
|
6
|
+
import {copyFolder} from "@stacksjs/storage";
|
|
7
|
+
var destinations = [
|
|
8
|
+
[frameworkPath("dist/types/components"), frameworkPath("components/vue/dist/types")],
|
|
9
|
+
[frameworkPath("dist/types/components"), frameworkPath("components/web/dist/types")],
|
|
10
|
+
[frameworkPath("dist/types/functions"), frameworkPath("functions/dist/types")]
|
|
11
|
+
];
|
|
12
|
+
destinations.forEach(([src, dest]) => {
|
|
13
|
+
copyFolder(src, dest);
|
|
14
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/deploy/index.ts
|
|
3
|
+
import process from "process";
|
|
4
|
+
import {log, runCommand} from "@stacksjs/cli";
|
|
5
|
+
import {config as config2} from "@stacksjs/config";
|
|
6
|
+
import {path as p} from "@stacksjs/path";
|
|
7
|
+
import {storage as storage2} from "@stacksjs/storage";
|
|
8
|
+
await runCommand("bun run build", {
|
|
9
|
+
cwd: p.corePath()
|
|
10
|
+
});
|
|
11
|
+
if (storage2.hasFiles(p.projectPath("docs"))) {
|
|
12
|
+
await runCommand("bun run build", {
|
|
13
|
+
cwd: p.frameworkPath("docs")
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
if (config2.app.docMode !== true) {
|
|
17
|
+
await runCommand("bun run build", {
|
|
18
|
+
cwd: p.frameworkPath("views")
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
await runCommand("bun build.ts", {
|
|
22
|
+
cwd: p.frameworkPath("server")
|
|
23
|
+
});
|
|
24
|
+
await runCommand("bun zip.ts", {
|
|
25
|
+
cwd: p.cloudPath()
|
|
26
|
+
});
|
|
27
|
+
log.info("Preparing Deployment...");
|
|
28
|
+
var profile = process.env.AWS_PROFILE || "stacks";
|
|
29
|
+
await runCommand(`bunx cdk deploy --require-approval never --profile="${profile}"`, {
|
|
30
|
+
cwd: p.frameworkCloudPath()
|
|
31
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/dev/components.ts
|
|
3
|
+
import {parseOptions, runCommand} from "@stacksjs/cli";
|
|
4
|
+
import {frameworkPath, viteConfigPath} from "@stacksjs/path";
|
|
5
|
+
var options = parseOptions();
|
|
6
|
+
if (options.verbose)
|
|
7
|
+
console.log("dev components options", options);
|
|
8
|
+
await runCommand(`bunx vite --config ${viteConfigPath("src/components.ts")}`, {
|
|
9
|
+
...options,
|
|
10
|
+
cwd: frameworkPath()
|
|
11
|
+
});
|
package/dist/dev/docs.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/helpers/utils.ts
|
|
3
|
+
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
4
|
+
import {err} from "@stacksjs/error-handling";
|
|
5
|
+
import {log} from "@stacksjs/logging";
|
|
6
|
+
import * as p from "@stacksjs/path";
|
|
7
|
+
import {glob} from "@stacksjs/storage";
|
|
8
|
+
var {Glob } = globalThis.Bun;
|
|
9
|
+
async function runAction(action, options) {
|
|
10
|
+
const glob2 = new Glob("**/*.ts");
|
|
11
|
+
const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true };
|
|
12
|
+
for await (const file of glob2.scan(scanOptions)) {
|
|
13
|
+
log.debug("file", file);
|
|
14
|
+
if (file === `${action}.ts` || file.endsWith(`${action}.ts`))
|
|
15
|
+
return (await import(p.userActionsPath(file))).default.handle();
|
|
16
|
+
const a = await import(p.userActionsPath(file));
|
|
17
|
+
if (a.name === action)
|
|
18
|
+
return await a.handle();
|
|
19
|
+
}
|
|
20
|
+
const opts = buddyOptions();
|
|
21
|
+
const path = p.relativeActionsPath(`src/${action}.ts`);
|
|
22
|
+
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
23
|
+
const optionsWithCwd = {
|
|
24
|
+
cwd: options?.cwd || p.projectPath(),
|
|
25
|
+
...options
|
|
26
|
+
};
|
|
27
|
+
log.debug("runAction:", cmd);
|
|
28
|
+
log.debug("action options:", optionsWithCwd);
|
|
29
|
+
return await runCommand(cmd, optionsWithCwd);
|
|
30
|
+
}
|
|
31
|
+
async function runActions(actions, options) {
|
|
32
|
+
log.debug("runActions:", actions, options);
|
|
33
|
+
if (!actions.length)
|
|
34
|
+
return err("No actions were specified");
|
|
35
|
+
for (const action of actions) {
|
|
36
|
+
log.debug(`running action "${action}"`);
|
|
37
|
+
if (!hasAction(action))
|
|
38
|
+
return err(`The specified action "${action}" does not exist`);
|
|
39
|
+
}
|
|
40
|
+
const opts = buddyOptions();
|
|
41
|
+
const o = {
|
|
42
|
+
cwd: options?.cwd || p.projectPath(),
|
|
43
|
+
...options
|
|
44
|
+
};
|
|
45
|
+
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`src/${action}.ts`)} ${opts}`);
|
|
46
|
+
log.debug("commands:", commands);
|
|
47
|
+
return await runCommands(commands, o);
|
|
48
|
+
}
|
|
49
|
+
function hasAction(action) {
|
|
50
|
+
const userActionPatterns = [
|
|
51
|
+
`${action}.ts`,
|
|
52
|
+
`${action}`,
|
|
53
|
+
`Dashboard/${action}.ts`,
|
|
54
|
+
`Dashboard/${action}`,
|
|
55
|
+
`Buddy/${action}.ts`,
|
|
56
|
+
`Buddy/${action}`
|
|
57
|
+
];
|
|
58
|
+
const actionPatterns = [`src/${action}.ts`, `src/${action}`, `${action}.ts`, `${action}`];
|
|
59
|
+
const userActionFiles = glob.sync(userActionPatterns.map((pattern) => p.userActionsPath(pattern)));
|
|
60
|
+
const actionFiles = glob.sync(actionPatterns.map((pattern) => p.actionsPath(pattern)));
|
|
61
|
+
return userActionFiles.length > 0 || actionFiles.length > 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/dev/index.ts
|
|
65
|
+
import {Action} from "@stacksjs/enums";
|
|
66
|
+
import {log as log2} from "@stacksjs/logging";
|
|
67
|
+
async function runDevServer(options) {
|
|
68
|
+
log2.info("Starting your Frontend Engine...");
|
|
69
|
+
await runAction(Action.Dev, options);
|
|
70
|
+
}
|
|
71
|
+
async function runFrontendDevServer(options) {
|
|
72
|
+
log2.info("Starting your UI Engine...");
|
|
73
|
+
await runAction(Action.Dev, options);
|
|
74
|
+
}
|
|
75
|
+
async function runBackendDevServer(options) {
|
|
76
|
+
runApiDevServer(options);
|
|
77
|
+
}
|
|
78
|
+
async function runApiDevServer(options) {
|
|
79
|
+
log2.info("Starting your API...");
|
|
80
|
+
await runAction(Action.DevApi, options);
|
|
81
|
+
}
|
|
82
|
+
async function runComponentsDevServer(options) {
|
|
83
|
+
log2.info("Starting your Library Engine...");
|
|
84
|
+
await runAction(Action.DevComponents, options);
|
|
85
|
+
}
|
|
86
|
+
async function runDashboardDevServer(options) {
|
|
87
|
+
log2.info("Starting your Dashboard...");
|
|
88
|
+
await runAction(Action.DevDashboard, options);
|
|
89
|
+
}
|
|
90
|
+
async function runSystemTrayDevServer(options) {
|
|
91
|
+
log2.info("Starting your System Tray...");
|
|
92
|
+
await runAction(Action.DevSystemTray, options);
|
|
93
|
+
}
|
|
94
|
+
async function runDesktopDevServer(options) {
|
|
95
|
+
log2.info("Starting your Desktop Engine...");
|
|
96
|
+
await runAction(Action.DevDesktop, options);
|
|
97
|
+
}
|
|
98
|
+
async function runDocsDevServer(options) {
|
|
99
|
+
log2.info("Starting your Docs Engine...");
|
|
100
|
+
await runAction(Action.DevDocs, options);
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
runSystemTrayDevServer,
|
|
104
|
+
runFrontendDevServer,
|
|
105
|
+
runDocsDevServer,
|
|
106
|
+
runDevServer,
|
|
107
|
+
runDesktopDevServer,
|
|
108
|
+
runDashboardDevServer,
|
|
109
|
+
runComponentsDevServer,
|
|
110
|
+
runBackendDevServer,
|
|
111
|
+
runApiDevServer
|
|
112
|
+
};
|
package/dist/examples.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/examples.ts
|
|
3
|
+
import process from "process";
|
|
4
|
+
import {NpmScript} from "@stacksjs/enums";
|
|
5
|
+
import {log} from "@stacksjs/logging";
|
|
6
|
+
import {hasComponents} from "@stacksjs/storage";
|
|
7
|
+
import {ExitCode} from "@stacksjs/types";
|
|
8
|
+
import {runNpmScript} from "@stacksjs/utils";
|
|
9
|
+
async function invoke(options) {
|
|
10
|
+
if (options.components || options.vue)
|
|
11
|
+
await componentExample(options);
|
|
12
|
+
else if (options.webComponents || options.elements)
|
|
13
|
+
await webComponentExample(options);
|
|
14
|
+
else
|
|
15
|
+
log.error("An unsupported option was used. Please try again, check the documentation & report the issue, if needed.");
|
|
16
|
+
}
|
|
17
|
+
async function examples(options) {
|
|
18
|
+
return invoke(options);
|
|
19
|
+
}
|
|
20
|
+
async function componentExample(options) {
|
|
21
|
+
if (hasComponents()) {
|
|
22
|
+
await runNpmScript(NpmScript.ExampleVue, options);
|
|
23
|
+
log.success("Your component library was built successfully");
|
|
24
|
+
} else {
|
|
25
|
+
log.info("No components found.");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async function webComponentExample(options) {
|
|
29
|
+
if (hasComponents()) {
|
|
30
|
+
log.info("Building your Web Component library...");
|
|
31
|
+
await runNpmScript(NpmScript.BuildWebComponents, options);
|
|
32
|
+
log.success("Your Web Component library was built successfully");
|
|
33
|
+
} else {
|
|
34
|
+
log.info("No components found.");
|
|
35
|
+
process.exit(ExitCode.FatalError);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
webComponentExample,
|
|
40
|
+
invoke,
|
|
41
|
+
examples,
|
|
42
|
+
componentExample
|
|
43
|
+
};
|