stacks 0.1.0 → 0.37.4

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 (208) hide show
  1. package/.gitignore +10 -0
  2. package/LICENSE.md +21 -0
  3. package/README.md +53 -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/package.json +64 -0
  11. package/core/actions/src/copy-types.ts +22 -0
  12. package/core/actions/src/generate/component-meta.ts +94 -0
  13. package/core/actions/src/generate/index.ts +4 -0
  14. package/core/actions/src/generate/lib-entries.ts +106 -0
  15. package/core/actions/src/generate/package-json.ts +87 -0
  16. package/core/actions/src/generate/vscode-custom-data.ts +28 -0
  17. package/core/actions/src/generate/vue-compat.ts +17 -0
  18. package/core/actions/src/generate-component-meta.ts +19 -0
  19. package/core/actions/src/generate-ide-helpers.ts +23 -0
  20. package/core/actions/src/generate-lib-entries.ts +22 -0
  21. package/core/actions/src/generate-package-json.ts +15 -0
  22. package/core/actions/src/generate-vscode-custom-data.ts +20 -0
  23. package/core/actions/src/generate-vue-compat.ts +10 -0
  24. package/core/arrays/README.md +59 -0
  25. package/core/arrays/node_modules/.bin/mkdist +17 -0
  26. package/core/arrays/node_modules/.bin/tsc +17 -0
  27. package/core/arrays/node_modules/.bin/tsserver +17 -0
  28. package/core/arrays/package.json +50 -0
  29. package/core/arrays/src/index.ts +3 -0
  30. package/core/build/README.md +59 -0
  31. package/core/build/entries/README.md +7 -0
  32. package/core/build/node_modules/.bin/jiti +17 -0
  33. package/core/build/node_modules/.bin/mkdist +17 -0
  34. package/core/build/node_modules/.bin/vite +17 -0
  35. package/core/build/node_modules/.bin/vite-ssg +17 -0
  36. package/core/build/node_modules/.bin/vue-docgen-web-types +17 -0
  37. package/core/build/package.json +71 -0
  38. package/core/build/src/example-vue.ts +26 -0
  39. package/core/build/src/example-wc.ts +26 -0
  40. package/core/build/src/functions.ts +56 -0
  41. package/core/build/src/index.ts +7 -0
  42. package/core/build/src/pages.ts +50 -0
  43. package/core/build/src/stacks.ts +204 -0
  44. package/core/build/src/vue-components.ts +76 -0
  45. package/core/build/src/web-components.ts +63 -0
  46. package/core/build/web-types.config.cjs +4 -0
  47. package/core/build/web-types.ts +14 -0
  48. package/core/collections/README.md +59 -0
  49. package/core/collections/node_modules/.bin/mkdist +17 -0
  50. package/core/collections/node_modules/.bin/tsc +17 -0
  51. package/core/collections/node_modules/.bin/tsserver +17 -0
  52. package/core/collections/package.json +54 -0
  53. package/core/collections/src/index.ts +1 -0
  54. package/core/fs/README.md +59 -0
  55. package/core/fs/node_modules/.bin/mkdist +17 -0
  56. package/core/fs/package.json +56 -0
  57. package/core/fs/src/index.ts +170 -0
  58. package/core/helpers/node_modules/.bin/mkdist +17 -0
  59. package/core/helpers/package.json +58 -0
  60. package/core/helpers/src/index.ts +129 -0
  61. package/core/modules/README.md +61 -0
  62. package/core/modules/node_modules/.bin/mkdist +17 -0
  63. package/core/modules/package.json +51 -0
  64. package/core/modules/src/i18n.ts +23 -0
  65. package/core/modules/src/nprogress.ts +12 -0
  66. package/core/modules/src/pwa.ts +12 -0
  67. package/core/objects/README.md +59 -0
  68. package/core/objects/node_modules/.bin/mkdist +17 -0
  69. package/core/objects/node_modules/.bin/tsc +17 -0
  70. package/core/objects/node_modules/.bin/tsserver +17 -0
  71. package/core/objects/package.json +51 -0
  72. package/core/objects/src/index.ts +1 -0
  73. package/core/paths/node_modules/.bin/mkdist +17 -0
  74. package/core/paths/node_modules/.bin/tsc +17 -0
  75. package/core/paths/node_modules/.bin/tsserver +17 -0
  76. package/core/paths/package.json +51 -0
  77. package/core/paths/src/index.ts +178 -0
  78. package/core/router/README.md +59 -0
  79. package/core/router/node_modules/.bin/mkdist +17 -0
  80. package/core/router/package.json +51 -0
  81. package/core/router/src/index.ts +14 -0
  82. package/core/security/README.md +59 -0
  83. package/core/security/node_modules/.bin/mkdist +17 -0
  84. package/core/security/package.json +56 -0
  85. package/core/security/src/crypt.ts +14 -0
  86. package/core/security/src/hash.ts +52 -0
  87. package/core/security/src/index.ts +3 -0
  88. package/core/security/src/key.ts +11 -0
  89. package/core/strings/README.md +59 -0
  90. package/core/strings/node_modules/.bin/mkdist +17 -0
  91. package/core/strings/node_modules/.bin/tsc +17 -0
  92. package/core/strings/node_modules/.bin/tsserver +17 -0
  93. package/core/strings/package.json +63 -0
  94. package/core/strings/src/index.ts +14 -0
  95. package/core/types/README.md +59 -0
  96. package/core/types/node_modules/.bin/markdown-it +17 -0
  97. package/core/types/node_modules/.bin/mkdist +17 -0
  98. package/core/types/node_modules/.bin/vite +17 -0
  99. package/core/types/node_modules/.bin/vitepress +17 -0
  100. package/core/types/package.json +60 -0
  101. package/core/types/src/app.ts +131 -0
  102. package/core/types/src/auto-imports.ts +3 -0
  103. package/core/types/src/build.ts +3 -0
  104. package/core/types/src/cli.ts +49 -0
  105. package/core/types/src/components.ts +66 -0
  106. package/core/types/src/deploy.ts +11 -0
  107. package/core/types/src/docs.ts +3 -0
  108. package/core/types/src/exit-code.ts +10 -0
  109. package/core/types/src/fs.ts +17 -0
  110. package/core/types/src/git.ts +131 -0
  111. package/core/types/src/hashing.ts +107 -0
  112. package/core/types/src/i18n.ts +19 -0
  113. package/core/types/src/index.ts +21 -0
  114. package/core/types/src/inspect.ts +10 -0
  115. package/core/types/src/layout.ts +8 -0
  116. package/core/types/src/library.ts +148 -0
  117. package/core/types/src/manifest.ts +9 -0
  118. package/core/types/src/markdown.ts +198 -0
  119. package/core/types/src/pages.ts +8 -0
  120. package/core/types/src/pwa.ts +8 -0
  121. package/core/types/src/ssg.ts +3 -0
  122. package/core/types/src/ui.ts +141 -0
  123. package/core/ui/README.md +60 -0
  124. package/core/ui/node_modules/.bin/mkdist +17 -0
  125. package/core/ui/node_modules/.bin/tsc +17 -0
  126. package/core/ui/node_modules/.bin/tsserver +17 -0
  127. package/core/ui/node_modules/.bin/vue-tsc +17 -0
  128. package/core/ui/package.json +62 -0
  129. package/core/ui/src/index.ts +60 -0
  130. package/custom-elements.json +14 -0
  131. package/examples/vue-components/App.vue +12 -0
  132. package/examples/vue-components/favicon.png +0 -0
  133. package/examples/vue-components/index.html +20 -0
  134. package/examples/web-components/favicon.png +0 -0
  135. package/examples/web-components/index.html +13 -0
  136. package/functions/node_modules/.bin/artisan +17 -0
  137. package/functions/node_modules/.bin/stacks +17 -0
  138. package/functions/node_modules/.bin/stx +17 -0
  139. package/functions/package.json +40 -0
  140. package/netlify.toml +18 -0
  141. package/nitro.config.ts +6 -0
  142. package/package.json +224 -27
  143. package/pages/App.vue +26 -0
  144. package/pages/index.html +23 -0
  145. package/pages/main.ts +26 -0
  146. package/pages/public/_headers +3 -0
  147. package/pages/public/favicon-dark.svg +3 -0
  148. package/pages/public/favicon.svg +3 -0
  149. package/pages/public/pwa-192x192.png +0 -0
  150. package/pages/public/pwa-512x512.png +0 -0
  151. package/pages/public/safari-pinned-tab.svg +41 -0
  152. package/pages/styles/main.css +29 -0
  153. package/pages/styles/markdown.css +28 -0
  154. package/scripts/ensure-env.sh +248 -0
  155. package/shims.d.ts +29 -0
  156. package/simple-git-hooks.cjs +4 -0
  157. package/src/cli/actions/build.ts +160 -0
  158. package/src/cli/actions/commit.ts +9 -0
  159. package/src/cli/actions/dev.ts +47 -0
  160. package/src/cli/actions/examples.ts +74 -0
  161. package/src/cli/actions/fresh.ts +9 -0
  162. package/src/cli/actions/generate.ts +159 -0
  163. package/src/cli/actions/index.ts +12 -0
  164. package/src/cli/actions/key.ts +31 -0
  165. package/src/cli/actions/lint.ts +19 -0
  166. package/src/cli/actions/make.ts +116 -0
  167. package/src/cli/actions/release.ts +9 -0
  168. package/src/cli/actions/test.ts +39 -0
  169. package/src/cli/actions/types.ts +180 -0
  170. package/src/cli/actions/update.ts +90 -0
  171. package/src/cli/build.ts +49 -0
  172. package/src/cli/create.ts +71 -0
  173. package/src/cli/dev.ts +28 -0
  174. package/src/cli/example.ts +28 -0
  175. package/src/cli/generate.ts +64 -0
  176. package/src/cli/index.ts +13 -0
  177. package/src/cli/key.ts +12 -0
  178. package/src/cli/make.ts +47 -0
  179. package/src/cli/test.ts +24 -0
  180. package/src/cli/types.ts +18 -0
  181. package/src/cli/update.ts +17 -0
  182. package/src/cli/utility.ts +39 -0
  183. package/src/cli.ts +48 -0
  184. package/src/docs.ts +4 -0
  185. package/src/index.ts +22 -0
  186. package/tsconfig.json +96 -0
  187. package/vitest.config.ts +22 -0
  188. package/vue-components/dist/.gitkeep +0 -0
  189. package/vue-components/index.html +13 -0
  190. package/vue-components/main.ts +18 -0
  191. package/vue-components/node_modules/.bin/artisan +17 -0
  192. package/vue-components/node_modules/.bin/stacks +17 -0
  193. package/vue-components/node_modules/.bin/stx +17 -0
  194. package/vue-components/package.json +40 -0
  195. package/web-components/dist/.gitkeep +0 -0
  196. package/web-components/node_modules/.bin/artisan +17 -0
  197. package/web-components/node_modules/.bin/stacks +17 -0
  198. package/web-components/node_modules/.bin/stx +17 -0
  199. package/web-components/package.json +40 -0
  200. package/web-types.json +67 -0
  201. package/.npmignore +0 -1
  202. package/.travis.yml +0 -4
  203. package/examples/stringReverse.js +0 -41
  204. package/examples/sumServer.js +0 -21
  205. package/examples/sumWorker.js +0 -23
  206. package/index.js +0 -1
  207. package/lib/stacks.js +0 -413
  208. package/test/test.stacks.js +0 -148
