stacks 0.37.4 → 0.37.5

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 (256) hide show
  1. package/README.md +7 -2
  2. package/dist/cli/actions/build.d.ts +7 -0
  3. package/dist/cli/actions/build.mjs +117 -0
  4. package/dist/cli/actions/commit.d.ts +1 -0
  5. package/dist/cli/actions/commit.mjs +8 -0
  6. package/dist/cli/actions/dev.d.ts +1 -0
  7. package/dist/cli/actions/dev.mjs +34 -0
  8. package/dist/cli/actions/examples.d.ts +3 -0
  9. package/dist/cli/actions/examples.mjs +57 -0
  10. package/dist/cli/actions/fresh.d.ts +1 -0
  11. package/dist/cli/actions/fresh.mjs +8 -0
  12. package/dist/cli/actions/generate.d.ts +7 -0
  13. package/dist/cli/actions/generate.mjs +117 -0
  14. package/dist/cli/actions/index.d.ts +12 -0
  15. package/dist/cli/actions/index.mjs +12 -0
  16. package/dist/cli/actions/key.d.ts +2 -0
  17. package/dist/cli/actions/key.mjs +22 -0
  18. package/dist/cli/actions/lint.d.ts +2 -0
  19. package/dist/cli/actions/lint.mjs +15 -0
  20. package/dist/cli/actions/make.d.ts +5 -0
  21. package/dist/cli/actions/make.mjs +97 -0
  22. package/dist/cli/actions/release.d.ts +1 -0
  23. package/dist/cli/actions/release.mjs +8 -0
  24. package/dist/cli/actions/test.d.ts +3 -0
  25. package/dist/cli/actions/test.mjs +30 -0
  26. package/dist/cli/actions/types.d.ts +9 -0
  27. package/dist/cli/actions/types.mjs +134 -0
  28. package/dist/cli/actions/update.d.ts +1 -0
  29. package/dist/cli/actions/update.mjs +59 -0
  30. package/dist/cli/build.d.ts +3 -0
  31. package/dist/cli/build.mjs +22 -0
  32. package/dist/cli/create.d.ts +3 -0
  33. package/dist/cli/create.mjs +46 -0
  34. package/dist/cli/dev.d.ts +3 -0
  35. package/dist/cli/dev.mjs +13 -0
  36. package/dist/cli/example.d.ts +3 -0
  37. package/dist/cli/example.mjs +13 -0
  38. package/dist/cli/generate.d.ts +3 -0
  39. package/dist/cli/generate.mjs +29 -0
  40. package/dist/cli/index.d.ts +12 -0
  41. package/dist/cli/index.mjs +12 -0
  42. package/dist/cli/key.d.ts +3 -0
  43. package/dist/cli/key.mjs +7 -0
  44. package/dist/cli/make.d.ts +3 -0
  45. package/dist/cli/make.mjs +22 -0
  46. package/dist/cli/test.d.ts +3 -0
  47. package/dist/cli/test.mjs +13 -0
  48. package/dist/cli/types.d.ts +3 -0
  49. package/dist/cli/types.mjs +9 -0
  50. package/dist/cli/update.d.ts +3 -0
  51. package/dist/cli/update.mjs +7 -0
  52. package/dist/cli/utility.d.ts +3 -0
  53. package/dist/cli/utility.mjs +22 -0
  54. package/dist/cli.d.ts +2 -0
  55. package/dist/cli.mjs +13970 -0
  56. package/dist/docs.d.ts +2 -0
  57. package/dist/docs.mjs +3 -0
  58. package/dist/index.d.ts +20 -0
  59. package/dist/index.mjs +20 -0
  60. package/package.json +33 -38
  61. package/.gitignore +0 -10
  62. package/auto-imports.d.ts +0 -826
  63. package/components.d.ts +0 -22
  64. package/core/actions/README.md +0 -59
  65. package/core/actions/node_modules/.bin/markdown-it +0 -17
  66. package/core/actions/node_modules/.bin/mkdist +0 -17
  67. package/core/actions/package.json +0 -64
  68. package/core/actions/src/copy-types.ts +0 -22
  69. package/core/actions/src/generate/component-meta.ts +0 -94
  70. package/core/actions/src/generate/index.ts +0 -4
  71. package/core/actions/src/generate/lib-entries.ts +0 -106
  72. package/core/actions/src/generate/package-json.ts +0 -87
  73. package/core/actions/src/generate/vscode-custom-data.ts +0 -28
  74. package/core/actions/src/generate/vue-compat.ts +0 -17
  75. package/core/actions/src/generate-component-meta.ts +0 -19
  76. package/core/actions/src/generate-ide-helpers.ts +0 -23
  77. package/core/actions/src/generate-lib-entries.ts +0 -22
  78. package/core/actions/src/generate-package-json.ts +0 -15
  79. package/core/actions/src/generate-vscode-custom-data.ts +0 -20
  80. package/core/actions/src/generate-vue-compat.ts +0 -10
  81. package/core/arrays/README.md +0 -59
  82. package/core/arrays/node_modules/.bin/mkdist +0 -17
  83. package/core/arrays/node_modules/.bin/tsc +0 -17
  84. package/core/arrays/node_modules/.bin/tsserver +0 -17
  85. package/core/arrays/package.json +0 -50
  86. package/core/arrays/src/index.ts +0 -3
  87. package/core/build/README.md +0 -59
  88. package/core/build/entries/README.md +0 -7
  89. package/core/build/node_modules/.bin/jiti +0 -17
  90. package/core/build/node_modules/.bin/mkdist +0 -17
  91. package/core/build/node_modules/.bin/vite +0 -17
  92. package/core/build/node_modules/.bin/vite-ssg +0 -17
  93. package/core/build/node_modules/.bin/vue-docgen-web-types +0 -17
  94. package/core/build/package.json +0 -71
  95. package/core/build/src/example-vue.ts +0 -26
  96. package/core/build/src/example-wc.ts +0 -26
  97. package/core/build/src/functions.ts +0 -56
  98. package/core/build/src/index.ts +0 -7
  99. package/core/build/src/pages.ts +0 -50
  100. package/core/build/src/stacks.ts +0 -204
  101. package/core/build/src/vue-components.ts +0 -76
  102. package/core/build/src/web-components.ts +0 -63
  103. package/core/build/web-types.config.cjs +0 -4
  104. package/core/build/web-types.ts +0 -14
  105. package/core/collections/README.md +0 -59
  106. package/core/collections/node_modules/.bin/mkdist +0 -17
  107. package/core/collections/node_modules/.bin/tsc +0 -17
  108. package/core/collections/node_modules/.bin/tsserver +0 -17
  109. package/core/collections/package.json +0 -54
  110. package/core/collections/src/index.ts +0 -1
  111. package/core/fs/README.md +0 -59
  112. package/core/fs/node_modules/.bin/mkdist +0 -17
  113. package/core/fs/package.json +0 -56
  114. package/core/fs/src/index.ts +0 -170
  115. package/core/helpers/node_modules/.bin/mkdist +0 -17
  116. package/core/helpers/package.json +0 -58
  117. package/core/helpers/src/index.ts +0 -129
  118. package/core/modules/README.md +0 -61
  119. package/core/modules/node_modules/.bin/mkdist +0 -17
  120. package/core/modules/package.json +0 -51
  121. package/core/modules/src/i18n.ts +0 -23
  122. package/core/modules/src/nprogress.ts +0 -12
  123. package/core/modules/src/pwa.ts +0 -12
  124. package/core/objects/README.md +0 -59
  125. package/core/objects/node_modules/.bin/mkdist +0 -17
  126. package/core/objects/node_modules/.bin/tsc +0 -17
  127. package/core/objects/node_modules/.bin/tsserver +0 -17
  128. package/core/objects/package.json +0 -51
  129. package/core/objects/src/index.ts +0 -1
  130. package/core/paths/node_modules/.bin/mkdist +0 -17
  131. package/core/paths/node_modules/.bin/tsc +0 -17
  132. package/core/paths/node_modules/.bin/tsserver +0 -17
  133. package/core/paths/package.json +0 -51
  134. package/core/paths/src/index.ts +0 -178
  135. package/core/router/README.md +0 -59
  136. package/core/router/node_modules/.bin/mkdist +0 -17
  137. package/core/router/package.json +0 -51
  138. package/core/router/src/index.ts +0 -14
  139. package/core/security/README.md +0 -59
  140. package/core/security/node_modules/.bin/mkdist +0 -17
  141. package/core/security/package.json +0 -56
  142. package/core/security/src/crypt.ts +0 -14
  143. package/core/security/src/hash.ts +0 -52
  144. package/core/security/src/index.ts +0 -3
  145. package/core/security/src/key.ts +0 -11
  146. package/core/strings/README.md +0 -59
  147. package/core/strings/node_modules/.bin/mkdist +0 -17
  148. package/core/strings/node_modules/.bin/tsc +0 -17
  149. package/core/strings/node_modules/.bin/tsserver +0 -17
  150. package/core/strings/package.json +0 -63
  151. package/core/strings/src/index.ts +0 -14
  152. package/core/types/README.md +0 -59
  153. package/core/types/node_modules/.bin/markdown-it +0 -17
  154. package/core/types/node_modules/.bin/mkdist +0 -17
  155. package/core/types/node_modules/.bin/vite +0 -17
  156. package/core/types/node_modules/.bin/vitepress +0 -17
  157. package/core/types/package.json +0 -60
  158. package/core/types/src/app.ts +0 -131
  159. package/core/types/src/auto-imports.ts +0 -3
  160. package/core/types/src/build.ts +0 -3
  161. package/core/types/src/cli.ts +0 -49
  162. package/core/types/src/components.ts +0 -66
  163. package/core/types/src/deploy.ts +0 -11
  164. package/core/types/src/docs.ts +0 -3
  165. package/core/types/src/exit-code.ts +0 -10
  166. package/core/types/src/fs.ts +0 -17
  167. package/core/types/src/git.ts +0 -131
  168. package/core/types/src/hashing.ts +0 -107
  169. package/core/types/src/i18n.ts +0 -19
  170. package/core/types/src/index.ts +0 -21
  171. package/core/types/src/inspect.ts +0 -10
  172. package/core/types/src/layout.ts +0 -8
  173. package/core/types/src/library.ts +0 -148
  174. package/core/types/src/manifest.ts +0 -9
  175. package/core/types/src/markdown.ts +0 -198
  176. package/core/types/src/pages.ts +0 -8
  177. package/core/types/src/pwa.ts +0 -8
  178. package/core/types/src/ssg.ts +0 -3
  179. package/core/types/src/ui.ts +0 -141
  180. package/core/ui/README.md +0 -60
  181. package/core/ui/node_modules/.bin/mkdist +0 -17
  182. package/core/ui/node_modules/.bin/tsc +0 -17
  183. package/core/ui/node_modules/.bin/tsserver +0 -17
  184. package/core/ui/node_modules/.bin/vue-tsc +0 -17
  185. package/core/ui/package.json +0 -62
  186. package/core/ui/src/index.ts +0 -60
  187. package/custom-elements.json +0 -14
  188. package/examples/vue-components/App.vue +0 -12
  189. package/examples/vue-components/favicon.png +0 -0
  190. package/examples/vue-components/index.html +0 -20
  191. package/examples/web-components/favicon.png +0 -0
  192. package/examples/web-components/index.html +0 -13
  193. package/functions/node_modules/.bin/artisan +0 -17
  194. package/functions/node_modules/.bin/stacks +0 -17
  195. package/functions/node_modules/.bin/stx +0 -17
  196. package/functions/package.json +0 -40
  197. package/netlify.toml +0 -18
  198. package/nitro.config.ts +0 -6
  199. package/pages/App.vue +0 -26
  200. package/pages/index.html +0 -23
  201. package/pages/main.ts +0 -26
  202. package/pages/public/_headers +0 -3
  203. package/pages/public/favicon-dark.svg +0 -3
  204. package/pages/public/favicon.svg +0 -3
  205. package/pages/public/pwa-192x192.png +0 -0
  206. package/pages/public/pwa-512x512.png +0 -0
  207. package/pages/public/safari-pinned-tab.svg +0 -41
  208. package/pages/styles/main.css +0 -29
  209. package/pages/styles/markdown.css +0 -28
  210. package/scripts/ensure-env.sh +0 -248
  211. package/shims.d.ts +0 -29
  212. package/simple-git-hooks.cjs +0 -4
  213. package/src/cli/actions/build.ts +0 -160
  214. package/src/cli/actions/commit.ts +0 -9
  215. package/src/cli/actions/dev.ts +0 -47
  216. package/src/cli/actions/examples.ts +0 -74
  217. package/src/cli/actions/fresh.ts +0 -9
  218. package/src/cli/actions/generate.ts +0 -159
  219. package/src/cli/actions/index.ts +0 -12
  220. package/src/cli/actions/key.ts +0 -31
  221. package/src/cli/actions/lint.ts +0 -19
  222. package/src/cli/actions/make.ts +0 -116
  223. package/src/cli/actions/release.ts +0 -9
  224. package/src/cli/actions/test.ts +0 -39
  225. package/src/cli/actions/types.ts +0 -180
  226. package/src/cli/actions/update.ts +0 -90
  227. package/src/cli/build.ts +0 -49
  228. package/src/cli/create.ts +0 -71
  229. package/src/cli/dev.ts +0 -28
  230. package/src/cli/example.ts +0 -28
  231. package/src/cli/generate.ts +0 -64
  232. package/src/cli/index.ts +0 -13
  233. package/src/cli/key.ts +0 -12
  234. package/src/cli/make.ts +0 -47
  235. package/src/cli/test.ts +0 -24
  236. package/src/cli/types.ts +0 -18
  237. package/src/cli/update.ts +0 -17
  238. package/src/cli/utility.ts +0 -39
  239. package/src/cli.ts +0 -48
  240. package/src/docs.ts +0 -4
  241. package/src/index.ts +0 -22
  242. package/tsconfig.json +0 -96
  243. package/vitest.config.ts +0 -22
  244. package/vue-components/dist/.gitkeep +0 -0
  245. package/vue-components/index.html +0 -13
  246. package/vue-components/main.ts +0 -18
  247. package/vue-components/node_modules/.bin/artisan +0 -17
  248. package/vue-components/node_modules/.bin/stacks +0 -17
  249. package/vue-components/node_modules/.bin/stx +0 -17
  250. package/vue-components/package.json +0 -40
  251. package/web-components/dist/.gitkeep +0 -0
  252. package/web-components/node_modules/.bin/artisan +0 -17
  253. package/web-components/node_modules/.bin/stacks +0 -17
  254. package/web-components/node_modules/.bin/stx +0 -17
  255. package/web-components/package.json +0 -40
  256. package/web-types.json +0 -67
