stacks 0.37.3 → 0.37.5
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/README.md +18 -25
- package/dist/cli/actions/build.d.ts +7 -0
- package/dist/cli/actions/build.mjs +117 -0
- package/dist/cli/actions/commit.d.ts +1 -0
- package/dist/cli/actions/commit.mjs +8 -0
- package/dist/cli/actions/dev.d.ts +1 -0
- package/dist/cli/actions/dev.mjs +34 -0
- package/dist/cli/actions/examples.d.ts +3 -0
- package/dist/cli/actions/examples.mjs +57 -0
- package/dist/cli/actions/fresh.d.ts +1 -0
- package/dist/cli/actions/fresh.mjs +8 -0
- package/dist/cli/actions/generate.d.ts +7 -0
- package/dist/cli/actions/generate.mjs +117 -0
- package/dist/cli/actions/index.d.ts +12 -0
- package/dist/cli/actions/index.mjs +12 -0
- package/dist/cli/actions/key.d.ts +2 -0
- package/dist/cli/actions/key.mjs +22 -0
- package/dist/cli/actions/lint.d.ts +2 -0
- package/dist/cli/actions/lint.mjs +15 -0
- package/dist/cli/actions/make.d.ts +5 -0
- package/dist/cli/actions/make.mjs +97 -0
- package/dist/cli/actions/release.d.ts +1 -0
- package/dist/cli/actions/release.mjs +8 -0
- package/dist/cli/actions/test.d.ts +3 -0
- package/dist/cli/actions/test.mjs +30 -0
- package/dist/cli/actions/types.d.ts +9 -0
- package/dist/cli/actions/types.mjs +134 -0
- package/dist/cli/actions/update.d.ts +1 -0
- package/dist/cli/actions/update.mjs +59 -0
- package/dist/cli/build.d.ts +3 -0
- package/dist/cli/build.mjs +22 -0
- package/dist/cli/create.d.ts +3 -0
- package/dist/cli/create.mjs +46 -0
- package/dist/cli/dev.d.ts +3 -0
- package/dist/cli/dev.mjs +13 -0
- package/dist/cli/example.d.ts +3 -0
- package/dist/cli/example.mjs +13 -0
- package/dist/cli/generate.d.ts +3 -0
- package/dist/cli/generate.mjs +29 -0
- package/dist/cli/index.d.ts +12 -0
- package/dist/cli/index.mjs +12 -0
- package/dist/cli/key.d.ts +3 -0
- package/dist/cli/key.mjs +7 -0
- package/dist/cli/make.d.ts +3 -0
- package/dist/cli/make.mjs +22 -0
- package/dist/cli/test.d.ts +3 -0
- package/dist/cli/test.mjs +13 -0
- package/dist/cli/types.d.ts +3 -0
- package/dist/cli/types.mjs +9 -0
- package/dist/cli/update.d.ts +3 -0
- package/dist/cli/update.mjs +7 -0
- package/dist/cli/utility.d.ts +3 -0
- package/dist/cli/utility.mjs +22 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.mjs +13970 -0
- package/dist/docs.d.ts +2 -0
- package/dist/docs.mjs +3 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.mjs +20 -0
- package/package.json +33 -38
- package/.gitignore +0 -10
- package/auto-imports.d.ts +0 -826
- package/components.d.ts +0 -22
- package/core/actions/README.md +0 -59
- package/core/actions/node_modules/.bin/markdown-it +0 -17
- package/core/actions/node_modules/.bin/mkdist +0 -17
- package/core/actions/node_modules/.bin/tsc +0 -17
- package/core/actions/node_modules/.bin/tsserver +0 -17
- package/core/actions/package.json +0 -64
- package/core/actions/src/copy-types.ts +0 -22
- package/core/actions/src/generate/component-meta.ts +0 -94
- package/core/actions/src/generate/index.ts +0 -4
- package/core/actions/src/generate/lib-entries.ts +0 -106
- package/core/actions/src/generate/package-json.ts +0 -87
- package/core/actions/src/generate/vscode-custom-data.ts +0 -28
- package/core/actions/src/generate/vue-compat.ts +0 -17
- package/core/actions/src/generate-component-meta.ts +0 -19
- package/core/actions/src/generate-ide-helpers.ts +0 -23
- package/core/actions/src/generate-lib-entries.ts +0 -22
- package/core/actions/src/generate-package-json.ts +0 -15
- package/core/actions/src/generate-vscode-custom-data.ts +0 -20
- package/core/actions/src/generate-vue-compat.ts +0 -10
- package/core/arrays/README.md +0 -59
- package/core/arrays/node_modules/.bin/mkdist +0 -17
- package/core/arrays/node_modules/.bin/tsc +0 -17
- package/core/arrays/node_modules/.bin/tsserver +0 -17
- package/core/arrays/package.json +0 -50
- package/core/arrays/src/index.ts +0 -3
- package/core/build/README.md +0 -59
- package/core/build/entries/README.md +0 -7
- package/core/build/node_modules/.bin/acorn +0 -17
- package/core/build/node_modules/.bin/browserslist +0 -17
- package/core/build/node_modules/.bin/jiti +0 -17
- package/core/build/node_modules/.bin/mkdist +0 -17
- package/core/build/node_modules/.bin/rollup +0 -17
- package/core/build/node_modules/.bin/vite +0 -17
- package/core/build/node_modules/.bin/vite-ssg +0 -17
- package/core/build/node_modules/.bin/vue-docgen-web-types +0 -17
- package/core/build/package.json +0 -71
- package/core/build/src/example-vue.ts +0 -26
- package/core/build/src/example-wc.ts +0 -26
- package/core/build/src/functions.ts +0 -56
- package/core/build/src/index.ts +0 -7
- package/core/build/src/pages.ts +0 -50
- package/core/build/src/stacks.ts +0 -204
- package/core/build/src/vue-components.ts +0 -76
- package/core/build/src/web-components.ts +0 -63
- package/core/build/web-types.config.cjs +0 -4
- package/core/build/web-types.ts +0 -14
- package/core/collections/README.md +0 -59
- package/core/collections/node_modules/.bin/mkdist +0 -17
- package/core/collections/node_modules/.bin/tsc +0 -17
- package/core/collections/node_modules/.bin/tsserver +0 -17
- package/core/collections/package.json +0 -54
- package/core/collections/src/index.ts +0 -1
- package/core/fs/README.md +0 -59
- package/core/fs/node_modules/.bin/mkdist +0 -17
- package/core/fs/package.json +0 -56
- package/core/fs/src/index.ts +0 -170
- package/core/helpers/node_modules/.bin/mkdist +0 -17
- package/core/helpers/package.json +0 -58
- package/core/helpers/src/index.ts +0 -129
- package/core/modules/README.md +0 -61
- package/core/modules/node_modules/.bin/acorn +0 -17
- package/core/modules/node_modules/.bin/mkdist +0 -17
- package/core/modules/package.json +0 -51
- package/core/modules/src/i18n.ts +0 -23
- package/core/modules/src/nprogress.ts +0 -12
- package/core/modules/src/pwa.ts +0 -12
- package/core/objects/README.md +0 -59
- package/core/objects/node_modules/.bin/mkdist +0 -17
- package/core/objects/node_modules/.bin/tsc +0 -17
- package/core/objects/node_modules/.bin/tsserver +0 -17
- package/core/objects/package.json +0 -51
- package/core/objects/src/index.ts +0 -1
- package/core/paths/node_modules/.bin/mkdist +0 -17
- package/core/paths/node_modules/.bin/tsc +0 -17
- package/core/paths/node_modules/.bin/tsserver +0 -17
- package/core/paths/package.json +0 -51
- package/core/paths/src/index.ts +0 -178
- package/core/router/README.md +0 -59
- package/core/router/node_modules/.bin/mkdist +0 -17
- package/core/router/package.json +0 -51
- package/core/router/src/index.ts +0 -14
- package/core/security/README.md +0 -59
- package/core/security/node_modules/.bin/mkdist +0 -17
- package/core/security/package.json +0 -56
- package/core/security/src/crypt.ts +0 -14
- package/core/security/src/hash.ts +0 -52
- package/core/security/src/index.ts +0 -3
- package/core/security/src/key.ts +0 -11
- package/core/strings/README.md +0 -59
- package/core/strings/node_modules/.bin/mkdist +0 -17
- package/core/strings/node_modules/.bin/tsc +0 -17
- package/core/strings/node_modules/.bin/tsserver +0 -17
- package/core/strings/package.json +0 -63
- package/core/strings/src/index.ts +0 -14
- package/core/types/README.md +0 -59
- package/core/types/node_modules/.bin/markdown-it +0 -17
- package/core/types/node_modules/.bin/mkdist +0 -17
- package/core/types/node_modules/.bin/vite +0 -17
- package/core/types/node_modules/.bin/vitepress +0 -17
- package/core/types/package.json +0 -60
- package/core/types/src/app.ts +0 -131
- package/core/types/src/auto-imports.ts +0 -3
- package/core/types/src/build.ts +0 -3
- package/core/types/src/cli.ts +0 -49
- package/core/types/src/components.ts +0 -66
- package/core/types/src/deploy.ts +0 -11
- package/core/types/src/docs.ts +0 -3
- package/core/types/src/exit-code.ts +0 -10
- package/core/types/src/fs.ts +0 -17
- package/core/types/src/git.ts +0 -131
- package/core/types/src/hashing.ts +0 -107
- package/core/types/src/i18n.ts +0 -19
- package/core/types/src/index.ts +0 -21
- package/core/types/src/inspect.ts +0 -10
- package/core/types/src/layout.ts +0 -8
- package/core/types/src/library.ts +0 -148
- package/core/types/src/manifest.ts +0 -9
- package/core/types/src/markdown.ts +0 -198
- package/core/types/src/pages.ts +0 -8
- package/core/types/src/pwa.ts +0 -8
- package/core/types/src/ssg.ts +0 -3
- package/core/types/src/ui.ts +0 -141
- package/core/ui/README.md +0 -60
- package/core/ui/node_modules/.bin/mkdist +0 -17
- package/core/ui/node_modules/.bin/tsc +0 -17
- package/core/ui/node_modules/.bin/tsserver +0 -17
- package/core/ui/node_modules/.bin/vite +0 -17
- package/core/ui/node_modules/.bin/vue-tsc +0 -17
- package/core/ui/package.json +0 -62
- package/core/ui/src/index.ts +0 -60
- package/custom-elements.json +0 -14
- package/examples/vue-components/App.vue +0 -12
- package/examples/vue-components/favicon.png +0 -0
- package/examples/vue-components/index.html +0 -20
- package/examples/web-components/favicon.png +0 -0
- package/examples/web-components/index.html +0 -13
- package/functions/node_modules/.bin/artisan +0 -17
- package/functions/node_modules/.bin/stacks +0 -17
- package/functions/node_modules/.bin/stx +0 -17
- package/functions/package.json +0 -40
- package/netlify.toml +0 -18
- package/nitro.config.ts +0 -6
- package/pages/App.vue +0 -26
- package/pages/index.html +0 -23
- package/pages/main.ts +0 -26
- package/pages/public/_headers +0 -3
- package/pages/public/favicon-dark.svg +0 -3
- package/pages/public/favicon.svg +0 -3
- package/pages/public/pwa-192x192.png +0 -0
- package/pages/public/pwa-512x512.png +0 -0
- package/pages/public/safari-pinned-tab.svg +0 -41
- package/pages/styles/main.css +0 -29
- package/pages/styles/markdown.css +0 -28
- package/scripts/ensure-env.sh +0 -248
- package/shims.d.ts +0 -29
- package/simple-git-hooks.cjs +0 -4
- package/src/cli/actions/build.ts +0 -160
- package/src/cli/actions/commit.ts +0 -9
- package/src/cli/actions/dev.ts +0 -47
- package/src/cli/actions/examples.ts +0 -74
- package/src/cli/actions/fresh.ts +0 -9
- package/src/cli/actions/generate.ts +0 -159
- package/src/cli/actions/index.ts +0 -12
- package/src/cli/actions/key.ts +0 -31
- package/src/cli/actions/lint.ts +0 -19
- package/src/cli/actions/make.ts +0 -116
- package/src/cli/actions/release.ts +0 -9
- package/src/cli/actions/test.ts +0 -39
- package/src/cli/actions/types.ts +0 -180
- package/src/cli/actions/update.ts +0 -90
- package/src/cli/build.ts +0 -49
- package/src/cli/create.ts +0 -71
- package/src/cli/dev.ts +0 -28
- package/src/cli/example.ts +0 -28
- package/src/cli/generate.ts +0 -64
- package/src/cli/index.ts +0 -13
- package/src/cli/key.ts +0 -12
- package/src/cli/make.ts +0 -47
- package/src/cli/test.ts +0 -24
- package/src/cli/types.ts +0 -18
- package/src/cli/update.ts +0 -17
- package/src/cli/utility.ts +0 -39
- package/src/cli.ts +0 -48
- package/src/docs.ts +0 -4
- package/src/index.ts +0 -22
- package/tsconfig.json +0 -96
- package/vitest.config.ts +0 -22
- package/vue-components/dist/.gitkeep +0 -0
- package/vue-components/index.html +0 -13
- package/vue-components/main.ts +0 -18
- package/vue-components/node_modules/.bin/artisan +0 -17
- package/vue-components/node_modules/.bin/stacks +0 -17
- package/vue-components/node_modules/.bin/stx +0 -17
- package/vue-components/node_modules/.vite/deps/@vueuse_core.js +0 -7847
- package/vue-components/node_modules/.vite/deps/@vueuse_core.js.map +0 -7
- package/vue-components/node_modules/.vite/deps/_metadata.json +0 -13
- package/vue-components/node_modules/.vite/deps/package.json +0 -1
- package/vue-components/package.json +0 -40
- package/web-components/dist/.gitkeep +0 -0
- package/web-components/node_modules/.bin/artisan +0 -17
- package/web-components/node_modules/.bin/stacks +0 -17
- package/web-components/node_modules/.bin/stx +0 -17
- package/web-components/package.json +0 -40
- package/web-types.json +0 -67
package/README.md
CHANGED
|
@@ -1,52 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Rapid Application Development
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Develop modern framework-agnostic web apps & libraries, faster. Stacks.js is a progressive full-stack framework with an approachable & easy-to-use onboarding experience.
|
|
4
4
|
|
|
5
5
|
## ☘️ Features
|
|
6
6
|
|
|
7
|
-
The
|
|
7
|
+
The goal of the framework is to _help you_ build applications rapidly & more efficiently, removing the boilerplate wherever possible—and the learning curve! Whether it's APIs, a component and/or function library, or simply a statically generate site, Stacks is a toolkit of composables, methods, and other goodies, required to build optimized outputs.
|
|
8
|
+
|
|
9
|
+
In other words, it's a highly optimized build process that automatically generates:
|
|
10
|
+
|
|
11
|
+
- `.mjs` & `.cjs` library distributions, including its TypeScript types
|
|
12
|
+
- a highly-performant JavaScript production-ready server to be deployed anywhere (e.g. Netlify, Vercel, AWS, etc.)
|
|
8
13
|
|
|
9
14
|
Other included core features are:
|
|
10
15
|
|
|
11
|
-
- ⚡️ Vite
|
|
12
|
-
-
|
|
16
|
+
- ⚡️ Vite powered, optimized for speed
|
|
17
|
+
- 🚜 Create one component, automatically generate a Vue & Web Component library
|
|
18
|
+
- 🎨 Optimized CSS engine for Vue & Web Components, and SSG pages _(defaults to Tailwind CSS utility classes)_
|
|
13
19
|
- 👣 Tiny foot-print in production builds
|
|
20
|
+
- 🌳 Treeshaking for Vue & Web Components, and function libraries
|
|
14
21
|
- 💬 Fully-typed TypeScript definitions
|
|
15
|
-
-
|
|
16
|
-
- 🎨 Optimized UnoCSS build for Vue & Web Components _(defaults to Tailwind CSS utility classes)_
|
|
22
|
+
- 📰 Automatically publishes your libraries to npm & creates your changelogs
|
|
17
23
|
- 🧙🏼♀️ Unified way to access hundreds of [icon sets](https://icon-sets.iconify.design)
|
|
18
24
|
— [Icons in Pure CSS](https://antfu.me/posts/icons-in-pure-css)
|
|
19
25
|
|
|
20
|
-
And all of this in a zero-config, yet configurable, way.
|
|
26
|
+
And all of this in a zero-config, yet highly-configurable, way.
|
|
21
27
|
|
|
22
28
|
## 🤖 Usage
|
|
23
29
|
|
|
24
30
|
If you want to use Stacks outside of this framework, install it as a dev dependency:
|
|
25
31
|
|
|
26
32
|
```bash
|
|
27
|
-
pnpm i -D
|
|
33
|
+
pnpm i -D stacks
|
|
28
34
|
```
|
|
29
35
|
|
|
30
36
|
Now, you can use it in your project:
|
|
31
37
|
|
|
32
|
-
```
|
|
33
|
-
import
|
|
34
|
-
Stacks,
|
|
35
|
-
atomicCssEngine,
|
|
36
|
-
autoImports,
|
|
37
|
-
components,
|
|
38
|
-
createApp,
|
|
39
|
-
defineConfig,
|
|
40
|
-
defineTestConfig,
|
|
41
|
-
inspect,
|
|
42
|
-
resolve,
|
|
43
|
-
uiEngine
|
|
44
|
-
} from 'stacksjs'
|
|
45
|
-
|
|
46
|
-
// you are now free to use any of the imported methods
|
|
38
|
+
```ts
|
|
39
|
+
import * as stacks from 'stacks'
|
|
47
40
|
```
|
|
48
41
|
|
|
49
|
-
Learn more in the docs.
|
|
42
|
+
You may easily import any of the exported methods. Learn more in the docs.
|
|
50
43
|
|
|
51
44
|
## 🧪 Testing
|
|
52
45
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function buildComponentLibraries(): Promise<void>;
|
|
2
|
+
export declare function buildVueComponentLibrary(): Promise<void>;
|
|
3
|
+
export declare function buildWebComponentLibrary(): Promise<void>;
|
|
4
|
+
export declare function buildDocs(): Promise<void>;
|
|
5
|
+
export declare function buildStacks(): Promise<void>;
|
|
6
|
+
export declare function buildFunctionsLibrary(): Promise<void>;
|
|
7
|
+
export declare function startBuildProcess(options: any): Promise<void>;
|
|
@@ -0,0 +1,117 @@
|
|
|
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.mjs";
|
|
7
|
+
const { prompts } = Prompts;
|
|
8
|
+
export async function buildComponentLibraries() {
|
|
9
|
+
try {
|
|
10
|
+
await runNpmScript(NpmScript.GenerateEntries);
|
|
11
|
+
await buildVueComponentLibrary();
|
|
12
|
+
await buildWebComponentLibrary();
|
|
13
|
+
} catch (error) {
|
|
14
|
+
consola.error("There was an error building your component libraries.");
|
|
15
|
+
consola.error(error);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export async function buildVueComponentLibrary() {
|
|
19
|
+
consola.info("Building your component library...");
|
|
20
|
+
if (hasComponents()) {
|
|
21
|
+
try {
|
|
22
|
+
await runNpmScript(NpmScript.BuildComponents);
|
|
23
|
+
consola.success("Your component library was built successfully.");
|
|
24
|
+
} catch (error) {
|
|
25
|
+
consola.error("There was an error building your component library.");
|
|
26
|
+
consola.error(error);
|
|
27
|
+
}
|
|
28
|
+
} else {
|
|
29
|
+
consola.info("No components found.");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export async function buildWebComponentLibrary() {
|
|
33
|
+
consola.info("Building your component library for production use & npm/CDN distribution...");
|
|
34
|
+
if (hasComponents()) {
|
|
35
|
+
try {
|
|
36
|
+
await runNpmScript(NpmScript.BuildWebComponents);
|
|
37
|
+
consola.success("Your Web Component library was built successfully.");
|
|
38
|
+
} catch (error) {
|
|
39
|
+
consola.error("There was an error building your Web Component library.");
|
|
40
|
+
consola.error(error);
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
consola.info("No components found.");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export async function buildDocs() {
|
|
47
|
+
consola.info("Building the Artisan CLI...");
|
|
48
|
+
try {
|
|
49
|
+
await runNpmScript(NpmScript.BuildDocs);
|
|
50
|
+
consola.success("Artisan CLI was built successfully.");
|
|
51
|
+
} catch (error) {
|
|
52
|
+
consola.error("There was an error building the Artisan CLI.");
|
|
53
|
+
consola.error(error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export async function buildStacks() {
|
|
57
|
+
consola.info("Building the Stacks Framework...");
|
|
58
|
+
try {
|
|
59
|
+
await runNpmScript(NpmScript.BuildStacks);
|
|
60
|
+
consola.success("Stacks was built successfully.");
|
|
61
|
+
} catch (error) {
|
|
62
|
+
consola.error("There was an error building the Stacks framework.");
|
|
63
|
+
consola.error(error);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export async function buildFunctionsLibrary() {
|
|
67
|
+
consola.info("Building your functions library for production use & npm/CDN distribution...");
|
|
68
|
+
if (hasFunctions()) {
|
|
69
|
+
try {
|
|
70
|
+
await runNpmScript(NpmScript.BuildFunctions);
|
|
71
|
+
consola.success("Your functions library was built successfully.");
|
|
72
|
+
} catch (error) {
|
|
73
|
+
consola.error("There was an error building your functions library.");
|
|
74
|
+
consola.error(error);
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
consola.info("No functions found.");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export async function startBuildProcess(options) {
|
|
81
|
+
if (options.components || options === "components") {
|
|
82
|
+
await buildComponentLibraries();
|
|
83
|
+
} else if (options.webComponents || options.elements || options === "web-components" || options === "elements") {
|
|
84
|
+
await buildWebComponentLibrary();
|
|
85
|
+
} else if (options.functions || options === "functions") {
|
|
86
|
+
await buildFunctionsLibrary();
|
|
87
|
+
} else if (options.docs || options === "docs") {
|
|
88
|
+
await buildDocs();
|
|
89
|
+
} else if (options.stacks || options === "stacks") {
|
|
90
|
+
await buildStacks();
|
|
91
|
+
} else if (options.npm || options === "npm") {
|
|
92
|
+
await buildComponentLibraries();
|
|
93
|
+
await buildFunctionsLibrary();
|
|
94
|
+
consola.success("All your libraries and its types were built successfully to be distributed on npm.");
|
|
95
|
+
} else {
|
|
96
|
+
const answer = await prompts.select({
|
|
97
|
+
type: "select",
|
|
98
|
+
name: "build",
|
|
99
|
+
message: "Which stack are you trying to build for production use?",
|
|
100
|
+
choices: [
|
|
101
|
+
{ title: "Components", value: "components" },
|
|
102
|
+
{ title: "Functions", value: "functions" },
|
|
103
|
+
{ title: "Docs", value: "docs" }
|
|
104
|
+
],
|
|
105
|
+
initial: 0
|
|
106
|
+
});
|
|
107
|
+
if (answer === "components")
|
|
108
|
+
await buildComponentLibraries();
|
|
109
|
+
if (answer === "functions")
|
|
110
|
+
await buildFunctionsLibrary();
|
|
111
|
+
else if (answer === "docs")
|
|
112
|
+
await buildDocs();
|
|
113
|
+
else
|
|
114
|
+
process.exit(ExitCode.InvalidArgument);
|
|
115
|
+
}
|
|
116
|
+
await generateTypes();
|
|
117
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function commit(): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import consola from "consola";
|
|
2
|
+
import { runNpmScript } from "@stacksjs/helpers";
|
|
3
|
+
import { NpmScript } from "@stacksjs/types";
|
|
4
|
+
export async function commit() {
|
|
5
|
+
consola.info("Committing...");
|
|
6
|
+
await runNpmScript(NpmScript.Commit);
|
|
7
|
+
consola.success("Committed.");
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function startDevelopmentServer(options: any): Promise<void>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Prompts from "prompts";
|
|
2
|
+
import consola from "consola";
|
|
3
|
+
import { runNpmScript } from "@stacksjs/helpers";
|
|
4
|
+
import { ExitCode, NpmScript } from "@stacksjs/types";
|
|
5
|
+
const { prompts } = Prompts;
|
|
6
|
+
export async function startDevelopmentServer(options) {
|
|
7
|
+
if (options.components || options === "components") {
|
|
8
|
+
consola.info("Starting development server for your components...");
|
|
9
|
+
await runNpmScript(NpmScript.DevComponents);
|
|
10
|
+
} else if (options.docs || options === "docs") {
|
|
11
|
+
consola.info("Starting development server for your documentation...");
|
|
12
|
+
await runNpmScript(NpmScript.DevDocs);
|
|
13
|
+
} else {
|
|
14
|
+
const answer = await prompts.select({
|
|
15
|
+
type: "select",
|
|
16
|
+
name: "development",
|
|
17
|
+
message: "Which development server are you trying to start?",
|
|
18
|
+
choices: [
|
|
19
|
+
{ title: "Components", value: "components" },
|
|
20
|
+
{ title: "Docs", value: "docs" }
|
|
21
|
+
],
|
|
22
|
+
initial: 0
|
|
23
|
+
});
|
|
24
|
+
if (answer === "components") {
|
|
25
|
+
consola.info("Starting development server for your components...");
|
|
26
|
+
await runNpmScript(NpmScript.DevComponents);
|
|
27
|
+
} else if (answer === "docs") {
|
|
28
|
+
consola.info("Starting docs server for your components...");
|
|
29
|
+
await runNpmScript(NpmScript.DevDocs);
|
|
30
|
+
} else {
|
|
31
|
+
process.exit(ExitCode.InvalidArgument);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
const { prompts } = Prompts;
|
|
7
|
+
export async function testComponentExample() {
|
|
8
|
+
if (hasComponents()) {
|
|
9
|
+
try {
|
|
10
|
+
await runNpmScript(NpmScript.ExampleVue);
|
|
11
|
+
consola.success("Your component library was built successfully.");
|
|
12
|
+
} catch (error) {
|
|
13
|
+
consola.error("There was an error building your component library.");
|
|
14
|
+
consola.error(error);
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
consola.info("No components found.");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export async function testWebComponentExample() {
|
|
21
|
+
consola.info("Building your Web Component library...");
|
|
22
|
+
if (hasComponents()) {
|
|
23
|
+
try {
|
|
24
|
+
await runNpmScript(NpmScript.BuildWebComponents);
|
|
25
|
+
consola.success("Your Web Component library was built successfully.");
|
|
26
|
+
} catch (error) {
|
|
27
|
+
consola.error("There was an error building your Web Component library.");
|
|
28
|
+
consola.error(error);
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
consola.info("No components found.");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export async function runExample(options) {
|
|
35
|
+
if (options.components || options === "components" || options === "vue") {
|
|
36
|
+
await testComponentExample();
|
|
37
|
+
} else if (options.webComponents || options.elements || options === "web-components" || options === "elements") {
|
|
38
|
+
await testWebComponentExample();
|
|
39
|
+
} else {
|
|
40
|
+
const answer = await prompts.select({
|
|
41
|
+
type: "select",
|
|
42
|
+
name: "example",
|
|
43
|
+
message: "Which example are you trying to view?",
|
|
44
|
+
choices: [
|
|
45
|
+
{ title: "Components", value: "components" },
|
|
46
|
+
{ title: "Web Components", value: "web-components" }
|
|
47
|
+
],
|
|
48
|
+
initial: 0
|
|
49
|
+
});
|
|
50
|
+
if (answer === "components")
|
|
51
|
+
await testComponentExample();
|
|
52
|
+
if (answer === "web-components")
|
|
53
|
+
await testWebComponentExample();
|
|
54
|
+
else
|
|
55
|
+
process.exit(ExitCode.InvalidArgument);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function reinstallNpmDependencies(): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import consola from "consola";
|
|
2
|
+
import { runNpmScript } from "@stacksjs/helpers";
|
|
3
|
+
import { NpmScript } from "@stacksjs/types";
|
|
4
|
+
export async function reinstallNpmDependencies() {
|
|
5
|
+
consola.info("Reinstalling your npm dependencies...");
|
|
6
|
+
await runNpmScript(NpmScript.Fresh);
|
|
7
|
+
consola.success("Successfully reinstalled your npm dependencies.");
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function generateLibEntries(): Promise<void>;
|
|
2
|
+
export declare function generateVueCompat(): Promise<void>;
|
|
3
|
+
export declare function generateWebTypes(): Promise<void>;
|
|
4
|
+
export declare function generateVsCodeCustomData(): Promise<void>;
|
|
5
|
+
export declare function generateIdeHelpers(): Promise<void>;
|
|
6
|
+
export declare function generateComponentMeta(): Promise<void>;
|
|
7
|
+
export declare function startGenerationProcess(options: any): Promise<void>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import consola from "consola";
|
|
2
|
+
import Prompts from "prompts";
|
|
3
|
+
import { runNpmScript } from "@stacksjs/helpers";
|
|
4
|
+
import { ExitCode, NpmScript } from "@stacksjs/types";
|
|
5
|
+
import { lintFix } from "./lint.mjs";
|
|
6
|
+
import { generateTypes } from "./types.mjs";
|
|
7
|
+
const { prompts } = Prompts;
|
|
8
|
+
export async function generateLibEntries() {
|
|
9
|
+
try {
|
|
10
|
+
await runNpmScript(NpmScript.GenerateEntries, "ignore");
|
|
11
|
+
consola.success("Library entry points were generated successfully.");
|
|
12
|
+
} catch (error) {
|
|
13
|
+
consola.error("There was an error generating your library entry points.");
|
|
14
|
+
consola.error(error);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export async function generateVueCompat() {
|
|
18
|
+
try {
|
|
19
|
+
await runNpmScript(NpmScript.GenerateVueCompat, "ignore");
|
|
20
|
+
consola.success("Vue 2 & 3 compatibility was generated successfully.");
|
|
21
|
+
} catch (error) {
|
|
22
|
+
consola.error("There was an error generating Vue compatibility.");
|
|
23
|
+
consola.error(error);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export async function generateWebTypes() {
|
|
27
|
+
try {
|
|
28
|
+
await runNpmScript(NpmScript.GenerateWebTypes, "ignore");
|
|
29
|
+
consola.success("Successfully generated the web-types.json file.");
|
|
30
|
+
} catch (error) {
|
|
31
|
+
consola.error("There was an error generating the web-types.json file");
|
|
32
|
+
consola.error(error);
|
|
33
|
+
process.exit(ExitCode.FatalError);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export async function generateVsCodeCustomData() {
|
|
37
|
+
try {
|
|
38
|
+
await runNpmScript(NpmScript.GenerateVsCodeCustomData, "ignore");
|
|
39
|
+
await lintFix("ignore");
|
|
40
|
+
consola.success("Successfully generated the custom-elements.json file.");
|
|
41
|
+
} catch (error) {
|
|
42
|
+
consola.error("There was an error generating the custom-elements.json file");
|
|
43
|
+
consola.error(error);
|
|
44
|
+
process.exit(ExitCode.FatalError);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export async function generateIdeHelpers() {
|
|
48
|
+
try {
|
|
49
|
+
await runNpmScript(NpmScript.GenerateIdeHelpers, "ignore");
|
|
50
|
+
await lintFix("ignore");
|
|
51
|
+
consola.success("Successfully generated IDE helpers.");
|
|
52
|
+
} catch (error) {
|
|
53
|
+
consola.error("There was an error generating IDE helpers.");
|
|
54
|
+
consola.error(error);
|
|
55
|
+
process.exit(ExitCode.FatalError);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export async function generateComponentMeta() {
|
|
59
|
+
try {
|
|
60
|
+
await runNpmScript(NpmScript.GenerateComponentMeta, "ignore");
|
|
61
|
+
await lintFix("ignore");
|
|
62
|
+
consola.success("Successfully generated component meta.");
|
|
63
|
+
} catch (error) {
|
|
64
|
+
consola.error("There was an error generating your component meta information.");
|
|
65
|
+
consola.error(error);
|
|
66
|
+
process.exit(ExitCode.FatalError);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export async function startGenerationProcess(options) {
|
|
70
|
+
if (options.types || options === "types") {
|
|
71
|
+
await generateTypes();
|
|
72
|
+
} else if (options.entries || options === "entries") {
|
|
73
|
+
await generateLibEntries();
|
|
74
|
+
} else if (options.webTypes || options === "web-types") {
|
|
75
|
+
await generateWebTypes();
|
|
76
|
+
} else if (options.customData || options === "custom-data") {
|
|
77
|
+
await generateVsCodeCustomData();
|
|
78
|
+
} else if (options.ideHelpers || options === "ide-helpers") {
|
|
79
|
+
await generateIdeHelpers();
|
|
80
|
+
} else if (options.vueCompatibility || options === "vue-compatibility") {
|
|
81
|
+
await generateVueCompat();
|
|
82
|
+
} else if (options.componentMeta || options === "component-meta") {
|
|
83
|
+
await generateComponentMeta();
|
|
84
|
+
} else {
|
|
85
|
+
const answer = await prompts.select({
|
|
86
|
+
type: "select",
|
|
87
|
+
name: "generate",
|
|
88
|
+
message: "What are you trying to generate?",
|
|
89
|
+
choices: [
|
|
90
|
+
{ title: "1.) TypeScript Types", value: "types" },
|
|
91
|
+
{ title: "2.) Library Entry Points", value: "entries" },
|
|
92
|
+
{ title: "3.) Web Types", value: "web-types" },
|
|
93
|
+
{ title: "4.) VS Code Custom Data", value: "custom-data" },
|
|
94
|
+
{ title: "5.) IDE Helpers", value: "ide-helpers" },
|
|
95
|
+
{ title: "6.) Vue 2 & 3 Compatibility", value: "vue-compatibility" },
|
|
96
|
+
{ title: "7.) Component Meta", value: "component-meta" }
|
|
97
|
+
],
|
|
98
|
+
initial: 0
|
|
99
|
+
});
|
|
100
|
+
if (answer === "types")
|
|
101
|
+
await generateTypes();
|
|
102
|
+
else if (answer === "entries")
|
|
103
|
+
await generateLibEntries();
|
|
104
|
+
else if (answer === "web-types")
|
|
105
|
+
await generateWebTypes();
|
|
106
|
+
else if (answer === "custom-data")
|
|
107
|
+
await generateVsCodeCustomData();
|
|
108
|
+
else if (answer === "ide-helpers")
|
|
109
|
+
await generateIdeHelpers();
|
|
110
|
+
else if (answer === "vue-compatibility")
|
|
111
|
+
await generateVueCompat();
|
|
112
|
+
else if (answer === "component-meta")
|
|
113
|
+
await generateComponentMeta();
|
|
114
|
+
else
|
|
115
|
+
process.exit(ExitCode.InvalidArgument);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './build';
|
|
2
|
+
export * from './commit';
|
|
3
|
+
export * from './dev';
|
|
4
|
+
export * from './examples';
|
|
5
|
+
export * from './fresh';
|
|
6
|
+
export * from './generate';
|
|
7
|
+
export * from './key';
|
|
8
|
+
export * from './lint';
|
|
9
|
+
export * from './make';
|
|
10
|
+
export * from './release';
|
|
11
|
+
export * from './test';
|
|
12
|
+
export * from './update';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./build.mjs";
|
|
2
|
+
export * from "./commit.mjs";
|
|
3
|
+
export * from "./dev.mjs";
|
|
4
|
+
export * from "./examples.mjs";
|
|
5
|
+
export * from "./fresh.mjs";
|
|
6
|
+
export * from "./generate.mjs";
|
|
7
|
+
export * from "./key.mjs";
|
|
8
|
+
export * from "./lint.mjs";
|
|
9
|
+
export * from "./make.mjs";
|
|
10
|
+
export * from "./release.mjs";
|
|
11
|
+
export * from "./test.mjs";
|
|
12
|
+
export * from "./update.mjs";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getRandomValues } from "node:crypto";
|
|
2
|
+
import consola from "consola";
|
|
3
|
+
import ezSpawn from "@jsdevtools/ez-spawn";
|
|
4
|
+
import { projectPath } from "@stacksjs/paths";
|
|
5
|
+
import { setEnvValue } from "@stacksjs/helpers";
|
|
6
|
+
import { isFile } from "@stacksjs/fs";
|
|
7
|
+
import utf8 from "crypto-js/enc-utf8";
|
|
8
|
+
import base64 from "crypto-js/enc-base64";
|
|
9
|
+
export async function generateAppKey() {
|
|
10
|
+
const random = getRandomValues(new Uint8Array(32));
|
|
11
|
+
const encodedWord = utf8.parse(random.toString());
|
|
12
|
+
const key = base64.stringify(encodedWord);
|
|
13
|
+
return `base64:${key}`;
|
|
14
|
+
}
|
|
15
|
+
export async function generate() {
|
|
16
|
+
consola.info("Setting random application key.");
|
|
17
|
+
if (!isFile(".env"))
|
|
18
|
+
await ezSpawn.async("cp .env.example .env", { stdio: "inherit", cwd: projectPath() });
|
|
19
|
+
await setEnvValue("APP_KEY", await generateAppKey());
|
|
20
|
+
consola.success("Application key set.");
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import consola from "consola";
|
|
2
|
+
import { runNpmScript } from "@stacksjs/helpers";
|
|
3
|
+
import { NpmScript } from "@stacksjs/types";
|
|
4
|
+
export async function lint(debug = "inherit") {
|
|
5
|
+
consola.info("Linting your codebase...");
|
|
6
|
+
await runNpmScript(NpmScript.Lint, debug);
|
|
7
|
+
consola.success("Successfully linted your codebase.");
|
|
8
|
+
}
|
|
9
|
+
export async function lintFix(debug = "inherit") {
|
|
10
|
+
if (debug !== "ignore")
|
|
11
|
+
consola.info("Fixing lint errors...");
|
|
12
|
+
await runNpmScript(NpmScript.LintFix, debug);
|
|
13
|
+
if (debug !== "ignore")
|
|
14
|
+
consola.success("Fixed lint errors.");
|
|
15
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function component(name: string): Promise<void>;
|
|
2
|
+
export declare function page(name: string): Promise<void>;
|
|
3
|
+
export declare function fx(name: string): Promise<void>;
|
|
4
|
+
export declare function language(language: string): Promise<void>;
|
|
5
|
+
export declare function stack(name: string): Promise<void>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import consola from "consola";
|
|
2
|
+
import * as ezSpawn from "@jsdevtools/ez-spawn";
|
|
3
|
+
import { writeTextFile } from "@stacksjs/fs";
|
|
4
|
+
import { resolve } from "@stacksjs/paths";
|
|
5
|
+
export async function component(name) {
|
|
6
|
+
consola.info("Creating your component...");
|
|
7
|
+
try {
|
|
8
|
+
await writeTextFile({
|
|
9
|
+
path: `./components/${name}.vue`,
|
|
10
|
+
data: `<script setup lang="ts">
|
|
11
|
+
// eslint-disable-next-line no-console
|
|
12
|
+
console.log('Hello World component created')
|
|
13
|
+
<\/script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div>
|
|
17
|
+
Some HTML block
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
`
|
|
21
|
+
});
|
|
22
|
+
consola.success(`Created the ${name} component.`);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
consola.error(err);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export async function page(name) {
|
|
28
|
+
consola.info("Creating your component...");
|
|
29
|
+
try {
|
|
30
|
+
await writeTextFile({
|
|
31
|
+
path: `./pages/${name}.vue`,
|
|
32
|
+
data: `<script setup lang="ts">
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.log('Hello World page created')
|
|
35
|
+
<\/script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div>
|
|
39
|
+
Visit http://127.0.0.1/${name}
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
`
|
|
43
|
+
});
|
|
44
|
+
consola.success(`Created the ${name} page.`);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
consola.error(err);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export async function fx(name) {
|
|
50
|
+
consola.info("Creating your function...");
|
|
51
|
+
try {
|
|
52
|
+
await writeTextFile({
|
|
53
|
+
path: `./functions/${name}.ts`,
|
|
54
|
+
data: `// reactive state
|
|
55
|
+
const ${name} = ref(0)
|
|
56
|
+
|
|
57
|
+
// functions that mutate state and trigger updates
|
|
58
|
+
function increment() {
|
|
59
|
+
${name}.value++
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
${name},
|
|
64
|
+
increment,
|
|
65
|
+
}
|
|
66
|
+
`
|
|
67
|
+
});
|
|
68
|
+
consola.success(`Created the ${name} function.`);
|
|
69
|
+
} catch (err) {
|
|
70
|
+
consola.error(err);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export async function language(language2) {
|
|
74
|
+
consola.info("Creating your translation file...");
|
|
75
|
+
try {
|
|
76
|
+
await writeTextFile({
|
|
77
|
+
path: `./lang/${language2}.yml`,
|
|
78
|
+
data: `button:
|
|
79
|
+
text: Copy
|
|
80
|
+
`
|
|
81
|
+
});
|
|
82
|
+
consola.success(`Created the ${language2} translation file.`);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
consola.error(err);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export async function stack(name) {
|
|
88
|
+
consola.info("Creating your stack...");
|
|
89
|
+
try {
|
|
90
|
+
const path = resolve(process.cwd(), name);
|
|
91
|
+
await ezSpawn.async(`giget stacks ${path}`);
|
|
92
|
+
consola.success("Successfully scaffolded your project.");
|
|
93
|
+
consola.info(`cd ${path} && pnpm install`);
|
|
94
|
+
} catch (err) {
|
|
95
|
+
consola.error(err);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function release(): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import consola from "consola";
|
|
2
|
+
import { runNpmScript } from "@stacksjs/helpers";
|
|
3
|
+
import { NpmScript } from "@stacksjs/types";
|
|
4
|
+
export async function release() {
|
|
5
|
+
consola.info("Releasing...");
|
|
6
|
+
await runNpmScript(NpmScript.Release);
|
|
7
|
+
consola.success("Triggered release workflow");
|
|
8
|
+
}
|