@stacksjs/actions 0.57.4 → 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.
Files changed (158) hide show
  1. package/README.md +4 -4
  2. package/dist/src/add.js +29 -0
  3. package/dist/src/build/component-libs.js +6 -0
  4. package/dist/src/build/core.js +25 -0
  5. package/dist/src/build/stacks.js +8 -0
  6. package/dist/src/build.js +226 -0
  7. package/dist/src/bump.js +8 -0
  8. package/dist/src/changelog.js +9 -0
  9. package/dist/src/clean.js +6 -0
  10. package/dist/src/commit.js +17 -0
  11. package/dist/{copy-types.mjs → src/copy-types.js} +7 -4
  12. package/dist/src/database/seed.js +4 -0
  13. package/dist/src/deploy/index.js +31 -0
  14. package/dist/src/dev/components.js +11 -0
  15. package/dist/src/dev/docs.js +7 -0
  16. package/dist/src/dev/index.js +90 -0
  17. package/dist/{examples.mjs → src/examples.js} +18 -8
  18. package/dist/src/fresh.js +18 -0
  19. package/dist/src/generate/component-meta.js +57 -0
  20. package/dist/src/generate/ide-helpers.js +83 -0
  21. package/dist/src/generate/index.js +161 -0
  22. package/dist/src/generate/lib-entries.js +168 -0
  23. package/dist/src/generate/vscode-custom-data.js +82 -0
  24. package/dist/src/generate/vue-compat.js +18 -0
  25. package/dist/{helpers/component-meta.mjs → src/helpers/component-meta.js} +13 -13
  26. package/dist/src/helpers/index.js +56 -0
  27. package/dist/src/helpers/lib-entries.js +160 -0
  28. package/dist/src/helpers/package-json.js +135 -0
  29. package/dist/src/helpers/utils.js +56 -0
  30. package/dist/src/helpers/vscode-custom-data.js +75 -0
  31. package/dist/src/helpers/vue-compat.js +16 -0
  32. package/dist/src/index.js +577 -0
  33. package/dist/src/key-generate.js +10 -0
  34. package/dist/src/lint/fix.js +8 -0
  35. package/dist/src/lint/index.js +21 -0
  36. package/dist/{make.mjs → src/make.js} +71 -49
  37. package/dist/src/prepublish.js +14 -0
  38. package/dist/src/release.js +545 -0
  39. package/dist/src/test/coverage.js +6 -0
  40. package/dist/src/test/feature.js +6 -0
  41. package/dist/src/test/ui.js +6 -0
  42. package/dist/src/test/unit.js +6 -0
  43. package/dist/src/test.js +6 -0
  44. package/dist/src/tinker.js +5 -0
  45. package/dist/src/typecheck.js +6 -0
  46. package/dist/src/types.js +21 -0
  47. package/dist/src/upgrade/dependencies.js +6 -0
  48. package/dist/src/upgrade/framework.js +1 -0
  49. package/dist/src/upgrade/index.js +1 -0
  50. package/dist/src/upgrade.js +39 -0
  51. package/package.json +53 -239
  52. package/LICENSE.md +0 -21
  53. package/dist/add.d.ts +0 -11
  54. package/dist/add.mjs +0 -20
  55. package/dist/build/component-libs.d.ts +0 -1
  56. package/dist/build/component-libs.mjs +0 -4
  57. package/dist/build/core.d.ts +0 -1
  58. package/dist/build/core.mjs +0 -6
  59. package/dist/build/stacks.d.ts +0 -1
  60. package/dist/build/stacks.mjs +0 -12
  61. package/dist/build.d.ts +0 -14
  62. package/dist/build.mjs +0 -68
  63. package/dist/bump.d.ts +0 -1
  64. package/dist/bump.mjs +0 -6
  65. package/dist/changelog.d.ts +0 -1
  66. package/dist/changelog.mjs +0 -6
  67. package/dist/clean.d.ts +0 -1
  68. package/dist/clean.mjs +0 -10
  69. package/dist/commit.d.ts +0 -8
  70. package/dist/commit.mjs +0 -11
  71. package/dist/copy-types.d.ts +0 -5
  72. package/dist/deploy/domains.d.ts +0 -1
  73. package/dist/deploy/domains.mjs +0 -7
  74. package/dist/deploy/index.d.ts +0 -1
  75. package/dist/deploy/index.mjs +0 -3
  76. package/dist/dev/components.d.ts +0 -1
  77. package/dist/dev/components.mjs +0 -4
  78. package/dist/dev/docs.d.ts +0 -1
  79. package/dist/dev/docs.mjs +0 -4
  80. package/dist/dev/index.d.ts +0 -5
  81. package/dist/dev/index.mjs +0 -20
  82. package/dist/examples.d.ts +0 -10
  83. package/dist/fresh.d.ts +0 -1
  84. package/dist/fresh.mjs +0 -6
  85. package/dist/generate/component-meta.d.ts +0 -5
  86. package/dist/generate/component-meta.mjs +0 -8
  87. package/dist/generate/ide-helpers.d.ts +0 -6
  88. package/dist/generate/ide-helpers.mjs +0 -9
  89. package/dist/generate/index.d.ts +0 -17
  90. package/dist/generate/index.mjs +0 -93
  91. package/dist/generate/lib-entries.d.ts +0 -2
  92. package/dist/generate/lib-entries.mjs +0 -14
  93. package/dist/generate/settings.d.ts +0 -1
  94. package/dist/generate/settings.mjs +0 -1
  95. package/dist/generate/vscode-custom-data.d.ts +0 -6
  96. package/dist/generate/vscode-custom-data.mjs +0 -8
  97. package/dist/generate/vue-compat.d.ts +0 -6
  98. package/dist/generate/vue-compat.mjs +0 -3
  99. package/dist/helpers/component-meta.d.ts +0 -22
  100. package/dist/helpers/index.d.ts +0 -6
  101. package/dist/helpers/index.mjs +0 -6
  102. package/dist/helpers/lib-entries.d.ts +0 -13
  103. package/dist/helpers/lib-entries.mjs +0 -101
  104. package/dist/helpers/package-json.d.ts +0 -3
  105. package/dist/helpers/package-json.mjs +0 -82
  106. package/dist/helpers/utils.d.ts +0 -19
  107. package/dist/helpers/utils.mjs +0 -40
  108. package/dist/helpers/vscode-custom-data.d.ts +0 -1
  109. package/dist/helpers/vscode-custom-data.mjs +0 -22
  110. package/dist/helpers/vue-compat.d.ts +0 -1
  111. package/dist/helpers/vue-compat.mjs +0 -12
  112. package/dist/index.d.ts +0 -1
  113. package/dist/index.mjs +0 -1
  114. package/dist/key-generate.d.ts +0 -1
  115. package/dist/key-generate.mjs +0 -8
  116. package/dist/lint/fix.d.ts +0 -1
  117. package/dist/lint/fix.mjs +0 -4
  118. package/dist/lint/index.d.ts +0 -1
  119. package/dist/lint/index.mjs +0 -14
  120. package/dist/make.d.ts +0 -25
  121. package/dist/migrate.d.ts +0 -1
  122. package/dist/migrate.mjs +0 -2
  123. package/dist/preinstall.d.ts +0 -8
  124. package/dist/preinstall.mjs +0 -17
  125. package/dist/prepublish.d.ts +0 -1
  126. package/dist/prepublish.mjs +0 -11
  127. package/dist/release.d.ts +0 -2
  128. package/dist/release.mjs +0 -16
  129. package/dist/seed.d.ts +0 -1
  130. package/dist/seed.mjs +0 -2
  131. package/dist/test/coverage.d.ts +0 -1
  132. package/dist/test/coverage.mjs +0 -4
  133. package/dist/test/feature.d.ts +0 -1
  134. package/dist/test/feature.mjs +0 -4
  135. package/dist/test/ui.d.ts +0 -1
  136. package/dist/test/ui.mjs +0 -4
  137. package/dist/test/unit.d.ts +0 -1
  138. package/dist/test/unit.mjs +0 -4
  139. package/dist/test.d.ts +0 -1
  140. package/dist/test.mjs +0 -4
  141. package/dist/tinker.d.ts +0 -1
  142. package/dist/tinker.mjs +0 -3
  143. package/dist/typecheck.d.ts +0 -1
  144. package/dist/typecheck.mjs +0 -4
  145. package/dist/types.d.ts +0 -8
  146. package/dist/types.mjs +0 -14
  147. package/dist/upgrade/dependencies.d.ts +0 -0
  148. package/dist/upgrade/dependencies.mjs +0 -0
  149. package/dist/upgrade/framework.d.ts +0 -0
  150. package/dist/upgrade/framework.mjs +0 -0
  151. package/dist/upgrade/index.d.ts +0 -0
  152. package/dist/upgrade/index.mjs +0 -0
  153. package/dist/upgrade/node.d.ts +0 -0
  154. package/dist/upgrade/node.mjs +0 -0
  155. package/dist/upgrade/package-manager.d.ts +0 -0
  156. package/dist/upgrade/package-manager.mjs +0 -0
  157. package/dist/upgrade.d.ts +0 -5
  158. package/dist/upgrade.mjs +0 -55
