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.
- package/.gitignore +10 -0
- package/LICENSE.md +21 -0
- package/README.md +65 -104
- package/auto-imports.d.ts +826 -0
- package/bin/stacks.mjs +4 -0
- package/components.d.ts +22 -0
- package/core/actions/README.md +59 -0
- package/core/actions/node_modules/.bin/markdown-it +17 -0
- package/core/actions/node_modules/.bin/mkdist +17 -0
- package/core/actions/node_modules/.bin/tsc +17 -0
- package/core/actions/node_modules/.bin/tsserver +17 -0
- package/core/actions/package.json +64 -0
- package/core/actions/src/copy-types.ts +22 -0
- package/core/actions/src/generate/component-meta.ts +94 -0
- package/core/actions/src/generate/index.ts +4 -0
- package/core/actions/src/generate/lib-entries.ts +106 -0
- package/core/actions/src/generate/package-json.ts +87 -0
- package/core/actions/src/generate/vscode-custom-data.ts +28 -0
- package/core/actions/src/generate/vue-compat.ts +17 -0
- package/core/actions/src/generate-component-meta.ts +19 -0
- package/core/actions/src/generate-ide-helpers.ts +23 -0
- package/core/actions/src/generate-lib-entries.ts +22 -0
- package/core/actions/src/generate-package-json.ts +15 -0
- package/core/actions/src/generate-vscode-custom-data.ts +20 -0
- package/core/actions/src/generate-vue-compat.ts +10 -0
- package/core/arrays/README.md +59 -0
- package/core/arrays/node_modules/.bin/mkdist +17 -0
- package/core/arrays/node_modules/.bin/tsc +17 -0
- package/core/arrays/node_modules/.bin/tsserver +17 -0
- package/core/arrays/package.json +50 -0
- package/core/arrays/src/index.ts +3 -0
- package/core/build/README.md +59 -0
- package/core/build/entries/README.md +7 -0
- package/core/build/node_modules/.bin/acorn +17 -0
- package/core/build/node_modules/.bin/browserslist +17 -0
- package/core/build/node_modules/.bin/jiti +17 -0
- package/core/build/node_modules/.bin/mkdist +17 -0
- package/core/build/node_modules/.bin/rollup +17 -0
- package/core/build/node_modules/.bin/vite +17 -0
- package/core/build/node_modules/.bin/vite-ssg +17 -0
- package/core/build/node_modules/.bin/vue-docgen-web-types +17 -0
- package/core/build/package.json +71 -0
- package/core/build/src/example-vue.ts +26 -0
- package/core/build/src/example-wc.ts +26 -0
- package/core/build/src/functions.ts +56 -0
- package/core/build/src/index.ts +7 -0
- package/core/build/src/pages.ts +50 -0
- package/core/build/src/stacks.ts +204 -0
- package/core/build/src/vue-components.ts +76 -0
- package/core/build/src/web-components.ts +63 -0
- package/core/build/web-types.config.cjs +4 -0
- package/core/build/web-types.ts +14 -0
- package/core/collections/README.md +59 -0
- package/core/collections/node_modules/.bin/mkdist +17 -0
- package/core/collections/node_modules/.bin/tsc +17 -0
- package/core/collections/node_modules/.bin/tsserver +17 -0
- package/core/collections/package.json +54 -0
- package/core/collections/src/index.ts +1 -0
- package/core/fs/README.md +59 -0
- package/core/fs/node_modules/.bin/mkdist +17 -0
- package/core/fs/package.json +56 -0
- package/core/fs/src/index.ts +170 -0
- package/core/helpers/node_modules/.bin/mkdist +17 -0
- package/core/helpers/package.json +58 -0
- package/core/helpers/src/index.ts +129 -0
- package/core/modules/README.md +61 -0
- package/core/modules/node_modules/.bin/acorn +17 -0
- package/core/modules/node_modules/.bin/mkdist +17 -0
- package/core/modules/package.json +51 -0
- package/core/modules/src/i18n.ts +23 -0
- package/core/modules/src/nprogress.ts +12 -0
- package/core/modules/src/pwa.ts +12 -0
- package/core/objects/README.md +59 -0
- package/core/objects/node_modules/.bin/mkdist +17 -0
- package/core/objects/node_modules/.bin/tsc +17 -0
- package/core/objects/node_modules/.bin/tsserver +17 -0
- package/core/objects/package.json +51 -0
- package/core/objects/src/index.ts +1 -0
- package/core/paths/node_modules/.bin/mkdist +17 -0
- package/core/paths/node_modules/.bin/tsc +17 -0
- package/core/paths/node_modules/.bin/tsserver +17 -0
- package/core/paths/package.json +51 -0
- package/core/paths/src/index.ts +178 -0
- package/core/router/README.md +59 -0
- package/core/router/node_modules/.bin/mkdist +17 -0
- package/core/router/package.json +51 -0
- package/core/router/src/index.ts +14 -0
- package/core/security/README.md +59 -0
- package/core/security/node_modules/.bin/mkdist +17 -0
- package/core/security/package.json +56 -0
- package/core/security/src/crypt.ts +14 -0
- package/core/security/src/hash.ts +52 -0
- package/core/security/src/index.ts +3 -0
- package/core/security/src/key.ts +11 -0
- package/core/strings/README.md +59 -0
- package/core/strings/node_modules/.bin/mkdist +17 -0
- package/core/strings/node_modules/.bin/tsc +17 -0
- package/core/strings/node_modules/.bin/tsserver +17 -0
- package/core/strings/package.json +63 -0
- package/core/strings/src/index.ts +14 -0
- package/core/types/README.md +59 -0
- package/core/types/node_modules/.bin/markdown-it +17 -0
- package/core/types/node_modules/.bin/mkdist +17 -0
- package/core/types/node_modules/.bin/vite +17 -0
- package/core/types/node_modules/.bin/vitepress +17 -0
- package/core/types/package.json +60 -0
- package/core/types/src/app.ts +131 -0
- package/core/types/src/auto-imports.ts +3 -0
- package/core/types/src/build.ts +3 -0
- package/core/types/src/cli.ts +49 -0
- package/core/types/src/components.ts +66 -0
- package/core/types/src/deploy.ts +11 -0
- package/core/types/src/docs.ts +3 -0
- package/core/types/src/exit-code.ts +10 -0
- package/core/types/src/fs.ts +17 -0
- package/core/types/src/git.ts +131 -0
- package/core/types/src/hashing.ts +107 -0
- package/core/types/src/i18n.ts +19 -0
- package/core/types/src/index.ts +21 -0
- package/core/types/src/inspect.ts +10 -0
- package/core/types/src/layout.ts +8 -0
- package/core/types/src/library.ts +148 -0
- package/core/types/src/manifest.ts +9 -0
- package/core/types/src/markdown.ts +198 -0
- package/core/types/src/pages.ts +8 -0
- package/core/types/src/pwa.ts +8 -0
- package/core/types/src/ssg.ts +3 -0
- package/core/types/src/ui.ts +141 -0
- package/core/ui/README.md +60 -0
- package/core/ui/node_modules/.bin/mkdist +17 -0
- package/core/ui/node_modules/.bin/tsc +17 -0
- package/core/ui/node_modules/.bin/tsserver +17 -0
- package/core/ui/node_modules/.bin/vite +17 -0
- package/core/ui/node_modules/.bin/vue-tsc +17 -0
- package/core/ui/package.json +62 -0
- package/core/ui/src/index.ts +60 -0
- package/custom-elements.json +14 -0
- package/examples/vue-components/App.vue +12 -0
- package/examples/vue-components/favicon.png +0 -0
- package/examples/vue-components/index.html +20 -0
- package/examples/web-components/favicon.png +0 -0
- package/examples/web-components/index.html +13 -0
- package/functions/node_modules/.bin/artisan +17 -0
- package/functions/node_modules/.bin/stacks +17 -0
- package/functions/node_modules/.bin/stx +17 -0
- package/functions/package.json +40 -0
- package/netlify.toml +18 -0
- package/nitro.config.ts +6 -0
- package/package.json +224 -27
- package/pages/App.vue +26 -0
- package/pages/index.html +23 -0
- package/pages/main.ts +26 -0
- package/pages/public/_headers +3 -0
- package/pages/public/favicon-dark.svg +3 -0
- package/pages/public/favicon.svg +3 -0
- package/pages/public/pwa-192x192.png +0 -0
- package/pages/public/pwa-512x512.png +0 -0
- package/pages/public/safari-pinned-tab.svg +41 -0
- package/pages/styles/main.css +29 -0
- package/pages/styles/markdown.css +28 -0
- package/scripts/ensure-env.sh +248 -0
- package/shims.d.ts +29 -0
- package/simple-git-hooks.cjs +4 -0
- package/src/cli/actions/build.ts +160 -0
- package/src/cli/actions/commit.ts +9 -0
- package/src/cli/actions/dev.ts +47 -0
- package/src/cli/actions/examples.ts +74 -0
- package/src/cli/actions/fresh.ts +9 -0
- package/src/cli/actions/generate.ts +159 -0
- package/src/cli/actions/index.ts +12 -0
- package/src/cli/actions/key.ts +31 -0
- package/src/cli/actions/lint.ts +19 -0
- package/src/cli/actions/make.ts +116 -0
- package/src/cli/actions/release.ts +9 -0
- package/src/cli/actions/test.ts +39 -0
- package/src/cli/actions/types.ts +180 -0
- package/src/cli/actions/update.ts +90 -0
- package/src/cli/build.ts +49 -0
- package/src/cli/create.ts +71 -0
- package/src/cli/dev.ts +28 -0
- package/src/cli/example.ts +28 -0
- package/src/cli/generate.ts +64 -0
- package/src/cli/index.ts +13 -0
- package/src/cli/key.ts +12 -0
- package/src/cli/make.ts +47 -0
- package/src/cli/test.ts +24 -0
- package/src/cli/types.ts +18 -0
- package/src/cli/update.ts +17 -0
- package/src/cli/utility.ts +39 -0
- package/src/cli.ts +48 -0
- package/src/docs.ts +4 -0
- package/src/index.ts +22 -0
- package/tsconfig.json +96 -0
- package/vitest.config.ts +22 -0
- package/vue-components/dist/.gitkeep +0 -0
- package/vue-components/index.html +13 -0
- package/vue-components/main.ts +18 -0
- package/vue-components/node_modules/.bin/artisan +17 -0
- package/vue-components/node_modules/.bin/stacks +17 -0
- package/vue-components/node_modules/.bin/stx +17 -0
- package/vue-components/node_modules/.vite/deps/@vueuse_core.js +7847 -0
- package/vue-components/node_modules/.vite/deps/@vueuse_core.js.map +7 -0
- package/vue-components/node_modules/.vite/deps/_metadata.json +13 -0
- package/vue-components/node_modules/.vite/deps/package.json +1 -0
- package/vue-components/package.json +40 -0
- package/web-components/dist/.gitkeep +0 -0
- package/web-components/node_modules/.bin/artisan +17 -0
- package/web-components/node_modules/.bin/stacks +17 -0
- package/web-components/node_modules/.bin/stx +17 -0
- package/web-components/package.json +40 -0
- package/web-types.json +67 -0
- package/.npmignore +0 -1
- package/.travis.yml +0 -4
- package/examples/stringReverse.js +0 -41
- package/examples/sumServer.js +0 -21
- package/examples/sumWorker.js +0 -23
- package/index.js +0 -1
- package/lib/stacks.js +0 -398
- package/test/test.stacks.js +0 -148
package/bin/stacks.mjs
ADDED
package/components.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// generated by unplugin-vue-components
|
|
2
|
+
// We suggest you to commit this file into source control
|
|
3
|
+
// Read more: https://github.com/vuejs/core/pull/3399
|
|
4
|
+
import '@vue/runtime-core'
|
|
5
|
+
|
|
6
|
+
export {}
|
|
7
|
+
|
|
8
|
+
declare module '@vue/runtime-core' {
|
|
9
|
+
export interface GlobalComponents {
|
|
10
|
+
404: typeof import('./../pages/layouts/404.vue')['default']
|
|
11
|
+
Counter: typeof import('./../components/Buttons/Counter.vue')['default']
|
|
12
|
+
Default: typeof import('./../pages/layouts/default.vue')['default']
|
|
13
|
+
Demo: typeof import('./../components/Demo.vue')['default']
|
|
14
|
+
HelloWorld: typeof import('./../components/HelloWorld.vue')['default']
|
|
15
|
+
Home: typeof import('./../pages/layouts/home.vue')['default']
|
|
16
|
+
Logo: typeof import('./../components/Logo.vue')['default']
|
|
17
|
+
README: typeof import('./../components/README.md')['default']
|
|
18
|
+
RouterLink: typeof import('vue-router')['RouterLink']
|
|
19
|
+
RouterView: typeof import('vue-router')['RouterView']
|
|
20
|
+
ToggleDark: typeof import('./../components/Buttons/ToggleDark.vue')['default']
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Stacks Actions
|
|
2
|
+
|
|
3
|
+
This package contains the Stacks Actions.
|
|
4
|
+
|
|
5
|
+
## ☘️ Features
|
|
6
|
+
|
|
7
|
+
wip
|
|
8
|
+
|
|
9
|
+
- ⚡️
|
|
10
|
+
|
|
11
|
+
wip
|
|
12
|
+
|
|
13
|
+
## 🤖 Usage
|
|
14
|
+
|
|
15
|
+
wip
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm i -D @stacksjs/actions
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Now, you can use it in your project:
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import * as invoke from '@stacksjs/actions/generate'
|
|
25
|
+
|
|
26
|
+
// wip
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Learn more in the docs.
|
|
30
|
+
|
|
31
|
+
## 🧪 Testing
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm test
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 📈 Changelog
|
|
38
|
+
|
|
39
|
+
Please see our [releases](https://github.com/stacksjs/stacksjs/releases) page for more information on what has changed recently.
|
|
40
|
+
|
|
41
|
+
## 💪🏼 Contributing
|
|
42
|
+
|
|
43
|
+
Please see [CONTRIBUTING](../../.github/CONTRIBUTING.md) for details.
|
|
44
|
+
|
|
45
|
+
## 🏝 Community
|
|
46
|
+
|
|
47
|
+
For help, discussion about best practices, or any other conversation that would benefit from being searchable:
|
|
48
|
+
|
|
49
|
+
[Discussions on GitHub](https://github.com/stacksjs/stacks/discussions)
|
|
50
|
+
|
|
51
|
+
For casual chit-chat with others using this package:
|
|
52
|
+
|
|
53
|
+
[Join the Open Web Discord Server](https://discord.ow3.org)
|
|
54
|
+
|
|
55
|
+
## 📄 License
|
|
56
|
+
|
|
57
|
+
The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
|
|
58
|
+
|
|
59
|
+
Made with ❤️
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="$NODE_PATH:/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/markdown-it@13.0.1/node_modules/markdown-it/bin/markdown-it.js" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/markdown-it@13.0.1/node_modules/markdown-it/bin/markdown-it.js" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="$NODE_PATH:/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/mkdist@0.3.13_typescript@4.8.4/node_modules/mkdist/dist/cli.cjs" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/mkdist@0.3.13_typescript@4.8.4/node_modules/mkdist/dist/cli.cjs" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="$NODE_PATH:/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/bin/tsc" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/bin/tsc" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
3
|
+
|
|
4
|
+
case `uname` in
|
|
5
|
+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
6
|
+
esac
|
|
7
|
+
|
|
8
|
+
if [ -z "$NODE_PATH" ]; then
|
|
9
|
+
export NODE_PATH="/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
10
|
+
else
|
|
11
|
+
export NODE_PATH="$NODE_PATH:/Users/chrisbreuer/Code/stacks/node_modules/.pnpm/node_modules"
|
|
12
|
+
fi
|
|
13
|
+
if [ -x "$basedir/node" ]; then
|
|
14
|
+
exec "$basedir/node" "$basedir/../../../../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/bin/tsserver" "$@"
|
|
15
|
+
else
|
|
16
|
+
exec node "$basedir/../../../../../node_modules/.pnpm/typescript@4.8.4/node_modules/typescript/bin/tsserver" "$@"
|
|
17
|
+
fi
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stacksjs/actions",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.37.3",
|
|
5
|
+
"packageManager": "pnpm@7.13.6",
|
|
6
|
+
"description": "The Stacks actions.",
|
|
7
|
+
"author": "Chris Breuer",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
10
|
+
"homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/actions#readme",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/stacksjs/stacks.git",
|
|
14
|
+
"directory": "./.stacks/core/actions"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/stacksjs/stacks/issues"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"actions",
|
|
21
|
+
"stacks",
|
|
22
|
+
"framework",
|
|
23
|
+
"typescript",
|
|
24
|
+
"javascript",
|
|
25
|
+
"vite",
|
|
26
|
+
"nitro",
|
|
27
|
+
"vue",
|
|
28
|
+
"components",
|
|
29
|
+
"library"
|
|
30
|
+
],
|
|
31
|
+
"contributors": [
|
|
32
|
+
"Chris Breuer <chris@ow3.org>"
|
|
33
|
+
],
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=v18.10.0",
|
|
39
|
+
"pnpm": ">=7.13.6"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "mkdist -d",
|
|
43
|
+
"dev": "mkdist -d",
|
|
44
|
+
"prepublishOnly": "pnpm run build",
|
|
45
|
+
"typecheck": "tsc --noEmit"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@stacksjs/fs": "workspace:*",
|
|
49
|
+
"@stacksjs/helpers": "workspace:*",
|
|
50
|
+
"@stacksjs/paths": "workspace:*",
|
|
51
|
+
"@stacksjs/strings": "workspace:*",
|
|
52
|
+
"@stacksjs/types": "workspace:*",
|
|
53
|
+
"@types/fs-extra": "^9.0.13",
|
|
54
|
+
"@vueuse/core": "^9.3.1",
|
|
55
|
+
"consola": "^2.15.3",
|
|
56
|
+
"fast-glob": "^3.2.12",
|
|
57
|
+
"fs-extra": "^10.1.0",
|
|
58
|
+
"markdown-it": "^13.0.1",
|
|
59
|
+
"vue-component-meta": "^1.0.8"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"mkdist": "^0.3.13"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This action copies all the generated types.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { frameworkPath } from '@stacksjs/paths'
|
|
8
|
+
import { copyFolder } from '@stacksjs/fs'
|
|
9
|
+
|
|
10
|
+
// relative to scripts directory
|
|
11
|
+
const destinations = [
|
|
12
|
+
[frameworkPath('dist/types/components'), frameworkPath('vue-components/dist/types')],
|
|
13
|
+
[frameworkPath('dist/types/components'), frameworkPath('web-components/dist/types')],
|
|
14
|
+
[frameworkPath('dist/types/functions'), frameworkPath('functions/dist/types')],
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
destinations.forEach(([src, dest]) => {
|
|
18
|
+
// const srcPath = resolve(__filename, '..', src)
|
|
19
|
+
// const destPath = resolve(__filename, '..', dest)
|
|
20
|
+
|
|
21
|
+
copyFolder(src, dest)
|
|
22
|
+
})
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import fg from 'fast-glob'
|
|
3
|
+
import MarkdownIt from 'markdown-it'
|
|
4
|
+
import { type ComponentMeta, type MetaCheckerOptions, createComponentMetaChecker } from 'vue-component-meta'
|
|
5
|
+
import { frameworkPath, join, parse, projectPath } from '@stacksjs/paths'
|
|
6
|
+
|
|
7
|
+
const md = new MarkdownIt()
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* ℹ️ Useful links
|
|
11
|
+
*
|
|
12
|
+
* vue-component-meta tests: https://github.com/johnsoncodehk/volar/blob/master/vue-language-tools/vue-component-meta/tests/index.spec.ts
|
|
13
|
+
* Discord thread about improving vue-component-meta: https://discord.com/channels/793943652350427136/1027819645677350912
|
|
14
|
+
* GitHub issue for improving vue-component-meta based on runtime/dynamic props: https://github.com/johnsoncodehk/volar/issues/1854
|
|
15
|
+
* Discord chat: https://discord.com/channels/793943652350427136/1027819645677350912
|
|
16
|
+
* original script: https://raw.githubusercontent.com/jd-solanki/anu/main/scripts/gen-component-meta.ts
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export interface ComponentApiProps {
|
|
20
|
+
name: ComponentMeta['props'][number]['name']
|
|
21
|
+
description: ComponentMeta['props'][number]['description']
|
|
22
|
+
|
|
23
|
+
// required: ComponentMeta['props'][number]['required']
|
|
24
|
+
type: ComponentMeta['props'][number]['type']
|
|
25
|
+
default: ComponentMeta['props'][number]['default']
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ComponentApi {
|
|
29
|
+
props: ComponentApiProps[]
|
|
30
|
+
events: ComponentMeta['events']
|
|
31
|
+
slots: ComponentMeta['slots']
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function generateComponentMeta() {
|
|
35
|
+
const checkerOptions: MetaCheckerOptions = {
|
|
36
|
+
forceUseTs: true,
|
|
37
|
+
schema: { ignore: ['MyIgnoredNestedProps'] },
|
|
38
|
+
printer: { newLine: 1 },
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const tsconfigChecker = createComponentMetaChecker(
|
|
42
|
+
projectPath('tsconfig.json'),
|
|
43
|
+
checkerOptions,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
const filterMeta = (meta: ComponentMeta): ComponentApi => {
|
|
47
|
+
// const clonedMeta: ComponentMeta = JSON.parse(JSON.stringify(meta))
|
|
48
|
+
|
|
49
|
+
// Exclude global props
|
|
50
|
+
const props: ComponentApiProps[] = []
|
|
51
|
+
meta.props.forEach((prop: any) => {
|
|
52
|
+
if (prop.global)
|
|
53
|
+
return
|
|
54
|
+
|
|
55
|
+
const { name, description, required, type, default: defaultValue } = prop
|
|
56
|
+
|
|
57
|
+
props.push({
|
|
58
|
+
name: `${name}${required ? '' : '?'}`,
|
|
59
|
+
description: md.render(description),
|
|
60
|
+
|
|
61
|
+
// required,
|
|
62
|
+
|
|
63
|
+
type,
|
|
64
|
+
default: defaultValue || 'unknown',
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
props,
|
|
70
|
+
events: meta.events,
|
|
71
|
+
slots: meta.slots,
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const components = fg.sync(['components/*.vue', 'components/**/*.vue'], {
|
|
76
|
+
cwd: projectPath(),
|
|
77
|
+
absolute: true,
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
components.forEach((componentPath) => {
|
|
81
|
+
// Thanks: https://futurestud.io/tutorials/node-js-get-a-file-name-with-or-without-extension
|
|
82
|
+
const componentExportName = parse(componentPath).name
|
|
83
|
+
const meta = filterMeta(tsconfigChecker.getComponentMeta(componentPath, componentExportName))
|
|
84
|
+
|
|
85
|
+
const metaDirPath = frameworkPath('component-meta')
|
|
86
|
+
|
|
87
|
+
// if meta dir doesn't exist create
|
|
88
|
+
if (!existsSync(metaDirPath))
|
|
89
|
+
mkdirSync(metaDirPath)
|
|
90
|
+
|
|
91
|
+
const metaJsonFilePath = join(metaDirPath, `${componentExportName}.json`)
|
|
92
|
+
writeFileSync(metaJsonFilePath, JSON.stringify(meta, null, 4))
|
|
93
|
+
})
|
|
94
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import consola from 'consola'
|
|
2
|
+
import { kebabCase } from '@stacksjs/strings'
|
|
3
|
+
import { libraryEntryPath } from '@stacksjs/paths'
|
|
4
|
+
import { writeTextFile } from '@stacksjs/fs'
|
|
5
|
+
import { determineResetPreset } from '@stacksjs/helpers'
|
|
6
|
+
import { ExitCode } from '@stacksjs/types'
|
|
7
|
+
import { library } from '../../../../config'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Based on the config values, this method
|
|
11
|
+
* will generate the library entry points.
|
|
12
|
+
*
|
|
13
|
+
* @param type string
|
|
14
|
+
*/
|
|
15
|
+
export async function generateLibEntry(type: 'vue-components' | 'web-components' | 'functions') {
|
|
16
|
+
if (type === 'vue-components')
|
|
17
|
+
consola.info('Creating the Vue component library entry point...')
|
|
18
|
+
else if (type === 'web-components')
|
|
19
|
+
consola.info('Creating the Web Component library entry point...')
|
|
20
|
+
else
|
|
21
|
+
consola.info('Creating the function library entry point...')
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
await writeTextFile({
|
|
25
|
+
path: libraryEntryPath(type),
|
|
26
|
+
data: generateEntryPointData(type),
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
if (type === 'vue-components')
|
|
30
|
+
consola.success('Created the Vue component library entry point.')
|
|
31
|
+
else if (type === 'web-components')
|
|
32
|
+
consola.success('Created the Web Component library entry point.')
|
|
33
|
+
else
|
|
34
|
+
consola.success('Created the function library entry point.')
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
consola.error(err)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function generateEntryPointData(type: 'vue-components' | 'web-components' | 'functions'): string {
|
|
42
|
+
let arr = []
|
|
43
|
+
|
|
44
|
+
if (type === 'functions') {
|
|
45
|
+
if (!library.functions.functions) {
|
|
46
|
+
consola.error('There are no functions defined to be built. Please check your config/library.ts file for potential adjustments.')
|
|
47
|
+
process.exit(ExitCode.FatalError)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
for (const fx of library.functions.functions) {
|
|
51
|
+
if (Array.isArray(fx))
|
|
52
|
+
arr.push(`export * as ${fx[1]} from '../../../functions/${fx[0]}'`)
|
|
53
|
+
else
|
|
54
|
+
arr.push(`export * from '../../../functions/${fx}'`)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// join the array into a string with each element being on a new line
|
|
58
|
+
return arr.join('\r\n')
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (type === 'vue-components') {
|
|
62
|
+
if (!library.vueComponents.tags) {
|
|
63
|
+
consola.error('There are no components defined to be built. Please check your config/library.ts file for potential adjustments.')
|
|
64
|
+
process.exit(ExitCode.FatalError)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
arr = determineResetPreset()
|
|
68
|
+
|
|
69
|
+
for (const component of library.vueComponents.tags.map(tag => tag.name)) {
|
|
70
|
+
if (Array.isArray(component))
|
|
71
|
+
arr.push(`export { default as ${component[1]} } from '../../../components/${component[0]}.vue'`)
|
|
72
|
+
else
|
|
73
|
+
arr.push(`export { default as ${component} } from '../../../components/${component}.vue'`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// join the array into a string with each element being on a new line
|
|
77
|
+
return arr.join('\r\n')
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// at this point, we know it is a Web Component we are building
|
|
81
|
+
arr = determineResetPreset()
|
|
82
|
+
const imports = [...arr, 'import { defineCustomElement } from \'vue\'']
|
|
83
|
+
const declarations = []
|
|
84
|
+
const definitions = []
|
|
85
|
+
|
|
86
|
+
if (!library.webComponents.tags) {
|
|
87
|
+
consola.error('There are no components defined to be built. Please check your config/library.ts file for potential adjustments.')
|
|
88
|
+
process.exit(ExitCode.FatalError)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
for (const component of library.webComponents.tags.map(tag => tag.name)) {
|
|
92
|
+
if (Array.isArray(component)) {
|
|
93
|
+
imports.push(`import ${component[1]} from '../../../components/${component[0]}.vue'`)
|
|
94
|
+
declarations.push(`const ${component[1]}CustomElement = defineCustomElement(${component[1]})`)
|
|
95
|
+
definitions.push(`customElements.define('${kebabCase(component[1])}', ${component[1]}CustomElement)`)
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
imports.push(`import ${component} from '../../../components/${component}.vue'`)
|
|
99
|
+
declarations.push(`const ${component}CustomElement = defineCustomElement(${component})`)
|
|
100
|
+
definitions.push(`customElements.define('${kebabCase(component)}', ${component}CustomElement)`)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// join the array into a string with each element being on a new line
|
|
105
|
+
return [...imports, ...declarations, ...definitions].join('\r\n')
|
|
106
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import consola from 'consola'
|
|
2
|
+
import { writeTextFile } from '@stacksjs/fs'
|
|
3
|
+
import { packageJsonPath } from '@stacksjs/paths'
|
|
4
|
+
import { packageManager } from '../../package.json'
|
|
5
|
+
import { library } from '../../../../config'
|
|
6
|
+
|
|
7
|
+
export async function generatePackageJson(type: 'vue-components' | 'web-components' | 'functions') {
|
|
8
|
+
let name, description, directory, keywords, config
|
|
9
|
+
|
|
10
|
+
if (type === 'vue-components') {
|
|
11
|
+
name = library.vueComponents.name
|
|
12
|
+
description = library.vueComponents.description
|
|
13
|
+
directory = 'components'
|
|
14
|
+
keywords = library.vueComponents.keywords
|
|
15
|
+
config = 'vue-components'
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
else if (type === 'web-components') {
|
|
19
|
+
name = library.webComponents.name
|
|
20
|
+
description = library.webComponents.description
|
|
21
|
+
directory = 'components'
|
|
22
|
+
keywords = library.webComponents.keywords
|
|
23
|
+
config = 'web-components'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
else if (type === 'functions') {
|
|
27
|
+
name = library.functions.name
|
|
28
|
+
description = library.functions.description
|
|
29
|
+
directory = 'functions'
|
|
30
|
+
keywords = library.functions.keywords
|
|
31
|
+
config = 'functions'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
// the version does not have to be set here,
|
|
36
|
+
// it will be set automatically by the release script
|
|
37
|
+
await writeTextFile({
|
|
38
|
+
path: packageJsonPath(type),
|
|
39
|
+
data: `{
|
|
40
|
+
"name": "${name}",
|
|
41
|
+
"type": "module",
|
|
42
|
+
"version": "",
|
|
43
|
+
"packageManager": "${packageManager}",
|
|
44
|
+
"description": "${description}",
|
|
45
|
+
"author": "${library.author}",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"homepage": "https://github.com/${library.repository}/tree/main/${directory}#readme",
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "git+https://github.com/${library.repository}.git",
|
|
51
|
+
"directory": "${directory}"
|
|
52
|
+
},
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/${library.repository}/issues"
|
|
55
|
+
},
|
|
56
|
+
"keywords": ${JSON.stringify(keywords)},
|
|
57
|
+
"contributors": ${JSON.stringify(library.contributors)},
|
|
58
|
+
"exports": {
|
|
59
|
+
".": {
|
|
60
|
+
"types": "./dist/index.d.ts",
|
|
61
|
+
"require": "./dist/index.cjs",
|
|
62
|
+
"import": "./dist/index.js"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"main": "dist/index.cjs",
|
|
66
|
+
"module": "dist/index.js",
|
|
67
|
+
"types": "dist/index.d.ts",
|
|
68
|
+
"files": [
|
|
69
|
+
"dist"
|
|
70
|
+
],
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "vite build -c ../build/${config}.ts",
|
|
73
|
+
"prepublishOnly": "pnpm run build"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"stacks": "workspace:*"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
`,
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
consola.success(`Created the ${type} package.json.`)
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
consola.error(err)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import consola from 'consola'
|
|
2
|
+
import { customElementsDataPath } from '@stacksjs/paths'
|
|
3
|
+
import { writeTextFile } from '@stacksjs/fs'
|
|
4
|
+
import { library } from '../../../../config'
|
|
5
|
+
|
|
6
|
+
export async function generateVsCodeCustomData() {
|
|
7
|
+
try {
|
|
8
|
+
// the version does not have to be set here,
|
|
9
|
+
// it will be set automatically by the release script
|
|
10
|
+
await writeTextFile({
|
|
11
|
+
path: customElementsDataPath(),
|
|
12
|
+
data: generateComponentInfoData(),
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
catch (err) {
|
|
16
|
+
consola.error(err)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function generateComponentInfoData() {
|
|
21
|
+
const componentsData = JSON.stringify(library.vueComponents.tags)
|
|
22
|
+
|
|
23
|
+
return `{
|
|
24
|
+
"version": 1.1,
|
|
25
|
+
"tags": ${componentsData}
|
|
26
|
+
}
|
|
27
|
+
`
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import fg from 'fast-glob'
|
|
2
|
+
import fs from 'fs-extra'
|
|
3
|
+
|
|
4
|
+
export async function generateVueCompat(paths: string[]) {
|
|
5
|
+
const files = await fg(paths, {
|
|
6
|
+
onlyFiles: true,
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
for (const f of files) {
|
|
10
|
+
const raw = await fs.readFile(f, 'utf-8')
|
|
11
|
+
const changed = raw
|
|
12
|
+
.replace(/"@vue\/composition-api"/g, '\'vue-demi\'')
|
|
13
|
+
.replace(/"vue"/g, '\'vue-demi\'')
|
|
14
|
+
.replace(/'vue'/g, '\'vue-demi\'')
|
|
15
|
+
await fs.writeFile(f, changed, 'utf-8')
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This action generates the component meta.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import consola from 'consola'
|
|
8
|
+
import { hasComponents } from '@stacksjs/fs'
|
|
9
|
+
import { generateComponentMeta } from './generate/component-meta'
|
|
10
|
+
|
|
11
|
+
async function generate() {
|
|
12
|
+
if (hasComponents())
|
|
13
|
+
await generateComponentMeta()
|
|
14
|
+
|
|
15
|
+
else
|
|
16
|
+
consola.info('No components found. Skipping component meta generation.')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
generate()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This action generates the web-types.json & custom-elements.json
|
|
5
|
+
* files for the components.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import consola from 'consola'
|
|
9
|
+
import { hasComponents } from '@stacksjs/fs'
|
|
10
|
+
import { generateVsCodeCustomData } from './generate/vscode-custom-data'
|
|
11
|
+
// import { generateVsCodeCustomData, generateWebTypes } from './generate/vscode-custom-data'
|
|
12
|
+
|
|
13
|
+
async function generate() {
|
|
14
|
+
if (hasComponents()) {
|
|
15
|
+
// await generateWebTypes()
|
|
16
|
+
await generateVsCodeCustomData()
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
consola.info('No components found. Skipping IDE helper generation.')
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
generate()
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import consola from 'consola'
|
|
3
|
+
import { hasComponents, hasFunctions } from '@stacksjs/fs'
|
|
4
|
+
import { generateLibEntry } from './generate/lib-entries'
|
|
5
|
+
|
|
6
|
+
async function generate() {
|
|
7
|
+
if (hasComponents()) {
|
|
8
|
+
await generateLibEntry('vue-components')
|
|
9
|
+
await generateLibEntry('web-components')
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
consola.info('No components found. Skipping building component entry points.')
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (hasFunctions())
|
|
16
|
+
await generateLibEntry('functions')
|
|
17
|
+
|
|
18
|
+
else
|
|
19
|
+
consola.info('No functions found. Skipping building function entry point.')
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
generate()
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { hasComponents, hasFunctions } from '@stacksjs/fs'
|
|
3
|
+
import { generatePackageJson } from './generate/package-json'
|
|
4
|
+
|
|
5
|
+
async function generate() {
|
|
6
|
+
if (hasComponents()) {
|
|
7
|
+
await generatePackageJson('vue-components')
|
|
8
|
+
await generatePackageJson('web-components')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (hasFunctions())
|
|
12
|
+
await generatePackageJson('functions')
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
generate()
|