@stacksjs/actions 0.58.73 → 0.59.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.
Files changed (108) hide show
  1. package/dist/action.d.ts +36 -0
  2. package/dist/add.d.ts +6 -0
  3. package/dist/build/component-libs.d.ts +1 -0
  4. package/dist/build/core.d.ts +1 -0
  5. package/dist/build/stacks.d.ts +1 -0
  6. package/dist/build.d.ts +9 -0
  7. package/dist/bump.d.ts +1 -0
  8. package/dist/changelog.d.ts +1 -0
  9. package/dist/clean.d.ts +1 -0
  10. package/dist/commit.d.ts +3 -0
  11. package/dist/copy-types.d.ts +5 -0
  12. package/dist/database/seed.d.ts +1 -0
  13. package/dist/deploy/index.d.ts +1 -0
  14. package/dist/dev/components.d.ts +1 -0
  15. package/dist/dev/docs.d.ts +1 -0
  16. package/dist/dev/index.d.ts +10 -0
  17. package/dist/examples.d.ts +5 -0
  18. package/dist/fresh.d.ts +1 -0
  19. package/dist/generate/component-meta.d.ts +5 -0
  20. package/dist/generate/ide-helpers.d.ts +6 -0
  21. package/dist/generate/index.d.ts +13 -0
  22. package/dist/generate/lib-entries.d.ts +2 -0
  23. package/dist/generate/vscode-custom-data.d.ts +6 -0
  24. package/dist/helpers/component-meta.d.ts +22 -0
  25. package/dist/helpers/lib-entries.d.ts +13 -0
  26. package/dist/helpers/package-json.d.ts +3 -0
  27. package/dist/helpers/utils.d.ts +18 -0
  28. package/dist/helpers/vscode-custom-data.d.ts +2 -0
  29. package/dist/index.d.ts +7 -0
  30. package/dist/key-generate.d.ts +1 -0
  31. package/dist/lint/fix.d.ts +1 -0
  32. package/dist/lint/index.d.ts +1 -0
  33. package/dist/make.d.ts +20 -0
  34. package/dist/prepublish.d.ts +1 -0
  35. package/dist/release.d.ts +2 -0
  36. package/dist/test/coverage.d.ts +1 -0
  37. package/dist/test/feature.d.ts +1 -0
  38. package/dist/test/ui.d.ts +1 -0
  39. package/dist/test/unit.d.ts +1 -0
  40. package/dist/test.d.ts +1 -0
  41. package/dist/tinker.d.ts +1 -0
  42. package/dist/typecheck.d.ts +1 -0
  43. package/dist/types.d.ts +3 -0
  44. package/dist/upgrade/dependencies.d.ts +1 -0
  45. package/dist/upgrade/framework.d.ts +1 -0
  46. package/dist/upgrade/index.d.ts +1 -0
  47. package/dist/upgrade.d.ts +4 -0
  48. package/package.json +5 -3
  49. package/src/bump.ts +8 -3
  50. package/src/check/ports.ts +11 -8
  51. package/src/deploy/index.ts +2 -6
  52. package/src/dev/index.ts +1 -1
  53. package/src/find-projects.ts +1 -1
  54. package/src/generate/index.ts +1 -1
  55. package/src/helpers/utils.ts +10 -14
  56. package/src/index.ts +1 -2
  57. package/src/lint/fix.ts +1 -0
  58. package/src/upgrade/shell.ts +5 -5
  59. package/dist/src/add.js +0 -29
  60. package/dist/src/build/component-libs.js +0 -6
  61. package/dist/src/build/core.js +0 -21
  62. package/dist/src/build/stacks.js +0 -8
  63. package/dist/src/build.js +0 -219
  64. package/dist/src/bump.js +0 -14
  65. package/dist/src/changelog.js +0 -17
  66. package/dist/src/clean.js +0 -6
  67. package/dist/src/commit.js +0 -17
  68. package/dist/src/copy-types.js +0 -14
  69. package/dist/src/database/seed.js +0 -1
  70. package/dist/src/deploy/index.js +0 -31
  71. package/dist/src/dev/components.js +0 -11
  72. package/dist/src/dev/docs.js +0 -7
  73. package/dist/src/dev/index.js +0 -92
  74. package/dist/src/examples.js +0 -43
  75. package/dist/src/fresh.js +0 -18
  76. package/dist/src/generate/component-meta.js +0 -59
  77. package/dist/src/generate/ide-helpers.js +0 -91
  78. package/dist/src/generate/index.js +0 -154
  79. package/dist/src/generate/lib-entries.js +0 -170
  80. package/dist/src/generate/vscode-custom-data.js +0 -91
  81. package/dist/src/helpers/component-meta.js +0 -50
  82. package/dist/src/helpers/index.js +0 -48
  83. package/dist/src/helpers/lib-entries.js +0 -161
  84. package/dist/src/helpers/package-json.js +0 -136
  85. package/dist/src/helpers/utils.js +0 -48
  86. package/dist/src/helpers/vscode-custom-data.js +0 -83
  87. package/dist/src/index.js +0 -590
  88. package/dist/src/key-generate.js +0 -10
  89. package/dist/src/lint/fix.js +0 -12
  90. package/dist/src/lint/index.js +0 -17
  91. package/dist/src/make.js +0 -291
  92. package/dist/src/prepublish.js +0 -14
  93. package/dist/src/release.js +0 -559
  94. package/dist/src/test/coverage.js +0 -6
  95. package/dist/src/test/feature.js +0 -6
  96. package/dist/src/test/ui.js +0 -6
  97. package/dist/src/test/unit.js +0 -6
  98. package/dist/src/test.js +0 -6
  99. package/dist/src/tinker.js +0 -5
  100. package/dist/src/typecheck.js +0 -6
  101. package/dist/src/types.js +0 -21
  102. package/dist/src/upgrade/dependencies.js +0 -6
  103. package/dist/src/upgrade/framework.js +0 -1
  104. package/dist/src/upgrade/index.js +0 -58
  105. package/dist/src/upgrade.js +0 -47
  106. package/src/generate/caddyfile.ts +0 -44
  107. package/src/helpers/index.ts +0 -1
  108. package/src/start-caddy.ts +0 -13
