@stacksjs/actions 0.58.72 → 0.59.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/action.d.ts +36 -0
  2. package/dist/add.d.ts +6 -0
  3. package/dist/build/component-libs.d.ts +1 -0
  4. package/dist/build/core.d.ts +1 -0
  5. package/dist/build/stacks.d.ts +1 -0
  6. package/dist/build.d.ts +9 -0
  7. package/dist/bump.d.ts +1 -0
  8. package/dist/changelog.d.ts +1 -0
  9. package/dist/clean.d.ts +1 -0
  10. package/dist/commit.d.ts +3 -0
  11. package/dist/copy-types.d.ts +5 -0
  12. package/dist/database/seed.d.ts +1 -0
  13. package/dist/deploy/index.d.ts +1 -0
  14. package/dist/dev/components.d.ts +1 -0
  15. package/dist/dev/docs.d.ts +1 -0
  16. package/dist/dev/index.d.ts +10 -0
  17. package/dist/examples.d.ts +5 -0
  18. package/dist/fresh.d.ts +1 -0
  19. package/dist/generate/component-meta.d.ts +5 -0
  20. package/dist/generate/ide-helpers.d.ts +6 -0
  21. package/dist/generate/index.d.ts +13 -0
  22. package/dist/generate/lib-entries.d.ts +2 -0
  23. package/dist/generate/vscode-custom-data.d.ts +6 -0
  24. package/dist/helpers/component-meta.d.ts +22 -0
  25. package/dist/helpers/lib-entries.d.ts +13 -0
  26. package/dist/helpers/package-json.d.ts +3 -0
  27. package/dist/helpers/utils.d.ts +18 -0
  28. package/dist/helpers/vscode-custom-data.d.ts +2 -0
  29. package/dist/index.d.ts +7 -0
  30. package/dist/key-generate.d.ts +1 -0
  31. package/dist/lint/fix.d.ts +1 -0
  32. package/dist/lint/index.d.ts +1 -0
  33. package/dist/make.d.ts +20 -0
  34. package/dist/prepublish.d.ts +1 -0
  35. package/dist/release.d.ts +2 -0
  36. package/dist/test/coverage.d.ts +1 -0
  37. package/dist/test/feature.d.ts +1 -0
  38. package/dist/test/ui.d.ts +1 -0
  39. package/dist/test/unit.d.ts +1 -0
  40. package/dist/test.d.ts +1 -0
  41. package/dist/tinker.d.ts +1 -0
  42. package/dist/typecheck.d.ts +1 -0
  43. package/dist/types.d.ts +3 -0
  44. package/dist/upgrade/dependencies.d.ts +1 -0
  45. package/dist/upgrade/framework.d.ts +1 -0
  46. package/dist/upgrade/index.d.ts +1 -0
  47. package/dist/upgrade.d.ts +4 -0
  48. package/package.json +5 -3
  49. package/src/bump.ts +8 -3
  50. package/src/check/ports.ts +27 -0
  51. package/src/deploy/index.ts +2 -6
  52. package/src/dev/api.ts +1 -1
  53. package/src/dev/index.ts +1 -1
  54. package/src/find-projects.ts +21 -0
  55. package/src/generate/action-types.ts +14 -78
  56. package/src/generate/custom-cli-file.ts +1 -1
  57. package/src/generate/index.ts +10 -2
  58. package/src/generate/symlink-core.ts +3 -0
  59. package/src/helpers/lib-entries.ts +3 -3
  60. package/src/helpers/utils.ts +10 -14
  61. package/src/index.ts +1 -2
  62. package/src/lint/fix.ts +1 -0
  63. package/src/upgrade/binary.ts +43 -0
  64. package/src/upgrade/index.ts +6 -0
  65. package/src/upgrade/shell.ts +64 -0
  66. package/dist/src/add.js +0 -29
  67. package/dist/src/build/component-libs.js +0 -6
  68. package/dist/src/build/core.js +0 -21
  69. package/dist/src/build/stacks.js +0 -8
  70. package/dist/src/build.js +0 -213
  71. package/dist/src/bump.js +0 -14
  72. package/dist/src/changelog.js +0 -17
  73. package/dist/src/clean.js +0 -6
  74. package/dist/src/commit.js +0 -17
  75. package/dist/src/copy-types.js +0 -14
  76. package/dist/src/database/seed.js +0 -1
  77. package/dist/src/deploy/index.js +0 -31
  78. package/dist/src/dev/components.js +0 -11
  79. package/dist/src/dev/docs.js +0 -7
  80. package/dist/src/dev/index.js +0 -92
  81. package/dist/src/examples.js +0 -43
  82. package/dist/src/fresh.js +0 -18
  83. package/dist/src/generate/component-meta.js +0 -59
  84. package/dist/src/generate/ide-helpers.js +0 -91
  85. package/dist/src/generate/index.js +0 -147
  86. package/dist/src/generate/lib-entries.js +0 -170
  87. package/dist/src/generate/vscode-custom-data.js +0 -91
  88. package/dist/src/helpers/component-meta.js +0 -50
  89. package/dist/src/helpers/index.js +0 -48
  90. package/dist/src/helpers/lib-entries.js +0 -161
  91. package/dist/src/helpers/package-json.js +0 -136
  92. package/dist/src/helpers/utils.js +0 -48
  93. package/dist/src/helpers/vscode-custom-data.js +0 -83
  94. package/dist/src/index.js +0 -583
  95. package/dist/src/key-generate.js +0 -10
  96. package/dist/src/lint/fix.js +0 -12
  97. package/dist/src/lint/index.js +0 -17
  98. package/dist/src/make.js +0 -291
  99. package/dist/src/prepublish.js +0 -14
  100. package/dist/src/release.js +0 -553
  101. package/dist/src/test/coverage.js +0 -6
  102. package/dist/src/test/feature.js +0 -6
  103. package/dist/src/test/ui.js +0 -6
  104. package/dist/src/test/unit.js +0 -6
  105. package/dist/src/test.js +0 -6
  106. package/dist/src/tinker.js +0 -5
  107. package/dist/src/typecheck.js +0 -6
  108. package/dist/src/types.js +0 -21
  109. package/dist/src/upgrade/dependencies.js +0 -6
  110. package/dist/src/upgrade/framework.js +0 -1
  111. package/dist/src/upgrade/index.js +0 -54
  112. package/dist/src/upgrade.js +0 -47
  113. package/src/generate/caddyfile.ts +0 -1
  114. package/src/helpers/index.ts +0 -1
  115. package/src/start-caddy.ts +0 -13