package/README.md CHANGED
@@ -14,7 +14,7 @@ This package contains the Stacks Actions.
14
14
  ## 🤖 Usage
15
15
 
16
16
  ```bash
17
- pnpm i -D @stacksjs/actions
17
+ bun install -d @stacksjs/actions
18
18
  ```
19
19
 
20
20
  Now, you can use it in your project:
@@ -30,7 +30,7 @@ Learn more in the docs.
30
30
  ## 🧪 Testing
31
31
 
32
32
  ```bash
33
- pnpm test
33
+ bun test
34
34
  ```
35
35
 
36
36
  ## 📈 Changelog
@@ -49,10 +49,10 @@ For help, discussion about best practices, or any other conversation that would
49
49
 
50
50
  For casual chit-chat with others using this package:
51
51
 
52
- [Join the Stacks Discord Server](https://discord.ow3.org)
52
+ [Join the Stacks Discord Server](https://discord.gg/stacksjs)
53
53
 
54
54
  ## 📄 License
55
55
 
56
56
  The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
57
57
 
58
- Made with ❤️
58
+ Made with 💙
@@ -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,6 @@
1
+ // @bun
2
+ // src/build/component-libs.ts
3
+ import {frameworkPath} from "@stacksjs/path";
4
+ import {runCommand} from "@stacksjs/cli";
5
+ import {NpmScript} from "@stacksjs/enums";
6
+ await runCommand(NpmScript.BuildComponents, { cwd: frameworkPath(), verbose: true });
@@ -0,0 +1,25 @@
1
+ // @bun
2
+ // src/build/core.ts
3
+ import process from "process";
4
+ import {glob} from "@stacksjs/storage";
5
+ import {corePath} from "@stacksjs/path";
6
+ import {ExitCode} from "@stacksjs/types";
7
+ import {dim, italic, log, runCommand} from "@stacksjs/cli";
8
+ log.info("Building core packages");
9
+ var dirs = await glob([corePath("*")], { onlyDirectories: true });
10
+ if (dirs.length === 0) {
11
+ log.info("No core packages found");
12
+ process.exit(ExitCode.FatalError);
13
+ }
14
+ dirs.forEach(async (folder) => {
15
+ log.info("\uD83C\uDFD7\uFE0F Building...");
16
+ log.info(`\uD83D\uDCE6 ${italic(dim(folder))}`);
17
+ const result = await runCommand("bun --bun run build", {
18
+ cwd: folder
19
+ });
20
+ if (result.isErr()) {
21
+ log.error(`Failed to build ${italic(folder)}`);
22
+ process.exit(ExitCode.FatalError);
23
+ }
24
+ log.success("\u2705 Build complete");
25
+ });
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ // src/build/stacks.ts
3
+ import {frameworkPath} from "@stacksjs/path";
4
+ import {runCommands} from "@stacksjs/cli";
5
+ await runCommands([
6
+ "bun build:cli",
7
+ "bun build:core"
8
+ ], { verbose: true, cwd: frameworkPath() });
@@ -0,0 +1,226 @@
1
+ // @bun
2
+ // src/helpers/utils.ts
3
+ import * as storage from "@stacksjs/storage";
4
+ import {italic, runCommand, runCommands, underline} 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
+ var parseOptions = function(options) {
9
+ if (!options)
10
+ return "";
11
+ const parsedOptions = Object.entries(options).map(([key, value]) => {
12
+ if (key.length === 1)
13
+ return `-${key}=${value}`;
14
+ if (typeof value === "boolean" && value)
15
+ return `--${key}`;
16
+ return `--${key}=${typeof value === "string" && value.includes(" ") ? `"${value}"` : value}`;
17
+ });
18
+ return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
19
+ };
20
+ async function runAction(action, options) {
21
+ if (!hasAction(action))
22
+ return err(handleError(`The specified action "${action}" does not exist`));
23
+ const opts = parseOptions(options);
24
+ const path = p.relativeActionsPath(`${action}.ts`);
25
+ const cmd = `bun --bun ${`${path} ${opts}`}`;
26
+ const o = {
27
+ cwd: options?.cwd || p.projectPath(),
28
+ ...options
29
+ };
30
+ if (options?.verbose) {
31
+ log.debug("Running cmd:", underline(italic(cmd)));
32
+ log.debug("Running action:", underline(italic(`./actions/${action}.ts`)));
33
+ log.debug("with action options of:", o);
34
+ }
35
+ return await runCommand(cmd, o);
36
+ }
37
+ async function runActions(actions, options) {
38
+ if (!actions.length)
39
+ return err("No actions were specified");
40
+ for (const action of actions) {
41
+ if (!hasAction(action))
42
+ return err(`The specified action "${action}" does not exist`);
43
+ }
44
+ const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)}`);
45
+ return await runCommands(commands, options);
46
+ }
47
+ function hasAction(action) {
48
+ if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
49
+ return true;
50
+ return storage.isFile(p.actionsPath(`${action}.ts`));
51
+ }
52
+ // src/generate/index.ts
53
+ import process from "process";
54
+ import {log as log2} from "@stacksjs/logging";
55
+ import {Action, NpmScript} from "@stacksjs/enums";
56
+ import {runNpmScript} from "@stacksjs/utils";
57
+ import {projectPath as projectPath2} from "@stacksjs/path";
58
+ async function invoke(options) {
59
+ if (options?.types)
60
+ await generateTypes(options);
61
+ else if (options?.entries)
62
+ await generateLibEntries(options);
63
+ else if (options?.webTypes)
64
+ await generateWebTypes(options);
65
+ else if (options?.customData)
66
+ await generateVsCodeCustomData(options);
67
+ else if (options?.ideHelpers)
68
+ await generateIdeHelpers(options);
69
+ else if (options?.vueCompatibility)
70
+ await generateVueCompat(options);
71
+ else if (options?.componentMeta)
72
+ await generateComponentMeta(options);
73
+ }
74
+ function generate(options) {
75
+ return invoke(options);
76
+ }
77
+ async function generateLibEntries(options) {
78
+ const result = await runAction(Action.GenerateLibraryEntries, {
79
+ ...options,
80
+ verbose: true,
81
+ cwd: projectPath2()
82
+ });
83
+ if (result.isErr()) {
84
+ log2.error("There was an error generating your library entry points", result.error);
85
+ process.exit();
86
+ }
87
+ log2.success("Library entry points generated successfully");
88
+ }
89
+ async function generateVueCompat(options) {
90
+ const result = await runNpmScript(NpmScript.GenerateVueCompat, options);
91
+ if (result.isErr()) {
92
+ log2.error("There was an error generating Vue 2 compatibility.", result.error);
93
+ process.exit();
94
+ }
95
+ log2.success("Libraries are now Vue 2 & 3 compatible");
96
+ }
97
+ async function generateWebTypes(options) {
98
+ const result = await runNpmScript(NpmScript.GenerateWebTypes, options);
99
+ if (result.isErr()) {
100
+ log2.error("There was an error generating the web-types.json file.", result.error);
101
+ process.exit();
102
+ }
103
+ log2.success("Successfully generated the web-types.json file");
104
+ }
105
+ async function generateVsCodeCustomData(options) {
106
+ const result = await runNpmScript(NpmScript.GenerateVsCodeCustomData, options);
107
+ if (result.isErr()) {
108
+ log2.error("There was an error generating the custom-elements.json file.", result.error);
109
+ process.exit();
110
+ }
111
+ await runAction(Action.LintFix, { verbose: true });
112
+ log2.success("Successfully generated the custom-elements.json file");
113
+ }
114
+ async function generateIdeHelpers(options) {
115
+ const result = await runNpmScript(NpmScript.GenerateIdeHelpers, options);
116
+ if (result.isErr()) {
117
+ log2.error("There was an error generating IDE helpers.", result.error);
118
+ process.exit();
119
+ }
120
+ await runAction(Action.LintFix, { verbose: true });
121
+ log2.success("Successfully generated IDE helpers");
122
+ }
123
+ async function generateComponentMeta(options) {
124
+ const result = await runNpmScript(NpmScript.GenerateComponentMeta, options);
125
+ if (result.isErr()) {
126
+ log2.error("There was an error generating your component meta information.", result.error);
127
+ process.exit();
128
+ }
129
+ await runAction(Action.LintFix, { verbose: true });
130
+ log2.success("Successfully generated component meta information");
131
+ }
132
+ async function generateTypes(options) {
133
+ const result = await runNpmScript(NpmScript.GenerateTypes, options);
134
+ if (result.isErr()) {
135
+ log2.error("There was an error generating your types.", result.error);
136
+ process.exit();
137
+ }
138
+ log2.success("Types were generated successfully");
139
+ }
140
+ function generateMigrations() {
141
+ log2.success("Successfully updated migrations");
142
+ }
143
+ function generatePkgxConfig() {
144
+ log2.success("Successfully generated `./pkgx.yaml` based on your configs");
145
+ }
146
+ async function generateSeeder() {
147
+ }
148
+
149
+ // src/build.ts
150
+ import {log as log3} from "@stacksjs/logging";
151
+ import {hasComponents, hasFunctions} from "@stacksjs/storage";
152
+ import {runNpmScript as runNpmScript2} from "@stacksjs/utils";
153
+ import {NpmScript as NpmScript2} from "@stacksjs/enums";
154
+ async function invoke2(options) {
155
+ if (options.components)
156
+ await componentLibraries(options);
157
+ else if (options.vueComponents)
158
+ await vueComponentLibrary(options);
159
+ else if (options.webComponents || options.elements)
160
+ await webComponentLibrary(options);
161
+ else if (options.functions)
162
+ await functionsLibrary(options);
163
+ else if (options.docs)
164
+ await docs(options);
165
+ else if (options.stacks)
166
+ await stacks(options);
167
+ await generateTypes();
168
+ }
169
+ async function build(options) {
170
+ return invoke2(options);
171
+ }
172
+ async function componentLibraries(options) {
173
+ await runNpmScript2(NpmScript2.GenerateEntries, options);
174
+ await vueComponentLibrary(options);
175
+ await webComponentLibrary(options);
176
+ }
177
+ async function vueComponentLibrary(options) {
178
+ if (hasComponents()) {
179
+ log3.info("Building your component library...");
180
+ await runNpmScript2(NpmScript2.BuildComponents, options);
181
+ log3.success("Your component library was built successfully");
182
+ } else {
183
+ log3.warn("No components found.");
184
+ log3.info("Before you can build components,");
185
+ log3.info("you need to have created some in the ./components folder.");
186
+ }
187
+ }
188
+ async function webComponentLibrary(options) {
189
+ log3.info("Building your component library for production use & npm/CDN distribution...");
190
+ if (hasComponents()) {
191
+ await runNpmScript2(NpmScript2.BuildWebComponents, options);
192
+ log3.success("Your Web Component library was built successfully");
193
+ } else {
194
+ log3.info("No components found.");
195
+ }
196
+ }
197
+ async function docs(options) {
198
+ log3.info("Building the documentation site...");
199
+ await runNpmScript2(NpmScript2.BuildDocs, options);
200
+ log3.success("Docs built successfully");
201
+ }
202
+ async function stacks(options) {
203
+ log3.info("Building the Stacks Framework...");
204
+ await runNpmScript2(NpmScript2.BuildStacks, options);
205
+ log3.success("Stacks built successfully");
206
+ }
207
+ async function functionsLibrary(options) {
208
+ if (hasFunctions()) {
209
+ log3.info("Building your functions library for production usages...");
210
+ log3.info("Production usages include: manual npm distribution and/or CDN distribution");
211
+ await runNpmScript2(NpmScript2.BuildFunctions, options);
212
+ log3.success("Functions library built successfully");
213
+ } else {
214
+ log3.info("No functions found");
215
+ }
216
+ }
217
+ export {
218
+ webComponentLibrary,
219
+ vueComponentLibrary,
220
+ stacks,
221
+ invoke2 as invoke,
222
+ functionsLibrary,
223
+ docs,
224
+ componentLibraries,
225
+ build
226
+ };
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ // src/bump.ts
3
+ import {runCommand} from "@stacksjs/cli";
4
+ import {path as p} from "@stacksjs/path";
5
+ await runCommand("buddy changelog --quiet", {
6
+ cwd: p.projectPath()
7
+ });
8
+ await runCommand("bunx bumpp ./package.json ./core/**/package.json ./ide/vscode/package.json --all", { cwd: p.frameworkPath(), stdin: "inherit" });
@@ -0,0 +1,9 @@
1
+ // @bun
2
+ // src/changelog.ts
3
+ import {execSync, runCommand} from "@stacksjs/cli";
4
+ import {projectPath} from "@stacksjs/path";
5
+ var fromRevision = await execSync("git describe --abbrev=0 --tags HEAD^");
6
+ var toRevision = await execSync("git describe");
7
+ await runCommand(`bunx changelogen --output CHANGELOG.md --from ${fromRevision} --to ${toRevision}`, {
8
+ cwd: projectPath()
9
+ });
@@ -0,0 +1,6 @@
1
+ // @bun
2
+ // src/clean.ts
3
+ import {log} from "@stacksjs/logging";
4
+ import {clean} from "@stacksjs/utils";
5
+ log.info("Running clean command...");
6
+ await clean();
@@ -0,0 +1,17 @@
1
+ // @bun
2
+ // src/commit.ts
3
+ import {log} from "@stacksjs/logging";
4
+ import {runNpmScript} from "@stacksjs/utils";
5
+ import {NpmScript} from "@stacksjs/enums";
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
+ };
@@ -1,7 +1,10 @@
1
- #!/usr/bin/env node
2
- import { frameworkPath } from "@stacksjs/path";
3
- import { copyFolder } from "@stacksjs/storage";
4
- const destinations = [
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 = [
5
8
  [frameworkPath("dist/types/components"), frameworkPath("components/vue/dist/types")],
6
9
  [frameworkPath("dist/types/components"), frameworkPath("components/web/dist/types")],
7
10
  [frameworkPath("dist/types/functions"), frameworkPath("functions/dist/types")]
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ // src/database/seed.ts
3
+ import {seed} from "@stacksjs/database";
4
+ await seed();
@@ -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.frameworkPath()
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 zip/api.ts", {
22
+ cwd: p.actionsPath()
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.cloudPath()
31
+ });
@@ -0,0 +1,11 @@
1
+ // @bun
2
+ // src/dev/components.ts
3
+ import {frameworkPath, vitePath} from "@stacksjs/path";
4
+ import {parseOptions, runCommand} from "@stacksjs/cli";
5
+ var options = parseOptions();
6
+ if (options.verbose)
7
+ console.log("dev components options", options);
8
+ await runCommand(`bunx --bun vite --config ${vitePath("src/components.ts")}`, {
9
+ ...options,
10
+ cwd: frameworkPath()
11
+ });
@@ -0,0 +1,7 @@
1
+ // @bun
2
+ // src/dev/docs.ts
3
+ import {runCommand} from "@stacksjs/cli";
4
+ import {frameworkPath} from "@stacksjs/path";
5
+ await runCommand("bun run dev", {
6
+ cwd: frameworkPath("docs")
7
+ });
@@ -0,0 +1,90 @@
1
+ // @bun
2
+ // src/helpers/utils.ts
3
+ import * as storage from "@stacksjs/storage";
4
+ import {italic, runCommand, runCommands, underline} 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
+ var parseOptions = function(options) {
9
+ if (!options)
10
+ return "";
11
+ const parsedOptions = Object.entries(options).map(([key, value]) => {
12
+ if (key.length === 1)
13
+ return `-${key}=${value}`;
14
+ if (typeof value === "boolean" && value)
15
+ return `--${key}`;
16
+ return `--${key}=${typeof value === "string" && value.includes(" ") ? `"${value}"` : value}`;
17
+ });
18
+ return parsedOptions.filter(Boolean).join(" ").replace("----=", "");
19
+ };
20
+ async function runAction(action, options) {
21
+ if (!hasAction(action))
22
+ return err(handleError(`The specified action "${action}" does not exist`));
23
+ const opts = parseOptions(options);
24
+ const path = p.relativeActionsPath(`${action}.ts`);
25
+ const cmd = `bun --bun ${`${path} ${opts}`}`;
26
+ const o = {
27
+ cwd: options?.cwd || p.projectPath(),
28
+ ...options
29
+ };
30
+ if (options?.verbose) {
31
+ log.debug("Running cmd:", underline(italic(cmd)));
32
+ log.debug("Running action:", underline(italic(`./actions/${action}.ts`)));
33
+ log.debug("with action options of:", o);
34
+ }
35
+ return await runCommand(cmd, o);
36
+ }
37
+ async function runActions(actions, options) {
38
+ if (!actions.length)
39
+ return err("No actions were specified");
40
+ for (const action of actions) {
41
+ if (!hasAction(action))
42
+ return err(`The specified action "${action}" does not exist`);
43
+ }
44
+ const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)}`);
45
+ return await runCommands(commands, options);
46
+ }
47
+ function hasAction(action) {
48
+ if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
49
+ return true;
50
+ return storage.isFile(p.actionsPath(`${action}.ts`));
51
+ }
52
+ // src/dev/index.ts
53
+ import {log as log2} from "@stacksjs/logging";
54
+ import {Action} from "@stacksjs/enums";
55
+ async function runDevServer(options) {
56
+ log2.info("Starting your Frontend Engine...");
57
+ await runAction(Action.Dev, options);
58
+ }
59
+ async function runFrontendDevServer(options) {
60
+ log2.info("Starting your UI Engine...");
61
+ await runAction(Action.Dev, options);
62
+ }
63
+ async function runBackendDevServer(options) {
64
+ runApiDevServer(options);
65
+ }
66
+ async function runApiDevServer(options) {
67
+ log2.info("Starting your API...");
68
+ await runAction(Action.DevApi, options);
69
+ }
70
+ async function runComponentsDevServer(options) {
71
+ log2.info("Starting your Library Engine...");
72
+ await runAction(Action.DevComponents, options);
73
+ }
74
+ async function runDesktopDevServer(options) {
75
+ log2.info("Starting your Desktop Engine...");
76
+ await runAction(Action.DevDesktop, options);
77
+ }
78
+ async function runDocsDevServer(options) {
79
+ log2.info("Starting your Docs Engine...");
80
+ await runAction(Action.DevDocs, options);
81
+ }
82
+ export {
83
+ runFrontendDevServer,
84
+ runDocsDevServer,
85
+ runDevServer,
86
+ runDesktopDevServer,
87
+ runComponentsDevServer,
88
+ runBackendDevServer,
89
+ runApiDevServer
90
+ };
@@ -1,8 +1,12 @@
1
- import { log } from "@stacksjs/logging";
2
- import { hasComponents } from "@stacksjs/storage";
3
- import { runNpmScript } from "@stacksjs/utils";
4
- import { ExitCode, NpmScript } from "@stacksjs/types";
5
- export async function invoke(options) {
1
+ // @bun
2
+ // src/examples.ts
3
+ import process from "process";
4
+ import {log} from "@stacksjs/logging";
5
+ import {hasComponents} from "@stacksjs/storage";
6
+ import {runNpmScript} from "@stacksjs/utils";
7
+ import {ExitCode} from "@stacksjs/types";
8
+ import {NpmScript} from "@stacksjs/enums";
9
+ async function invoke(options) {
6
10
  if (options.components || options.vue)
7
11
  await componentExample(options);
8
12
  else if (options.webComponents || options.elements)
@@ -10,10 +14,10 @@ export async function invoke(options) {
10
14
  else
11
15
  log.error("An unsupported option was used. Please try again, check the documentation & report the issue, if needed.");
12
16
  }
13
- export async function examples(options) {
17
+ async function examples(options) {
14
18
  return invoke(options);
15
19
  }
16
- export async function componentExample(options) {
20
+ async function componentExample(options) {
17
21
  if (hasComponents()) {
18
22
  await runNpmScript(NpmScript.ExampleVue, options);
19
23
  log.success("Your component library was built successfully");
@@ -21,7 +25,7 @@ export async function componentExample(options) {
21
25
  log.info("No components found.");
22
26
  }
23
27
  }
24
- export async function webComponentExample(options) {
28
+ async function webComponentExample(options) {
25
29
  if (hasComponents()) {
26
30
  log.info("Building your Web Component library...");
27
31
  await runNpmScript(NpmScript.BuildWebComponents, options);
@@ -31,3 +35,9 @@ export async function webComponentExample(options) {
31
35
  process.exit(ExitCode.FatalError);
32
36
  }
33
37
  }
38
+ export {
39
+ webComponentExample,
40
+ invoke,
41
+ examples,
42
+ componentExample
43
+ };
@@ -0,0 +1,18 @@
1
+ // @bun
2
+ // src/fresh.ts
3
+ import process from "process";
4
+ import {ExitCode} from "@stacksjs/types";
5
+ import {runCommand} from "@stacksjs/cli";
6
+ import {logger} from "@stacksjs/logging";
7
+ import {projectPath} from "@stacksjs/path";
8
+ import {cleanProject} from "@stacksjs/utils";
9
+ logger.log("Cleaning project...");
10
+ await cleanProject();
11
+ logger.log("Installing dependencies...");
12
+ var result = await runCommand("bun install", {
13
+ cwd: projectPath()
14
+ });
15
+ if (result.isErr()) {
16
+ handleError(result.error);
17
+ process.exit(ExitCode.FatalError);
18
+ }
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+
4
+ // src/helpers/component-meta.ts
5
+ import {frameworkPath, join, parse, projectPath} from "@stacksjs/path";
6
+ import {existsSync, glob, mkdirSync, writeFileSync} from "@stacksjs/storage";
7
+ import MarkdownIt from "markdown-it";
8
+ import {createComponentMetaChecker} from "vue-component-meta";
9
+ function generateComponentMeta() {
10
+ const md = new MarkdownIt;
11
+ const checkerOptions = {
12
+ forceUseTs: true,
13
+ schema: { ignore: ["MyIgnoredNestedProps"] },
14
+ printer: { newLine: 1 }
15
+ };
16
+ const tsconfigChecker = createComponentMetaChecker(projectPath("tsconfig.json"), checkerOptions);
17
+ const filterMeta = (meta) => {
18
+ const props = [];
19
+ meta.props.forEach((prop) => {
20
+ if (prop?.global)
21
+ return;
22
+ const { name, description, required, type, default: defaultValue } = prop;
23
+ props.push({
24
+ name: `${name}${required ? "" : "?"}`,
25
+ description: md.render(description),
26
+ type,
27
+ default: defaultValue || "unknown"
28
+ });
29
+ });
30
+ return {
31
+ props,
32
+ events: meta.events,
33
+ slots: meta.slots
34
+ };
35
+ };
36
+ const components = glob.sync(["components/*.stx", "components/**/*.stx"], {
37
+ cwd: projectPath(),
38
+ absolute: true
39
+ });
40
+ components.forEach((componentPath) => {
41
+ const componentExportName = parse(componentPath).name;
42
+ const meta = filterMeta(tsconfigChecker.getComponentMeta(componentPath, componentExportName));
43
+ const metaDirPath = frameworkPath("component-meta");
44
+ if (!existsSync(metaDirPath))
45
+ mkdirSync(metaDirPath);
46
+ const metaJsonFilePath = join(metaDirPath, `${componentExportName}.json`);
47
+ writeFileSync(metaJsonFilePath, JSON.stringify(meta, null, 4));
48
+ });
49
+ }
50
+
51
+ // src/generate/component-meta.ts
52
+ import {log} from "@stacksjs/logging";
53
+ import {hasComponents} from "@stacksjs/storage";
54
+ if (hasComponents())
55
+ generateComponentMeta();
56
+ else
57
+ log.info("No components found. Skipping component meta generation.");