@stacksjs/actions 0.57.3 → 0.58.19
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 +4 -4
- package/dist/src/add.js +29 -0
- package/dist/src/build/component-libs.js +6 -0
- package/dist/src/build/core.js +25 -0
- package/dist/src/build/stacks.js +8 -0
- package/dist/src/build.js +226 -0
- package/dist/src/bump.js +8 -0
- package/dist/src/changelog.js +9 -0
- package/dist/src/clean.js +6 -0
- package/dist/src/commit.js +17 -0
- package/dist/{copy-types.mjs → src/copy-types.js} +7 -4
- package/dist/src/database/seed.js +4 -0
- package/dist/src/deploy/index.js +31 -0
- package/dist/src/dev/components.js +11 -0
- package/dist/src/dev/docs.js +7 -0
- package/dist/src/dev/index.js +90 -0
- package/dist/{examples.mjs → src/examples.js} +18 -8
- package/dist/src/fresh.js +18 -0
- package/dist/src/generate/component-meta.js +57 -0
- package/dist/src/generate/ide-helpers.js +83 -0
- package/dist/src/generate/index.js +161 -0
- package/dist/src/generate/lib-entries.js +168 -0
- package/dist/src/generate/vscode-custom-data.js +82 -0
- package/dist/src/generate/vue-compat.js +18 -0
- package/dist/{helpers/component-meta.mjs → src/helpers/component-meta.js} +13 -13
- package/dist/src/helpers/index.js +56 -0
- package/dist/src/helpers/lib-entries.js +160 -0
- package/dist/src/helpers/package-json.js +135 -0
- package/dist/src/helpers/utils.js +56 -0
- package/dist/src/helpers/vscode-custom-data.js +75 -0
- package/dist/src/helpers/vue-compat.js +16 -0
- package/dist/src/index.js +577 -0
- package/dist/src/key-generate.js +10 -0
- package/dist/src/lint/fix.js +8 -0
- package/dist/src/lint/index.js +21 -0
- package/dist/{make.mjs → src/make.js} +71 -49
- package/dist/src/prepublish.js +14 -0
- package/dist/src/release.js +545 -0
- package/dist/src/test/coverage.js +6 -0
- package/dist/src/test/feature.js +6 -0
- package/dist/src/test/ui.js +6 -0
- package/dist/src/test/unit.js +6 -0
- package/dist/src/test.js +6 -0
- package/dist/src/tinker.js +5 -0
- package/dist/src/typecheck.js +6 -0
- package/dist/src/types.js +21 -0
- package/dist/src/upgrade/dependencies.js +6 -0
- package/dist/src/upgrade/framework.js +1 -0
- package/dist/src/upgrade/index.js +1 -0
- package/dist/src/upgrade.js +39 -0
- package/package.json +53 -239
- package/LICENSE.md +0 -21
- package/dist/add.d.ts +0 -11
- package/dist/add.mjs +0 -20
- package/dist/build/component-libs.d.ts +0 -1
- package/dist/build/component-libs.mjs +0 -4
- package/dist/build/core.d.ts +0 -1
- package/dist/build/core.mjs +0 -6
- package/dist/build/stacks.d.ts +0 -1
- package/dist/build/stacks.mjs +0 -12
- package/dist/build.d.ts +0 -14
- package/dist/build.mjs +0 -68
- package/dist/build.ts.d.ts +0 -1
- package/dist/build.ts.mjs +0 -13
- package/dist/bump.d.ts +0 -1
- package/dist/bump.mjs +0 -6
- package/dist/changelog.d.ts +0 -1
- package/dist/changelog.mjs +0 -6
- package/dist/clean.d.ts +0 -1
- package/dist/clean.mjs +0 -10
- package/dist/commit.d.ts +0 -8
- package/dist/commit.mjs +0 -11
- package/dist/copy-types.d.ts +0 -5
- package/dist/deploy/domains.d.ts +0 -1
- package/dist/deploy/domains.mjs +0 -3
- package/dist/deploy/index.d.ts +0 -1
- package/dist/deploy/index.mjs +0 -3
- package/dist/dev/components.d.ts +0 -1
- package/dist/dev/components.mjs +0 -4
- package/dist/dev/docs.d.ts +0 -1
- package/dist/dev/docs.mjs +0 -4
- package/dist/dev/index.d.ts +0 -5
- package/dist/dev/index.mjs +0 -20
- package/dist/examples.d.ts +0 -10
- package/dist/fresh.d.ts +0 -1
- package/dist/fresh.mjs +0 -6
- package/dist/generate/component-meta.d.ts +0 -5
- package/dist/generate/component-meta.mjs +0 -8
- package/dist/generate/ide-helpers.d.ts +0 -6
- package/dist/generate/ide-helpers.mjs +0 -9
- package/dist/generate/index.d.ts +0 -17
- package/dist/generate/index.mjs +0 -93
- package/dist/generate/lib-entries.d.ts +0 -2
- package/dist/generate/lib-entries.mjs +0 -14
- package/dist/generate/settings.d.ts +0 -1
- package/dist/generate/settings.mjs +0 -1
- package/dist/generate/vscode-custom-data.d.ts +0 -6
- package/dist/generate/vscode-custom-data.mjs +0 -8
- package/dist/generate/vue-compat.d.ts +0 -6
- package/dist/generate/vue-compat.mjs +0 -3
- package/dist/helpers/component-meta.d.ts +0 -22
- package/dist/helpers/index.d.ts +0 -6
- package/dist/helpers/index.mjs +0 -6
- package/dist/helpers/lib-entries.d.ts +0 -13
- package/dist/helpers/lib-entries.mjs +0 -101
- package/dist/helpers/package-json.d.ts +0 -3
- package/dist/helpers/package-json.mjs +0 -82
- package/dist/helpers/utils.d.ts +0 -19
- package/dist/helpers/utils.mjs +0 -40
- package/dist/helpers/vscode-custom-data.d.ts +0 -1
- package/dist/helpers/vscode-custom-data.mjs +0 -22
- package/dist/helpers/vue-compat.d.ts +0 -1
- package/dist/helpers/vue-compat.mjs +0 -12
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +0 -1
- package/dist/key-generate.d.ts +0 -1
- package/dist/key-generate.mjs +0 -8
- package/dist/lint/fix.d.ts +0 -1
- package/dist/lint/fix.mjs +0 -4
- package/dist/lint/index.d.ts +0 -1
- package/dist/lint/index.mjs +0 -14
- package/dist/make.d.ts +0 -25
- package/dist/migrate.d.ts +0 -1
- package/dist/migrate.mjs +0 -2
- package/dist/preinstall.d.ts +0 -8
- package/dist/preinstall.mjs +0 -17
- package/dist/prepublish.d.ts +0 -1
- package/dist/prepublish.mjs +0 -11
- package/dist/release.d.ts +0 -2
- package/dist/release.mjs +0 -16
- package/dist/seed.d.ts +0 -1
- package/dist/seed.mjs +0 -2
- package/dist/test/coverage.d.ts +0 -1
- package/dist/test/coverage.mjs +0 -4
- package/dist/test/feature.d.ts +0 -1
- package/dist/test/feature.mjs +0 -4
- package/dist/test/ui.d.ts +0 -1
- package/dist/test/ui.mjs +0 -4
- package/dist/test/unit.d.ts +0 -1
- package/dist/test/unit.mjs +0 -4
- package/dist/test.d.ts +0 -1
- package/dist/test.mjs +0 -4
- package/dist/test.ts.d.ts +0 -2
- package/dist/test.ts.mjs +0 -6
- package/dist/tinker.d.ts +0 -1
- package/dist/tinker.mjs +0 -3
- package/dist/typecheck.d.ts +0 -1
- package/dist/typecheck.mjs +0 -4
- package/dist/types.d.ts +0 -8
- package/dist/types.mjs +0 -14
- package/dist/upgrade/dependencies.d.ts +0 -0
- package/dist/upgrade/dependencies.mjs +0 -0
- package/dist/upgrade/framework.d.ts +0 -0
- package/dist/upgrade/framework.mjs +0 -0
- package/dist/upgrade/index.d.ts +0 -0
- package/dist/upgrade/index.mjs +0 -0
- package/dist/upgrade/node.d.ts +0 -0
- package/dist/upgrade/node.mjs +0 -0
- package/dist/upgrade/package-manager.d.ts +0 -0
- package/dist/upgrade/package-manager.mjs +0 -0
- package/dist/upgrade.d.ts +0 -5
- package/dist/upgrade.mjs +0 -55
- package/dist/upgrade.ts.d.ts +0 -1
- package/dist/upgrade.ts.mjs +0 -9
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/make.ts
|
|
3
|
+
import process from "process";
|
|
4
|
+
import {italic} from "@stacksjs/cli";
|
|
5
|
+
import {log} from "@stacksjs/logging";
|
|
6
|
+
import {createFolder, doesFolderExist, writeTextFile} from "@stacksjs/storage";
|
|
7
|
+
import {frameworkPath, projectPath, resolve} from "@stacksjs/path";
|
|
8
|
+
async function invoke(options) {
|
|
5
9
|
if (options.component)
|
|
6
|
-
await
|
|
10
|
+
await makeComponent(options);
|
|
7
11
|
if (options.database)
|
|
8
|
-
|
|
9
|
-
if (options.factory)
|
|
10
|
-
await factory(options);
|
|
12
|
+
makeDatabase(options);
|
|
11
13
|
if (options.function)
|
|
12
|
-
await
|
|
14
|
+
await makeFunction(options);
|
|
13
15
|
if (options.language)
|
|
14
|
-
await
|
|
16
|
+
await makeLanguage(options);
|
|
15
17
|
if (options.notification)
|
|
16
|
-
await
|
|
18
|
+
await makeNotification(options);
|
|
17
19
|
if (options.page)
|
|
18
|
-
await
|
|
20
|
+
await makePage(options);
|
|
19
21
|
if (options.stack)
|
|
20
|
-
|
|
22
|
+
makeStack(options);
|
|
21
23
|
}
|
|
22
|
-
|
|
24
|
+
async function make(options) {
|
|
23
25
|
return invoke(options);
|
|
24
26
|
}
|
|
25
|
-
|
|
27
|
+
async function makeComponent(options) {
|
|
26
28
|
try {
|
|
27
29
|
const name = options.name;
|
|
28
30
|
log.info("Creating your component...");
|
|
@@ -33,14 +35,14 @@ export async function component(options) {
|
|
|
33
35
|
process.exit();
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
|
-
|
|
38
|
+
async function createComponent(options) {
|
|
37
39
|
const name = options.name;
|
|
38
40
|
await writeTextFile({
|
|
39
|
-
path: `./components/${name}.
|
|
41
|
+
path: `./components/${name}.stx`,
|
|
40
42
|
data: `<script setup lang="ts">
|
|
41
43
|
// eslint-disable-next-line no-console
|
|
42
44
|
console.log('Hello World component created')
|
|
43
|
-
|
|
45
|
+
</script>
|
|
44
46
|
|
|
45
47
|
<template>
|
|
46
48
|
<div>
|
|
@@ -50,35 +52,35 @@ console.log('Hello World component created')
|
|
|
50
52
|
`
|
|
51
53
|
});
|
|
52
54
|
}
|
|
53
|
-
|
|
55
|
+
function makeDatabase(options) {
|
|
54
56
|
try {
|
|
55
57
|
const name = options.name;
|
|
56
58
|
log.info(`Creating your ${italic(name)} database...`);
|
|
57
|
-
|
|
59
|
+
createDatabase(options);
|
|
58
60
|
log.success(`Created the ${italic(name)} database`);
|
|
59
61
|
} catch (error) {
|
|
60
62
|
log.error("There was an error creating your database", error);
|
|
61
63
|
process.exit();
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
|
-
|
|
66
|
+
function createDatabase(options) {
|
|
65
67
|
console.log("options", options);
|
|
66
68
|
}
|
|
67
|
-
|
|
69
|
+
function factory(options) {
|
|
68
70
|
try {
|
|
69
71
|
const name = options.name;
|
|
70
72
|
log.info(`Creating your ${italic(name)} factory...`);
|
|
71
|
-
|
|
73
|
+
createDatabase(options);
|
|
72
74
|
log.success(`Created the ${italic(name)} factory`);
|
|
73
75
|
} catch (error) {
|
|
74
76
|
log.error("There was an error creating your factory", error);
|
|
75
77
|
process.exit();
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
|
-
|
|
80
|
+
function createFactory(options) {
|
|
79
81
|
console.log("options", options);
|
|
80
82
|
}
|
|
81
|
-
|
|
83
|
+
async function makeNotification(options) {
|
|
82
84
|
try {
|
|
83
85
|
const name = options.name;
|
|
84
86
|
log.info(`Creating your ${italic(name)} notification...`);
|
|
@@ -89,25 +91,25 @@ export async function notification(options) {
|
|
|
89
91
|
process.exit();
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
|
-
|
|
94
|
+
async function makePage(options) {
|
|
93
95
|
try {
|
|
94
96
|
const name = options.name;
|
|
95
97
|
log.info("Creating your page...");
|
|
96
|
-
createPage(options);
|
|
98
|
+
await createPage(options);
|
|
97
99
|
log.success(`Created the ${name} page`);
|
|
98
100
|
} catch (error) {
|
|
99
101
|
log.error("There was an error creating your page", error);
|
|
100
102
|
process.exit();
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
|
-
|
|
105
|
+
async function createPage(options) {
|
|
104
106
|
const name = options.name;
|
|
105
107
|
await writeTextFile({
|
|
106
|
-
path: `./pages/${name}.
|
|
108
|
+
path: `./pages/${name}.stx`,
|
|
107
109
|
data: `<script setup lang="ts">
|
|
108
110
|
// eslint-disable-next-line no-console
|
|
109
111
|
console.log('Hello World page created')
|
|
110
|
-
|
|
112
|
+
</script>
|
|
111
113
|
|
|
112
114
|
<template>
|
|
113
115
|
<div>
|
|
@@ -117,7 +119,7 @@ console.log('Hello World page created')
|
|
|
117
119
|
`
|
|
118
120
|
});
|
|
119
121
|
}
|
|
120
|
-
|
|
122
|
+
async function makeFunction(options) {
|
|
121
123
|
try {
|
|
122
124
|
const name = options.name;
|
|
123
125
|
log.info("Creating your function...");
|
|
@@ -128,7 +130,7 @@ export async function fx(options) {
|
|
|
128
130
|
process.exit();
|
|
129
131
|
}
|
|
130
132
|
}
|
|
131
|
-
|
|
133
|
+
async function createFunction(options) {
|
|
132
134
|
const name = options.name;
|
|
133
135
|
await writeTextFile({
|
|
134
136
|
path: `./functions/${name}.ts`,
|
|
@@ -147,18 +149,18 @@ export {
|
|
|
147
149
|
`
|
|
148
150
|
});
|
|
149
151
|
}
|
|
150
|
-
|
|
152
|
+
async function makeLanguage(options) {
|
|
151
153
|
try {
|
|
152
154
|
const name = options.name;
|
|
153
155
|
log.info("Creating your translation file...");
|
|
154
|
-
createLanguage(options);
|
|
156
|
+
await createLanguage(options);
|
|
155
157
|
log.success(`Created the ${name} translation file`);
|
|
156
158
|
} catch (error) {
|
|
157
159
|
log.error("There was an error creating your language.", error);
|
|
158
160
|
process.exit();
|
|
159
161
|
}
|
|
160
162
|
}
|
|
161
|
-
|
|
163
|
+
async function createLanguage(options) {
|
|
162
164
|
const name = options.name;
|
|
163
165
|
await writeTextFile({
|
|
164
166
|
path: `./lang/${name}.yml`,
|
|
@@ -167,20 +169,19 @@ export async function createLanguage(options) {
|
|
|
167
169
|
`
|
|
168
170
|
});
|
|
169
171
|
}
|
|
170
|
-
|
|
172
|
+
function makeStack(options) {
|
|
171
173
|
try {
|
|
172
174
|
const name = options.name;
|
|
173
175
|
log.info(`Creating your ${name} stack...`);
|
|
174
|
-
const
|
|
175
|
-
await spawn(`giget stacks ${path}`);
|
|
176
|
+
const path2 = resolve(process.cwd(), name);
|
|
176
177
|
log.success("Successfully scaffolded your project");
|
|
177
|
-
log.info(`cd ${
|
|
178
|
+
log.info(`cd ${path2} && bun install`);
|
|
178
179
|
} catch (error) {
|
|
179
180
|
log.error("There was an error creating your stack", error);
|
|
180
181
|
process.exit();
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
|
-
|
|
184
|
+
async function createNotification(options) {
|
|
184
185
|
const name = options.name;
|
|
185
186
|
try {
|
|
186
187
|
let importOption = "EmailOptions";
|
|
@@ -192,7 +193,7 @@ export async function createNotification(options) {
|
|
|
192
193
|
importOption = "SMSOptions";
|
|
193
194
|
await writeTextFile({
|
|
194
195
|
path: `./notifications/${name}.ts`,
|
|
195
|
-
data: `import type { ${importOption} } from '@stacksjs/types'
|
|
196
|
+
data: `import type { ${importOption} } from \'@stacksjs/types\'
|
|
196
197
|
|
|
197
198
|
function content(): string {
|
|
198
199
|
return 'example'
|
|
@@ -209,14 +210,14 @@ function send(): ${importOption} {
|
|
|
209
210
|
return false;
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
|
-
|
|
213
|
+
async function createMigration(options) {
|
|
213
214
|
const optionName = options.name;
|
|
214
215
|
const table = "dummy-name";
|
|
215
216
|
const name = optionName[0].toUpperCase() + optionName.slice(1);
|
|
216
|
-
const
|
|
217
|
+
const path2 = frameworkPath(`database/migrations/${name}.ts`);
|
|
217
218
|
try {
|
|
218
219
|
await writeTextFile({
|
|
219
|
-
path: `${
|
|
220
|
+
path: `${path2}`,
|
|
220
221
|
data: `import { Kysely } from 'kysely'
|
|
221
222
|
|
|
222
223
|
export async function up(db: Kysely<any>): Promise<void> {
|
|
@@ -226,18 +227,18 @@ export async function up(db: Kysely<any>): Promise<void> {
|
|
|
226
227
|
.execute()
|
|
227
228
|
}`
|
|
228
229
|
});
|
|
229
|
-
log.success(`Successfully created your migration file at
|
|
230
|
+
log.success(`Successfully created your migration file at stacks/database/migrations/${name}.ts`);
|
|
230
231
|
} catch (error) {
|
|
231
232
|
log.error(error);
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
|
-
|
|
235
|
+
async function createModel(options) {
|
|
235
236
|
const optionName = options.name;
|
|
236
237
|
const name = optionName[0].toUpperCase() + optionName.slice(1);
|
|
237
|
-
const
|
|
238
|
+
const path2 = projectPath(`app/Models/${name}.ts`);
|
|
238
239
|
try {
|
|
239
240
|
await writeTextFile({
|
|
240
|
-
path: `${
|
|
241
|
+
path: `${path2}`,
|
|
241
242
|
data: `import { faker } from '@stacksjs/faker'
|
|
242
243
|
import { validate } from '@stacksjs/validation'
|
|
243
244
|
import type { Model } from '@stacksjs/types'
|
|
@@ -262,8 +263,29 @@ export default <Model> {
|
|
|
262
263
|
},
|
|
263
264
|
}`
|
|
264
265
|
});
|
|
265
|
-
log.success(`Successfully created your model at app/
|
|
266
|
+
log.success(`Successfully created your model at app/Models/${name}.ts`);
|
|
266
267
|
} catch (error) {
|
|
267
268
|
log.error(error);
|
|
268
269
|
}
|
|
269
270
|
}
|
|
271
|
+
export {
|
|
272
|
+
makeStack,
|
|
273
|
+
makePage,
|
|
274
|
+
makeNotification,
|
|
275
|
+
makeLanguage,
|
|
276
|
+
makeFunction,
|
|
277
|
+
makeDatabase,
|
|
278
|
+
makeComponent,
|
|
279
|
+
make,
|
|
280
|
+
invoke,
|
|
281
|
+
factory,
|
|
282
|
+
createPage,
|
|
283
|
+
createNotification,
|
|
284
|
+
createModel,
|
|
285
|
+
createMigration,
|
|
286
|
+
createLanguage,
|
|
287
|
+
createFunction,
|
|
288
|
+
createFactory,
|
|
289
|
+
createDatabase,
|
|
290
|
+
createComponent
|
|
291
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/prepublish.ts
|
|
3
|
+
import process from "process";
|
|
4
|
+
import {log} from "@stacksjs/logging";
|
|
5
|
+
import {runtimePath} from "@stacksjs/path";
|
|
6
|
+
import {runNpmScript} from "@stacksjs/utils";
|
|
7
|
+
import {NpmScript} from "@stacksjs/enums";
|
|
8
|
+
log.info("Running prepublish command...");
|
|
9
|
+
var result = await runNpmScript(NpmScript.BuildStacks, { verbose: true, cwd: runtimePath() });
|
|
10
|
+
if (result.isErr()) {
|
|
11
|
+
log.error(new Error("There was an error while prepublishing your stack"), result.error);
|
|
12
|
+
process.exit();
|
|
13
|
+
}
|
|
14
|
+
log.success("Prepublishing completed");
|