package/README.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # Rapid Application Development
2
2
 
3
- This Stacks.js framework/package contains the core logic—its runtime, helpers, and CLI (excluding the IDE setup).
3
+ Develop modern framework-agnostic web apps & libraries, faster. Stacks.js is a progressive full-stack framework with an approachable & easy-to-use onboarding experience.
4
4
 
5
5
  ## ☘️ Features
6
6
 
7
- The ultimate goal of the framework is to _help you_ build applications rapidly. Whether it's APIs, a component and/or function library, or simply a statically generate site. Stacks is a toolkit of composables, methods, and other goodies required to build optimized outputs. It's a highly optimized build process that automatically generates `.mjs` & `.cjs` library distributions for you, including its TypeScript types.
7
+ The goal of the framework is to _help you_ build applications rapidly & more efficiently, removing the boilerplate wherever possible—and the learning curve! Whether it's APIs, a component and/or function library, or simply a statically generate site, Stacks is a toolkit of composables, methods, and other goodies, required to build optimized outputs.
8
+
9
+ In other words, it's a highly optimized build process that automatically generates:
10
+
11
+ - `.mjs` & `.cjs` library distributions, including its TypeScript types
12
+ - a highly-performant JavaScript production-ready server to be deployed anywhere (e.g. Netlify, Vercel, AWS, etc.)
8
13
 