@@ -0,0 +1,49 @@
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 }
@@ -0,0 +1,71 @@
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 ADDED
@@ -0,0 +1,28 @@
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 }
@@ -0,0 +1,28 @@
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 }
@@ -0,0 +1,64 @@
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 }
@@ -0,0 +1,13 @@
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 ADDED
@@ -0,0 +1,12 @@
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 }
@@ -0,0 +1,47 @@
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 }
@@ -0,0 +1,24 @@
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 }
@@ -0,0 +1,18 @@
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 }
@@ -0,0 +1,17 @@
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 }
@@ -0,0 +1,39 @@
1
+ import type { CAC } from 'cac'
2
+ import { reinstallNpmDependencies } from './actions/fresh'
3
+ import { lint, lintFix } from './actions/lint'
4
+ import { release } from './actions/release'
5
+ import { commit } from './actions/commit'
6
+
7
+ async function utility(stacks: CAC) {
8
+ stacks
9
+ .command('fresh', 'Reinstalls your npm dependencies.')
10
+ .action(async () => {
11
+ await reinstallNpmDependencies()
12
+ })
13
+
14
+ stacks
15
+ .command('lint', 'Automagically lints your codebase.')
16
+ .action(async () => {
17
+ await lint()
18
+ })
19
+
20
+ stacks
21
+ .command('lint:fix', 'Automagically fixes lint errors.')
22
+ .action(async () => {
23
+ await lintFix()
24
+ })
25
+
26
+ stacks
27
+ .command('release', 'Releases a new version of your libraries/packages.')
28
+ .action(async () => {
29
+ await release()
30
+ })
31
+
32
+ stacks
33
+ .command('commit', 'Commit your stashed changes.')
34
+ .action(async () => {
35
+ await commit()
36
+ })
37
+ }
38
+
39
+ export { utility }
package/src/cli.ts ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ import cac from 'cac'
3
+ import { isProjectCreated } from '@stacksjs/helpers'
4
+ import { ExitCode } from '@stacksjs/types'
5
+ import { version } from '../package.json'
6
+ import { build, create, dev, example, generate, key, make, test, update, utility } from './cli/'
7
+
8
+ const cli = cac('stacks')
9
+
10
+ // setup global error handlers
11
+ process.on('uncaughtException', errorHandler)
12
+ process.on('unhandledRejection', errorHandler)
13
+
14
+ async function main() {
15
+ // before running any commands, check if the project is already initialized
16
+ await key(cli)
17
+
18
+ if (!await isProjectCreated()) {
19
+ await create(cli)
20
+ }
21
+ else {
22
+ await update(cli)
23
+ await generate(cli)
24
+ await dev(cli)
25
+ await build(cli)
26
+ await utility(cli)
27
+ await make(cli)
28
+ await example(cli)
29
+ await test(cli)
30
+ }
31
+
32
+ cli.help()
33
+ cli.version(version)
34
+
35
+ cli.parse()
36
+ }
37
+
38
+ main()
39
+
40
+ function errorHandler(error: Error): void {
41
+ let message = error.message || String(error)
42
+
43
+ if (process.env.DEBUG || process.env.NODE_ENV === 'development')
44
+ message = error.stack || message
45
+
46
+ console.error(message)
47
+ process.exit(ExitCode.FatalError)
48
+ }
package/src/docs.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { defineConfig } from 'vitepress'
2
+ import docs from 'config/docs'
3
+
4
+ export default defineConfig(docs)
package/src/index.ts ADDED
@@ -0,0 +1,22 @@
1
+ export * from '@stacksjs/ui'
2
+ export * from '@stacksjs/router'
3
+ export * from '@stacksjs/fs'
4
+ export * from '@stacksjs/arrays'
5
+ export * from '@stacksjs/strings'
6
+ export * from '@stacksjs/collections'
7
+ export * from '@stacksjs/paths'
8
+ export * from '@stacksjs/objects'
9
+ export * from '@stacksjs/build'
10
+ export * from '@stacksjs/actions/generate'
11
+ export * from '@stacksjs/types'
12
+
13
+ // utilities
14
+ export * from '../alias'
15
+ export * from '../config'
16
+ export * from '@stacksjs/helpers'
17
+ export * from '@stacksjs/strings'
18
+ export * from '@stacksjs/objects'
19
+ export * from '@stacksjs/paths'
20
+ export * from '@vueuse/core'
21
+ export * from '@vueuse/head'
22
+ export * from '@vueuse/shared'
package/tsconfig.json ADDED
@@ -0,0 +1,96 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "node",
6
+ "skipLibCheck": true,
7
+ "strict": true,
8
+ "jsx": "preserve",
9
+ "sourceMap": true,
10
+ "resolveJsonModule": true,
11
+ "importHelpers": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "allowJs": true,
14
+ "forceConsistentCasingInFileNames": true,
15
+ "esModuleInterop": true,
16
+ "noUnusedLocals": true,
17
+ "isolatedModules": true,
18
+ "strictNullChecks": true,
19
+ "baseUrl": ".",
20
+ "outDir": "./dist/types",
21
+ "lib": [
22
+ "ESNext",
23
+ "DOM"
24
+ ],
25
+ "types": [
26
+ "vitest",
27
+ "vite/client",
28
+ "vue/ref-macros",
29
+ "vite-plugin-pages/client",
30
+ "vite-plugin-vue-component-preview/client",
31
+ "vite-plugin-vue-layouts/client",
32
+ "vite-plugin-pwa/client"
33
+ ],
34
+ "paths": {
35
+ "~/*": ["../*"],
36
+ "@stacksjs/actions/*": ["./core/actions/src/*"],
37
+ "@stacksjs/actions/generate": ["./core/actions/src/generate/index.ts"],
38
+ "@stacksjs/alias": ["./alias.ts"],
39
+ "@stacksjs/alias/*": ["./core/alias/src/*"],
40
+ "@stacksjs/arrays/*": ["./core/arrays/src/*"],
41
+ "@stacksjs/arrays": ["./core/arrays/src/index.ts"],
42
+ "@stacksjs/build": ["./core/build/src/index.ts"],
43
+ "@stacksjs/build/*": ["./core/build/src/*"],
44
+ "@stacksjs/cli": ["./src/cli.ts"],
45
+ "@stacksjs/cli/*": ["./src/cli/*"],
46
+ "@stacksjs/collections": ["./core/collections/src/index.ts"],
47
+ "@stacksjs/collections/*": ["./core/collections/src/*"],
48
+ "@stacksjs/config": ["./config.ts"],
49
+ "@stacksjs/config/*": ["../config/*"],
50
+ "@stacksjs/fs": ["./core/fs/src/index.ts"],
51
+ "@stacksjs/fs/*": ["./core/fs/src/*"],
52
+ "@stacksjs/helpers": ["./core/helpers/src/index.ts"],
53
+ "@stacksjs/helpers/*": ["./core/helpers/src/*"],
54
+ "@stacksjs/modules/*": ["./core/modules/src/*"],
55
+ "@stacksjs/objects": ["./core/objects/src/index.ts"],
56
+ "@stacksjs/objects/*": ["./core/objects/src/*"],
57
+ "@stacksjs/paths": ["./core/paths/src/index.ts"],
58
+ "@stacksjs/paths/*": ["./core/paths/src/*"],
59
+ "@stacksjs/router": ["./core/router/src/index.ts"],
60
+ "@stacksjs/router/*": ["./core/router/src/*"],
61
+ "@stacksjs/security": ["./core/security/src/index.ts"],
62
+ "@stacksjs/security/*": ["./core/security/src/*"],
63
+ "@stacksjs/strings": ["./core/strings/src/index.ts"],
64
+ "@stacksjs/strings/*": ["./core/strings/src/*"],
65
+ "@stacksjs/types": ["./core/types/src/index.ts"],
66
+ "@stacksjs/types/*": ["./core/types/src/*"],
67
+ "@stacksjs/ui": ["./core/ui/src/index.ts"],
68
+ "@stacksjs/ui/*": ["./core/ui/src/*"],
69
+ "@stacksjs/utils": ["./core/utils/src/index.ts"],
70
+ "@stacksjs/utils/*": ["./core/utils/src/*"],
71
+ "stacks": ["./src/index.ts"],
72
+ "stacks/*": ["./src/*"],
73
+ "framework/*": ["./*"],
74
+ "functions/*": ["../functions/*"],
75
+ "config/*": ["../config/*"],
76
+ "components/*": ["../components/*"],
77
+ "pages/*": ["../pages/*"]
78
+ }
79
+ },
80
+ "include": [
81
+ "./**.d.ts",
82
+ "./**/*",
83
+ "../components/**/*",
84
+ "../functions/**/*",
85
+ "../pages/**/*"
86
+ ],
87
+ "exclude": [
88
+ "./nitro.config.ts",
89
+ "./vitest.config.ts",
90
+ "./examples/**",
91
+ "../commitlint.config.cjs",
92
+ "../**/README.md",
93
+ "../**/dist/**",
94
+ "../**/node_modules/**"
95
+ ]
96
+ }
@@ -0,0 +1,22 @@
1
+ import { defineConfig } from 'vitest/config'
2
+ import alias from './core/alias'
3
+
4
+ export default defineConfig({
5
+ root: '..',
6
+
7
+ optimizeDeps: {
8
+ entries: [],
9
+ },
10
+
11
+ resolve: {
12
+ alias,
13
+ },
14
+
15
+ test: {
16
+ globals: true,
17
+ coverage: {
18
+ provider: 'istanbul',
19
+ exclude: ['.stacks'],
20
+ },
21
+ },
22
+ })
File without changes
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" href=".github/art/logo.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Stacks Playground</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="./main.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,18 @@
1
+ import { createApp } from 'vue'
2
+ // import Previewer from 'virtual:vue-component-preview'
3
+ import Demo from '../../components/Demo.vue'
4
+
5
+ // prepare the messages object from the yaml language files
6
+ // const messages = Object.fromEntries(
7
+ // Object.entries(
8
+ // import.meta.glob<{ default: any }>('../../../lang/*.y(a)?ml', { eager: true }))
9
+ // .map(([key, value]) => {
10
+ // const yaml = key.endsWith('.yaml')
11
+ // return [key.slice(14, yaml ? -5 : -4), value.default]
12
+ // }),
13
+ // )
14
+
15
+ const app = createApp(Demo)
16
+
17
+ // app.use(Previewer)
18
+ app.mount('#app')