stacks 0.37.4 → 0.37.6

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
@@ -0,0 +1,134 @@
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
+ const { prompts } = Prompts;
7
+ export async function generateTypes() {
8
+ try {
9
+ await runNpmScript(NpmScript.TypesGenerate, "ignore");
10
+ consola.success("Types were generated successfully.");
11
+ } catch (error) {
12
+ consola.error("There was an error generating your types.");
13
+ consola.error(error);
14
+ }
15
+ }
16
+ export async function fixTypes() {
17
+ try {
18
+ await runNpmScript(NpmScript.TypesFix, "ignore");
19
+ consola.success("Types were generated successfully.");
20
+ } catch (error) {
21
+ consola.error("There was an error generating your types.");
22
+ consola.error(error);
23
+ }
24
+ }
25
+ export async function generateLibEntries() {
26
+ try {
27
+ await runNpmScript(NpmScript.GenerateEntries, "ignore");
28
+ consola.success("Library entry points were generated successfully.");
29
+ } catch (error) {
30
+ consola.error("There was an error generating your library entry points.");
31
+ consola.error(error);
32
+ }
33
+ }
34
+ export async function generateVueCompat() {
35
+ try {
36
+ await runNpmScript(NpmScript.GenerateVueCompat, "ignore");
37
+ consola.success("Vue 2 & 3 compatibility was generated successfully.");
38
+ } catch (error) {
39
+ consola.error("There was an error generating Vue compatibility.");
40
+ consola.error(error);
41
+ }
42
+ }
43
+ export async function generateWebTypes() {
44
+ try {
45
+ await runNpmScript(NpmScript.GenerateWebTypes, "ignore");
46
+ consola.success("Successfully generated the web-types.json file.");
47
+ } catch (error) {
48
+ consola.error("There was an error generating the web-types.json file");
49
+ consola.error(error);
50
+ process.exit(ExitCode.FatalError);
51
+ }
52
+ }
53
+ export async function generateVsCodeCustomData() {
54
+ try {
55
+ await runNpmScript(NpmScript.GenerateVsCodeCustomData, "ignore");
56
+ await lintFix("ignore");
57
+ consola.success("Successfully generated the custom-elements.json file.");
58
+ } catch (error) {
59
+ consola.error("There was an error generating the custom-elements.json file");
60
+ consola.error(error);
61
+ process.exit(ExitCode.FatalError);
62
+ }
63
+ }
64
+ export async function generateIdeHelpers() {
65
+ try {
66
+ await runNpmScript(NpmScript.GenerateIdeHelpers, "ignore");
67
+ await lintFix("ignore");
68
+ consola.success("Successfully generated IDE helpers.");
69
+ } catch (error) {
70
+ consola.error("There was an error generating IDE helpers.");
71
+ consola.error(error);
72
+ process.exit(ExitCode.FatalError);
73
+ }
74
+ }
75
+ export async function generateComponentMeta() {
76
+ try {
77
+ await runNpmScript(NpmScript.GenerateComponentMeta, "ignore");
78
+ await lintFix("ignore");
79
+ consola.success("Successfully generated component meta.");
80
+ } catch (error) {
81
+ consola.error("There was an error generating your component meta information.");
82
+ consola.error(error);
83
+ process.exit(ExitCode.FatalError);
84
+ }
85
+ }
86
+ export async function startGenerationProcess(options) {
87
+ if (options.types || options === "types") {
88
+ await generateTypes();
89
+ } else if (options.entries || options === "entries") {
90
+ await generateLibEntries();
91
+ } else if (options.webTypes || options === "web-types") {
92
+ await generateWebTypes();
93
+ } else if (options.customData || options === "custom-data") {
94
+ await generateVsCodeCustomData();
95
+ } else if (options.ideHelpers || options === "ide-helpers") {
96
+ await generateIdeHelpers();
97
+ } else if (options.vueCompatibility || options === "vue-compatibility") {
98
+ await generateVueCompat();
99
+ } else if (options.componentMeta || options === "component-meta") {
100
+ await generateComponentMeta();
101
+ } else {
102
+ const answer = await prompts.select({
103
+ type: "select",
104
+ name: "generate",
105
+ message: "What are you trying to generate?",
106
+ choices: [
107
+ { title: "1.) TypeScript Types", value: "types" },
108
+ { title: "2.) Library Entry Points", value: "entries" },
109
+ { title: "3.) Web Types", value: "web-types" },
110
+ { title: "4.) VS Code Custom Data", value: "custom-data" },
111
+ { title: "5.) IDE Helpers", value: "ide-helpers" },
112
+ { title: "6.) Vue 2 & 3 Compatibility", value: "vue-compatibility" },
113
+ { title: "7.) Component Meta", value: "component-meta" }
114
+ ],
115
+ initial: 0
116
+ });
117
+ if (answer === "types")
118
+ await generateTypes();
119
+ else if (answer === "entries")
120
+ await generateLibEntries();
121
+ else if (answer === "web-types")
122
+ await generateWebTypes();
123
+ else if (answer === "custom-data")
124
+ await generateVsCodeCustomData();
125
+ else if (answer === "ide-helpers")
126
+ await generateIdeHelpers();
127
+ else if (answer === "vue-compatibility")
128
+ await generateVueCompat();
129
+ else if (answer === "component-meta")
130
+ await generateComponentMeta();
131
+ else
132
+ process.exit(ExitCode.InvalidArgument);
133
+ }
134
+ }
@@ -0,0 +1 @@
1
+ export declare function stacks(options: any): Promise<void>;
@@ -0,0 +1,59 @@
1
+ import * as ezSpawn from "@jsdevtools/ez-spawn";
2
+ import consola from "consola";
3
+ import Prompts from "prompts";
4
+ import { copyFolder, deleteEmptyFolders, deleteFiles, deleteFolder, doesFolderExist } from "@stacksjs/fs";
5
+ import { resolve } from "@stacksjs/paths";
6
+ import { runNpmScript } from "@stacksjs/helpers";
7
+ import { ExitCode, NpmScript } from "@stacksjs/types";
8
+ const { prompts } = Prompts;
9
+ export async function stacks(options) {
10
+ if (options.framework) {
11
+ try {
12
+ await ezSpawn.async("git diff --quiet HEAD -- ./.stacks", { stdio: "inherit", cwd: process.cwd() });
13
+ } catch (error) {
14
+ if (error.status === 1) {
15
+ if (!options.force) {
16
+ const answer = await prompts.confirm({
17
+ type: "select",
18
+ name: "framework-update",
19
+ message: "Would you like to overwrite your ./stacks changes in favor of the Stacks update?"
20
+ });
21
+ if (!answer) {
22
+ consola.info("The framework was not updated.");
23
+ consola.info("Note: if you commit your changes and replay the update, you will see what has changed.");
24
+ process.exit(ExitCode.Success);
25
+ }
26
+ }
27
+ }
28
+ }
29
+ consola.info("Downloading framework updates...");
30
+ const tempFolderName = "updates";
31
+ const tempUpdatePath = resolve(process.cwd(), tempFolderName);
32
+ if (doesFolderExist(tempUpdatePath))
33
+ await deleteFolder(tempUpdatePath);
34
+ await ezSpawn.async(`giget stacks ${tempFolderName}`, { stdio: options.debug ? "inherit" : "ignore" });
35
+ consola.success("Downloaded framework updates.");
36
+ consola.info("Updating framework...");
37
+ const frameworkPath = resolve(process.cwd(), ".stacks");
38
+ const exclude = ["functions/package.json", "vue-components/package.json", "web-components/package.json", "auto-imports.d.ts", "components.d.ts", "dist"];
39
+ await deleteFiles(frameworkPath, exclude);
40
+ for (let i = 0; i < 5; i++)
41
+ await deleteEmptyFolders(frameworkPath);
42
+ const from = resolve(process.cwd(), "./updates/.stacks");
43
+ const to = frameworkPath;
44
+ await copyFolder(from, to, exclude);
45
+ consola.info("Cleanup...");
46
+ await deleteFolder(tempUpdatePath);
47
+ consola.success("Framework updated.");
48
+ }
49
+ if (options.dependencies) {
50
+ consola.info("Updating dependencies...");
51
+ await runNpmScript(NpmScript.Update);
52
+ consola.success("Updated dependencies.");
53
+ }
54
+ if (options.packageManager) {
55
+ consola.info("Updating pnpm...");
56
+ const version = await runNpmScript(NpmScript.UpdatePackageManager);
57
+ consola.success("Successfully updated pnpm to: ", version);
58
+ }
59
+ }
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function build(stacks: CAC): Promise<void>;
3
+ export { build };
@@ -0,0 +1,22 @@
1
+ import { startBuildProcess } from "./actions/build.mjs";
2
+ async function build(stacks) {
3
+ stacks.command("build", "Automagically build any of your libraries/packages for production use. Select any of the following packages").option("-c, --components", "Build your component library").option("-w, --web-components", "Build your framework agnostic web component library").option("-e, --elements", "An alias to the -w flag").option("-f, --functions", "Build your function library").option("-d, --docs", "Build your documentation site").option("--debug", "Add additional debug logs", { default: false }).action(async (options) => {
4
+ await startBuildProcess(options);
5
+ });
6
+ stacks.command("build:components", "Automagically build your component libraries for production use & npm/CDN distribution.").action(async () => {
7
+ await startBuildProcess("components");
8
+ });
9
+ stacks.command("build:functions", "Automagically build your function library for production use & npm/CDN distribution.").action(async () => {
10
+ await startBuildProcess("functions");
11
+ });
12
+ stacks.command("build:web-components", "Automagically build web component library for production use & npm/CDN distribution.").action(async () => {
13
+ await startBuildProcess("web-components");
14
+ });
15
+ stacks.command("build:docs", "Automagically build your documentation site.").action(async () => {
16
+ await startBuildProcess("docs");
17
+ });
18
+ stacks.command("build:stacks", "Build the core Stacks framework.").action(async () => {
19
+ await startBuildProcess("stacks");
20
+ });
21
+ }
22
+ export { build };
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function create(stack: CAC): Promise<void>;
3
+ export { create };
@@ -0,0 +1,46 @@
1
+ import consola from "consola";
2
+ import * as ezSpawn from "@jsdevtools/ez-spawn";
3
+ import { resolve } from "pathe";
4
+ import { bold, cyan, dim, link } from "kolorist";
5
+ import { useOnline } from "@vueuse/core";
6
+ import { isFolder } from "@stacksjs/fs";
7
+ import { ExitCode } from "@stacksjs/types";
8
+ import { version } from "../../package.json";
9
+ import { generate as generateAppKey } from "./actions/key.mjs";
10
+ async function create(stack) {
11
+ stack.option("-n, --name <name>", "Name of the stack").option("-u, --ui", "Are you building a UI?", { default: true }).option("-c, --components", "Are you building UI components?", { default: true }).option("-w, --web-components", "Automagically built optimized custom elements/web components?", { default: true }).option("-v, --vue", "Automagically built a Vue component library?", { default: true }).option("-p, --pages", "How about pages?", { default: true }).option("-f, --functions", "Are you developing functions/composables?", { default: true }).option("-a, --api", "Are you building an API?", { default: true }).option("-d, --database", "Do you need a database?", { default: true }).option("--debug", "Add additional debug logs", { default: false });
12
+ stack.command("").action(async (args) => {
13
+ const name = stack.args[0] || args.name || ".";
14
+ const path = resolve(process.cwd(), name);
15
+ console.log();
16
+ console.log(cyan(bold("Stacks CLI")) + dim(` v${version}`));
17
+ console.log();
18
+ if (await isFolder(path)) {
19
+ consola.error(`Path ${path} already exists`);
20
+ process.exit(ExitCode.FatalError);
21
+ }
22
+ const online = useOnline();
23
+ if (!online) {
24
+ consola.info("It appears you are disconnected from the internet. The Stacks setup requires a brief internet connection for setup.");
25
+ process.exit(ExitCode.FatalError);
26
+ }
27
+ consola.info("Setting up your stack.");
28
+ await ezSpawn.async(`giget stacks ${name}`, { stdio: args.debug ? "inherit" : "ignore" });
29
+ consola.success(`Successfully scaffolded your project at ${cyan(path)}`);
30
+ consola.info("Ensuring your environment is ready...");
31
+ await ezSpawn.async("fnm use", { stdio: args.debug ? "inherit" : "ignore", cwd: path });
32
+ consola.success("Environment is ready.");
33
+ consola.info("Installing & setting up Stacks.");
34
+ await ezSpawn.async("pnpm install", { stdio: args.debug ? "inherit" : "ignore", cwd: path });
35
+ await ezSpawn.async("cp .env.example .env", { stdio: args.debug ? "inherit" : "ignore", cwd: path });
36
+ await generateAppKey();
37
+ await ezSpawn.async("git init", { stdio: args.debug ? "inherit" : "ignore", cwd: path });
38
+ consola.success("Installed & set-up \u{1F680}");
39
+ console.log();
40
+ consola.info(bold("Welcome to the Stacks Framework! \u269B\uFE0F"));
41
+ console.log(`cd ${link(path, `vscode://file/${path}:1`)} && code .`);
42
+ console.log();
43
+ consola.log("To learn more, visit https://stacksjs.dev");
44
+ });
45
+ }
46
+ export { create };
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function dev(stacks: CAC): Promise<void>;
3
+ export { dev };
@@ -0,0 +1,13 @@
1
+ import { startDevelopmentServer } from "./actions/dev.mjs";
2
+ async function dev(stacks) {
3
+ stacks.command("dev", "Start the development server for any of the following packages").option("-c, --components", "Start the Components development server").option("-f, --functions", "Start the Functions development server").option("-d, --docs", "Start the Documentation development server").action(async (options) => {
4
+ await startDevelopmentServer(options);
5
+ });
6
+ stacks.command("dev:components", "Start the development server for your component library").action(async () => {
7
+ await startDevelopmentServer("components");
8
+ });
9
+ stacks.command("dev:docs", "Start the development server for your documentation").action(async () => {
10
+ await startDevelopmentServer("docs");
11
+ });
12
+ }
13
+ export { dev };
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function example(stacks: CAC): Promise<void>;
3
+ export { example };
@@ -0,0 +1,13 @@
1
+ import { runExample } from "./actions/examples.mjs";
2
+ async function example(stacks) {
3
+ stacks.command("example", "Test your libraries against your built bundle.").option("-c, --components", "Test your Vue component library").option("-v, --vue", "Test your Vue component library").option("-w, --web-components", "Test your web component library").action(async (options) => {
4
+ await runExample(options);
5
+ });
6
+ stacks.command("example:vue", "Test your Vue component library.").alias("example:components").action(async () => {
7
+ await runExample("vue");
8
+ });
9
+ stacks.command("example:web-components", "Test your Web Component library.").action(async () => {
10
+ await runExample("web-components");
11
+ });
12
+ }
13
+ export { example };
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function generate(stacks: CAC): Promise<void>;
3
+ export { generate };
@@ -0,0 +1,29 @@
1
+ import { generateComponentMeta, generateIdeHelpers, generateLibEntries, generateVsCodeCustomData, generateVueCompat, generateWebTypes, startGenerationProcess } from "./actions/generate.mjs";
2
+ import { generateTypes } from "./actions/types.mjs";
3
+ async function generate(stacks) {
4
+ stacks.command("generate", "Automagically build any of your libraries/packages for production use. Select any of the following packages").option("-t, --types", "Generate your TypeScript types").option("-e, --entries", "Generate your function & component library entry points").option("-w, --web-types", "Generate web-types.json for IDEs").option("-c, --custom-data", "Generate VS Code custom data (custom-elements.json) for IDEs").option("-i, --ide-helpers", "Generate IDE helpers").option("-v, --vue-compatibility", "Generate Vue 2 & 3 compatibility").option("-c, --component-meta", "Generate component meta information").option("--debug", "Add additional debug logs", { default: false }).action(async (options) => {
5
+ await startGenerationProcess(options);
6
+ });
7
+ stacks.command("generate:types", "Generate the types of & for your library/libraries").action(async () => {
8
+ await generateTypes();
9
+ });
10
+ stacks.command("generate:entries", "Generate the entry points for your libraries").action(async () => {
11
+ await generateLibEntries();
12
+ });
13
+ stacks.command("generate:vue-compatibility", "Generate Vue 2 & 3 compatibility").action(async () => {
14
+ await generateVueCompat();
15
+ });
16
+ stacks.command("generate:web-types", "Generate web-types.json for IDEs").action(async () => {
17
+ await generateWebTypes();
18
+ });
19
+ stacks.command("generate:vscode-custom-data", "Generate VS Code custom data (custom-elements.json) for IDEs").action(async () => {
20
+ await generateVsCodeCustomData();
21
+ });
22
+ stacks.command("generate:ide-helpers", "Generate IDE helpers").action(async () => {
23
+ await generateIdeHelpers();
24
+ });
25
+ stacks.command("generate:component-meta", "Generate component meta information").action(async () => {
26
+ await generateComponentMeta();
27
+ });
28
+ }
29
+ export { generate };
@@ -0,0 +1,12 @@
1
+ import { build } from './build';
2
+ import { dev } from './dev';
3
+ import { example } from './example';
4
+ import { generate } from './generate';
5
+ import { utility } from './utility';
6
+ import { make } from './make';
7
+ import { test } from './test';
8
+ import { create } from './create';
9
+ import { update } from './update';
10
+ import { types } from './types';
11
+ import { key } from './key';
12
+ export { dev, build, utility, make, example, test, create, update, generate, key, types };
@@ -0,0 +1,12 @@
1
+ import { build } from "./build.mjs";
2
+ import { dev } from "./dev.mjs";
3
+ import { example } from "./example.mjs";
4
+ import { generate } from "./generate.mjs";
5
+ import { utility } from "./utility.mjs";
6
+ import { make } from "./make.mjs";
7
+ import { test } from "./test.mjs";
8
+ import { create } from "./create.mjs";
9
+ import { update } from "./update.mjs";
10
+ import { types } from "./types.mjs";
11
+ import { key } from "./key.mjs";
12
+ export { dev, build, utility, make, example, test, create, update, generate, key, types };
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function key(stacks: CAC): Promise<void>;
3
+ export { key };
@@ -0,0 +1,7 @@
1
+ import { generate as generateAppKey } from "./actions/key.mjs";
2
+ async function key(stacks) {
3
+ stacks.command("key:generate", "Generate & set the application key.").action(async () => {
4
+ await generateAppKey();
5
+ });
6
+ }
7
+ export { key };
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function make(stacks: CAC): Promise<void>;
3
+ export { make };
@@ -0,0 +1,22 @@
1
+ import { component as makeComponent, fx as makeFunction, language as makeLanguage, page as makePage, stack as makeStack } from "./actions/make.mjs";
2
+ async function make(stacks) {
3
+ stacks.command("make", "Test your libraries against your built bundle.").option("-c, --component", "Scaffolds a component.").option("-p, --page", "Scaffolds a page.").option("-f, --function", "Scaffolds a function.").option("-l, --language", "Scaffolds a language.").option("-s, --stack", "Scaffolds a new stack.").action(async (options) => {
4
+ await runMake(stacks.args[0], options);
5
+ });
6
+ stacks.command("make:component", "Scaffolds a component.").action(async () => {
7
+ await makeComponent(stacks.args[0]);
8
+ });
9
+ stacks.command("make:page", "Scaffolds a page.").action(async () => {
10
+ await makePage(stacks.args[0]);
11
+ });
12
+ stacks.command("make:function", "Scaffolds a function.").action(async () => {
13
+ await makeFunction(stacks.args[0]);
14
+ });
15
+ stacks.command("make:lang", "Scaffolds a language file.").action(async () => {
16
+ await makeLanguage(stacks.args[0]);
17
+ });
18
+ stacks.command("make:stack", "Scaffolds a new stack.").action(async () => {
19
+ await makeStack(stacks.args[0]);
20
+ });
21
+ }
22
+ export { make };
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function test(stacks: CAC): Promise<void>;
3
+ export { test };
@@ -0,0 +1,13 @@
1
+ import { generateTestCoverageReport, runTestSuite, typecheck } from "./actions/test.mjs";
2
+ async function test(stacks) {
3
+ stacks.command("test", "Runs your test suite.").action(async () => {
4
+ await runTestSuite();
5
+ });
6
+ stacks.command("test:types", "Typechecks your codebase.").action(async () => {
7
+ await typecheck();
8
+ });
9
+ stacks.command("test:coverage", "Generates a test coverage report.").action(async () => {
10
+ await generateTestCoverageReport();
11
+ });
12
+ }
13
+ export { test };
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function types(stacks: CAC): Promise<void>;
3
+ export { types };
@@ -0,0 +1,9 @@
1
+ import { generateTypes } from "./actions/types.mjs";
2
+ async function types(stacks) {
3
+ stacks.command("types:generate", "Generate the types of & for your library/libraries").action(async () => {
4
+ await generateTypes();
5
+ });
6
+ stacks.command("types:fix", "Generate the types of & for your library/libraries").action(async () => {
7
+ });
8
+ }
9
+ export { types };
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function update(stacks: CAC): Promise<void>;
3
+ export { update };
@@ -0,0 +1,7 @@
1
+ import { stacks as updateStacks } from "./actions/update.mjs";
2
+ async function update(stacks) {
3
+ stacks.command("update", "Updates dependencies & framework.").option("-c, --framework", "Update the Stacks framework", { default: true }).option("-d, --dependencies", "Update your dependencies", { default: true }).option("-p, --package-manager", "Update your package manager, i.e. pnpm", { default: true }).option("-f, --force", "Overwrite possible local updates with remote framework updates", { default: false }).option("--debug", "Add additional debug logs", { default: false }).action(async (options) => {
4
+ await updateStacks(options);
5
+ });
6
+ }
7
+ export { update };
@@ -0,0 +1,3 @@
1
+ import type { CAC } from 'cac';
2
+ declare function utility(stacks: CAC): Promise<void>;
3
+ export { utility };
@@ -0,0 +1,22 @@
1
+ import { reinstallNpmDependencies } from "./actions/fresh.mjs";
2
+ import { lint, lintFix } from "./actions/lint.mjs";
3
+ import { release } from "./actions/release.mjs";
4
+ import { commit } from "./actions/commit.mjs";
5
+ async function utility(stacks) {
6
+ stacks.command("fresh", "Reinstalls your npm dependencies.").action(async () => {
7
+ await reinstallNpmDependencies();
8
+ });
9
+ stacks.command("lint", "Automagically lints your codebase.").action(async () => {
10
+ await lint();
11
+ });
12
+ stacks.command("lint:fix", "Automagically fixes lint errors.").action(async () => {
13
+ await lintFix();
14
+ });
15
+ stacks.command("release", "Releases a new version of your libraries/packages.").action(async () => {
16
+ await release();
17
+ });
18
+ stacks.command("commit", "Commit your stashed changes.").action(async () => {
19
+ await commit();
20
+ });
21
+ }
22
+ export { utility };
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};