9
14
  Other included core features are:
10
15
 
@@ -0,0 +1,7 @@
1
+ export declare function buildComponentLibraries(): Promise<void>;
2
+ export declare function buildVueComponentLibrary(): Promise<void>;
3
+ export declare function buildWebComponentLibrary(): Promise<void>;
4
+ export declare function buildDocs(): Promise<void>;
5
+ export declare function buildStacks(): Promise<void>;
6
+ export declare function buildFunctionsLibrary(): Promise<void>;
7
+ export declare function startBuildProcess(options: any): Promise<void>;
@@ -0,0 +1,117 @@
1
+ import Prompts from "prompts";
2
+ import consola from "consola";
3
+ import { hasComponents, hasFunctions } from "@stacksjs/fs";
4
+ import { runNpmScript } from "@stacksjs/helpers";
5
+ import { ExitCode, NpmScript } from "@stacksjs/types";
6
+ import { generateTypes } from "./types.mjs";
7
+ const { prompts } = Prompts;
8
+ export async function buildComponentLibraries() {
9
+ try {
10
+ await runNpmScript(NpmScript.GenerateEntries);
11
+ await buildVueComponentLibrary();
12
+ await buildWebComponentLibrary();
13
+ } catch (error) {
14
+ consola.error("There was an error building your component libraries.");
15
+ consola.error(error);
16
+ }
17
+ }
18
+ export async function buildVueComponentLibrary() {
19
+ consola.info("Building your component library...");
20
+ if (hasComponents()) {
21
+ try {
22
+ await runNpmScript(NpmScript.BuildComponents);
23
+ consola.success("Your component library was built successfully.");
24
+ } catch (error) {
25
+ consola.error("There was an error building your component library.");
26
+ consola.error(error);
27
+ }
28
+ } else {
29
+ consola.info("No components found.");
30
+ }
31
+ }
32
+ export async function buildWebComponentLibrary() {
33
+ consola.info("Building your component library for production use & npm/CDN distribution...");
34
+ if (hasComponents()) {
35
+ try {
36
+ await runNpmScript(NpmScript.BuildWebComponents);
37
+ consola.success("Your Web Component library was built successfully.");
38
+ } catch (error) {
39
+ consola.error("There was an error building your Web Component library.");
40
+ consola.error(error);
41
+ }
42
+ } else {
43
+ consola.info("No components found.");
44
+ }
45
+ }
46
+ export async function buildDocs() {
47
+ consola.info("Building the Artisan CLI...");
48
+ try {
49
+ await runNpmScript(NpmScript.BuildDocs);
50
+ consola.success("Artisan CLI was built successfully.");
51
+ } catch (error) {
52
+ consola.error("There was an error building the Artisan CLI.");
53
+ consola.error(error);
54
+ }
55
+ }
56
+ export async function buildStacks() {
57
+ consola.info("Building the Stacks Framework...");
58
+ try {
59
+ await runNpmScript(NpmScript.BuildStacks);
60
+ consola.success("Stacks was built successfully.");
61
+ } catch (error) {
62
+ consola.error("There was an error building the Stacks framework.");
63
+ consola.error(error);
64
+ }
65
+ }
66
+ export async function buildFunctionsLibrary() {
67
+ consola.info("Building your functions library for production use & npm/CDN distribution...");
68
+ if (hasFunctions()) {
69
+ try {
70
+ await runNpmScript(NpmScript.BuildFunctions);
71
+ consola.success("Your functions library was built successfully.");
72
+ } catch (error) {
73
+ consola.error("There was an error building your functions library.");
74
+ consola.error(error);
75
+ }
76
+ } else {
77
+ consola.info("No functions found.");
78
+ }
79
+ }
80
+ export async function startBuildProcess(options) {
81
+ if (options.components || options === "components") {
82
+ await buildComponentLibraries();
83
+ } else if (options.webComponents || options.elements || options === "web-components" || options === "elements") {
84
+ await buildWebComponentLibrary();
85
+ } else if (options.functions || options === "functions") {
86
+ await buildFunctionsLibrary();
87
+ } else if (options.docs || options === "docs") {
88
+ await buildDocs();
89
+ } else if (options.stacks || options === "stacks") {
90
+ await buildStacks();
91
+ } else if (options.npm || options === "npm") {
92
+ await buildComponentLibraries();
93
+ await buildFunctionsLibrary();
94
+ consola.success("All your libraries and its types were built successfully to be distributed on npm.");
95
+ } else {
96
+ const answer = await prompts.select({
97
+ type: "select",
98
+ name: "build",
99
+ message: "Which stack are you trying to build for production use?",
100
+ choices: [
101
+ { title: "Components", value: "components" },
102
+ { title: "Functions", value: "functions" },
103
+ { title: "Docs", value: "docs" }
104
+ ],
105
+ initial: 0
106
+ });
107
+ if (answer === "components")
108
+ await buildComponentLibraries();
109
+ if (answer === "functions")
110
+ await buildFunctionsLibrary();
111
+ else if (answer === "docs")
112
+ await buildDocs();
113
+ else
114
+ process.exit(ExitCode.InvalidArgument);
115
+ }
116
+ await generateTypes();
117
+ }
@@ -0,0 +1 @@
1
+ export declare function commit(): Promise<void>;
@@ -0,0 +1,8 @@
1
+ import consola from "consola";
2
+ import { runNpmScript } from "@stacksjs/helpers";
3
+ import { NpmScript } from "@stacksjs/types";
4
+ export async function commit() {
5
+ consola.info("Committing...");
6
+ await runNpmScript(NpmScript.Commit);
7
+ consola.success("Committed.");
8
+ }
@@ -0,0 +1 @@
1
+ export declare function startDevelopmentServer(options: any): Promise<void>;
@@ -0,0 +1,34 @@
1
+ import Prompts from "prompts";
2
+ import consola from "consola";
3
+ import { runNpmScript } from "@stacksjs/helpers";
4
+ import { ExitCode, NpmScript } from "@stacksjs/types";
5
+ const { prompts } = Prompts;
6
+ export async function startDevelopmentServer(options) {
7
+ if (options.components || options === "components") {
8
+ consola.info("Starting development server for your components...");
9
+ await runNpmScript(NpmScript.DevComponents);
10
+ } else if (options.docs || options === "docs") {
11
+ consola.info("Starting development server for your documentation...");
12
+ await runNpmScript(NpmScript.DevDocs);
13
+ } else {
14
+ const answer = await prompts.select({
15
+ type: "select",
16
+ name: "development",
17
+ message: "Which development server are you trying to start?",
18
+ choices: [
19
+ { title: "Components", value: "components" },
20
+ { title: "Docs", value: "docs" }
21
+ ],
22
+ initial: 0
23
+ });
24
+ if (answer === "components") {
25
+ consola.info("Starting development server for your components...");
26
+ await runNpmScript(NpmScript.DevComponents);
27
+ } else if (answer === "docs") {
28
+ consola.info("Starting docs server for your components...");
29
+ await runNpmScript(NpmScript.DevDocs);
30
+ } else {
31
+ process.exit(ExitCode.InvalidArgument);
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,3 @@
1
+ export declare function testComponentExample(): Promise<void>;
2
+ export declare function testWebComponentExample(): Promise<void>;
3
+ export declare function runExample(options: any): Promise<void>;
@@ -0,0 +1,57 @@
1
+ import Prompts from "prompts";
2
+ import consola from "consola";
3
+ import { hasComponents } from "@stacksjs/fs";
4
+ import { runNpmScript } from "@stacksjs/helpers";
5
+ import { ExitCode, NpmScript } from "@stacksjs/types";
6
+ const { prompts } = Prompts;
7
+ export async function testComponentExample() {
8
+ if (hasComponents()) {
9
+ try {
10
+ await runNpmScript(NpmScript.ExampleVue);
11
+ consola.success("Your component library was built successfully.");
12
+ } catch (error) {
13
+ consola.error("There was an error building your component library.");
14
+ consola.error(error);
15
+ }
16
+ } else {
17
+ consola.info("No components found.");
18
+ }
19
+ }
20
+ export async function testWebComponentExample() {
21
+ consola.info("Building your Web Component library...");
22
+ if (hasComponents()) {
23
+ try {
24
+ await runNpmScript(NpmScript.BuildWebComponents);
25
+ consola.success("Your Web Component library was built successfully.");
26
+ } catch (error) {
27
+ consola.error("There was an error building your Web Component library.");
28
+ consola.error(error);
29
+ }
30
+ } else {
31
+ consola.info("No components found.");
32
+ }
33
+ }
34
+ export async function runExample(options) {
35
+ if (options.components || options === "components" || options === "vue") {
36
+ await testComponentExample();
37
+ } else if (options.webComponents || options.elements || options === "web-components" || options === "elements") {
38
+ await testWebComponentExample();
39
+ } else {
40
+ const answer = await prompts.select({
41
+ type: "select",
42
+ name: "example",
43
+ message: "Which example are you trying to view?",
44
+ choices: [
45
+ { title: "Components", value: "components" },
46
+ { title: "Web Components", value: "web-components" }
47
+ ],
48
+ initial: 0
49
+ });
50
+ if (answer === "components")
51
+ await testComponentExample();
52
+ if (answer === "web-components")
53
+ await testWebComponentExample();
54
+ else
55
+ process.exit(ExitCode.InvalidArgument);
56
+ }
57
+ }
@@ -0,0 +1 @@
1
+ export declare function reinstallNpmDependencies(): Promise<void>;
@@ -0,0 +1,8 @@
1
+ import consola from "consola";
2
+ import { runNpmScript } from "@stacksjs/helpers";
3
+ import { NpmScript } from "@stacksjs/types";
4
+ export async function reinstallNpmDependencies() {
5
+ consola.info("Reinstalling your npm dependencies...");
6
+ await runNpmScript(NpmScript.Fresh);
7
+ consola.success("Successfully reinstalled your npm dependencies.");
8
+ }
@@ -0,0 +1,7 @@
1
+ export declare function generateLibEntries(): Promise<void>;
2
+ export declare function generateVueCompat(): Promise<void>;
3
+ export declare function generateWebTypes(): Promise<void>;
4
+ export declare function generateVsCodeCustomData(): Promise<void>;
5
+ export declare function generateIdeHelpers(): Promise<void>;
6
+ export declare function generateComponentMeta(): Promise<void>;
7
+ export declare function startGenerationProcess(options: any): Promise<void>;
@@ -0,0 +1,117 @@
1
+ import consola from "consola";
2
+ import Prompts from "prompts";
3
+ import { runNpmScript } from "@stacksjs/helpers";
4
+ import { ExitCode, NpmScript } from "@stacksjs/types";
5
+ import { lintFix } from "./lint.mjs";
6
+ import { generateTypes } from "./types.mjs";
7
+ const { prompts } = Prompts;
8
+ export async function generateLibEntries() {
9
+ try {
10
+ await runNpmScript(NpmScript.GenerateEntries, "ignore");
11
+ consola.success("Library entry points were generated successfully.");
12
+ } catch (error) {
13
+ consola.error("There was an error generating your library entry points.");
14
+ consola.error(error);
15
+ }
16
+ }
17
+ export async function generateVueCompat() {
18
+ try {
19
+ await runNpmScript(NpmScript.GenerateVueCompat, "ignore");
20
+ consola.success("Vue 2 & 3 compatibility was generated successfully.");
21
+ } catch (error) {
22
+ consola.error("There was an error generating Vue compatibility.");
23
+ consola.error(error);
24
+ }
25
+ }
26
+ export async function generateWebTypes() {
27
+ try {
28
+ await runNpmScript(NpmScript.GenerateWebTypes, "ignore");
29
+ consola.success("Successfully generated the web-types.json file.");
30
+ } catch (error) {
31
+ consola.error("There was an error generating the web-types.json file");
32
+ consola.error(error);
33
+ process.exit(ExitCode.FatalError);
34
+ }
35
+ }
36
+ export async function generateVsCodeCustomData() {
37
+ try {
38
+ await runNpmScript(NpmScript.GenerateVsCodeCustomData, "ignore");
39
+ await lintFix("ignore");
40
+ consola.success("Successfully generated the custom-elements.json file.");
41
+ } catch (error) {
42
+ consola.error("There was an error generating the custom-elements.json file");
43
+ consola.error(error);
44
+ process.exit(ExitCode.FatalError);
45
+ }
46
+ }
47
+ export async function generateIdeHelpers() {
48
+ try {
49
+ await runNpmScript(NpmScript.GenerateIdeHelpers, "ignore");
50
+ await lintFix("ignore");
51
+ consola.success("Successfully generated IDE helpers.");
52
+ } catch (error) {
53
+ consola.error("There was an error generating IDE helpers.");
54
+ consola.error(error);
55
+ process.exit(ExitCode.FatalError);
56
+ }
57
+ }
58
+ export async function generateComponentMeta() {
59
+ try {
60
+ await runNpmScript(NpmScript.GenerateComponentMeta, "ignore");
61
+ await lintFix("ignore");
62
+ consola.success("Successfully generated component meta.");
63
+ } catch (error) {
64
+ consola.error("There was an error generating your component meta information.");
65
+ consola.error(error);
66
+ process.exit(ExitCode.FatalError);
67
+ }
68
+ }
69
+ export async function startGenerationProcess(options) {
70
+ if (options.types || options === "types") {
71
+ await generateTypes();
72
+ } else if (options.entries || options === "entries") {
73
+ await generateLibEntries();
74
+ } else if (options.webTypes || options === "web-types") {
75
+ await generateWebTypes();
76
+ } else if (options.customData || options === "custom-data") {
77
+ await generateVsCodeCustomData();
78
+ } else if (options.ideHelpers || options === "ide-helpers") {
79
+ await generateIdeHelpers();
80
+ } else if (options.vueCompatibility || options === "vue-compatibility") {
81
+ await generateVueCompat();
82
+ } else if (options.componentMeta || options === "component-meta") {
83
+ await generateComponentMeta();
84
+ } else {
85
+ const answer = await prompts.select({
86
+ type: "select",
87
+ name: "generate",
88
+ message: "What are you trying to generate?",
89
+ choices: [
90
+ { title: "1.) TypeScript Types", value: "types" },
91
+ { title: "2.) Library Entry Points", value: "entries" },
92
+ { title: "3.) Web Types", value: "web-types" },
93
+ { title: "4.) VS Code Custom Data", value: "custom-data" },
94
+ { title: "5.) IDE Helpers", value: "ide-helpers" },
95
+ { title: "6.) Vue 2 & 3 Compatibility", value: "vue-compatibility" },
96
+ { title: "7.) Component Meta", value: "component-meta" }
97
+ ],
98
+ initial: 0
99
+ });
100
+ if (answer === "types")
101
+ await generateTypes();
102
+ else if (answer === "entries")
103
+ await generateLibEntries();
104
+ else if (answer === "web-types")
105
+ await generateWebTypes();
106
+ else if (answer === "custom-data")
107
+ await generateVsCodeCustomData();
108
+ else if (answer === "ide-helpers")
109
+ await generateIdeHelpers();
110
+ else if (answer === "vue-compatibility")
111
+ await generateVueCompat();
112
+ else if (answer === "component-meta")
113
+ await generateComponentMeta();
114
+ else
115
+ process.exit(ExitCode.InvalidArgument);
116
+ }
117
+ }
@@ -0,0 +1,12 @@
1
+ export * from './build';
2
+ export * from './commit';
3
+ export * from './dev';
4
+ export * from './examples';
5
+ export * from './fresh';
6
+ export * from './generate';
7
+ export * from './key';
8
+ export * from './lint';
9
+ export * from './make';
10
+ export * from './release';
11
+ export * from './test';
12
+ export * from './update';
@@ -0,0 +1,12 @@
1
+ export * from "./build.mjs";
2
+ export * from "./commit.mjs";
3
+ export * from "./dev.mjs";
4
+ export * from "./examples.mjs";
5
+ export * from "./fresh.mjs";
6
+ export * from "./generate.mjs";
7
+ export * from "./key.mjs";
8
+ export * from "./lint.mjs";
9
+ export * from "./make.mjs";
10
+ export * from "./release.mjs";
11
+ export * from "./test.mjs";
12
+ export * from "./update.mjs";
@@ -0,0 +1,2 @@
1
+ export declare function generateAppKey(): Promise<string>;
2
+ export declare function generate(): Promise<boolean>;
@@ -0,0 +1,22 @@
1
+ import { getRandomValues } from "node:crypto";
2
+ import consola from "consola";
3
+ import ezSpawn from "@jsdevtools/ez-spawn";
4
+ import { projectPath } from "@stacksjs/paths";
5
+ import { setEnvValue } from "@stacksjs/helpers";
6
+ import { isFile } from "@stacksjs/fs";
7
+ import utf8 from "crypto-js/enc-utf8";
8
+ import base64 from "crypto-js/enc-base64";
9
+ export async function generateAppKey() {
10
+ const random = getRandomValues(new Uint8Array(32));
11
+ const encodedWord = utf8.parse(random.toString());
12
+ const key = base64.stringify(encodedWord);
13
+ return `base64:${key}`;
14
+ }
15
+ export async function generate() {
16
+ consola.info("Setting random application key.");
17
+ if (!isFile(".env"))
18
+ await ezSpawn.async("cp .env.example .env", { stdio: "inherit", cwd: projectPath() });
19
+ await setEnvValue("APP_KEY", await generateAppKey());
20
+ consola.success("Application key set.");
21
+ return true;
22
+ }
@@ -0,0 +1,2 @@
1
+ export declare function lint(debug?: 'ignore' | 'inherit'): Promise<void>;
2
+ export declare function lintFix(debug?: 'ignore' | 'inherit'): Promise<void>;
@@ -0,0 +1,15 @@
1
+ import consola from "consola";
2
+ import { runNpmScript } from "@stacksjs/helpers";
3
+ import { NpmScript } from "@stacksjs/types";
4
+ export async function lint(debug = "inherit") {
5
+ consola.info("Linting your codebase...");
6
+ await runNpmScript(NpmScript.Lint, debug);
7
+ consola.success("Successfully linted your codebase.");
8
+ }
9
+ export async function lintFix(debug = "inherit") {
10
+ if (debug !== "ignore")
11
+ consola.info("Fixing lint errors...");
12
+ await runNpmScript(NpmScript.LintFix, debug);
13
+ if (debug !== "ignore")
14
+ consola.success("Fixed lint errors.");
15
+ }
@@ -0,0 +1,5 @@
1
+ export declare function component(name: string): Promise<void>;
2
+ export declare function page(name: string): Promise<void>;
3
+ export declare function fx(name: string): Promise<void>;
4
+ export declare function language(language: string): Promise<void>;
5
+ export declare function stack(name: string): Promise<void>;
@@ -0,0 +1,97 @@
1
+ import consola from "consola";
2
+ import * as ezSpawn from "@jsdevtools/ez-spawn";
3
+ import { writeTextFile } from "@stacksjs/fs";
4
+ import { resolve } from "@stacksjs/paths";
5
+ export async function component(name) {
6
+ consola.info("Creating your component...");
7
+ try {
8
+ await writeTextFile({
9
+ path: `./components/${name}.vue`,
10
+ data: `<script setup lang="ts">
11
+ // eslint-disable-next-line no-console
12
+ console.log('Hello World component created')
13
+ <\/script>
14
+
15
+ <template>
16
+ <div>
17
+ Some HTML block
18
+ </div>
19
+ </template>
20
+ `
21
+ });
22
+ consola.success(`Created the ${name} component.`);
23
+ } catch (err) {
24
+ consola.error(err);
25
+ }
26
+ }
27
+ export async function page(name) {
28
+ consola.info("Creating your component...");
29
+ try {
30
+ await writeTextFile({
31
+ path: `./pages/${name}.vue`,
32
+ data: `<script setup lang="ts">
33
+ // eslint-disable-next-line no-console
34
+ console.log('Hello World page created')
35
+ <\/script>
36
+
37
+ <template>
38
+ <div>
39
+ Visit http://127.0.0.1/${name}
40
+ </div>
41
+ </template>
42
+ `
43
+ });
44
+ consola.success(`Created the ${name} page.`);
45
+ } catch (err) {
46
+ consola.error(err);
47
+ }
48
+ }
49
+ export async function fx(name) {
50
+ consola.info("Creating your function...");
51
+ try {
52
+ await writeTextFile({
53
+ path: `./functions/${name}.ts`,
54
+ data: `// reactive state
55
+ const ${name} = ref(0)
56
+
57
+ // functions that mutate state and trigger updates
58
+ function increment() {
59
+ ${name}.value++
60
+ }
61
+
62
+ export {
63
+ ${name},
64
+ increment,
65
+ }
66
+ `
67
+ });
68
+ consola.success(`Created the ${name} function.`);
69
+ } catch (err) {
70
+ consola.error(err);
71
+ }
72
+ }
73
+ export async function language(language2) {
74
+ consola.info("Creating your translation file...");
75
+ try {
76
+ await writeTextFile({
77
+ path: `./lang/${language2}.yml`,
78
+ data: `button:
79
+ text: Copy
80
+ `
81
+ });
82
+ consola.success(`Created the ${language2} translation file.`);
83
+ } catch (err) {
84
+ consola.error(err);
85
+ }
86
+ }
87
+ export async function stack(name) {
88
+ consola.info("Creating your stack...");
89
+ try {
90
+ const path = resolve(process.cwd(), name);
91
+ await ezSpawn.async(`giget stacks ${path}`);
92
+ consola.success("Successfully scaffolded your project.");
93
+ consola.info(`cd ${path} && pnpm install`);
94
+ } catch (err) {
95
+ consola.error(err);
96
+ }
97
+ }
@@ -0,0 +1 @@
1
+ export declare function release(): Promise<void>;
@@ -0,0 +1,8 @@
1
+ import consola from "consola";
2
+ import { runNpmScript } from "@stacksjs/helpers";
3
+ import { NpmScript } from "@stacksjs/types";
4
+ export async function release() {
5
+ consola.info("Releasing...");
6
+ await runNpmScript(NpmScript.Release);
7
+ consola.success("Triggered release workflow");
8
+ }
@@ -0,0 +1,3 @@
1
+ export declare function typecheck(): Promise<void>;
2
+ export declare function runTestSuite(): Promise<void>;
3
+ export declare function generateTestCoverageReport(): Promise<void>;
@@ -0,0 +1,30 @@
1
+ import consola from "consola";
2
+ import { runNpmScript } from "@stacksjs/helpers";
3
+ import { NpmScript } from "@stacksjs/types";
4
+ export async function typecheck() {
5
+ consola.info("Typechecking your codebase...");
6
+ try {
7
+ await runNpmScript(NpmScript.TestTypes);
8
+ consola.success("Finished typechecking your codebase.");
9
+ } catch (error) {
10
+ consola.error(error);
11
+ }
12
+ }
13
+ export async function runTestSuite() {
14
+ consola.info("Running your test suite...");
15
+ try {
16
+ await runNpmScript(NpmScript.Test);
17
+ consola.success("Completed running the test suite.");
18
+ } catch (error) {
19
+ consola.error(error);
20
+ }
21
+ }
22
+ export async function generateTestCoverageReport() {
23
+ consola.info("Generating a test coverage report...");
24
+ try {
25
+ await runNpmScript(NpmScript.TestCoverage);
26
+ consola.success("Generated the test coverage report.");
27
+ } catch (error) {
28
+ consola.error(error);
29
+ }
30
+ }
@@ -0,0 +1,9 @@
1
+ export declare function generateTypes(): Promise<void>;
2
+ export declare function fixTypes(): Promise<void>;
3
+ export declare function generateLibEntries(): Promise<void>;
4
+ export declare function generateVueCompat(): Promise<void>;
5
+ export declare function generateWebTypes(): Promise<void>;
6
+ export declare function generateVsCodeCustomData(): Promise<void>;
7
+ export declare function generateIdeHelpers(): Promise<void>;
8
+ export declare function generateComponentMeta(): Promise<void>;
9
+ export declare function startGenerationProcess(options: any): Promise<void>;