@@ -1,91 +0,0 @@
1
- #!/usr/bin/env bun
2
- // @bun
3
-
4
- // src/helpers/vscode-custom-data.ts
5
- import {log} from "@stacksjs/logging";
6
- import {customElementsDataPath} from "@stacksjs/path";
7
- import {writeTextFile} from "@stacksjs/storage";
8
-
9
- // /home/runner/work/stacks/stacks/config/library.ts
10
- var library_default = {
11
- name: "hello-world",
12
- owner: "@stacksjs",
13
- repository: "stacksjs/stacks",
14
- license: "MIT",
15
- author: "Chris Breuer",
16
- contributors: ["Chris Breuer <chris@stacksjs.org>"],
17
- defaultLanguage: "en",
18
- releaseable: true,
19
- vueComponents: {
20
- name: "hello-world-vue",
21
- description: "Your Vue component library description",
22
- keywords: ["component", "library", "vue", "vite", "typescript", "javascript"],
23
- tags: [{
24
- name: ["HelloWorld", "AppHelloWorld"],
25
- description: "The Hello World custom element, built via this framework.",
26
- attributes: [{
27
- name: "greeting",
28
- description: "The greeting."
29
- }]
30
- }]
31
- },
32
- webComponents: {
33
- name: "hello-world-elements",
34
- description: "Your framework agnostic web component library description.",
35
- keywords: ["custom-elements", "web-components", "library", "framework-agnostic", "typescript", "javascript"],
36
- tags: [{
37
- name: ["HelloWorld", "AppHelloWorld"],
38
- description: "The Hello World custom element, built via this framework.",
39
- attributes: [{
40
- name: "greeting",
41
- description: "The greeting."
42
- }]
43
- }]
44
- },
45
- functions: {
46
- name: "hello-world-fx",
47
- description: "Your function library description.",
48
- keywords: ["functions", "composables", "library", "typescript", "javascript"],
49
- shouldGenerateSourcemap: false,
50
- functions: [
51
- "counter",
52
- "dark"
53
- ]
54
- }
55
- };
56
-
57
- // src/helpers/vscode-custom-data.ts
58
- async function generateVsCodeCustomData() {
59
- try {
60
- log.info("Generating custom-elements.json...");
61
- await writeTextFile({
62
- path: customElementsDataPath(),
63
- data: generateComponentInfoData()
64
- });
65
- log.success("Generated custom-elements.json for IDEs.");
66
- } catch (err) {
67
- log.error("There was an error generating the custom-elements.json file.", err);
68
- }
69
- }
70
- async function generateWebTypes() {
71
- log.info("Generating web-types.json...");
72
- log.info("This feature is not yet implemented.");
73
- }
74
- var generateComponentInfoData = function() {
75
- const componentsData = JSON.stringify(library_default.vueComponents?.tags);
76
- return `{
77
- "version": 1.1,
78
- "tags": ${componentsData}
79
- }
80
- `;
81
- };
82
-
83
- // src/generate/vscode-custom-data.ts
84
- import {log as log2} from "@stacksjs/logging";
85
- import {hasComponents} from "@stacksjs/storage";
86
- log2.info("Generating VS Code custom data...");
87
- if (hasComponents())
88
- await generateVsCodeCustomData();
89
- else
90
- log2.info("No components found. Skipping VS Code custom data generation.");
91
- log2.success("Generated VS Code custom data.");
@@ -1,50 +0,0 @@
1
- // @bun
2
- // src/helpers/component-meta.ts
3
- import {frameworkPath, join, parse, projectPath} from "@stacksjs/path";
4
- import {existsSync, glob, mkdirSync, writeFileSync} from "@stacksjs/storage";
5
- import MarkdownIt from "markdown-it";
6
- import {createComponentMetaChecker} from "vue-component-meta";
7
- function generateComponentMeta() {
8
- const md = new MarkdownIt;
9
- const checkerOptions = {
10
- forceUseTs: true,
11
- schema: { ignore: ["MyIgnoredNestedProps"] },
12
- printer: { newLine: 1 }
13
- };
14
- const tsconfigChecker = createComponentMetaChecker(projectPath("tsconfig.json"), checkerOptions);
15
- const filterMeta = (meta) => {
16
- const props = [];
17
- meta.props.forEach((prop) => {
18
- if (prop?.global)
19
- return;
20
- const { name, description, required, type, default: defaultValue } = prop;
21
- props.push({
22
- name: `${name}${required ? "" : "?"}`,
23
- description: md.render(description),
24
- type,
25
- default: defaultValue || "unknown"
26
- });
27
- });
28
- return {
29
- props,
30
- events: meta.events,
31
- slots: meta.slots
32
- };
33
- };
34
- const components = glob.sync(["components/*.stx", "components/**/*.stx"], {
35
- cwd: projectPath(),
36
- absolute: true
37
- });
38
- components.forEach((componentPath) => {
39
- const componentExportName = parse(componentPath).name;
40
- const meta = filterMeta(tsconfigChecker.getComponentMeta(componentPath, componentExportName));
41
- const metaDirPath = frameworkPath("component-meta");
42
- if (!existsSync(metaDirPath))
43
- mkdirSync(metaDirPath);
44
- const metaJsonFilePath = join(metaDirPath, `${componentExportName}.json`);
45
- writeFileSync(metaJsonFilePath, JSON.stringify(meta, null, 4));
46
- });
47
- }
48
- export {
49
- generateComponentMeta
50
- };
@@ -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,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
- // /home/runner/work/stacks/stacks/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("Creating Vue 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("Creating 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("Creating 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
- // /home/runner/work/stacks/stacks/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
- // /home/runner/work/stacks/stacks/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
- };