package/dist/src/make.js DELETED
@@ -1,291 +0,0 @@
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) {
9
- if (options.component)
10
- await makeComponent(options);
11
- if (options.database)
12
- makeDatabase(options);
13
- if (options.function)
14
- await makeFunction(options);
15
- if (options.language)
16
- await makeLanguage(options);
17
- if (options.notification)
18
- await makeNotification(options);
19
- if (options.page)
20
- await makePage(options);
21
- if (options.stack)
22
- makeStack(options);
23
- }
24
- async function make(options) {
25
- return invoke(options);
26
- }
27
- async function makeComponent(options) {
28
- try {
29
- const name = options.name;
30
- log.info("Creating your component...");
31
- await createComponent(options);
32
- log.success(`Created ${italic(name)} component`);
33
- } catch (error) {
34
- log.error("There was an error creating your component", error);
35
- process.exit();
36
- }
37
- }
38
- async function createComponent(options) {
39
- const name = options.name;
40
- await writeTextFile({
41
- path: `./components/${name}.stx`,
42
- data: `<script setup lang="ts">
43
- // eslint-disable-next-line no-console
44
- console.log('Hello World component created')
45
- </script>
46
-
47
- <template>
48
- <div>
49
- Some HTML block
50
- </div>
51
- </template>
52
- `
53
- });
54
- }
55
- function makeDatabase(options) {
56
- try {
57
- const name = options.name;
58
- log.info(`Creating your ${italic(name)} database...`);
59
- createDatabase(options);
60
- log.success(`Created ${italic(name)} database`);
61
- } catch (error) {
62
- log.error("There was an error creating your database", error);
63
- process.exit();
64
- }
65
- }
66
- function createDatabase(options) {
67
- console.log("options", options);
68
- }
69
- function factory(options) {
70
- try {
71
- const name = options.name;
72
- log.info(`Creating your ${italic(name)} factory...`);
73
- createDatabase(options);
74
- log.success(`Created ${italic(name)} factory`);
75
- } catch (error) {
76
- log.error("There was an error creating your factory", error);
77
- process.exit();
78
- }
79
- }
80
- function createFactory(options) {
81
- console.log("options", options);
82
- }
83
- async function makeNotification(options) {
84
- try {
85
- const name = options.name;
86
- log.info(`Creating your ${italic(name)} notification...`);
87
- await createNotification(options);
88
- log.success(`Created ${italic(name)} notification`);
89
- } catch (error) {
90
- log.error("There was an error creating your notification", error);
91
- process.exit();
92
- }
93
- }
94
- async function makePage(options) {
95
- try {
96
- const name = options.name;
97
- log.info("Creating your page...");
98
- await createPage(options);
99
- log.success(`Created ${name} page`);
100
- } catch (error) {
101
- log.error("There was an error creating your page", error);
102
- process.exit();
103
- }
104
- }
105
- async function createPage(options) {
106
- const name = options.name;
107
- await writeTextFile({
108
- path: `./pages/${name}.stx`,
109
- data: `<script setup lang="ts">
110
- // eslint-disable-next-line no-console
111
- console.log('Hello World page created')
112
- </script>
113
-
114
- <template>
115
- <div>
116
- Visit http://127.0.0.1/${name}
117
- </div>
118
- </template>
119
- `
120
- });
121
- }
122
- async function makeFunction(options) {
123
- try {
124
- const name = options.name;
125
- log.info("Creating your function...");
126
- await createFunction(options);
127
- log.success(`Created ${name} function`);
128
- } catch (error) {
129
- log.error("There was an error creating your function", error);
130
- process.exit();
131
- }
132
- }
133
- async function createFunction(options) {
134
- const name = options.name;
135
- await writeTextFile({
136
- path: `./functions/${name}.ts`,
137
- data: `// reactive state
138
- const ${name} = ref(0)
139
-
140
- // functions that mutate state and trigger updates
141
- function increment() {
142
- ${name}.value++
143
- }
144
-
145
- export {
146
- ${name},
147
- increment,
148
- }
149
- `
150
- });
151
- }
152
- async function makeLanguage(options) {
153
- try {
154
- const name = options.name;
155
- log.info("Creating your translation file...");
156
- await createLanguage(options);
157
- log.success(`Created ${name} translation file`);
158
- } catch (error) {
159
- log.error("There was an error creating your language.", error);
160
- process.exit();
161
- }
162
- }
163
- async function createLanguage(options) {
164
- const name = options.name;
165
- await writeTextFile({
166
- path: `./lang/${name}.yml`,
167
- data: `button:
168
- text: Copy
169
- `
170
- });
171
- }
172
- function makeStack(options) {
173
- try {
174
- const name = options.name;
175
- log.info(`Creating your ${name} stack...`);
176
- const path2 = resolve(process.cwd(), name);
177
- log.success("Successfully scaffolded your project");
178
- log.info(`cd ${path2} && bun install`);
179
- } catch (error) {
180
- log.error("There was an error creating your stack", error);
181
- process.exit();
182
- }
183
- }
184
- async function createNotification(options) {
185
- const name = options.name;
186
- try {
187
- let importOption = "EmailOptions";
188
- if (!doesFolderExist("notifications"))
189
- await createFolder("./notifications");
190
- if (options.chat)
191
- importOption = "ChatOptions";
192
- if (options.sms)
193
- importOption = "SMSOptions";
194
- await writeTextFile({
195
- path: `./notifications/${name}.ts`,
196
- data: `import type { ${importOption} } from \'@stacksjs/types\'
197
-
198
- function content(): string {
199
- return 'example'
200
- }
201
-
202
- function send(): ${importOption} {
203
- return {
204
- content: content(),
205
- }
206
- }`
207
- });
208
- return true;
209
- } catch (error) {
210
- return false;
211
- }
212
- }
213
- async function createMigration(options) {
214
- const optionName = options.name;
215
- const table = "dummy-name";
216
- const name = optionName[0].toUpperCase() + optionName.slice(1);
217
- const path2 = frameworkPath(`database/migrations/${name}.ts`);
218
- try {
219
- await writeTextFile({
220
- path: `${path2}`,
221
- data: `import { Kysely } from 'kysely'
222
-
223
- export async function up(db: Kysely<any>): Promise<void> {
224
- await db.schema
225
- .createTable('${table}')
226
- .addColumn('id', 'integer', (col) => col.autoIncrement().primaryKey())
227
- .execute()
228
- }`
229
- });
230
- log.success(`Successfully created your migration file at stacks/database/migrations/${name}.ts`);
231
- } catch (error) {
232
- log.error(error);
233
- }
234
- }
235
- async function createModel(options) {
236
- const optionName = options.name;
237
- const name = optionName[0].toUpperCase() + optionName.slice(1);
238
- const path2 = projectPath(`app/Models/${name}.ts`);
239
- try {
240
- await writeTextFile({
241
- path: `${path2}`,
242
- data: `import { faker } from '@stacksjs/faker'
243
- import { validate } from '@stacksjs/validation'
244
- import type { Model } from '@stacksjs/types'
245
-
246
- export default <Model> {
247
- name: '${name}',
248
-
249
- searchable: true, // boolean | IndexSettings,
250
- authenticatable: true, // boolean | AuthSettings,
251
-
252
- seeder: {
253
- count: 10,
254
- },
255
-
256
- fields: {
257
- name: {
258
- validation: validate.string().min(3).max(255),
259
- factory: () => faker.person,
260
- },
261
-
262
- // more fields here
263
- },
264
- }`
265
- });
266
- log.success(`Successfully created your model at app/Models/${name}.ts`);
267
- } catch (error) {
268
- log.error(error);
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
- };
@@ -1,14 +0,0 @@
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");