stacks 0.0.9 → 0.37.3

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 (219) hide show
  1. package/.gitignore +10 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +65 -104
  4. package/auto-imports.d.ts +826 -0
  5. package/bin/stacks.mjs +4 -0
  6. package/components.d.ts +22 -0
  7. package/core/actions/README.md +59 -0
  8. package/core/actions/node_modules/.bin/markdown-it +17 -0
  9. package/core/actions/node_modules/.bin/mkdist +17 -0
  10. package/core/actions/node_modules/.bin/tsc +17 -0
  11. package/core/actions/node_modules/.bin/tsserver +17 -0
  12. package/core/actions/package.json +64 -0
  13. package/core/actions/src/copy-types.ts +22 -0
  14. package/core/actions/src/generate/component-meta.ts +94 -0
  15. package/core/actions/src/generate/index.ts +4 -0
  16. package/core/actions/src/generate/lib-entries.ts +106 -0
  17. package/core/actions/src/generate/package-json.ts +87 -0
  18. package/core/actions/src/generate/vscode-custom-data.ts +28 -0
  19. package/core/actions/src/generate/vue-compat.ts +17 -0
  20. package/core/actions/src/generate-component-meta.ts +19 -0
  21. package/core/actions/src/generate-ide-helpers.ts +23 -0
  22. package/core/actions/src/generate-lib-entries.ts +22 -0
  23. package/core/actions/src/generate-package-json.ts +15 -0
  24. package/core/actions/src/generate-vscode-custom-data.ts +20 -0
  25. package/core/actions/src/generate-vue-compat.ts +10 -0
  26. package/core/arrays/README.md +59 -0
  27. package/core/arrays/node_modules/.bin/mkdist +17 -0
  28. package/core/arrays/node_modules/.bin/tsc +17 -0
  29. package/core/arrays/node_modules/.bin/tsserver +17 -0
  30. package/core/arrays/package.json +50 -0
  31. package/core/arrays/src/index.ts +3 -0
  32. package/core/build/README.md +59 -0
  33. package/core/build/entries/README.md +7 -0
  34. package/core/build/node_modules/.bin/acorn +17 -0
  35. package/core/build/node_modules/.bin/browserslist +17 -0
  36. package/core/build/node_modules/.bin/jiti +17 -0
  37. package/core/build/node_modules/.bin/mkdist +17 -0
  38. package/core/build/node_modules/.bin/rollup +17 -0
  39. package/core/build/node_modules/.bin/vite +17 -0
  40. package/core/build/node_modules/.bin/vite-ssg +17 -0
  41. package/core/build/node_modules/.bin/vue-docgen-web-types +17 -0
  42. package/core/build/package.json +71 -0
  43. package/core/build/src/example-vue.ts +26 -0
  44. package/core/build/src/example-wc.ts +26 -0
  45. package/core/build/src/functions.ts +56 -0
  46. package/core/build/src/index.ts +7 -0
  47. package/core/build/src/pages.ts +50 -0
  48. package/core/build/src/stacks.ts +204 -0
  49. package/core/build/src/vue-components.ts +76 -0
  50. package/core/build/src/web-components.ts +63 -0
  51. package/core/build/web-types.config.cjs +4 -0
  52. package/core/build/web-types.ts +14 -0
  53. package/core/collections/README.md +59 -0
  54. package/core/collections/node_modules/.bin/mkdist +17 -0
  55. package/core/collections/node_modules/.bin/tsc +17 -0
  56. package/core/collections/node_modules/.bin/tsserver +17 -0
  57. package/core/collections/package.json +54 -0
  58. package/core/collections/src/index.ts +1 -0
  59. package/core/fs/README.md +59 -0
  60. package/core/fs/node_modules/.bin/mkdist +17 -0
  61. package/core/fs/package.json +56 -0
  62. package/core/fs/src/index.ts +170 -0
  63. package/core/helpers/node_modules/.bin/mkdist +17 -0
  64. package/core/helpers/package.json +58 -0
  65. package/core/helpers/src/index.ts +129 -0
  66. package/core/modules/README.md +61 -0
  67. package/core/modules/node_modules/.bin/acorn +17 -0
  68. package/core/modules/node_modules/.bin/mkdist +17 -0
  69. package/core/modules/package.json +51 -0
  70. package/core/modules/src/i18n.ts +23 -0
  71. package/core/modules/src/nprogress.ts +12 -0
  72. package/core/modules/src/pwa.ts +12 -0
  73. package/core/objects/README.md +59 -0
  74. package/core/objects/node_modules/.bin/mkdist +17 -0
  75. package/core/objects/node_modules/.bin/tsc +17 -0
  76. package/core/objects/node_modules/.bin/tsserver +17 -0
  77. package/core/objects/package.json +51 -0
  78. package/core/objects/src/index.ts +1 -0
  79. package/core/paths/node_modules/.bin/mkdist +17 -0
  80. package/core/paths/node_modules/.bin/tsc +17 -0
  81. package/core/paths/node_modules/.bin/tsserver +17 -0
  82. package/core/paths/package.json +51 -0
  83. package/core/paths/src/index.ts +178 -0
  84. package/core/router/README.md +59 -0
  85. package/core/router/node_modules/.bin/mkdist +17 -0
  86. package/core/router/package.json +51 -0
  87. package/core/router/src/index.ts +14 -0
  88. package/core/security/README.md +59 -0
  89. package/core/security/node_modules/.bin/mkdist +17 -0
  90. package/core/security/package.json +56 -0
  91. package/core/security/src/crypt.ts +14 -0
  92. package/core/security/src/hash.ts +52 -0
  93. package/core/security/src/index.ts +3 -0
  94. package/core/security/src/key.ts +11 -0
  95. package/core/strings/README.md +59 -0
  96. package/core/strings/node_modules/.bin/mkdist +17 -0
  97. package/core/strings/node_modules/.bin/tsc +17 -0
  98. package/core/strings/node_modules/.bin/tsserver +17 -0
  99. package/core/strings/package.json +63 -0
  100. package/core/strings/src/index.ts +14 -0
  101. package/core/types/README.md +59 -0
  102. package/core/types/node_modules/.bin/markdown-it +17 -0
  103. package/core/types/node_modules/.bin/mkdist +17 -0
  104. package/core/types/node_modules/.bin/vite +17 -0
  105. package/core/types/node_modules/.bin/vitepress +17 -0
  106. package/core/types/package.json +60 -0
  107. package/core/types/src/app.ts +131 -0
  108. package/core/types/src/auto-imports.ts +3 -0
  109. package/core/types/src/build.ts +3 -0
  110. package/core/types/src/cli.ts +49 -0
  111. package/core/types/src/components.ts +66 -0
  112. package/core/types/src/deploy.ts +11 -0
  113. package/core/types/src/docs.ts +3 -0
  114. package/core/types/src/exit-code.ts +10 -0
  115. package/core/types/src/fs.ts +17 -0
  116. package/core/types/src/git.ts +131 -0
  117. package/core/types/src/hashing.ts +107 -0
  118. package/core/types/src/i18n.ts +19 -0
  119. package/core/types/src/index.ts +21 -0
  120. package/core/types/src/inspect.ts +10 -0
  121. package/core/types/src/layout.ts +8 -0
  122. package/core/types/src/library.ts +148 -0
  123. package/core/types/src/manifest.ts +9 -0
  124. package/core/types/src/markdown.ts +198 -0
  125. package/core/types/src/pages.ts +8 -0
  126. package/core/types/src/pwa.ts +8 -0
  127. package/core/types/src/ssg.ts +3 -0
  128. package/core/types/src/ui.ts +141 -0
  129. package/core/ui/README.md +60 -0
  130. package/core/ui/node_modules/.bin/mkdist +17 -0
  131. package/core/ui/node_modules/.bin/tsc +17 -0
  132. package/core/ui/node_modules/.bin/tsserver +17 -0
  133. package/core/ui/node_modules/.bin/vite +17 -0
  134. package/core/ui/node_modules/.bin/vue-tsc +17 -0
  135. package/core/ui/package.json +62 -0
  136. package/core/ui/src/index.ts +60 -0
  137. package/custom-elements.json +14 -0
  138. package/examples/vue-components/App.vue +12 -0
  139. package/examples/vue-components/favicon.png +0 -0
  140. package/examples/vue-components/index.html +20 -0
  141. package/examples/web-components/favicon.png +0 -0
  142. package/examples/web-components/index.html +13 -0
  143. package/functions/node_modules/.bin/artisan +17 -0
  144. package/functions/node_modules/.bin/stacks +17 -0
  145. package/functions/node_modules/.bin/stx +17 -0
  146. package/functions/package.json +40 -0
  147. package/netlify.toml +18 -0
  148. package/nitro.config.ts +6 -0
  149. package/package.json +224 -27
  150. package/pages/App.vue +26 -0
  151. package/pages/index.html +23 -0
  152. package/pages/main.ts +26 -0
  153. package/pages/public/_headers +3 -0
  154. package/pages/public/favicon-dark.svg +3 -0
  155. package/pages/public/favicon.svg +3 -0
  156. package/pages/public/pwa-192x192.png +0 -0
  157. package/pages/public/pwa-512x512.png +0 -0
  158. package/pages/public/safari-pinned-tab.svg +41 -0
  159. package/pages/styles/main.css +29 -0
  160. package/pages/styles/markdown.css +28 -0
  161. package/scripts/ensure-env.sh +248 -0
  162. package/shims.d.ts +29 -0
  163. package/simple-git-hooks.cjs +4 -0
  164. package/src/cli/actions/build.ts +160 -0
  165. package/src/cli/actions/commit.ts +9 -0
  166. package/src/cli/actions/dev.ts +47 -0
  167. package/src/cli/actions/examples.ts +74 -0
  168. package/src/cli/actions/fresh.ts +9 -0
  169. package/src/cli/actions/generate.ts +159 -0
  170. package/src/cli/actions/index.ts +12 -0
  171. package/src/cli/actions/key.ts +31 -0
  172. package/src/cli/actions/lint.ts +19 -0
  173. package/src/cli/actions/make.ts +116 -0
  174. package/src/cli/actions/release.ts +9 -0
  175. package/src/cli/actions/test.ts +39 -0
  176. package/src/cli/actions/types.ts +180 -0
  177. package/src/cli/actions/update.ts +90 -0
  178. package/src/cli/build.ts +49 -0
  179. package/src/cli/create.ts +71 -0
  180. package/src/cli/dev.ts +28 -0
  181. package/src/cli/example.ts +28 -0
  182. package/src/cli/generate.ts +64 -0
  183. package/src/cli/index.ts +13 -0
  184. package/src/cli/key.ts +12 -0
  185. package/src/cli/make.ts +47 -0
  186. package/src/cli/test.ts +24 -0
  187. package/src/cli/types.ts +18 -0
  188. package/src/cli/update.ts +17 -0
  189. package/src/cli/utility.ts +39 -0
  190. package/src/cli.ts +48 -0
  191. package/src/docs.ts +4 -0
  192. package/src/index.ts +22 -0
  193. package/tsconfig.json +96 -0
  194. package/vitest.config.ts +22 -0
  195. package/vue-components/dist/.gitkeep +0 -0
  196. package/vue-components/index.html +13 -0
  197. package/vue-components/main.ts +18 -0
  198. package/vue-components/node_modules/.bin/artisan +17 -0
  199. package/vue-components/node_modules/.bin/stacks +17 -0
  200. package/vue-components/node_modules/.bin/stx +17 -0
  201. package/vue-components/node_modules/.vite/deps/@vueuse_core.js +7847 -0
  202. package/vue-components/node_modules/.vite/deps/@vueuse_core.js.map +7 -0
  203. package/vue-components/node_modules/.vite/deps/_metadata.json +13 -0
  204. package/vue-components/node_modules/.vite/deps/package.json +1 -0
  205. package/vue-components/package.json +40 -0
  206. package/web-components/dist/.gitkeep +0 -0
  207. package/web-components/node_modules/.bin/artisan +17 -0
  208. package/web-components/node_modules/.bin/stacks +17 -0
  209. package/web-components/node_modules/.bin/stx +17 -0
  210. package/web-components/package.json +40 -0
  211. package/web-types.json +67 -0
  212. package/.npmignore +0 -1
  213. package/.travis.yml +0 -4
  214. package/examples/stringReverse.js +0 -41
  215. package/examples/sumServer.js +0 -21
  216. package/examples/sumWorker.js +0 -23
  217. package/index.js +0 -1
  218. package/lib/stacks.js +0 -398
  219. package/test/test.stacks.js +0 -148
