stacks 0.37.4 → 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 +7 -2
- 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/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/jiti +0 -17
- package/core/build/node_modules/.bin/mkdist +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/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/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/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/src/cli/actions/build.ts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import Prompts from 'prompts'
|
|
2
|
-
import consola from 'consola'
|
|
3
|
-
import { hasComponents, hasFunctions } from '@stacksjs/fs'
|
|
4
|
-
import { runNpmScript } from '@stacksjs/helpers'
|
|
5
|
-
import { ExitCode, NpmScript } from '@stacksjs/types'
|
|
6
|
-
import { generateTypes } from './types'
|
|
7
|
-
|
|
8
|
-
const { prompts } = Prompts
|
|
9
|
-
|
|
10
|
-
export async function buildComponentLibraries() {
|
|
11
|
-
try {
|
|
12
|
-
await runNpmScript(NpmScript.GenerateEntries)
|
|
13
|
-
await buildVueComponentLibrary()
|
|
14
|
-
await buildWebComponentLibrary()
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
consola.error('There was an error building your component libraries.')
|
|
18
|
-
consola.error(error)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export async function buildVueComponentLibrary() {
|
|
23
|
-
consola.info('Building your component library...')
|
|
24
|
-
|
|
25
|
-
if (hasComponents()) {
|
|
26
|
-
try {
|
|
27
|
-
await runNpmScript(NpmScript.BuildComponents)
|
|
28
|
-
consola.success('Your component library was built successfully.')
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
consola.error('There was an error building your component library.')
|
|
32
|
-
consola.error(error)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
consola.info('No components found.')
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export async function buildWebComponentLibrary() {
|
|
41
|
-
consola.info('Building your component library for production use & npm/CDN distribution...')
|
|
42
|
-
|
|
43
|
-
if (hasComponents()) {
|
|
44
|
-
try {
|
|
45
|
-
await runNpmScript(NpmScript.BuildWebComponents)
|
|
46
|
-
consola.success('Your Web Component library was built successfully.')
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
consola.error('There was an error building your Web Component library.')
|
|
50
|
-
consola.error(error)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
consola.info('No components found.')
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export async function buildDocs() {
|
|
59
|
-
consola.info('Building the Artisan CLI...')
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
await runNpmScript(NpmScript.BuildDocs)
|
|
63
|
-
consola.success('Artisan CLI was built successfully.')
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
consola.error('There was an error building the Artisan CLI.')
|
|
67
|
-
consola.error(error)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export async function buildStacks() {
|
|
72
|
-
consola.info('Building the Stacks Framework...')
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
await runNpmScript(NpmScript.BuildStacks)
|
|
76
|
-
consola.success('Stacks was built successfully.')
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
consola.error('There was an error building the Stacks framework.')
|
|
80
|
-
consola.error(error)
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export async function buildFunctionsLibrary() {
|
|
85
|
-
consola.info('Building your functions library for production use & npm/CDN distribution...')
|
|
86
|
-
|
|
87
|
-
if (hasFunctions()) {
|
|
88
|
-
try {
|
|
89
|
-
await runNpmScript(NpmScript.BuildFunctions)
|
|
90
|
-
consola.success('Your functions library was built successfully.')
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
consola.error('There was an error building your functions library.')
|
|
94
|
-
consola.error(error)
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
consola.info('No functions found.')
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export async function startBuildProcess(options: any) {
|
|
103
|
-
if (options.components || options === 'components') {
|
|
104
|
-
await buildComponentLibraries()
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
else if (options.webComponents || options.elements || options === 'web-components' || options === 'elements') {
|
|
108
|
-
await buildWebComponentLibrary()
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
else if (options.functions || options === 'functions') {
|
|
112
|
-
await buildFunctionsLibrary()
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
else if (options.docs || options === 'docs') {
|
|
116
|
-
await buildDocs()
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
else if (options.stacks || options === 'stacks') {
|
|
120
|
-
await buildStacks()
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
else if (options.npm || options === 'npm') {
|
|
124
|
-
await buildComponentLibraries()
|
|
125
|
-
await buildFunctionsLibrary()
|
|
126
|
-
|
|
127
|
-
consola.success('All your libraries and its types were built successfully to be distributed on npm.')
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
else {
|
|
131
|
-
const answer = await prompts.select({
|
|
132
|
-
type: 'select',
|
|
133
|
-
name: 'build',
|
|
134
|
-
message: 'Which stack are you trying to build for production use?',
|
|
135
|
-
choices: [ // todo: should be a multi-select
|
|
136
|
-
{ title: 'Components', value: 'components' },
|
|
137
|
-
{ title: 'Functions', value: 'functions' },
|
|
138
|
-
// { title: 'Pages', value: 'pages' },
|
|
139
|
-
{ title: 'Docs', value: 'docs' },
|
|
140
|
-
],
|
|
141
|
-
initial: 0,
|
|
142
|
-
})
|
|
143
|
-
|
|
144
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
145
|
-
if (answer === 'components')
|
|
146
|
-
await buildComponentLibraries()
|
|
147
|
-
|
|
148
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
149
|
-
if (answer === 'functions')
|
|
150
|
-
await buildFunctionsLibrary()
|
|
151
|
-
|
|
152
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
153
|
-
else if (answer === 'docs')
|
|
154
|
-
await buildDocs()
|
|
155
|
-
|
|
156
|
-
else process.exit(ExitCode.InvalidArgument)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
await generateTypes()
|
|
160
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import consola from 'consola'
|
|
2
|
-
import { runNpmScript } from '@stacksjs/helpers'
|
|
3
|
-
import { NpmScript } from '@stacksjs/types'
|
|
4
|
-
|
|
5
|
-
export async function commit() {
|
|
6
|
-
consola.info('Committing...')
|
|
7
|
-
await runNpmScript(NpmScript.Commit)
|
|
8
|
-
consola.success('Committed.')
|
|
9
|
-
}
|
package/src/cli/actions/dev.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import Prompts from 'prompts'
|
|
2
|
-
import consola from 'consola'
|
|
3
|
-
import { runNpmScript } from '@stacksjs/helpers'
|
|
4
|
-
import { ExitCode, NpmScript } from '@stacksjs/types'
|
|
5
|
-
|
|
6
|
-
const { prompts } = Prompts
|
|
7
|
-
|
|
8
|
-
export async function startDevelopmentServer(options: any) {
|
|
9
|
-
if (options.components || options === 'components') {
|
|
10
|
-
consola.info('Starting development server for your components...')
|
|
11
|
-
await runNpmScript(NpmScript.DevComponents)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
else if (options.docs || options === 'docs') {
|
|
15
|
-
consola.info('Starting development server for your documentation...')
|
|
16
|
-
await runNpmScript(NpmScript.DevDocs)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
else {
|
|
20
|
-
const answer = await prompts.select({
|
|
21
|
-
type: 'select',
|
|
22
|
-
name: 'development',
|
|
23
|
-
message: 'Which development server are you trying to start?',
|
|
24
|
-
choices: [
|
|
25
|
-
{ title: 'Components', value: 'components' },
|
|
26
|
-
// { title: 'Functions', value: 'functions' },
|
|
27
|
-
// { title: 'Pages', value: 'pages' },
|
|
28
|
-
{ title: 'Docs', value: 'docs' },
|
|
29
|
-
],
|
|
30
|
-
initial: 0,
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
34
|
-
if (answer === 'components') {
|
|
35
|
-
consola.info('Starting development server for your components...')
|
|
36
|
-
await runNpmScript(NpmScript.DevComponents)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
40
|
-
else if (answer === 'docs') {
|
|
41
|
-
consola.info('Starting docs server for your components...')
|
|
42
|
-
await runNpmScript(NpmScript.DevDocs)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
else { process.exit(ExitCode.InvalidArgument) }
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import Prompts from 'prompts'
|
|
2
|
-
import consola from 'consola'
|
|
3
|
-
import { hasComponents } from '@stacksjs/fs'
|
|
4
|
-
import { runNpmScript } from '@stacksjs/helpers'
|
|
5
|
-
import { ExitCode, NpmScript } from '@stacksjs/types'
|
|
6
|
-
|
|
7
|
-
const { prompts } = Prompts
|
|
8
|
-
|
|
9
|
-
export async function testComponentExample() {
|
|
10
|
-
if (hasComponents()) {
|
|
11
|
-
try {
|
|
12
|
-
await runNpmScript(NpmScript.ExampleVue)
|
|
13
|
-
consola.success('Your component library was built successfully.')
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
consola.error('There was an error building your component library.')
|
|
17
|
-
consola.error(error)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
consola.info('No components found.')
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export async function testWebComponentExample() {
|
|
26
|
-
consola.info('Building your Web Component library...')
|
|
27
|
-
|
|
28
|
-
if (hasComponents()) {
|
|
29
|
-
try {
|
|
30
|
-
await runNpmScript(NpmScript.BuildWebComponents)
|
|
31
|
-
consola.success('Your Web Component library was built successfully.')
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
consola.error('There was an error building your Web Component library.')
|
|
35
|
-
consola.error(error)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
consola.info('No components found.')
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export async function runExample(options: any) {
|
|
44
|
-
if (options.components || options === 'components' || options === 'vue') {
|
|
45
|
-
await testComponentExample()
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
else if (options.webComponents || options.elements || options === 'web-components' || options === 'elements') {
|
|
49
|
-
await testWebComponentExample()
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
else {
|
|
53
|
-
const answer = await prompts.select({
|
|
54
|
-
type: 'select',
|
|
55
|
-
name: 'example',
|
|
56
|
-
message: 'Which example are you trying to view?',
|
|
57
|
-
choices: [
|
|
58
|
-
{ title: 'Components', value: 'components' },
|
|
59
|
-
{ title: 'Web Components', value: 'web-components' },
|
|
60
|
-
],
|
|
61
|
-
initial: 0,
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
65
|
-
if (answer === 'components')
|
|
66
|
-
await testComponentExample()
|
|
67
|
-
|
|
68
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
69
|
-
if (answer === 'web-components')
|
|
70
|
-
await testWebComponentExample()
|
|
71
|
-
|
|
72
|
-
else process.exit(ExitCode.InvalidArgument)
|
|
73
|
-
}
|
|
74
|
-
}
|
package/src/cli/actions/fresh.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import consola from 'consola'
|
|
2
|
-
import { runNpmScript } from '@stacksjs/helpers'
|
|
3
|
-
import { NpmScript } from '@stacksjs/types'
|
|
4
|
-
|
|
5
|
-
export async function reinstallNpmDependencies() {
|
|
6
|
-
consola.info('Reinstalling your npm dependencies...')
|
|
7
|
-
await runNpmScript(NpmScript.Fresh)
|
|
8
|
-
consola.success('Successfully reinstalled your npm dependencies.')
|
|
9
|
-
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import consola from 'consola'
|
|
2
|
-
import Prompts from 'prompts'
|
|
3
|
-
import { runNpmScript } from '@stacksjs/helpers'
|
|
4
|
-
import { ExitCode, NpmScript } from '@stacksjs/types'
|
|
5
|
-
import { lintFix } from './lint'
|
|
6
|
-
import { generateTypes } from './types'
|
|
7
|
-
|
|
8
|
-
const { prompts } = Prompts
|
|
9
|
-
|
|
10
|
-
export async function generateLibEntries() {
|
|
11
|
-
try {
|
|
12
|
-
await runNpmScript(NpmScript.GenerateEntries, 'ignore')
|
|
13
|
-
consola.success('Library entry points were generated successfully.')
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
consola.error('There was an error generating your library entry points.')
|
|
17
|
-
consola.error(error)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function generateVueCompat() {
|
|
22
|
-
try {
|
|
23
|
-
await runNpmScript(NpmScript.GenerateVueCompat, 'ignore')
|
|
24
|
-
consola.success('Vue 2 & 3 compatibility was generated successfully.')
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
consola.error('There was an error generating Vue compatibility.')
|
|
28
|
-
consola.error(error)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function generateWebTypes() {
|
|
33
|
-
try {
|
|
34
|
-
await runNpmScript(NpmScript.GenerateWebTypes, 'ignore')
|
|
35
|
-
consola.success('Successfully generated the web-types.json file.')
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
consola.error('There was an error generating the web-types.json file')
|
|
39
|
-
consola.error(error)
|
|
40
|
-
process.exit(ExitCode.FatalError)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export async function generateVsCodeCustomData() {
|
|
45
|
-
try {
|
|
46
|
-
await runNpmScript(NpmScript.GenerateVsCodeCustomData, 'ignore')
|
|
47
|
-
await lintFix('ignore') // the created json file needs to be linted
|
|
48
|
-
consola.success('Successfully generated the custom-elements.json file.')
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
consola.error('There was an error generating the custom-elements.json file')
|
|
52
|
-
consola.error(error)
|
|
53
|
-
process.exit(ExitCode.FatalError)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export async function generateIdeHelpers() {
|
|
58
|
-
try {
|
|
59
|
-
await runNpmScript(NpmScript.GenerateIdeHelpers, 'ignore')
|
|
60
|
-
await lintFix('ignore') // the created json file needs to be linted
|
|
61
|
-
consola.success('Successfully generated IDE helpers.')
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
consola.error('There was an error generating IDE helpers.')
|
|
65
|
-
consola.error(error)
|
|
66
|
-
process.exit(ExitCode.FatalError)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export async function generateComponentMeta() {
|
|
71
|
-
try {
|
|
72
|
-
await runNpmScript(NpmScript.GenerateComponentMeta, 'ignore')
|
|
73
|
-
await lintFix('ignore') // the created json file needs to be linted
|
|
74
|
-
consola.success('Successfully generated component meta.')
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
consola.error('There was an error generating your component meta information.')
|
|
78
|
-
consola.error(error)
|
|
79
|
-
process.exit(ExitCode.FatalError)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export async function startGenerationProcess(options: any) {
|
|
84
|
-
if (options.types || options === 'types') {
|
|
85
|
-
await generateTypes()
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
else if (options.entries || options === 'entries') {
|
|
89
|
-
await generateLibEntries()
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
else if (options.webTypes || options === 'web-types') {
|
|
93
|
-
await generateWebTypes()
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
else if (options.customData || options === 'custom-data') {
|
|
97
|
-
await generateVsCodeCustomData()
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
else if (options.ideHelpers || options === 'ide-helpers') {
|
|
101
|
-
await generateIdeHelpers()
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
else if (options.vueCompatibility || options === 'vue-compatibility') {
|
|
105
|
-
await generateVueCompat()
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
else if (options.componentMeta || options === 'component-meta') {
|
|
109
|
-
await generateComponentMeta()
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
else {
|
|
113
|
-
const answer = await prompts.select({
|
|
114
|
-
type: 'select',
|
|
115
|
-
name: 'generate',
|
|
116
|
-
message: 'What are you trying to generate?',
|
|
117
|
-
choices: [ // todo: should be a multi-select
|
|
118
|
-
{ title: '1.) TypeScript Types', value: 'types' },
|
|
119
|
-
{ title: '2.) Library Entry Points', value: 'entries' },
|
|
120
|
-
{ title: '3.) Web Types', value: 'web-types' },
|
|
121
|
-
{ title: '4.) VS Code Custom Data', value: 'custom-data' },
|
|
122
|
-
{ title: '5.) IDE Helpers', value: 'ide-helpers' },
|
|
123
|
-
{ title: '6.) Vue 2 & 3 Compatibility', value: 'vue-compatibility' },
|
|
124
|
-
{ title: '7.) Component Meta', value: 'component-meta' },
|
|
125
|
-
],
|
|
126
|
-
initial: 0,
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
130
|
-
if (answer === 'types')
|
|
131
|
-
await generateTypes()
|
|
132
|
-
|
|
133
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
134
|
-
else if (answer === 'entries')
|
|
135
|
-
await generateLibEntries()
|
|
136
|
-
|
|
137
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
138
|
-
else if (answer === 'web-types')
|
|
139
|
-
await generateWebTypes()
|
|
140
|
-
|
|
141
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
142
|
-
else if (answer === 'custom-data')
|
|
143
|
-
await generateVsCodeCustomData()
|
|
144
|
-
|
|
145
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
146
|
-
else if (answer === 'ide-helpers')
|
|
147
|
-
await generateIdeHelpers()
|
|
148
|
-
|
|
149
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
150
|
-
else if (answer === 'vue-compatibility')
|
|
151
|
-
await generateVueCompat()
|
|
152
|
-
|
|
153
|
-
// @ts-expect-error the answer object type expects to return a void type but it returns a string
|
|
154
|
-
else if (answer === 'component-meta')
|
|
155
|
-
await generateComponentMeta()
|
|
156
|
-
|
|
157
|
-
else process.exit(ExitCode.InvalidArgument)
|
|
158
|
-
}
|
|
159
|
-
}
|
package/src/cli/actions/index.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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'
|
package/src/cli/actions/key.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { getRandomValues } from 'node:crypto'
|
|
2
|
-
import consola from 'consola'
|
|
3
|
-
import ezSpawn from '@jsdevtools/ez-spawn'
|
|
4
|
-
// import { generateAppKey } from '@stacksjs/security'
|
|
5
|
-
import { projectPath } from '@stacksjs/paths'
|
|
6
|
-
import { setEnvValue } from '@stacksjs/helpers'
|
|
7
|
-
import { isFile } from '@stacksjs/fs'
|
|
8
|
-
import utf8 from 'crypto-js/enc-utf8'
|
|
9
|
-
import base64 from 'crypto-js/enc-base64'
|
|
10
|
-
|
|
11
|
-
export async function generateAppKey() {
|
|
12
|
-
const random = getRandomValues(new Uint8Array(32))
|
|
13
|
-
const encodedWord = utf8.parse(random.toString())
|
|
14
|
-
const key = base64.stringify(encodedWord)
|
|
15
|
-
|
|
16
|
-
return `base64:${key}`
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function generate() {
|
|
20
|
-
consola.info('Setting random application key.')
|
|
21
|
-
|
|
22
|
-
// if the .env file does not exist, ensure it is created
|
|
23
|
-
if (!isFile('.env'))
|
|
24
|
-
await ezSpawn.async('cp .env.example .env', { stdio: 'inherit', cwd: projectPath() })
|
|
25
|
-
|
|
26
|
-
await setEnvValue('APP_KEY', await generateAppKey())
|
|
27
|
-
|
|
28
|
-
consola.success('Application key set.')
|
|
29
|
-
|
|
30
|
-
return true
|
|
31
|
-
}
|
package/src/cli/actions/lint.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import consola from 'consola'
|
|
2
|
-
import { runNpmScript } from '@stacksjs/helpers'
|
|
3
|
-
import { NpmScript } from '@stacksjs/types'
|
|
4
|
-
|
|
5
|
-
export async function lint(debug: 'ignore' | 'inherit' = 'inherit') {
|
|
6
|
-
consola.info('Linting your codebase...')
|
|
7
|
-
await runNpmScript(NpmScript.Lint, debug)
|
|
8
|
-
consola.success('Successfully linted your codebase.')
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export async function lintFix(debug: 'ignore' | 'inherit' = 'inherit') {
|
|
12
|
-
if (debug !== 'ignore')
|
|
13
|
-
consola.info('Fixing lint errors...')
|
|
14
|
-
|
|
15
|
-
await runNpmScript(NpmScript.LintFix, debug)
|
|
16
|
-
|
|
17
|
-
if (debug !== 'ignore')
|
|
18
|
-
consola.success('Fixed lint errors.')
|
|
19
|
-
}
|
package/src/cli/actions/make.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
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
|
-
|
|
6
|
-
export async function component(name: string) {
|
|
7
|
-
consola.info('Creating your component...')
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
await writeTextFile({
|
|
11
|
-
path: `./components/${name}.vue`,
|
|
12
|
-
data: `<script setup lang="ts">
|
|
13
|
-
// eslint-disable-next-line no-console
|
|
14
|
-
console.log('Hello World component created')
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<template>
|
|
18
|
-
<div>
|
|
19
|
-
Some HTML block
|
|
20
|
-
</div>
|
|
21
|
-
</template>
|
|
22
|
-
`,
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
consola.success(`Created the ${name} component.`)
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
consola.error(err)
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function page(name: string) {
|
|
33
|
-
consola.info('Creating your component...')
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
await writeTextFile({
|
|
37
|
-
path: `./pages/${name}.vue`,
|
|
38
|
-
data: `<script setup lang="ts">
|
|
39
|
-
// eslint-disable-next-line no-console
|
|
40
|
-
console.log('Hello World page created')
|
|
41
|
-
</script>
|
|
42
|
-
|
|
43
|
-
<template>
|
|
44
|
-
<div>
|
|
45
|
-
Visit http://127.0.0.1/${name}
|
|
46
|
-
</div>
|
|
47
|
-
</template>
|
|
48
|
-
`,
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
consola.success(`Created the ${name} page.`)
|
|
52
|
-
}
|
|
53
|
-
catch (err) {
|
|
54
|
-
consola.error(err)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export async function fx(name: string) {
|
|
59
|
-
consola.info('Creating your function...')
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
await writeTextFile({
|
|
63
|
-
path: `./functions/${name}.ts`,
|
|
64
|
-
data: `// reactive state
|
|
65
|
-
const ${name} = ref(0)
|
|
66
|
-
|
|
67
|
-
// functions that mutate state and trigger updates
|
|
68
|
-
function increment() {
|
|
69
|
-
${name}.value++
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export {
|
|
73
|
-
${name},
|
|
74
|
-
increment,
|
|
75
|
-
}
|
|
76
|
-
`,
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
consola.success(`Created the ${name} function.`)
|
|
80
|
-
}
|
|
81
|
-
catch (err) {
|
|
82
|
-
consola.error(err)
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export async function language(language: string) {
|
|
87
|
-
consola.info('Creating your translation file...')
|
|
88
|
-
|
|
89
|
-
try {
|
|
90
|
-
await writeTextFile({
|
|
91
|
-
path: `./lang/${language}.yml`,
|
|
92
|
-
data: `button:
|
|
93
|
-
text: Copy
|
|
94
|
-
`,
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
consola.success(`Created the ${language} translation file.`)
|
|
98
|
-
}
|
|
99
|
-
catch (err) {
|
|
100
|
-
consola.error(err)
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export async function stack(name: string) {
|
|
105
|
-
consola.info('Creating your stack...')
|
|
106
|
-
|
|
107
|
-
try {
|
|
108
|
-
const path = resolve(process.cwd(), name)
|
|
109
|
-
await ezSpawn.async(`giget stacks ${path}`)
|
|
110
|
-
consola.success('Successfully scaffolded your project.')
|
|
111
|
-
consola.info(`cd ${path} && pnpm install`)
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
consola.error(err)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import consola from 'consola'
|
|
2
|
-
import { runNpmScript } from '@stacksjs/helpers'
|
|
3
|
-
import { NpmScript } from '@stacksjs/types'
|
|
4
|
-
|
|
5
|
-
export async function release() {
|
|
6
|
-
consola.info('Releasing...')
|
|
7
|
-
await runNpmScript(NpmScript.Release)
|
|
8
|
-
consola.success('Triggered release workflow')
|
|
9
|
-
}
|
package/src/cli/actions/test.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import consola from 'consola'
|
|
2
|
-
import { runNpmScript } from '@stacksjs/helpers'
|
|
3
|
-
import { NpmScript } from '@stacksjs/types'
|
|
4
|
-
|
|
5
|
-
export async function typecheck() {
|
|
6
|
-
consola.info('Typechecking your codebase...')
|
|
7
|
-
|
|
8
|
-
try {
|
|
9
|
-
await runNpmScript(NpmScript.TestTypes)
|
|
10
|
-
consola.success('Finished typechecking your codebase.')
|
|
11
|
-
}
|
|
12
|
-
catch (error) {
|
|
13
|
-
consola.error(error)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export async function runTestSuite() {
|
|
18
|
-
consola.info('Running your test suite...')
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
await runNpmScript(NpmScript.Test)
|
|
22
|
-
consola.success('Completed running the test suite.')
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
consola.error(error)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function generateTestCoverageReport() {
|
|
30
|
-
consola.info('Generating a test coverage report...')
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
await runNpmScript(NpmScript.TestCoverage)
|
|
34
|
-
consola.success('Generated the test coverage report.')
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
consola.error(error)
|
|
38
|
-
}
|
|
39
|
-
}
|