@stacksjs/actions 0.58.73 → 0.59.2
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/dist/action.d.ts +36 -0
- package/dist/add.d.ts +6 -0
- package/dist/build/component-libs.d.ts +1 -0
- package/dist/build/core.d.ts +1 -0
- package/dist/build/stacks.d.ts +1 -0
- package/dist/build.d.ts +9 -0
- package/dist/bump.d.ts +1 -0
- package/dist/changelog.d.ts +1 -0
- package/dist/clean.d.ts +1 -0
- package/dist/commit.d.ts +3 -0
- package/dist/copy-types.d.ts +5 -0
- package/dist/database/seed.d.ts +1 -0
- package/dist/deploy/index.d.ts +1 -0
- package/dist/dev/components.d.ts +1 -0
- package/dist/dev/docs.d.ts +1 -0
- package/dist/dev/index.d.ts +10 -0
- package/dist/examples.d.ts +5 -0
- package/dist/fresh.d.ts +1 -0
- package/dist/generate/component-meta.d.ts +5 -0
- package/dist/generate/ide-helpers.d.ts +6 -0
- package/dist/generate/index.d.ts +13 -0
- package/dist/generate/lib-entries.d.ts +2 -0
- package/dist/generate/vscode-custom-data.d.ts +6 -0
- package/dist/helpers/component-meta.d.ts +22 -0
- package/dist/helpers/lib-entries.d.ts +13 -0
- package/dist/helpers/package-json.d.ts +3 -0
- package/dist/helpers/utils.d.ts +18 -0
- package/dist/helpers/vscode-custom-data.d.ts +2 -0
- package/dist/index.d.ts +7 -0
- package/dist/key-generate.d.ts +1 -0
- package/dist/lint/fix.d.ts +1 -0
- package/dist/lint/index.d.ts +1 -0
- package/dist/make.d.ts +20 -0
- package/dist/prepublish.d.ts +1 -0
- package/dist/release.d.ts +2 -0
- package/dist/test/coverage.d.ts +1 -0
- package/dist/test/feature.d.ts +1 -0
- package/dist/test/ui.d.ts +1 -0
- package/dist/test/unit.d.ts +1 -0
- package/dist/test.d.ts +1 -0
- package/dist/tinker.d.ts +1 -0
- package/dist/typecheck.d.ts +1 -0
- package/dist/types.d.ts +3 -0
- package/dist/upgrade/dependencies.d.ts +1 -0
- package/dist/upgrade/framework.d.ts +1 -0
- package/dist/upgrade/index.d.ts +1 -0
- package/dist/upgrade.d.ts +4 -0
- package/package.json +5 -3
- package/src/bump.ts +8 -3
- package/src/check/ports.ts +11 -8
- package/src/deploy/index.ts +2 -6
- package/src/dev/index.ts +1 -1
- package/src/find-projects.ts +1 -1
- package/src/generate/index.ts +1 -1
- package/src/helpers/utils.ts +10 -14
- package/src/index.ts +1 -2
- package/src/lint/fix.ts +1 -0
- package/src/upgrade/shell.ts +5 -5
- package/dist/src/add.js +0 -29
- package/dist/src/build/component-libs.js +0 -6
- package/dist/src/build/core.js +0 -21
- package/dist/src/build/stacks.js +0 -8
- package/dist/src/build.js +0 -219
- package/dist/src/bump.js +0 -14
- package/dist/src/changelog.js +0 -17
- package/dist/src/clean.js +0 -6
- package/dist/src/commit.js +0 -17
- package/dist/src/copy-types.js +0 -14
- package/dist/src/database/seed.js +0 -1
- package/dist/src/deploy/index.js +0 -31
- package/dist/src/dev/components.js +0 -11
- package/dist/src/dev/docs.js +0 -7
- package/dist/src/dev/index.js +0 -92
- package/dist/src/examples.js +0 -43
- package/dist/src/fresh.js +0 -18
- package/dist/src/generate/component-meta.js +0 -59
- package/dist/src/generate/ide-helpers.js +0 -91
- package/dist/src/generate/index.js +0 -154
- package/dist/src/generate/lib-entries.js +0 -170
- package/dist/src/generate/vscode-custom-data.js +0 -91
- package/dist/src/helpers/component-meta.js +0 -50
- package/dist/src/helpers/index.js +0 -48
- package/dist/src/helpers/lib-entries.js +0 -161
- package/dist/src/helpers/package-json.js +0 -136
- package/dist/src/helpers/utils.js +0 -48
- package/dist/src/helpers/vscode-custom-data.js +0 -83
- package/dist/src/index.js +0 -590
- package/dist/src/key-generate.js +0 -10
- package/dist/src/lint/fix.js +0 -12
- package/dist/src/lint/index.js +0 -17
- package/dist/src/make.js +0 -291
- package/dist/src/prepublish.js +0 -14
- package/dist/src/release.js +0 -559
- package/dist/src/test/coverage.js +0 -6
- package/dist/src/test/feature.js +0 -6
- package/dist/src/test/ui.js +0 -6
- package/dist/src/test/unit.js +0 -6
- package/dist/src/test.js +0 -6
- package/dist/src/tinker.js +0 -5
- package/dist/src/typecheck.js +0 -6
- package/dist/src/types.js +0 -21
- package/dist/src/upgrade/dependencies.js +0 -6
- package/dist/src/upgrade/framework.js +0 -1
- package/dist/src/upgrade/index.js +0 -58
- package/dist/src/upgrade.js +0 -47
- package/src/generate/caddyfile.ts +0 -44
- package/src/helpers/index.ts +0 -1
- package/src/start-caddy.ts +0 -13
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/helpers/lib-entries.ts
|
|
3
|
-
import process from "process";
|
|
4
|
-
import {log} from "@stacksjs/logging";
|
|
5
|
-
import {kebabCase} from "@stacksjs/strings";
|
|
6
|
-
import {componentsPath, functionsPath, libraryEntryPath} from "@stacksjs/path";
|
|
7
|
-
import {writeTextFile} from "@stacksjs/storage";
|
|
8
|
-
import {determineResetPreset} from "@stacksjs/utils";
|
|
9
|
-
import {ExitCode} from "@stacksjs/types";
|
|
10
|
-
|
|
11
|
-
// ../../../../config/library.ts
|
|
12
|
-
var library_default = {
|
|
13
|
-
name: "hello-world",
|
|
14
|
-
owner: "@stacksjs",
|
|
15
|
-
repository: "stacksjs/stacks",
|
|
16
|
-
license: "MIT",
|
|
17
|
-
author: "Chris Breuer",
|
|
18
|
-
contributors: ["Chris Breuer <chris@stacksjs.org>"],
|
|
19
|
-
defaultLanguage: "en",
|
|
20
|
-
releaseable: true,
|
|
21
|
-
vueComponents: {
|
|
22
|
-
name: "hello-world-vue",
|
|
23
|
-
description: "Your Vue component library description",
|
|
24
|
-
keywords: ["component", "library", "vue", "vite", "typescript", "javascript"],
|
|
25
|
-
tags: [{
|
|
26
|
-
name: ["HelloWorld", "AppHelloWorld"],
|
|
27
|
-
description: "The Hello World custom element, built via this framework.",
|
|
28
|
-
attributes: [{
|
|
29
|
-
name: "greeting",
|
|
30
|
-
description: "The greeting."
|
|
31
|
-
}]
|
|
32
|
-
}]
|
|
33
|
-
},
|
|
34
|
-
webComponents: {
|
|
35
|
-
name: "hello-world-elements",
|
|
36
|
-
description: "Your framework agnostic web component library description.",
|
|
37
|
-
keywords: ["custom-elements", "web-components", "library", "framework-agnostic", "typescript", "javascript"],
|
|
38
|
-
tags: [{
|
|
39
|
-
name: ["HelloWorld", "AppHelloWorld"],
|
|
40
|
-
description: "The Hello World custom element, built via this framework.",
|
|
41
|
-
attributes: [{
|
|
42
|
-
name: "greeting",
|
|
43
|
-
description: "The greeting."
|
|
44
|
-
}]
|
|
45
|
-
}]
|
|
46
|
-
},
|
|
47
|
-
functions: {
|
|
48
|
-
name: "hello-world-fx",
|
|
49
|
-
description: "Your function library description.",
|
|
50
|
-
keywords: ["functions", "composables", "library", "typescript", "javascript"],
|
|
51
|
-
shouldGenerateSourcemap: false,
|
|
52
|
-
functions: [
|
|
53
|
-
"counter",
|
|
54
|
-
"dark"
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
// src/helpers/lib-entries.ts
|
|
60
|
-
async function generateLibEntry(type) {
|
|
61
|
-
await createLibraryEntryPoint(type);
|
|
62
|
-
}
|
|
63
|
-
async function createLibraryEntryPoint(type) {
|
|
64
|
-
if (type === "vue-components")
|
|
65
|
-
await createVueLibraryEntryPoint();
|
|
66
|
-
if (type === "web-components")
|
|
67
|
-
await createWebComponentLibraryEntryPoint();
|
|
68
|
-
if (type === "functions")
|
|
69
|
-
await createFunctionLibraryEntryPoint();
|
|
70
|
-
}
|
|
71
|
-
async function createVueLibraryEntryPoint(type = "vue-components") {
|
|
72
|
-
log.info("Ensuring Component Library Entry Point...");
|
|
73
|
-
await writeTextFile({
|
|
74
|
-
path: libraryEntryPath(type),
|
|
75
|
-
data: generateEntryPointData(type)
|
|
76
|
-
}).catch((err) => {
|
|
77
|
-
log.error("There was an error generating the Vue Component Library Entry Point.", err);
|
|
78
|
-
process.exit(ExitCode.FatalError);
|
|
79
|
-
});
|
|
80
|
-
log.success("Created Vue Component Library Entry Point");
|
|
81
|
-
}
|
|
82
|
-
async function createWebComponentLibraryEntryPoint(type = "web-components") {
|
|
83
|
-
log.info("Ensuring Web Component Library Entry Point...");
|
|
84
|
-
await writeTextFile({
|
|
85
|
-
path: libraryEntryPath(type),
|
|
86
|
-
data: generateEntryPointData(type)
|
|
87
|
-
}).catch((err) => {
|
|
88
|
-
log.error("There was an error generating the Web Component library entry point", err);
|
|
89
|
-
process.exit(ExitCode.FatalError);
|
|
90
|
-
});
|
|
91
|
-
log.success("Created Web Component Library Entry Point");
|
|
92
|
-
}
|
|
93
|
-
async function createFunctionLibraryEntryPoint(type = "functions") {
|
|
94
|
-
log.info("Ensuring Function Library Entry Point...");
|
|
95
|
-
await writeTextFile({
|
|
96
|
-
path: libraryEntryPath(type),
|
|
97
|
-
data: generateEntryPointData(type)
|
|
98
|
-
}).catch((err) => {
|
|
99
|
-
log.error("There was an error generating Function Library Entry Point", err);
|
|
100
|
-
process.exit(ExitCode.FatalError);
|
|
101
|
-
});
|
|
102
|
-
log.success("Created Functions Library Entry Point");
|
|
103
|
-
}
|
|
104
|
-
function generateEntryPointData(type) {
|
|
105
|
-
let arr = [];
|
|
106
|
-
if (type === "functions") {
|
|
107
|
-
if (!library_default.functions?.functions) {
|
|
108
|
-
log.error(new Error("There are no functions defined to be built. Please check your config/library.ts file for potential adjustments"));
|
|
109
|
-
process.exit();
|
|
110
|
-
}
|
|
111
|
-
for (const fx of library_default.functions?.functions) {
|
|
112
|
-
if (Array.isArray(fx))
|
|
113
|
-
arr.push(`export * as ${fx[1]} from '${functionsPath(fx[0])}'`);
|
|
114
|
-
else
|
|
115
|
-
arr.push(`export * from '${functionsPath(fx)}'`);
|
|
116
|
-
}
|
|
117
|
-
return arr.join("\r\n");
|
|
118
|
-
}
|
|
119
|
-
if (type === "vue-components") {
|
|
120
|
-
if (!library_default.vueComponents?.tags) {
|
|
121
|
-
log.error(new Error("There are no components defined to be built. Please check your config/library.ts file for potential adjustments"));
|
|
122
|
-
process.exit();
|
|
123
|
-
}
|
|
124
|
-
arr = determineResetPreset();
|
|
125
|
-
for (const component of library_default.vueComponents?.tags.map((tag) => tag.name)) {
|
|
126
|
-
if (Array.isArray(component))
|
|
127
|
-
arr.push(`export { default as ${component[1]} } from '${componentsPath(component[0])}.stx'`);
|
|
128
|
-
else
|
|
129
|
-
arr.push(`export { default as ${component} } from '${componentsPath(component)}.stx'`);
|
|
130
|
-
}
|
|
131
|
-
return arr.join("\r\n");
|
|
132
|
-
}
|
|
133
|
-
arr = determineResetPreset();
|
|
134
|
-
const imports = [...arr, "import { defineCustomElement } from \'vue\'"];
|
|
135
|
-
const declarations = [];
|
|
136
|
-
const definitions = [];
|
|
137
|
-
if (!library_default.webComponents?.tags) {
|
|
138
|
-
log.error(new Error("There are no components defined to be built. Please check your config/library.ts file for potential adjustments"));
|
|
139
|
-
process.exit();
|
|
140
|
-
}
|
|
141
|
-
for (const component of library_default.webComponents?.tags.map((tag) => tag.name)) {
|
|
142
|
-
if (Array.isArray(component)) {
|
|
143
|
-
imports.push(`import ${component[1]} from '${componentsPath(component[0])}.stx'`);
|
|
144
|
-
declarations.push(`const ${component[1]}CustomElement = defineCustomElement(${component[1]})`);
|
|
145
|
-
definitions.push(`customElements.define('${kebabCase(component[1])}', ${component[1]}CustomElement)`);
|
|
146
|
-
} else {
|
|
147
|
-
imports.push(`import ${component} from '${componentsPath(component)}.stx'`);
|
|
148
|
-
declarations.push(`const ${component}CustomElement = defineCustomElement(${component})`);
|
|
149
|
-
definitions.push(`customElements.define('${kebabCase(component)}', ${component}CustomElement)`);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return [...imports, ...declarations, ...definitions].join("\r\n");
|
|
153
|
-
}
|
|
154
|
-
export {
|
|
155
|
-
generateLibEntry,
|
|
156
|
-
generateEntryPointData,
|
|
157
|
-
createWebComponentLibraryEntryPoint,
|
|
158
|
-
createVueLibraryEntryPoint,
|
|
159
|
-
createLibraryEntryPoint,
|
|
160
|
-
createFunctionLibraryEntryPoint
|
|
161
|
-
};
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/helpers/package-json.ts
|
|
3
|
-
import {log} from "@stacksjs/logging";
|
|
4
|
-
import {writeTextFile} from "@stacksjs/storage";
|
|
5
|
-
import {packageJsonPath} from "@stacksjs/path";
|
|
6
|
-
|
|
7
|
-
// ../../../../config/library.ts
|
|
8
|
-
var library_default = {
|
|
9
|
-
name: "hello-world",
|
|
10
|
-
owner: "@stacksjs",
|
|
11
|
-
repository: "stacksjs/stacks",
|
|
12
|
-
license: "MIT",
|
|
13
|
-
author: "Chris Breuer",
|
|
14
|
-
contributors: ["Chris Breuer <chris@stacksjs.org>"],
|
|
15
|
-
defaultLanguage: "en",
|
|
16
|
-
releaseable: true,
|
|
17
|
-
vueComponents: {
|
|
18
|
-
name: "hello-world-vue",
|
|
19
|
-
description: "Your Vue component library description",
|
|
20
|
-
keywords: ["component", "library", "vue", "vite", "typescript", "javascript"],
|
|
21
|
-
tags: [{
|
|
22
|
-
name: ["HelloWorld", "AppHelloWorld"],
|
|
23
|
-
description: "The Hello World custom element, built via this framework.",
|
|
24
|
-
attributes: [{
|
|
25
|
-
name: "greeting",
|
|
26
|
-
description: "The greeting."
|
|
27
|
-
}]
|
|
28
|
-
}]
|
|
29
|
-
},
|
|
30
|
-
webComponents: {
|
|
31
|
-
name: "hello-world-elements",
|
|
32
|
-
description: "Your framework agnostic web component library description.",
|
|
33
|
-
keywords: ["custom-elements", "web-components", "library", "framework-agnostic", "typescript", "javascript"],
|
|
34
|
-
tags: [{
|
|
35
|
-
name: ["HelloWorld", "AppHelloWorld"],
|
|
36
|
-
description: "The Hello World custom element, built via this framework.",
|
|
37
|
-
attributes: [{
|
|
38
|
-
name: "greeting",
|
|
39
|
-
description: "The greeting."
|
|
40
|
-
}]
|
|
41
|
-
}]
|
|
42
|
-
},
|
|
43
|
-
functions: {
|
|
44
|
-
name: "hello-world-fx",
|
|
45
|
-
description: "Your function library description.",
|
|
46
|
-
keywords: ["functions", "composables", "library", "typescript", "javascript"],
|
|
47
|
-
shouldGenerateSourcemap: false,
|
|
48
|
-
functions: [
|
|
49
|
-
"counter",
|
|
50
|
-
"dark"
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// src/helpers/package-json.ts
|
|
56
|
-
async function generatePackageJson(type) {
|
|
57
|
-
let name, description, directory, keywords, config, prettyName;
|
|
58
|
-
if (type === "vue-components") {
|
|
59
|
-
name = library_default.vueComponents?.name;
|
|
60
|
-
description = library_default.vueComponents?.description;
|
|
61
|
-
directory = "components";
|
|
62
|
-
keywords = library_default.vueComponents?.keywords;
|
|
63
|
-
config = "vue-components";
|
|
64
|
-
} else if (type === "web-components") {
|
|
65
|
-
name = library_default.webComponents?.name;
|
|
66
|
-
description = library_default.webComponents?.description;
|
|
67
|
-
directory = "components";
|
|
68
|
-
keywords = library_default.webComponents?.keywords;
|
|
69
|
-
config = "web-components";
|
|
70
|
-
} else if (type === "functions") {
|
|
71
|
-
name = library_default.functions?.name;
|
|
72
|
-
description = library_default.functions?.description;
|
|
73
|
-
directory = "functions";
|
|
74
|
-
keywords = library_default.functions?.keywords;
|
|
75
|
-
config = "functions";
|
|
76
|
-
}
|
|
77
|
-
try {
|
|
78
|
-
await writeTextFile({
|
|
79
|
-
path: packageJsonPath(type),
|
|
80
|
-
data: `{
|
|
81
|
-
"name": "${name}",
|
|
82
|
-
"type": "module",
|
|
83
|
-
"version": "",
|
|
84
|
-
"packageManager": "bun",
|
|
85
|
-
"description": "${description}",
|
|
86
|
-
"author": "${library_default.author}",
|
|
87
|
-
"license": "MIT",
|
|
88
|
-
"homepage": "https://github.com/${library_default.repository}/tree/main/${directory}#readme",
|
|
89
|
-
"repository": {
|
|
90
|
-
"type": "git",
|
|
91
|
-
"url": "git+https://github.com/${library_default.repository}.git",
|
|
92
|
-
"directory": "${directory}"
|
|
93
|
-
},
|
|
94
|
-
"bugs": {
|
|
95
|
-
"url": "https://github.com/${library_default.repository}/issues"
|
|
96
|
-
},
|
|
97
|
-
"keywords": ${JSON.stringify(keywords)},
|
|
98
|
-
"contributors": ${JSON.stringify(library_default.contributors)},
|
|
99
|
-
"exports": {
|
|
100
|
-
".": {
|
|
101
|
-
"types": "./dist/index.d.ts",
|
|
102
|
-
"require": "./dist/index.cjs",
|
|
103
|
-
"import": "./dist/index.js"
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
"main": "dist/index.cjs",
|
|
107
|
-
"module": "dist/index.js",
|
|
108
|
-
"types": "dist/index.d.ts",
|
|
109
|
-
"files": [
|
|
110
|
-
"dist",
|
|
111
|
-
"README.md"
|
|
112
|
-
],
|
|
113
|
-
"scripts": {
|
|
114
|
-
"build": "vite build -c ../build/${config}.ts",
|
|
115
|
-
"prepublishOnly": "bun --bun run build"
|
|
116
|
-
},
|
|
117
|
-
"devDependencies": {
|
|
118
|
-
"stacks": "workspace:*"
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
`
|
|
122
|
-
});
|
|
123
|
-
if (type === "vue-components")
|
|
124
|
-
prettyName = "Vue Component library";
|
|
125
|
-
else if (type === "web-components")
|
|
126
|
-
prettyName = "Web Component library";
|
|
127
|
-
else if (type === "functions")
|
|
128
|
-
prettyName = "Function Library";
|
|
129
|
-
log.success(`Created ${prettyName} package.json file`);
|
|
130
|
-
} catch (err) {
|
|
131
|
-
log.error(`There was an error creating the ${prettyName} package.json`, err);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
export {
|
|
135
|
-
generatePackageJson
|
|
136
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/helpers/utils.ts
|
|
3
|
-
import * as storage from "@stacksjs/storage";
|
|
4
|
-
import {buddyOptions, runCommand, runCommands} from "@stacksjs/cli";
|
|
5
|
-
import {log} from "@stacksjs/logging";
|
|
6
|
-
import * as p from "@stacksjs/path";
|
|
7
|
-
import {err, handleError} from "@stacksjs/error-handling";
|
|
8
|
-
async function runAction(action, options) {
|
|
9
|
-
const opts = buddyOptions();
|
|
10
|
-
const path = p.relativeActionsPath(`${action}.ts`);
|
|
11
|
-
const cmd = `bun --bun ${path} ${opts}`.trimEnd();
|
|
12
|
-
const optionsWithCwd = {
|
|
13
|
-
cwd: options?.cwd || p.projectPath(),
|
|
14
|
-
...options
|
|
15
|
-
};
|
|
16
|
-
log.debug("runAction:", cmd);
|
|
17
|
-
log.debug("action options:", optionsWithCwd);
|
|
18
|
-
if (!hasAction(action))
|
|
19
|
-
return err(handleError(`The specified action "${action}" does not exist`));
|
|
20
|
-
return await runCommand(cmd, optionsWithCwd);
|
|
21
|
-
}
|
|
22
|
-
async function runActions(actions, options) {
|
|
23
|
-
log.debug("runActions:", actions);
|
|
24
|
-
log.debug("actions options:", options);
|
|
25
|
-
if (!actions.length)
|
|
26
|
-
return err("No actions were specified");
|
|
27
|
-
for (const action of actions) {
|
|
28
|
-
if (!hasAction(action))
|
|
29
|
-
return err(`The specified action "${action}" does not exist`);
|
|
30
|
-
}
|
|
31
|
-
const opts = buddyOptions();
|
|
32
|
-
const o = {
|
|
33
|
-
cwd: options?.cwd || p.projectPath(),
|
|
34
|
-
...options
|
|
35
|
-
};
|
|
36
|
-
const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`);
|
|
37
|
-
return await runCommands(commands, o);
|
|
38
|
-
}
|
|
39
|
-
function hasAction(action) {
|
|
40
|
-
if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
|
|
41
|
-
return true;
|
|
42
|
-
return storage.isFile(p.actionsPath(`${action}.ts`));
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
runActions,
|
|
46
|
-
runAction,
|
|
47
|
-
hasAction
|
|
48
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/helpers/vscode-custom-data.ts
|
|
3
|
-
import {log} from "@stacksjs/logging";
|
|
4
|
-
import {customElementsDataPath} from "@stacksjs/path";
|
|
5
|
-
import {writeTextFile} from "@stacksjs/storage";
|
|
6
|
-
|
|
7
|
-
// ../../../../config/library.ts
|
|
8
|
-
var library_default = {
|
|
9
|
-
name: "hello-world",
|
|
10
|
-
owner: "@stacksjs",
|
|
11
|
-
repository: "stacksjs/stacks",
|
|
12
|
-
license: "MIT",
|
|
13
|
-
author: "Chris Breuer",
|
|
14
|
-
contributors: ["Chris Breuer <chris@stacksjs.org>"],
|
|
15
|
-
defaultLanguage: "en",
|
|
16
|
-
releaseable: true,
|
|
17
|
-
vueComponents: {
|
|
18
|
-
name: "hello-world-vue",
|
|
19
|
-
description: "Your Vue component library description",
|
|
20
|
-
keywords: ["component", "library", "vue", "vite", "typescript", "javascript"],
|
|
21
|
-
tags: [{
|
|
22
|
-
name: ["HelloWorld", "AppHelloWorld"],
|
|
23
|
-
description: "The Hello World custom element, built via this framework.",
|
|
24
|
-
attributes: [{
|
|
25
|
-
name: "greeting",
|
|
26
|
-
description: "The greeting."
|
|
27
|
-
}]
|
|
28
|
-
}]
|
|
29
|
-
},
|
|
30
|
-
webComponents: {
|
|
31
|
-
name: "hello-world-elements",
|
|
32
|
-
description: "Your framework agnostic web component library description.",
|
|
33
|
-
keywords: ["custom-elements", "web-components", "library", "framework-agnostic", "typescript", "javascript"],
|
|
34
|
-
tags: [{
|
|
35
|
-
name: ["HelloWorld", "AppHelloWorld"],
|
|
36
|
-
description: "The Hello World custom element, built via this framework.",
|
|
37
|
-
attributes: [{
|
|
38
|
-
name: "greeting",
|
|
39
|
-
description: "The greeting."
|
|
40
|
-
}]
|
|
41
|
-
}]
|
|
42
|
-
},
|
|
43
|
-
functions: {
|
|
44
|
-
name: "hello-world-fx",
|
|
45
|
-
description: "Your function library description.",
|
|
46
|
-
keywords: ["functions", "composables", "library", "typescript", "javascript"],
|
|
47
|
-
shouldGenerateSourcemap: false,
|
|
48
|
-
functions: [
|
|
49
|
-
"counter",
|
|
50
|
-
"dark"
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// src/helpers/vscode-custom-data.ts
|
|
56
|
-
async function generateVsCodeCustomData() {
|
|
57
|
-
try {
|
|
58
|
-
log.info("Generating custom-elements.json...");
|
|
59
|
-
await writeTextFile({
|
|
60
|
-
path: customElementsDataPath(),
|
|
61
|
-
data: generateComponentInfoData()
|
|
62
|
-
});
|
|
63
|
-
log.success("Generated custom-elements.json for IDEs.");
|
|
64
|
-
} catch (err) {
|
|
65
|
-
log.error("There was an error generating the custom-elements.json file.", err);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
async function generateWebTypes() {
|
|
69
|
-
log.info("Generating web-types.json...");
|
|
70
|
-
log.info("This feature is not yet implemented.");
|
|
71
|
-
}
|
|
72
|
-
var generateComponentInfoData = function() {
|
|
73
|
-
const componentsData = JSON.stringify(library_default.vueComponents?.tags);
|
|
74
|
-
return `{
|
|
75
|
-
"version": 1.1,
|
|
76
|
-
"tags": ${componentsData}
|
|
77
|
-
}
|
|
78
|
-
`;
|
|
79
|
-
};
|
|
80
|
-
export {
|
|
81
|
-
generateWebTypes,
|
|
82
|
-
generateVsCodeCustomData
|
|
83
|
-
};
|