@@ -0,0 +1,248 @@
1
+ #!/bin/bash
2
+ # many thanks to: https://raw.githubusercontent.com/Schniz/fnm/master/.ci/install.sh
3
+
4
+ set -e
5
+
6
+ # check if node is installed
7
+ if which node > /dev/null
8
+ then
9
+ # check if Node version is over 16.17 or else install it & enable corepack,
10
+ # if it is not >= 16.17, we will need to update by auto-detecting whether
11
+ # a node manager used
12
+ wip
13
+ else
14
+ if which fnm > /dev/null
15
+ then
16
+ # use fnm to install a specified Node version
17
+ echo 'testing here'
18
+ echo ${pwd}
19
+ fnm use
20
+ elif which nvm > /dev/null
21
+ # use nvm to install correct node version
22
+ cp .node-version .nvmrc
23
+ nvm use
24
+ fi
25
+ fi
26
+ else
27
+ # install node (abstract above into a function)
28
+
29
+ # check if fnm is installed, if it is, assume it's used
30
+ then
31
+ nvm use
32
+
33
+
34
+
35
+ # check if nvm is installed
36
+
37
+
38
+ INSTALL_DIR="$HOME/.fnm"
39
+ RELEASE="latest"
40
+ OS="$(uname -s)"
41
+
42
+
43
+
44
+ # Parse Flags
45
+ parse_args() {
46
+ while [[ $# -gt 0 ]]; do
47
+ key="$1"
48
+
49
+ case $key in
50
+ -d | --install-dir)
51
+ INSTALL_DIR="$2"
52
+ shift # past argument
53
+ shift # past value
54
+ ;;
55
+ -s | --skip-shell)
56
+ SKIP_SHELL="true"
57
+ shift # past argument
58
+ ;;
59
+ --force-install | --force-no-brew)
60
+ echo "\`--force-install\`: I hope you know what you're doing." >&2
61
+ FORCE_INSTALL="true"
62
+ shift
63
+ ;;
64
+ -r | --release)
65
+ RELEASE="$2"
66
+ shift # past release argument
67
+ shift # past release value
68
+ ;;
69
+ *)
70
+ echo "Unrecognized argument $key"
71
+ exit 1
72
+ ;;
73
+ esac
74
+ done
75
+ }
76
+
77
+ set_filename() {
78
+ if [ "$OS" = "Linux" ]; then
79
+ # Based on https://stackoverflow.com/a/45125525
80
+ case "$(uname -m)" in
81
+ arm | armv7*)
82
+ FILENAME="fnm-arm32"
83
+ ;;
84
+ aarch* | armv8*)
85
+ FILENAME="fnm-arm64"
86
+ ;;
87
+ *)
88
+ FILENAME="fnm-linux"
89
+ esac
90
+ elif [ "$OS" = "Darwin" ] && [ "$FORCE_INSTALL" = "true" ]; then
91
+ FILENAME="fnm-macos"
92
+ USE_HOMEBREW="false"
93
+ echo "Downloading the latest fnm binary from GitHub..."
94
+ echo " Pro tip: it's easier to use Homebrew for managing fnm in macOS."
95
+ echo " Remove the \`--force-no-brew\` so it will be easy to upgrade."
96
+ elif [ "$OS" = "Darwin" ]; then
97
+ USE_HOMEBREW="true"
98
+ echo "Downloading fnm using Homebrew..."
99
+ else
100
+ echo "OS $OS is not supported."
101
+ echo "If you think that's a bug - please file an issue to https://github.com/Schniz/fnm/issues"
102
+ exit 1
103
+ fi
104
+ }
105
+
106
+ download_fnm() {
107
+ if [ "$USE_HOMEBREW" = "true" ]; then
108
+ brew install fnm
109
+ else
110
+ if [ "$RELEASE" = "latest" ]; then
111
+ URL="https://github.com/Schniz/fnm/releases/latest/download/$FILENAME.zip"
112
+ else
113
+ URL="https://github.com/Schniz/fnm/releases/download/$RELEASE/$FILENAME.zip"
114
+ fi
115
+
116
+ DOWNLOAD_DIR=$(mktemp -d)
117
+
118
+ echo "Downloading $URL..."
119
+
120
+ mkdir -p "$INSTALL_DIR" &>/dev/null
121
+
122
+ if ! curl --progress-bar --fail -L "$URL" -o "$DOWNLOAD_DIR/$FILENAME.zip"; then
123
+ echo "Download failed. Check that the release/filename are correct."
124
+ exit 1
125
+ fi
126
+
127
+ unzip -q "$DOWNLOAD_DIR/$FILENAME.zip" -d "$DOWNLOAD_DIR"
128
+
129
+ if [ -f "$DOWNLOAD_DIR/fnm" ]; then
130
+ mv "$DOWNLOAD_DIR/fnm" "$INSTALL_DIR/fnm"
131
+ else
132
+ mv "$DOWNLOAD_DIR/$FILENAME/fnm" "$INSTALL_DIR/fnm"
133
+ fi
134
+
135
+ chmod u+x "$INSTALL_DIR/fnm"
136
+ fi
137
+ }
138
+
139
+ check_dependencies() {
140
+ echo "Checking dependencies for the installation script..."
141
+
142
+ echo -n "Checking availability of curl... "
143
+ if hash curl 2>/dev/null; then
144
+ echo "OK!"
145
+ else
146
+ echo "Missing!"
147
+ SHOULD_EXIT="true"
148
+ fi
149
+
150
+ echo -n "Checking availability of unzip... "
151
+ if hash unzip 2>/dev/null; then
152
+ echo "OK!"
153
+ else
154
+ echo "Missing!"
155
+ SHOULD_EXIT="true"
156
+ fi
157
+
158
+ if [ "$USE_HOMEBREW" = "true" ]; then
159
+ echo -n "Checking availability of Homebrew (brew)... "
160
+ if hash brew 2>/dev/null; then
161
+ echo "OK!"
162
+ else
163
+ echo "Missing!"
164
+ SHOULD_EXIT="true"
165
+ fi
166
+ fi
167
+
168
+ if [ "$SHOULD_EXIT" = "true" ]; then
169
+ echo "Not installing fnm due to missing dependencies."
170
+ exit 1
171
+ fi
172
+ }
173
+
174
+ ensure_containing_dir_exists() {
175
+ local CONTAINING_DIR
176
+ CONTAINING_DIR="$(dirname "$1")"
177
+ if [ ! -d "$CONTAINING_DIR" ]; then
178
+ echo " >> Creating directory $CONTAINING_DIR"
179
+ mkdir -p "$CONTAINING_DIR"
180
+ fi
181
+ }
182
+
183
+ setup_shell() {
184
+ CURRENT_SHELL="$(basename "$SHELL")"
185
+
186
+ if [ "$CURRENT_SHELL" = "zsh" ]; then
187
+ CONF_FILE=${ZDOTDIR:-$HOME}/.zshrc
188
+ ensure_containing_dir_exists "$CONF_FILE"
189
+ echo "Installing for Zsh. Appending the following to $CONF_FILE:"
190
+ echo ""
191
+ echo ' # fnm'
192
+ echo ' export PATH='"$INSTALL_DIR"':$PATH'
193
+ echo ' eval "`fnm env`"'
194
+
195
+ echo '' >>$CONF_FILE
196
+ echo '# fnm' >>$CONF_FILE
197
+ echo 'export PATH='$INSTALL_DIR':$PATH' >>$CONF_FILE
198
+ echo 'eval "`fnm env`"' >>$CONF_FILE
199
+
200
+ elif [ "$CURRENT_SHELL" = "fish" ]; then
201
+ CONF_FILE=$HOME/.config/fish/conf.d/fnm.fish
202
+ ensure_containing_dir_exists "$CONF_FILE"
203
+ echo "Installing for Fish. Appending the following to $CONF_FILE:"
204
+ echo ""
205
+ echo ' # fnm'
206
+ echo ' set PATH '"$INSTALL_DIR"' $PATH'
207
+ echo ' fnm env | source'
208
+
209
+ echo '# fnm' >>$CONF_FILE
210
+ echo 'set PATH '"$INSTALL_DIR"' $PATH' >>$CONF_FILE
211
+ echo 'fnm env | source' >>$CONF_FILE
212
+
213
+ elif [ "$CURRENT_SHELL" = "bash" ]; then
214
+ if [ "$OS" = "Darwin" ]; then
215
+ CONF_FILE=$HOME/.profile
216
+ else
217
+ CONF_FILE=$HOME/.bashrc
218
+ fi
219
+ ensure_containing_dir_exists "$CONF_FILE"
220
+ echo "Installing for Bash. Appending the following to $CONF_FILE:"
221
+ echo ""
222
+ echo ' # fnm'
223
+ echo ' export PATH='"$INSTALL_DIR"':$PATH'
224
+ echo ' eval "`fnm env`"'
225
+
226
+ echo '' >>$CONF_FILE
227
+ echo '# fnm' >>$CONF_FILE
228
+ echo 'export PATH='"$INSTALL_DIR"':$PATH' >>$CONF_FILE
229
+ echo 'eval "`fnm env`"' >>$CONF_FILE
230
+
231
+ else
232
+ echo "Could not infer shell type. Please set up manually."
233
+ exit 1
234
+ fi
235
+
236
+ echo ""
237
+ echo "In order to apply the changes, open a new terminal or run the following command:"
238
+ echo ""
239
+ echo " source $CONF_FILE"
240
+ }
241
+
242
+ parse_args "$@"
243
+ set_filename
244
+ check_dependencies
245
+ download_fnm
246
+ if [ "$SKIP_SHELL" != "true" ]; then
247
+ setup_shell
248
+ fi
package/shims.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ interface ImportMetaEnv {
2
+ readonly APP_NAME: string
3
+ readonly APP_ENV: string
4
+ readonly APP_KEY: string
5
+ readonly APP_URL: string
6
+ readonly APP_DEBUG: boolean
7
+ }
8
+
9
+ interface ImportMeta {
10
+ readonly env: ImportMetaEnv
11
+ }
12
+
13
+ declare interface Window {
14
+ // extend the window
15
+ }
16
+
17
+ // via `vite-plugin-vue-markdown`, markdown
18
+ // files can be treated as Vue components
19
+ declare module '*.md' {
20
+ import { type DefineComponent } from 'vue'
21
+ const component: DefineComponent<{}, {}, any>
22
+ export default component
23
+ }
24
+
25
+ declare module '*.vue' {
26
+ import { type DefineComponent } from 'vue'
27
+ const component: DefineComponent<{}, {}, any>
28
+ export default component
29
+ }
@@ -0,0 +1,4 @@
1
+ const jiti = require('jiti')(__filename)
2
+ const config = jiti('../config/git.ts')
3
+
4
+ module.exports = config.hooks
@@ -0,0 +1,160 @@
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'
7
+
8
+ const { prompts } = Prompts
9
+
10
+ export async function buildComponentLibraries() {
11
+ try {
12
+ await runNpmScript(NpmScript.GenerateEntries)
13
+ await buildVueComponentLibrary()
14
+ await buildWebComponentLibrary()
15
+ }
16
+ catch (error) {
17
+ consola.error('There was an error building your component libraries.')
18
+ consola.error(error)
19
+ }
20
+ }
21
+
22
+ export async function buildVueComponentLibrary() {
23
+ consola.info('Building your component library...')
24
+
25
+ if (hasComponents()) {
26
+ try {
27
+ await runNpmScript(NpmScript.BuildComponents)
28
+ consola.success('Your component library was built successfully.')
29
+ }
30
+ catch (error) {
31
+ consola.error('There was an error building your component library.')
32
+ consola.error(error)
33
+ }
34
+ }
35
+ else {
36
+ consola.info('No components found.')
37
+ }
38
+ }
39
+
40
+ export async function buildWebComponentLibrary() {
41
+ consola.info('Building your component library for production use & npm/CDN distribution...')
42
+
43
+ if (hasComponents()) {
44
+ try {
45
+ await runNpmScript(NpmScript.BuildWebComponents)
46
+ consola.success('Your Web Component library was built successfully.')
47
+ }
48
+ catch (error) {
49
+ consola.error('There was an error building your Web Component library.')
50
+ consola.error(error)
51
+ }
52
+ }
53
+ else {
54
+ consola.info('No components found.')
55
+ }
56
+ }
57
+
58
+ export async function buildDocs() {
59
+ consola.info('Building the Artisan CLI...')
60
+
61
+ try {
62
+ await runNpmScript(NpmScript.BuildDocs)
63
+ consola.success('Artisan CLI was built successfully.')
64
+ }
65
+ catch (error) {
66
+ consola.error('There was an error building the Artisan CLI.')
67
+ consola.error(error)
68
+ }
69
+ }
70
+
71
+ export async function buildStacks() {
72
+ consola.info('Building the Stacks Framework...')
73
+
74
+ try {
75
+ await runNpmScript(NpmScript.BuildStacks)
76
+ consola.success('Stacks was built successfully.')
77
+ }
78
+ catch (error) {
79
+ consola.error('There was an error building the Stacks framework.')
80
+ consola.error(error)
81
+ }
82
+ }
83
+
84
+ export async function buildFunctionsLibrary() {
85
+ consola.info('Building your functions library for production use & npm/CDN distribution...')
86
+
87
+ if (hasFunctions()) {
88
+ try {
89
+ await runNpmScript(NpmScript.BuildFunctions)
90
+ consola.success('Your functions library was built successfully.')
91
+ }
92
+ catch (error) {
93
+ consola.error('There was an error building your functions library.')
94
+ consola.error(error)
95
+ }
96
+ }
97
+ else {
98
+ consola.info('No functions found.')
99
+ }
100
+ }
101
+
102
+ export async function startBuildProcess(options: any) {
103
+ if (options.components || options === 'components') {
104
+ await buildComponentLibraries()
105
+ }
106
+
107
+ else if (options.webComponents || options.elements || options === 'web-components' || options === 'elements') {
108
+ await buildWebComponentLibrary()
109
+ }
110
+
111
+ else if (options.functions || options === 'functions') {
112
+ await buildFunctionsLibrary()
113
+ }
114
+
115
+ else if (options.docs || options === 'docs') {
116
+ await buildDocs()
117
+ }
118
+
119
+ else if (options.stacks || options === 'stacks') {
120
+ await buildStacks()
121
+ }
122
+
123
+ else if (options.npm || options === 'npm') {
124
+ await buildComponentLibraries()
125
+ await buildFunctionsLibrary()
126
+
127
+ consola.success('All your libraries and its types were built successfully to be distributed on npm.')
128
+ }
129
+
130
+ else {
131
+ const answer = await prompts.select({
132
+ type: 'select',
133
+ name: 'build',
134
+ message: 'Which stack are you trying to build for production use?',
135
+ choices: [ // todo: should be a multi-select
136
+ { title: 'Components', value: 'components' },
137
+ { title: 'Functions', value: 'functions' },
138
+ // { title: 'Pages', value: 'pages' },
139
+ { title: 'Docs', value: 'docs' },
140
+ ],
141
+ initial: 0,
142
+ })
143
+
144
+ // @ts-expect-error the answer object type expects to return a void type but it returns a string
145
+ if (answer === 'components')
146
+ await buildComponentLibraries()
147
+
148
+ // @ts-expect-error the answer object type expects to return a void type but it returns a string
149
+ if (answer === 'functions')
150
+ await buildFunctionsLibrary()
151
+
152
+ // @ts-expect-error the answer object type expects to return a void type but it returns a string
153
+ else if (answer === 'docs')
154
+ await buildDocs()
155
+
156
+ else process.exit(ExitCode.InvalidArgument)
157
+ }
158
+
159
+ await generateTypes()
160
+ }
@@ -0,0 +1,9 @@
1
+ import consola from 'consola'
2
+ import { runNpmScript } from '@stacksjs/helpers'
3
+ import { NpmScript } from '@stacksjs/types'
4
+
5
+ export async function commit() {
6
+ consola.info('Committing...')
7
+ await runNpmScript(NpmScript.Commit)
8
+ consola.success('Committed.')
9
+ }
@@ -0,0 +1,47 @@
1
+ import Prompts from 'prompts'
2
+ import consola from 'consola'
3
+ import { runNpmScript } from '@stacksjs/helpers'
4
+ import { ExitCode, NpmScript } from '@stacksjs/types'
5
+
6
+ const { prompts } = Prompts
7
+
8
+ export async function startDevelopmentServer(options: any) {
9
+ if (options.components || options === 'components') {
10
+ consola.info('Starting development server for your components...')
11
+ await runNpmScript(NpmScript.DevComponents)
12
+ }
13
+
14
+ else if (options.docs || options === 'docs') {
15
+ consola.info('Starting development server for your documentation...')
16
+ await runNpmScript(NpmScript.DevDocs)
17
+ }
18
+
19
+ else {
20
+ const answer = await prompts.select({
21
+ type: 'select',
22
+ name: 'development',
23
+ message: 'Which development server are you trying to start?',
24
+ choices: [
25
+ { title: 'Components', value: 'components' },
26
+ // { title: 'Functions', value: 'functions' },
27
+ // { title: 'Pages', value: 'pages' },
28
+ { title: 'Docs', value: 'docs' },
29
+ ],
30
+ initial: 0,
31
+ })
32
+
33
+ // @ts-expect-error the answer object type expects to return a void type but it returns a string
34
+ if (answer === 'components') {
35
+ consola.info('Starting development server for your components...')
36
+ await runNpmScript(NpmScript.DevComponents)
37
+ }
38
+
39
+ // @ts-expect-error the answer object type expects to return a void type but it returns a string
40
+ else if (answer === 'docs') {
41
+ consola.info('Starting docs server for your components...')
42
+ await runNpmScript(NpmScript.DevDocs)
43
+ }
44
+
45
+ else { process.exit(ExitCode.InvalidArgument) }
46
+ }
47
+ }
@@ -0,0 +1,74 @@
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
+
7
+ const { prompts } = Prompts
8
+
9
+ export async function testComponentExample() {
10
+ if (hasComponents()) {
11
+ try {
12
+ await runNpmScript(NpmScript.ExampleVue)
13
+ consola.success('Your component library was built successfully.')
14
+ }
15
+ catch (error) {
16
+ consola.error('There was an error building your component library.')
17
+ consola.error(error)
18
+ }
19
+ }
20
+ else {
21
+ consola.info('No components found.')
22
+ }
23
+ }
24
+
25
+ export async function testWebComponentExample() {
26
+ consola.info('Building your Web Component library...')
27
+
28
+ if (hasComponents()) {
29
+ try {
30
+ await runNpmScript(NpmScript.BuildWebComponents)
31
+ consola.success('Your Web Component library was built successfully.')
32
+ }
33
+ catch (error) {
34
+ consola.error('There was an error building your Web Component library.')
35
+ consola.error(error)
36
+ }
37
+ }
38
+ else {
39
+ consola.info('No components found.')
40
+ }
41
+ }
42
+
43
+ export async function runExample(options: any) {
44
+ if (options.components || options === 'components' || options === 'vue') {
45
+ await testComponentExample()
46
+ }
47
+
48
+ else if (options.webComponents || options.elements || options === 'web-components' || options === 'elements') {
49
+ await testWebComponentExample()
50
+ }
51
+
52
+ else {
53
+ const answer = await prompts.select({
54
+ type: 'select',
55
+ name: 'example',
56
+ message: 'Which example are you trying to view?',
57
+ choices: [
58
+ { title: 'Components', value: 'components' },
59
+ { title: 'Web Components', value: 'web-components' },
60
+ ],
61
+ initial: 0,
62
+ })
63
+
64
+ // @ts-expect-error the answer object type expects to return a void type but it returns a string
65
+ if (answer === 'components')
66
+ await testComponentExample()
67
+
68
+ // @ts-expect-error the answer object type expects to return a void type but it returns a string
69
+ if (answer === 'web-components')
70
+ await testWebComponentExample()
71
+
72
+ else process.exit(ExitCode.InvalidArgument)
73
+ }
74
+ }
@@ -0,0 +1,9 @@
1
+ import consola from 'consola'
2
+ import { runNpmScript } from '@stacksjs/helpers'
3
+ import { NpmScript } from '@stacksjs/types'
4
+
5
+ export async function reinstallNpmDependencies() {
6
+ consola.info('Reinstalling your npm dependencies...')
7
+ await runNpmScript(NpmScript.Fresh)
8
+ consola.success('Successfully reinstalled your npm dependencies.')
9
+ }