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
@@ -1,180 +0,0 @@
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'
6
-
7
- const { prompts } = Prompts
8
-
9
- export async function generateTypes() {
10
- try {
11
- await runNpmScript(NpmScript.TypesGenerate, 'ignore')
12
- consola.success('Types were generated successfully.')
13
- }
14
- catch (error) {
15
- consola.error('There was an error generating your types.')
16
- consola.error(error)
17
- }
18
- }
19
-
20
- export async function fixTypes() {
21
- try {
22
- await runNpmScript(NpmScript.TypesFix, 'ignore')
23
- consola.success('Types were generated successfully.')
24
- }
25
- catch (error) {
26
- consola.error('There was an error generating your types.')
27
- consola.error(error)
28
- }
29
- }
30
-
31
- export async function generateLibEntries() {
32
- try {
33
- await runNpmScript(NpmScript.GenerateEntries, 'ignore')
34
- consola.success('Library entry points were generated successfully.')
35
- }
36
- catch (error) {
37
- consola.error('There was an error generating your library entry points.')
38
- consola.error(error)
39
- }
40
- }
41
-
42
- export async function generateVueCompat() {
43
- try {
44
- await runNpmScript(NpmScript.GenerateVueCompat, 'ignore')
45
- consola.success('Vue 2 & 3 compatibility was generated successfully.')
46
- }
47
- catch (error) {
48
- consola.error('There was an error generating Vue compatibility.')
49
- consola.error(error)
50
- }
51
- }
52
-
53
- export async function generateWebTypes() {
54
- try {
55
- await runNpmScript(NpmScript.GenerateWebTypes, 'ignore')
56
- consola.success('Successfully generated the web-types.json file.')
57
- }
58
- catch (error) {
59
- consola.error('There was an error generating the web-types.json file')
60
- consola.error(error)
61
- process.exit(ExitCode.FatalError)
62
- }
63
- }
64
-
65
- export async function generateVsCodeCustomData() {
66
- try {
67
- await runNpmScript(NpmScript.GenerateVsCodeCustomData, 'ignore')
68
- await lintFix('ignore') // the created json file needs to be linted
69
- consola.success('Successfully generated the custom-elements.json file.')
70
- }
71
- catch (error) {
72
- consola.error('There was an error generating the custom-elements.json file')
73
- consola.error(error)
74
- process.exit(ExitCode.FatalError)
75
- }
76
- }
77
-
78
- export async function generateIdeHelpers() {
79
- try {
80
- await runNpmScript(NpmScript.GenerateIdeHelpers, 'ignore')
81
- await lintFix('ignore') // the created json file needs to be linted
82
- consola.success('Successfully generated IDE helpers.')
83
- }
84
- catch (error) {
85
- consola.error('There was an error generating IDE helpers.')
86
- consola.error(error)
87
- process.exit(ExitCode.FatalError)
88
- }
89
- }
90
-
91
- export async function generateComponentMeta() {
92
- try {
93
- await runNpmScript(NpmScript.GenerateComponentMeta, 'ignore')
94
- await lintFix('ignore') // the created json file needs to be linted
95
- consola.success('Successfully generated component meta.')
96
- }
97
- catch (error) {
98
- consola.error('There was an error generating your component meta information.')
99
- consola.error(error)
100
- process.exit(ExitCode.FatalError)
101
- }
102
- }
103
-
104
- export async function startGenerationProcess(options: any) {
105
- if (options.types || options === 'types') {
106
- await generateTypes()
107
- }
108
-
109
- else if (options.entries || options === 'entries') {
110
- await generateLibEntries()
111
- }
112
-
113
- else if (options.webTypes || options === 'web-types') {
114
- await generateWebTypes()
115
- }
116
-
117
- else if (options.customData || options === 'custom-data') {
118
- await generateVsCodeCustomData()
119
- }
120
-
121
- else if (options.ideHelpers || options === 'ide-helpers') {
122
- await generateIdeHelpers()
123
- }
124
-
125
- else if (options.vueCompatibility || options === 'vue-compatibility') {
126
- await generateVueCompat()
127
- }
128
-
129
- else if (options.componentMeta || options === 'component-meta') {
130
- await generateComponentMeta()
131
- }
132
-
133
- else {
134
- const answer = await prompts.select({
135
- type: 'select',
136
- name: 'generate',
137
- message: 'What are you trying to generate?',
138
- choices: [ // todo: should be a multi-select
139
- { title: '1.) TypeScript Types', value: 'types' },
140
- { title: '2.) Library Entry Points', value: 'entries' },
141
- { title: '3.) Web Types', value: 'web-types' },
142
- { title: '4.) VS Code Custom Data', value: 'custom-data' },
143
- { title: '5.) IDE Helpers', value: 'ide-helpers' },
144
- { title: '6.) Vue 2 & 3 Compatibility', value: 'vue-compatibility' },
145
- { title: '7.) Component Meta', value: 'component-meta' },
146
- ],
147
- initial: 0,
148
- })
149
-
150
- // @ts-expect-error the answer object type expects to return a void type but it returns a string
151
- if (answer === 'types')
152
- await generateTypes()
153
-
154
- // @ts-expect-error the answer object type expects to return a void type but it returns a string
155
- else if (answer === 'entries')
156
- await generateLibEntries()
157
-
158
- // @ts-expect-error the answer object type expects to return a void type but it returns a string
159
- else if (answer === 'web-types')
160
- await generateWebTypes()
161
-
162
- // @ts-expect-error the answer object type expects to return a void type but it returns a string
163
- else if (answer === 'custom-data')
164
- await generateVsCodeCustomData()
165
-
166
- // @ts-expect-error the answer object type expects to return a void type but it returns a string
167
- else if (answer === 'ide-helpers')
168
- await generateIdeHelpers()
169
-
170
- // @ts-expect-error the answer object type expects to return a void type but it returns a string
171
- else if (answer === 'vue-compatibility')
172
- await generateVueCompat()
173
-
174
- // @ts-expect-error the answer object type expects to return a void type but it returns a string
175
- else if (answer === 'component-meta')
176
- await generateComponentMeta()
177
-
178
- else process.exit(ExitCode.InvalidArgument)
179
- }
180
- }
@@ -1,90 +0,0 @@
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
-
9
- const { prompts } = Prompts
10
-
11
- export async function stacks(options: any) {
12
- // first, we need to update the framework, if updates available
13
- // TODO: need to delete all files except the whitelisted ones
14
- if (options.framework) {
15
- try {
16
- // check if the .stacks folder has any updates
17
- // https://carlosbecker.com/posts/git-changed/
18
- await ezSpawn.async('git diff --quiet HEAD -- ./.stacks', { stdio: 'inherit', cwd: process.cwd() })
19
- }
20
- catch (error: any) {
21
- if (error.status === 1) {
22
- // even though the ./.stacks folder should not be edited, instead config values should be adjusted,
23
- // there is a chance that users may apply local core edits, as it's totally acceptable, as long as
24
- // the user knows what they are doing. There is also a change that simply the deps within .stacks
25
- // folder have been updated and that could produce a diff.
26
- if (!options.force) {
27
- const answer = await prompts.confirm({
28
- type: 'select',
29
- name: 'framework-update',
30
- message: 'Would you like to overwrite your ./stacks changes in favor of the Stacks update?',
31
- })
32
-
33
- // @ts-expect-error the answer object type expects to return a void type but it returns boolean
34
- if (!answer) {
35
- consola.info('The framework was not updated.')
36
- consola.info('Note: if you commit your changes and replay the update, you will see what has changed.')
37
- process.exit(ExitCode.Success)
38
- }
39
- }
40
- }
41
- }
42
-
43
- consola.info('Downloading framework updates...')
44
-
45
- const tempFolderName = 'updates'
46
- const tempUpdatePath = resolve(process.cwd(), tempFolderName)
47
- if (doesFolderExist(tempUpdatePath))
48
- await deleteFolder(tempUpdatePath)
49
-
50
- await ezSpawn.async(`giget stacks ${tempFolderName}`, { stdio: options.debug ? 'inherit' : 'ignore' }) // TODO: stdio should inherit when APP_DEBUG or debug flag is true
51
- consola.success('Downloaded framework updates.')
52
-
53
- consola.info('Updating framework...')
54
-
55
- const frameworkPath = resolve(process.cwd(), '.stacks')
56
- const exclude = ['functions/package.json', 'vue-components/package.json', 'web-components/package.json', 'auto-imports.d.ts', 'components.d.ts', 'dist']
57
-
58
- await deleteFiles(frameworkPath, exclude)
59
-
60
- // loop 5 times to make sure all "deep empty" folders are deleted
61
- for (let i = 0; i < 5; i++)
62
- await deleteEmptyFolders(frameworkPath)
63
-
64
- const from = resolve(process.cwd(), './updates/.stacks')
65
- const to = frameworkPath
66
- await copyFolder(from, to, exclude)
67
-
68
- consola.info('Cleanup...')
69
- await deleteFolder(tempUpdatePath)
70
- consola.success('Framework updated.')
71
- }
72
-
73
- // then, we need to update the project's & framework's dependencies, if updates available
74
- if (options.dependencies) {
75
- consola.info('Updating dependencies...')
76
- await runNpmScript(NpmScript.Update)
77
- consola.success('Updated dependencies.')
78
- }
79
-
80
- if (options.packageManager) {
81
- consola.info('Updating pnpm...')
82
- const version = await runNpmScript(NpmScript.UpdatePackageManager)
83
- consola.success('Successfully updated pnpm to: ', version)
84
- }
85
-
86
- // TODO: also update CI files & configurations, and other files, possibly
87
- // ideally we want this to be smart enough to update only the files that have changed
88
-
89
- // TODO: this script should trigger regeneration of auto-imports.d.ts & components.d.ts
90
- }
package/src/cli/build.ts DELETED
@@ -1,49 +0,0 @@
1
- import type { CAC } from 'cac'
2
- import { startBuildProcess } from './actions/build'
3
-
4
- async function build(stacks: CAC) {
5
- stacks
6
- .command('build', 'Automagically build any of your libraries/packages for production use. Select any of the following packages')
7
- .option('-c, --components', 'Build your component library')
8
- .option('-w, --web-components', 'Build your framework agnostic web component library') // these are automatically built with your -c option as well
9
- .option('-e, --elements', 'An alias to the -w flag')
10
- .option('-f, --functions', 'Build your function library')
11
- .option('-d, --docs', 'Build your documentation site')
12
- .option('--debug', 'Add additional debug logs', { default: false })
13
- // .option('-p, --pages', 'Build your pages')
14
- .action(async (options: any) => {
15
- await startBuildProcess(options)
16
- })
17
-
18
- stacks
19
- .command('build:components', 'Automagically build your component libraries for production use & npm/CDN distribution.')
20
- .action(async () => {
21
- await startBuildProcess('components')
22
- })
23
-
24
- stacks
25
- .command('build:functions', 'Automagically build your function library for production use & npm/CDN distribution.')
26
- .action(async () => {
27
- await startBuildProcess('functions')
28
- })
29
-
30
- stacks
31
- .command('build:web-components', 'Automagically build web component library for production use & npm/CDN distribution.')
32
- .action(async () => {
33
- await startBuildProcess('web-components')
34
- })
35
-
36
- stacks
37
- .command('build:docs', 'Automagically build your documentation site.')
38
- .action(async () => {
39
- await startBuildProcess('docs')
40
- })
41
-
42
- stacks
43
- .command('build:stacks', 'Build the core Stacks framework.')
44
- .action(async () => {
45
- await startBuildProcess('stacks')
46
- })
47
- }
48
-
49
- export { build }
package/src/cli/create.ts DELETED
@@ -1,71 +0,0 @@
1
- import type { CAC } from 'cac'
2
- import consola from 'consola'
3
- import * as ezSpawn from '@jsdevtools/ez-spawn'
4
- import { resolve } from 'pathe'
5
- import { bold, cyan, dim, link } from 'kolorist'
6
- import { useOnline } from '@vueuse/core'
7
- import { isFolder } from '@stacksjs/fs'
8
- import { ExitCode } from '@stacksjs/types'
9
- import { version } from '../../package.json'
10
- import { generate as generateAppKey } from './actions/key'
11
-
12
- async function create(stack: CAC) {
13
- stack
14
- .option('-n, --name <name>', 'Name of the stack')
15
- .option('-u, --ui', 'Are you building a UI?', { default: true }) // if no, disregard remainder of questions wrt UI
16
- .option('-c, --components', 'Are you building UI components?', { default: true }) // if no, -v and -w would be false
17
- .option('-w, --web-components', 'Automagically built optimized custom elements/web components?', { default: true })
18
- .option('-v, --vue', 'Automagically built a Vue component library?', { default: true })
19
- .option('-p, --pages', 'How about pages?', { default: true }) // pages need an HTTP server
20
- .option('-f, --functions', 'Are you developing functions/composables?', { default: true }) // if no, API would be false
21
- .option('-a, --api', 'Are you building an API?', { default: true }) // APIs need an HTTP server & assumes functions is true
22
- .option('-d, --database', 'Do you need a database?', { default: true })
23
- .option('--debug', 'Add additional debug logs', { default: false })
24
- // .option('--auth', 'Scaffold an authentication?', { default: true })
25
-
26
- stack
27
- .command('')
28
- .action(async (args: any) => {
29
- const name = stack.args[0] || args.name || '.'
30
- const path = resolve(process.cwd(), name)
31
-
32
- console.log()
33
- console.log(cyan(bold('Stacks CLI')) + dim(` v${version}`))
34
- console.log()
35
-
36
- if (await isFolder(path)) {
37
- consola.error(`Path ${path} already exists`)
38
- process.exit(ExitCode.FatalError)
39
- }
40
-
41
- const online = useOnline()
42
- if (!online) {
43
- consola.info('It appears you are disconnected from the internet. The Stacks setup requires a brief internet connection for setup.')
44
- process.exit(ExitCode.FatalError)
45
- }
46
-
47
- consola.info('Setting up your stack.')
48
- await ezSpawn.async(`giget stacks ${name}`, { stdio: args.debug ? 'inherit' : 'ignore' }) // todo: stdio should inherit when APP_DEBUG or debug flag is true
49
- consola.success(`Successfully scaffolded your project at ${cyan(path)}`)
50
-
51
- consola.info('Ensuring your environment is ready...')
52
- // todo: this should check for whether the proper Node version is installed because fnm is not a requirement
53
- await ezSpawn.async('fnm use', { stdio: args.debug ? 'inherit' : 'ignore', cwd: path }) // todo: stdio should inherit when APP_DEBUG or debug flag is true
54
- consola.success('Environment is ready.')
55
-
56
- consola.info('Installing & setting up Stacks.')
57
- await ezSpawn.async('pnpm install', { stdio: args.debug ? 'inherit' : 'ignore', cwd: path }) // todo: stdio should inherit when APP_DEBUG or debug flag is true
58
- await ezSpawn.async('cp .env.example .env', { stdio: args.debug ? 'inherit' : 'ignore', cwd: path }) // todo: stdio should inherit when APP_DEBUG or debug flag is true
59
- await generateAppKey()
60
- await ezSpawn.async('git init', { stdio: args.debug ? 'inherit' : 'ignore', cwd: path }) // todo: stdio should inherit when APP_DEBUG or debug flag is true
61
- consola.success('Installed & set-up 🚀')
62
-
63
- console.log()
64
- consola.info(bold('Welcome to the Stacks Framework! ⚛️'))
65
- console.log(`cd ${link(path, `vscode://file/${path}:1`)} && code .`)
66
- console.log()
67
- consola.log('To learn more, visit https://stacksjs.dev')
68
- })
69
- }
70
-
71
- export { create }
package/src/cli/dev.ts DELETED
@@ -1,28 +0,0 @@
1
- import type { CAC } from 'cac'
2
- import { startDevelopmentServer } from './actions/dev'
3
-
4
- async function dev(stacks: CAC) {
5
- stacks
6
- .command('dev', 'Start the development server for any of the following packages')
7
- .option('-c, --components', 'Start the Components development server')
8
- .option('-f, --functions', 'Start the Functions development server')
9
- .option('-d, --docs', 'Start the Documentation development server')
10
- // .option('-p, --pages', 'Start the Pages development server')
11
- .action(async (options: any) => {
12
- await startDevelopmentServer(options)
13
- })
14
-
15
- stacks
16
- .command('dev:components', 'Start the development server for your component library')
17
- .action(async () => {
18
- await startDevelopmentServer('components')
19
- })
20
-
21
- stacks
22
- .command('dev:docs', 'Start the development server for your documentation')
23
- .action(async () => {
24
- await startDevelopmentServer('docs')
25
- })
26
- }
27
-
28
- export { dev }
@@ -1,28 +0,0 @@
1
- import type { CAC } from 'cac'
2
- import { runExample } from './actions/examples'
3
-
4
- async function example(stacks: CAC) {
5
- stacks
6
- .command('example', 'Test your libraries against your built bundle.')
7
- .option('-c, --components', 'Test your Vue component library')
8
- .option('-v, --vue', 'Test your Vue component library')
9
- .option('-w, --web-components', 'Test your web component library')
10
- .action(async (options) => {
11
- await runExample(options)
12
- })
13
-
14
- stacks
15
- .command('example:vue', 'Test your Vue component library.')
16
- .alias('example:components')
17
- .action(async () => {
18
- await runExample('vue')
19
- })
20
-
21
- stacks
22
- .command('example:web-components', 'Test your Web Component library.')
23
- .action(async () => {
24
- await runExample('web-components')
25
- })
26
- }
27
-
28
- export { example }
@@ -1,64 +0,0 @@
1
- import type { CAC } from 'cac'
2
- import { generateComponentMeta, generateIdeHelpers, generateLibEntries, generateVsCodeCustomData, generateVueCompat, generateWebTypes, startGenerationProcess } from './actions/generate'
3
- import { generateTypes } from './actions/types'
4
-
5
- async function generate(stacks: CAC) {
6
- stacks
7
- .command('generate', 'Automagically build any of your libraries/packages for production use. Select any of the following packages')
8
- .option('-t, --types', 'Generate your TypeScript types')
9
- .option('-e, --entries', 'Generate your function & component library entry points')
10
- .option('-w, --web-types', 'Generate web-types.json for IDEs')
11
- .option('-c, --custom-data', 'Generate VS Code custom data (custom-elements.json) for IDEs')
12
- .option('-i, --ide-helpers', 'Generate IDE helpers')
13
- .option('-v, --vue-compatibility', 'Generate Vue 2 & 3 compatibility')
14
- .option('-c, --component-meta', 'Generate component meta information')
15
- .option('--debug', 'Add additional debug logs', { default: false })
16
- .action(async (options: any) => {
17
- await startGenerationProcess(options)
18
- })
19
-
20
- stacks
21
- .command('generate:types', 'Generate the types of & for your library/libraries')
22
- .action(async () => {
23
- await generateTypes()
24
- })
25
-
26
- stacks
27
- .command('generate:entries', 'Generate the entry points for your libraries')
28
- .action(async () => {
29
- // run the generate:entries command
30
- await generateLibEntries()
31
- })
32
-
33
- stacks
34
- .command('generate:vue-compatibility', 'Generate Vue 2 & 3 compatibility')
35
- .action(async () => {
36
- await generateVueCompat()
37
- })
38
-
39
- stacks
40
- .command('generate:web-types', 'Generate web-types.json for IDEs')
41
- .action(async () => {
42
- await generateWebTypes()
43
- })
44
-
45
- stacks
46
- .command('generate:vscode-custom-data', 'Generate VS Code custom data (custom-elements.json) for IDEs')
47
- .action(async () => {
48
- await generateVsCodeCustomData()
49
- })
50
-
51
- stacks
52
- .command('generate:ide-helpers', 'Generate IDE helpers')
53
- .action(async () => {
54
- await generateIdeHelpers()
55
- })
56
-
57
- stacks
58
- .command('generate:component-meta', 'Generate component meta information')
59
- .action(async () => {
60
- await generateComponentMeta()
61
- })
62
- }
63
-
64
- export { generate }
package/src/cli/index.ts DELETED
@@ -1,13 +0,0 @@
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
-
13
- export { dev, build, utility, make, example, test, create, update, generate, key, types }
package/src/cli/key.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { CAC } from 'cac'
2
- import { generate as generateAppKey } from './actions/key'
3
-
4
- async function key(stacks: CAC) {
5
- stacks
6
- .command('key:generate', 'Generate & set the application key.')
7
- .action(async () => {
8
- await generateAppKey()
9
- })
10
- }
11
-
12
- export { key }
package/src/cli/make.ts DELETED
@@ -1,47 +0,0 @@
1
- import type { CAC } from 'cac'
2
- import { component as makeComponent, fx as makeFunction, language as makeLanguage, page as makePage, stack as makeStack } from './actions/make'
3
-
4
- async function make(stacks: CAC) {
5
- stacks
6
- .command('make', 'Test your libraries against your built bundle.')
7
- .option('-c, --component', 'Scaffolds a component.')
8
- .option('-p, --page', 'Scaffolds a page.')
9
- .option('-f, --function', 'Scaffolds a function.')
10
- .option('-l, --language', 'Scaffolds a language.')
11
- .option('-s, --stack', 'Scaffolds a new stack.')
12
- .action(async (options) => {
13
- await runMake(stacks.args[0], options)
14
- })
15
-
16
- stacks
17
- .command('make:component', 'Scaffolds a component.')
18
- .action(async () => {
19
- await makeComponent(stacks.args[0])
20
- })
21
-
22
- stacks
23
- .command('make:page', 'Scaffolds a page.')
24
- .action(async () => {
25
- await makePage(stacks.args[0])
26
- })
27
-
28
- stacks
29
- .command('make:function', 'Scaffolds a function.')
30
- .action(async () => {
31
- await makeFunction(stacks.args[0])
32
- })
33
-
34
- stacks
35
- .command('make:lang', 'Scaffolds a language file.')
36
- .action(async () => {
37
- await makeLanguage(stacks.args[0])
38
- })
39
-
40
- stacks
41
- .command('make:stack', 'Scaffolds a new stack.')
42
- .action(async () => {
43
- await makeStack(stacks.args[0])
44
- })
45
- }
46
-
47
- export { make }
package/src/cli/test.ts DELETED
@@ -1,24 +0,0 @@
1
- import type { CAC } from 'cac'
2
- import { generateTestCoverageReport, runTestSuite, typecheck } from './actions/test'
3
-
4
- async function test(stacks: CAC) {
5
- stacks
6
- .command('test', 'Runs your test suite.')
7
- .action(async () => {
8
- await runTestSuite()
9
- })
10
-
11
- stacks
12
- .command('test:types', 'Typechecks your codebase.')
13
- .action(async () => {
14
- await typecheck()
15
- })
16
-
17
- stacks
18
- .command('test:coverage', 'Generates a test coverage report.')
19
- .action(async () => {
20
- await generateTestCoverageReport()
21
- })
22
- }
23
-
24
- export { test }
package/src/cli/types.ts DELETED
@@ -1,18 +0,0 @@
1
- import type { CAC } from 'cac'
2
- import { generateTypes } from './actions/types'
3
-
4
- async function types(stacks: CAC) {
5
- stacks
6
- .command('types:generate', 'Generate the types of & for your library/libraries')
7
- .action(async () => {
8
- await generateTypes()
9
- })
10
-
11
- stacks
12
- .command('types:fix', 'Generate the types of & for your library/libraries')
13
- .action(async () => {
14
- // await fixTypes()
15
- })
16
- }
17
-
18
- export { types }
package/src/cli/update.ts DELETED
@@ -1,17 +0,0 @@
1
- import type { CAC } from 'cac'
2
- import { stacks as updateStacks } from './actions/update'
3
-
4
- async function update(stacks: CAC) {
5
- stacks
6
- .command('update', 'Updates dependencies & framework.')
7
- .option('-c, --framework', 'Update the Stacks framework', { default: true })
8
- .option('-d, --dependencies', 'Update your dependencies', { default: true })
9
- .option('-p, --package-manager', 'Update your package manager, i.e. pnpm', { default: true })
10
- .option('-f, --force', 'Overwrite possible local updates with remote framework updates', { default: false })
11
- .option('--debug', 'Add additional debug logs', { default: false })
12
- .action(async (options: any) => {
13
- await updateStacks(options)
14
- })
15
- }
16
-
17
- export { update }