@stacksjs/actions 0.58.72 → 0.59.1
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.d.ts +36 -0
- package/dist/add.d.ts +6 -0
- package/dist/build/component-libs.d.ts +1 -0
- package/dist/build/core.d.ts +1 -0
- package/dist/build/stacks.d.ts +1 -0
- package/dist/build.d.ts +9 -0
- package/dist/bump.d.ts +1 -0
- package/dist/changelog.d.ts +1 -0
- package/dist/clean.d.ts +1 -0
- package/dist/commit.d.ts +3 -0
- package/dist/copy-types.d.ts +5 -0
- package/dist/database/seed.d.ts +1 -0
- package/dist/deploy/index.d.ts +1 -0
- package/dist/dev/components.d.ts +1 -0
- package/dist/dev/docs.d.ts +1 -0
- package/dist/dev/index.d.ts +10 -0
- package/dist/examples.d.ts +5 -0
- package/dist/fresh.d.ts +1 -0
- package/dist/generate/component-meta.d.ts +5 -0
- package/dist/generate/ide-helpers.d.ts +6 -0
- package/dist/generate/index.d.ts +13 -0
- package/dist/generate/lib-entries.d.ts +2 -0
- package/dist/generate/vscode-custom-data.d.ts +6 -0
- package/dist/helpers/component-meta.d.ts +22 -0
- package/dist/helpers/lib-entries.d.ts +13 -0
- package/dist/helpers/package-json.d.ts +3 -0
- package/dist/helpers/utils.d.ts +18 -0
- package/dist/helpers/vscode-custom-data.d.ts +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/key-generate.d.ts +1 -0
- package/dist/lint/fix.d.ts +1 -0
- package/dist/lint/index.d.ts +1 -0
- package/dist/make.d.ts +20 -0
- package/dist/prepublish.d.ts +1 -0
- package/dist/release.d.ts +2 -0
- package/dist/test/coverage.d.ts +1 -0
- package/dist/test/feature.d.ts +1 -0
- package/dist/test/ui.d.ts +1 -0
- package/dist/test/unit.d.ts +1 -0
- package/dist/test.d.ts +1 -0
- package/dist/tinker.d.ts +1 -0
- package/dist/typecheck.d.ts +1 -0
- package/dist/types.d.ts +3 -0
- package/dist/upgrade/dependencies.d.ts +1 -0
- package/dist/upgrade/framework.d.ts +1 -0
- package/dist/upgrade/index.d.ts +1 -0
- package/dist/upgrade.d.ts +4 -0
- package/package.json +5 -3
- package/src/bump.ts +8 -3
- package/src/check/ports.ts +27 -0
- package/src/deploy/index.ts +2 -6
- package/src/dev/api.ts +1 -1
- package/src/dev/index.ts +1 -1
- package/src/find-projects.ts +21 -0
- package/src/generate/action-types.ts +14 -78
- package/src/generate/custom-cli-file.ts +1 -1
- package/src/generate/index.ts +10 -2
- package/src/generate/symlink-core.ts +3 -0
- package/src/helpers/lib-entries.ts +3 -3
- package/src/helpers/utils.ts +10 -14
- package/src/index.ts +1 -2
- package/src/lint/fix.ts +1 -0
- package/src/upgrade/binary.ts +43 -0
- package/src/upgrade/index.ts +6 -0
- package/src/upgrade/shell.ts +64 -0
- package/dist/src/add.js +0 -29
- package/dist/src/build/component-libs.js +0 -6
- package/dist/src/build/core.js +0 -21
- package/dist/src/build/stacks.js +0 -8
- package/dist/src/build.js +0 -213
- package/dist/src/bump.js +0 -14
- package/dist/src/changelog.js +0 -17
- package/dist/src/clean.js +0 -6
- package/dist/src/commit.js +0 -17
- package/dist/src/copy-types.js +0 -14
- package/dist/src/database/seed.js +0 -1
- package/dist/src/deploy/index.js +0 -31
- package/dist/src/dev/components.js +0 -11
- package/dist/src/dev/docs.js +0 -7
- package/dist/src/dev/index.js +0 -92
- package/dist/src/examples.js +0 -43
- package/dist/src/fresh.js +0 -18
- package/dist/src/generate/component-meta.js +0 -59
- package/dist/src/generate/ide-helpers.js +0 -91
- package/dist/src/generate/index.js +0 -147
- package/dist/src/generate/lib-entries.js +0 -170
- package/dist/src/generate/vscode-custom-data.js +0 -91
- package/dist/src/helpers/component-meta.js +0 -50
- package/dist/src/helpers/index.js +0 -48
- package/dist/src/helpers/lib-entries.js +0 -161
- package/dist/src/helpers/package-json.js +0 -136
- package/dist/src/helpers/utils.js +0 -48
- package/dist/src/helpers/vscode-custom-data.js +0 -83
- package/dist/src/index.js +0 -583
- package/dist/src/key-generate.js +0 -10
- package/dist/src/lint/fix.js +0 -12
- package/dist/src/lint/index.js +0 -17
- package/dist/src/make.js +0 -291
- package/dist/src/prepublish.js +0 -14
- package/dist/src/release.js +0 -553
- package/dist/src/test/coverage.js +0 -6
- package/dist/src/test/feature.js +0 -6
- package/dist/src/test/ui.js +0 -6
- package/dist/src/test/unit.js +0 -6
- package/dist/src/test.js +0 -6
- package/dist/src/tinker.js +0 -5
- package/dist/src/typecheck.js +0 -6
- package/dist/src/types.js +0 -21
- package/dist/src/upgrade/dependencies.js +0 -6
- package/dist/src/upgrade/framework.js +0 -1
- package/dist/src/upgrade/index.js +0 -54
- package/dist/src/upgrade.js +0 -47
- package/src/generate/caddyfile.ts +0 -1
- package/src/helpers/index.ts +0 -1
- package/src/start-caddy.ts +0 -13
package/dist/src/release.js
DELETED
|
@@ -1,553 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
// @bun
|
|
3
|
-
|
|
4
|
-
// src/helpers/utils.ts
|
|
5
|
-
import * as storage from "@stacksjs/storage";
|
|
6
|
-
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
7
|
-
import {log} from "@stacksjs/logging";
|
|
8
|
-
import * as p from "@stacksjs/path";
|
|
9
|
-
import {err, handleError} from "@stacksjs/error-handling";
|
|
10
|
-
async function runAction(action, options) {
|
|
11
|
-
const opts = buddyOptions();
|
|
12
|
-
const path = p.relativeActionsPath(`${action}.ts`);
|
|
13
|
-
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
14
|
-
const optionsWithCwd = {
|
|
15
|
-
cwd: options?.cwd || p.projectPath(),
|
|
16
|
-
...options
|
|
17
|
-
};
|
|
18
|
-
log.debug("runAction:", cmd);
|
|
19
|
-
log.debug("action options:", optionsWithCwd);
|
|
20
|
-
if (!hasAction(action))
|
|
21
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
22
|
-
return await runCommand(cmd, optionsWithCwd);
|
|
23
|
-
}
|
|
24
|
-
async function runActions(actions, options) {
|
|
25
|
-
log.debug("runActions:", actions);
|
|
26
|
-
log.debug("actions options:", options);
|
|
27
|
-
if (!actions.length)
|
|
28
|
-
return err("No actions were specified");
|
|
29
|
-
for (const action of actions) {
|
|
30
|
-
if (!hasAction(action))
|
|
31
|
-
return err(`The specified action "${action}" does not exist`);
|
|
32
|
-
}
|
|
33
|
-
const opts = buddyOptions();
|
|
34
|
-
const o = {
|
|
35
|
-
cwd: options?.cwd || p.projectPath(),
|
|
36
|
-
...options
|
|
37
|
-
};
|
|
38
|
-
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
39
|
-
return await runCommands(commands, o);
|
|
40
|
-
}
|
|
41
|
-
function hasAction(action) {
|
|
42
|
-
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
|
43
|
-
return true;
|
|
44
|
-
return storage.isFile(p.actionsPath(`${action}.ts`));
|
|
45
|
-
}
|
|
46
|
-
// src/dev/index.ts
|
|
47
|
-
import {log as log2} from "@stacksjs/logging";
|
|
48
|
-
import {Action} from "@stacksjs/enums";
|
|
49
|
-
async function runDevServer(options) {
|
|
50
|
-
log2.info("Starting your Frontend Engine...");
|
|
51
|
-
await runAction(Action.Dev, options);
|
|
52
|
-
}
|
|
53
|
-
async function runFrontendDevServer(options) {
|
|
54
|
-
log2.info("Starting your UI Engine...");
|
|
55
|
-
await runAction(Action.Dev, options);
|
|
56
|
-
}
|
|
57
|
-
async function runBackendDevServer(options) {
|
|
58
|
-
runApiDevServer(options);
|
|
59
|
-
}
|
|
60
|
-
async function runApiDevServer(options) {
|
|
61
|
-
log2.info("Starting your API...");
|
|
62
|
-
await runAction(Action.DevApi, options);
|
|
63
|
-
}
|
|
64
|
-
async function runComponentsDevServer(options) {
|
|
65
|
-
log2.info("Starting your Library Engine...");
|
|
66
|
-
await runAction(Action.DevComponents, options);
|
|
67
|
-
}
|
|
68
|
-
async function runDashboardDevServer(options) {
|
|
69
|
-
log2.info("Starting your Dashboard...");
|
|
70
|
-
await runAction(Action.DevDashboard, options);
|
|
71
|
-
}
|
|
72
|
-
async function runSystemTrayDevServer(options) {
|
|
73
|
-
log2.info("Starting your System Tray...");
|
|
74
|
-
await runAction(Action.DevSystemTray, options);
|
|
75
|
-
}
|
|
76
|
-
async function runDesktopDevServer(options) {
|
|
77
|
-
log2.info("Starting your Desktop Engine...");
|
|
78
|
-
await runAction(Action.DevDesktop, options);
|
|
79
|
-
}
|
|
80
|
-
async function runDocsDevServer(options) {
|
|
81
|
-
log2.info("Starting your Docs Engine...");
|
|
82
|
-
await runAction(Action.DevDocs, options);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// src/generate/index.ts
|
|
86
|
-
import process from "process";
|
|
87
|
-
import {log as log3} from "@stacksjs/logging";
|
|
88
|
-
import {Action as Action2, NpmScript} from "@stacksjs/enums";
|
|
89
|
-
import {runNpmScript} from "@stacksjs/utils";
|
|
90
|
-
import {frameworkPath, projectPath as projectPath2} from "@stacksjs/path";
|
|
91
|
-
async function invoke(options) {
|
|
92
|
-
if (options?.types)
|
|
93
|
-
await generateTypes(options);
|
|
94
|
-
else if (options?.entries)
|
|
95
|
-
await generateLibEntries(options);
|
|
96
|
-
else if (options?.webTypes)
|
|
97
|
-
await generateWebTypes(options);
|
|
98
|
-
else if (options?.customData)
|
|
99
|
-
await generateVsCodeCustomData(options);
|
|
100
|
-
else if (options?.ideHelpers)
|
|
101
|
-
await generateIdeHelpers(options);
|
|
102
|
-
else if (options?.componentMeta)
|
|
103
|
-
await generateComponentMeta(options);
|
|
104
|
-
}
|
|
105
|
-
function generate(options) {
|
|
106
|
-
return invoke(options);
|
|
107
|
-
}
|
|
108
|
-
async function generateLibEntries(options) {
|
|
109
|
-
const result = await runAction(Action2.GenerateLibraryEntries, {
|
|
110
|
-
...options,
|
|
111
|
-
cwd: projectPath2()
|
|
112
|
-
});
|
|
113
|
-
if (result.isErr()) {
|
|
114
|
-
log3.error("There was an error generating your library entry points", result.error);
|
|
115
|
-
process.exit();
|
|
116
|
-
}
|
|
117
|
-
log3.success("Library entry points generated successfully");
|
|
118
|
-
}
|
|
119
|
-
async function generateWebTypes(options) {
|
|
120
|
-
const result = await runNpmScript(NpmScript.GenerateWebTypes, options);
|
|
121
|
-
if (result.isErr()) {
|
|
122
|
-
log3.error("There was an error generating the web-types.json file.", result.error);
|
|
123
|
-
process.exit();
|
|
124
|
-
}
|
|
125
|
-
log3.success("Successfully generated the web-types.json file");
|
|
126
|
-
}
|
|
127
|
-
async function generateVsCodeCustomData(options) {
|
|
128
|
-
const result = await runNpmScript(NpmScript.GenerateVsCodeCustomData, {
|
|
129
|
-
cwd: frameworkPath(),
|
|
130
|
-
...options
|
|
131
|
-
});
|
|
132
|
-
if (result.isErr()) {
|
|
133
|
-
log3.error("There was an error generating the custom-elements.json file.", result.error);
|
|
134
|
-
process.exit();
|
|
135
|
-
}
|
|
136
|
-
await runAction(Action2.LintFix, { verbose: true });
|
|
137
|
-
log3.success("Successfully generated the custom-elements.json file");
|
|
138
|
-
}
|
|
139
|
-
async function generateIdeHelpers(options) {
|
|
140
|
-
const result = await runNpmScript(NpmScript.GenerateIdeHelpers, options);
|
|
141
|
-
if (result.isErr()) {
|
|
142
|
-
log3.error("There was an error generating IDE helpers.", result.error);
|
|
143
|
-
process.exit();
|
|
144
|
-
}
|
|
145
|
-
await runAction(Action2.LintFix, { verbose: true });
|
|
146
|
-
log3.success("Successfully generated IDE helpers");
|
|
147
|
-
}
|
|
148
|
-
async function generateComponentMeta(options) {
|
|
149
|
-
const result = await runNpmScript(NpmScript.GenerateComponentMeta, options);
|
|
150
|
-
if (result.isErr()) {
|
|
151
|
-
log3.error("There was an error generating your component meta information.", result.error);
|
|
152
|
-
process.exit();
|
|
153
|
-
}
|
|
154
|
-
await runAction(Action2.LintFix, { verbose: true });
|
|
155
|
-
log3.success("Successfully generated component meta information");
|
|
156
|
-
}
|
|
157
|
-
async function generateTypes(options) {
|
|
158
|
-
const result = await runNpmScript(NpmScript.GenerateTypes, {
|
|
159
|
-
cwd: frameworkPath(),
|
|
160
|
-
...options
|
|
161
|
-
});
|
|
162
|
-
if (result.isErr()) {
|
|
163
|
-
log3.error("There was an error generating your types.", result.error);
|
|
164
|
-
process.exit();
|
|
165
|
-
}
|
|
166
|
-
log3.success("Types were generated successfully");
|
|
167
|
-
}
|
|
168
|
-
function generateMigrations() {
|
|
169
|
-
log3.success("Successfully updated migrations");
|
|
170
|
-
}
|
|
171
|
-
function generatePkgxConfig() {
|
|
172
|
-
log3.success("Successfully generated `./pkgx.yaml` based on your configs");
|
|
173
|
-
}
|
|
174
|
-
async function generateSeeder() {
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// src/examples.ts
|
|
178
|
-
import process2 from "process";
|
|
179
|
-
import {log as log4} from "@stacksjs/logging";
|
|
180
|
-
import {hasComponents} from "@stacksjs/storage";
|
|
181
|
-
import {runNpmScript as runNpmScript2} from "@stacksjs/utils";
|
|
182
|
-
import {ExitCode} from "@stacksjs/types";
|
|
183
|
-
import {NpmScript as NpmScript2} from "@stacksjs/enums";
|
|
184
|
-
async function invoke2(options) {
|
|
185
|
-
if (options.components || options.vue)
|
|
186
|
-
await componentExample(options);
|
|
187
|
-
else if (options.webComponents || options.elements)
|
|
188
|
-
await webComponentExample(options);
|
|
189
|
-
else
|
|
190
|
-
log4.error("An unsupported option was used. Please try again, check the documentation & report the issue, if needed.");
|
|
191
|
-
}
|
|
192
|
-
async function examples(options) {
|
|
193
|
-
return invoke2(options);
|
|
194
|
-
}
|
|
195
|
-
async function componentExample(options) {
|
|
196
|
-
if (hasComponents()) {
|
|
197
|
-
await runNpmScript2(NpmScript2.ExampleVue, options);
|
|
198
|
-
log4.success("Your component library was built successfully");
|
|
199
|
-
} else {
|
|
200
|
-
log4.info("No components found.");
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
async function webComponentExample(options) {
|
|
204
|
-
if (hasComponents()) {
|
|
205
|
-
log4.info("Building your Web Component library...");
|
|
206
|
-
await runNpmScript2(NpmScript2.BuildWebComponents, options);
|
|
207
|
-
log4.success("Your Web Component library was built successfully");
|
|
208
|
-
} else {
|
|
209
|
-
log4.info("No components found.");
|
|
210
|
-
process2.exit(ExitCode.FatalError);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// src/commit.ts
|
|
215
|
-
import {log as log5} from "@stacksjs/logging";
|
|
216
|
-
import {runNpmScript as runNpmScript3} from "@stacksjs/utils";
|
|
217
|
-
import {NpmScript as NpmScript3} from "@stacksjs/enums";
|
|
218
|
-
async function invoke3(options) {
|
|
219
|
-
log5.info("Committing...");
|
|
220
|
-
await runNpmScript3(NpmScript3.Commit, options);
|
|
221
|
-
log5.success("Committed");
|
|
222
|
-
}
|
|
223
|
-
async function commit(options) {
|
|
224
|
-
return invoke3(options);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// src/add.ts
|
|
228
|
-
import {installPackage} from "@stacksjs/cli";
|
|
229
|
-
async function invoke4(options) {
|
|
230
|
-
if (options?.table)
|
|
231
|
-
await addTable();
|
|
232
|
-
if (options?.calendar)
|
|
233
|
-
await addCalendar();
|
|
234
|
-
}
|
|
235
|
-
async function add(options) {
|
|
236
|
-
return invoke4(options);
|
|
237
|
-
}
|
|
238
|
-
async function addTable() {
|
|
239
|
-
await installPackage("@stacksjs/table");
|
|
240
|
-
}
|
|
241
|
-
async function addCalendar() {
|
|
242
|
-
await installPackage("@stacksjs/calendar");
|
|
243
|
-
}
|
|
244
|
-
async function installPackages(names) {
|
|
245
|
-
for (const name of names)
|
|
246
|
-
await installPackage(name);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// src/make.ts
|
|
250
|
-
import process3 from "process";
|
|
251
|
-
import {italic} from "@stacksjs/cli";
|
|
252
|
-
import {log as log6} from "@stacksjs/logging";
|
|
253
|
-
import {createFolder, doesFolderExist, writeTextFile} from "@stacksjs/storage";
|
|
254
|
-
import {frameworkPath as frameworkPath2, projectPath as projectPath3, resolve} from "@stacksjs/path";
|
|
255
|
-
async function invoke5(options) {
|
|
256
|
-
if (options.component)
|
|
257
|
-
await makeComponent(options);
|
|
258
|
-
if (options.database)
|
|
259
|
-
makeDatabase(options);
|
|
260
|
-
if (options.function)
|
|
261
|
-
await makeFunction(options);
|
|
262
|
-
if (options.language)
|
|
263
|
-
await makeLanguage(options);
|
|
264
|
-
if (options.notification)
|
|
265
|
-
await makeNotification(options);
|
|
266
|
-
if (options.page)
|
|
267
|
-
await makePage(options);
|
|
268
|
-
if (options.stack)
|
|
269
|
-
makeStack(options);
|
|
270
|
-
}
|
|
271
|
-
async function make(options) {
|
|
272
|
-
return invoke5(options);
|
|
273
|
-
}
|
|
274
|
-
async function makeComponent(options) {
|
|
275
|
-
try {
|
|
276
|
-
const name = options.name;
|
|
277
|
-
log6.info("Creating your component...");
|
|
278
|
-
await createComponent(options);
|
|
279
|
-
log6.success(`Created ${italic(name)} component`);
|
|
280
|
-
} catch (error) {
|
|
281
|
-
log6.error("There was an error creating your component", error);
|
|
282
|
-
process3.exit();
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
async function createComponent(options) {
|
|
286
|
-
const name = options.name;
|
|
287
|
-
await writeTextFile({
|
|
288
|
-
path: `./components/${name}.stx`,
|
|
289
|
-
data: `<script setup lang="ts">
|
|
290
|
-
// eslint-disable-next-line no-console
|
|
291
|
-
console.log('Hello World component created')
|
|
292
|
-
</script>
|
|
293
|
-
|
|
294
|
-
<template>
|
|
295
|
-
<div>
|
|
296
|
-
Some HTML block
|
|
297
|
-
</div>
|
|
298
|
-
</template>
|
|
299
|
-
`
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
function makeDatabase(options) {
|
|
303
|
-
try {
|
|
304
|
-
const name = options.name;
|
|
305
|
-
log6.info(`Creating your ${italic(name)} database...`);
|
|
306
|
-
createDatabase(options);
|
|
307
|
-
log6.success(`Created ${italic(name)} database`);
|
|
308
|
-
} catch (error) {
|
|
309
|
-
log6.error("There was an error creating your database", error);
|
|
310
|
-
process3.exit();
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
function createDatabase(options) {
|
|
314
|
-
console.log("options", options);
|
|
315
|
-
}
|
|
316
|
-
function factory(options) {
|
|
317
|
-
try {
|
|
318
|
-
const name = options.name;
|
|
319
|
-
log6.info(`Creating your ${italic(name)} factory...`);
|
|
320
|
-
createDatabase(options);
|
|
321
|
-
log6.success(`Created ${italic(name)} factory`);
|
|
322
|
-
} catch (error) {
|
|
323
|
-
log6.error("There was an error creating your factory", error);
|
|
324
|
-
process3.exit();
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
function createFactory(options) {
|
|
328
|
-
console.log("options", options);
|
|
329
|
-
}
|
|
330
|
-
async function makeNotification(options) {
|
|
331
|
-
try {
|
|
332
|
-
const name = options.name;
|
|
333
|
-
log6.info(`Creating your ${italic(name)} notification...`);
|
|
334
|
-
await createNotification(options);
|
|
335
|
-
log6.success(`Created ${italic(name)} notification`);
|
|
336
|
-
} catch (error) {
|
|
337
|
-
log6.error("There was an error creating your notification", error);
|
|
338
|
-
process3.exit();
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
async function makePage(options) {
|
|
342
|
-
try {
|
|
343
|
-
const name = options.name;
|
|
344
|
-
log6.info("Creating your page...");
|
|
345
|
-
await createPage(options);
|
|
346
|
-
log6.success(`Created ${name} page`);
|
|
347
|
-
} catch (error) {
|
|
348
|
-
log6.error("There was an error creating your page", error);
|
|
349
|
-
process3.exit();
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
async function createPage(options) {
|
|
353
|
-
const name = options.name;
|
|
354
|
-
await writeTextFile({
|
|
355
|
-
path: `./pages/${name}.stx`,
|
|
356
|
-
data: `<script setup lang="ts">
|
|
357
|
-
// eslint-disable-next-line no-console
|
|
358
|
-
console.log('Hello World page created')
|
|
359
|
-
</script>
|
|
360
|
-
|
|
361
|
-
<template>
|
|
362
|
-
<div>
|
|
363
|
-
Visit http://127.0.0.1/${name}
|
|
364
|
-
</div>
|
|
365
|
-
</template>
|
|
366
|
-
`
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
async function makeFunction(options) {
|
|
370
|
-
try {
|
|
371
|
-
const name = options.name;
|
|
372
|
-
log6.info("Creating your function...");
|
|
373
|
-
await createFunction(options);
|
|
374
|
-
log6.success(`Created ${name} function`);
|
|
375
|
-
} catch (error) {
|
|
376
|
-
log6.error("There was an error creating your function", error);
|
|
377
|
-
process3.exit();
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
async function createFunction(options) {
|
|
381
|
-
const name = options.name;
|
|
382
|
-
await writeTextFile({
|
|
383
|
-
path: `./functions/${name}.ts`,
|
|
384
|
-
data: `// reactive state
|
|
385
|
-
const ${name} = ref(0)
|
|
386
|
-
|
|
387
|
-
// functions that mutate state and trigger updates
|
|
388
|
-
function increment() {
|
|
389
|
-
${name}.value++
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
export {
|
|
393
|
-
${name},
|
|
394
|
-
increment,
|
|
395
|
-
}
|
|
396
|
-
`
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
|
-
async function makeLanguage(options) {
|
|
400
|
-
try {
|
|
401
|
-
const name = options.name;
|
|
402
|
-
log6.info("Creating your translation file...");
|
|
403
|
-
await createLanguage(options);
|
|
404
|
-
log6.success(`Created ${name} translation file`);
|
|
405
|
-
} catch (error) {
|
|
406
|
-
log6.error("There was an error creating your language.", error);
|
|
407
|
-
process3.exit();
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
async function createLanguage(options) {
|
|
411
|
-
const name = options.name;
|
|
412
|
-
await writeTextFile({
|
|
413
|
-
path: `./lang/${name}.yml`,
|
|
414
|
-
data: `button:
|
|
415
|
-
text: Copy
|
|
416
|
-
`
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
function makeStack(options) {
|
|
420
|
-
try {
|
|
421
|
-
const name = options.name;
|
|
422
|
-
log6.info(`Creating your ${name} stack...`);
|
|
423
|
-
const path3 = resolve(process3.cwd(), name);
|
|
424
|
-
log6.success("Successfully scaffolded your project");
|
|
425
|
-
log6.info(`cd ${path3} && bun install`);
|
|
426
|
-
} catch (error) {
|
|
427
|
-
log6.error("There was an error creating your stack", error);
|
|
428
|
-
process3.exit();
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
async function createNotification(options) {
|
|
432
|
-
const name = options.name;
|
|
433
|
-
try {
|
|
434
|
-
let importOption = "EmailOptions";
|
|
435
|
-
if (!doesFolderExist("notifications"))
|
|
436
|
-
await createFolder("./notifications");
|
|
437
|
-
if (options.chat)
|
|
438
|
-
importOption = "ChatOptions";
|
|
439
|
-
if (options.sms)
|
|
440
|
-
importOption = "SMSOptions";
|
|
441
|
-
await writeTextFile({
|
|
442
|
-
path: `./notifications/${name}.ts`,
|
|
443
|
-
data: `import type { ${importOption} } from \'@stacksjs/types\'
|
|
444
|
-
|
|
445
|
-
function content(): string {
|
|
446
|
-
return 'example'
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
function send(): ${importOption} {
|
|
450
|
-
return {
|
|
451
|
-
content: content(),
|
|
452
|
-
}
|
|
453
|
-
}`
|
|
454
|
-
});
|
|
455
|
-
return true;
|
|
456
|
-
} catch (error) {
|
|
457
|
-
return false;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
async function createMigration(options) {
|
|
461
|
-
const optionName = options.name;
|
|
462
|
-
const table = "dummy-name";
|
|
463
|
-
const name = optionName[0].toUpperCase() + optionName.slice(1);
|
|
464
|
-
const path3 = frameworkPath2(`database/migrations/${name}.ts`);
|
|
465
|
-
try {
|
|
466
|
-
await writeTextFile({
|
|
467
|
-
path: `${path3}`,
|
|
468
|
-
data: `import { Kysely } from 'kysely'
|
|
469
|
-
|
|
470
|
-
export async function up(db: Kysely<any>): Promise<void> {
|
|
471
|
-
await db.schema
|
|
472
|
-
.createTable('${table}')
|
|
473
|
-
.addColumn('id', 'integer', (col) => col.autoIncrement().primaryKey())
|
|
474
|
-
.execute()
|
|
475
|
-
}`
|
|
476
|
-
});
|
|
477
|
-
log6.success(`Successfully created your migration file at stacks/database/migrations/${name}.ts`);
|
|
478
|
-
} catch (error) {
|
|
479
|
-
log6.error(error);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
async function createModel(options) {
|
|
483
|
-
const optionName = options.name;
|
|
484
|
-
const name = optionName[0].toUpperCase() + optionName.slice(1);
|
|
485
|
-
const path3 = projectPath3(`app/Models/${name}.ts`);
|
|
486
|
-
try {
|
|
487
|
-
await writeTextFile({
|
|
488
|
-
path: `${path3}`,
|
|
489
|
-
data: `import { faker } from '@stacksjs/faker'
|
|
490
|
-
import { validate } from '@stacksjs/validation'
|
|
491
|
-
import type { Model } from '@stacksjs/types'
|
|
492
|
-
|
|
493
|
-
export default <Model> {
|
|
494
|
-
name: '${name}',
|
|
495
|
-
|
|
496
|
-
searchable: true, // boolean | IndexSettings,
|
|
497
|
-
authenticatable: true, // boolean | AuthSettings,
|
|
498
|
-
|
|
499
|
-
seeder: {
|
|
500
|
-
count: 10,
|
|
501
|
-
},
|
|
502
|
-
|
|
503
|
-
fields: {
|
|
504
|
-
name: {
|
|
505
|
-
validation: validate.string().min(3).max(255),
|
|
506
|
-
factory: () => faker.person,
|
|
507
|
-
},
|
|
508
|
-
|
|
509
|
-
// more fields here
|
|
510
|
-
},
|
|
511
|
-
}`
|
|
512
|
-
});
|
|
513
|
-
log6.success(`Successfully created your model at app/Models/${name}.ts`);
|
|
514
|
-
} catch (error) {
|
|
515
|
-
log6.error(error);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
// src/action.ts
|
|
520
|
-
class Action3 {
|
|
521
|
-
name;
|
|
522
|
-
description;
|
|
523
|
-
fields;
|
|
524
|
-
rate;
|
|
525
|
-
tries;
|
|
526
|
-
backoff;
|
|
527
|
-
enabled;
|
|
528
|
-
handle;
|
|
529
|
-
constructor({ name, description, fields, handle, rate, tries, backoff, enabled }) {
|
|
530
|
-
this.name = name;
|
|
531
|
-
this.description = description;
|
|
532
|
-
this.fields = fields;
|
|
533
|
-
this.rate = rate;
|
|
534
|
-
this.tries = tries;
|
|
535
|
-
this.backoff = backoff;
|
|
536
|
-
this.enabled = enabled;
|
|
537
|
-
this.handle = handle;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
// src/release.ts
|
|
541
|
-
import {projectPath as projectPath4} from "@stacksjs/path";
|
|
542
|
-
import {Action as Action4} from "@stacksjs/enums";
|
|
543
|
-
import {log as log7} from "@stacksjs/logging";
|
|
544
|
-
import {app} from "@stacksjs/config";
|
|
545
|
-
await runActions([
|
|
546
|
-
Action4.GenerateLibraryEntries,
|
|
547
|
-
Action4.LintFix,
|
|
548
|
-
Action4.Bump
|
|
549
|
-
], {
|
|
550
|
-
cwd: projectPath4(),
|
|
551
|
-
stdin: "inherit"
|
|
552
|
-
});
|
|
553
|
-
log7.success(`Successfully released ${app.name}`);
|
package/dist/src/test/feature.js
DELETED
package/dist/src/test/ui.js
DELETED
package/dist/src/test/unit.js
DELETED
package/dist/src/test.js
DELETED
package/dist/src/tinker.js
DELETED
package/dist/src/typecheck.js
DELETED
package/dist/src/types.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/types.ts
|
|
3
|
-
import process from "process";
|
|
4
|
-
import {log} from "@stacksjs/logging";
|
|
5
|
-
import {runNpmScript} from "@stacksjs/utils";
|
|
6
|
-
import {NpmScript} from "@stacksjs/enums";
|
|
7
|
-
async function invoke(options) {
|
|
8
|
-
const results = await runNpmScript(NpmScript.TypesFix, options);
|
|
9
|
-
if (results.isErr()) {
|
|
10
|
-
log.error("There was an error fixing your types.", results.error);
|
|
11
|
-
process.exit();
|
|
12
|
-
}
|
|
13
|
-
log.success("Types are set");
|
|
14
|
-
}
|
|
15
|
-
async function types(options) {
|
|
16
|
-
return invoke(options);
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
types,
|
|
20
|
-
invoke
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/helpers/utils.ts
|
|
3
|
-
import * as storage from "@stacksjs/storage";
|
|
4
|
-
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
5
|
-
import {log} from "@stacksjs/logging";
|
|
6
|
-
import * as p from "@stacksjs/path";
|
|
7
|
-
import {err, handleError} from "@stacksjs/error-handling";
|
|
8
|
-
async function runAction(action, options) {
|
|
9
|
-
const opts = buddyOptions();
|
|
10
|
-
const path = p.relativeActionsPath(`${action}.ts`);
|
|
11
|
-
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
12
|
-
const optionsWithCwd = {
|
|
13
|
-
cwd: options?.cwd || p.projectPath(),
|
|
14
|
-
...options
|
|
15
|
-
};
|
|
16
|
-
log.debug("runAction:", cmd);
|
|
17
|
-
log.debug("action options:", optionsWithCwd);
|
|
18
|
-
if (!hasAction(action))
|
|
19
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
20
|
-
return await runCommand(cmd, optionsWithCwd);
|
|
21
|
-
}
|
|
22
|
-
async function runActions(actions, options) {
|
|
23
|
-
log.debug("runActions:", actions);
|
|
24
|
-
log.debug("actions options:", options);
|
|
25
|
-
if (!actions.length)
|
|
26
|
-
return err("No actions were specified");
|
|
27
|
-
for (const action of actions) {
|
|
28
|
-
if (!hasAction(action))
|
|
29
|
-
return err(`The specified action "${action}" does not exist`);
|
|
30
|
-
}
|
|
31
|
-
const opts = buddyOptions();
|
|
32
|
-
const o = {
|
|
33
|
-
cwd: options?.cwd || p.projectPath(),
|
|
34
|
-
...options
|
|
35
|
-
};
|
|
36
|
-
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
37
|
-
return await runCommands(commands, o);
|
|
38
|
-
}
|
|
39
|
-
function hasAction(action) {
|
|
40
|
-
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
|
41
|
-
return true;
|
|
42
|
-
return storage.isFile(p.actionsPath(`${action}.ts`));
|
|
43
|
-
}
|
|
44
|
-
// src/upgrade/index.ts
|
|
45
|
-
import process from "process";
|
|
46
|
-
import {parseArgs} from "@stacksjs/cli";
|
|
47
|
-
import {Action} from "@stacksjs/enums";
|
|
48
|
-
import {ExitCode} from "@stacksjs/types";
|
|
49
|
-
var options = parseArgs();
|
|
50
|
-
if (options?.dependencies || options?.all)
|
|
51
|
-
await runAction(Action.UpgradeDeps, options);
|
|
52
|
-
if (options?.bun || options?.all)
|
|
53
|
-
await runAction(Action.UpgradeBun, options);
|
|
54
|
-
process.exit(ExitCode.InvalidArgument);
|