@stacksjs/actions 0.61.24 → 0.63.0
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/add.js +3 -0
- package/dist/add.js.map +10 -0
- package/dist/build/component-libs.js +3 -0
- package/dist/build/component-libs.js.map +10 -0
- package/dist/build/core.js +3 -0
- package/dist/build/core.js.map +10 -0
- package/dist/build/stacks.js +3 -0
- package/dist/build/stacks.js.map +10 -0
- package/dist/build.js +6 -4
- package/dist/build.js.map +14 -0
- package/dist/bump.js +7 -4
- package/dist/bump.js.map +10 -0
- package/dist/changelog.js +3 -0
- package/dist/changelog.js.map +10 -0
- package/dist/clean.js +3 -0
- package/dist/clean.js.map +10 -0
- package/dist/commit.js +3 -0
- package/dist/commit.js.map +10 -0
- package/dist/copy-types.js +3 -0
- package/dist/copy-types.js.map +10 -0
- package/dist/database/seed.js +3 -0
- package/dist/database/seed.js.map +10 -0
- package/dist/deploy/index.js +14 -5
- package/dist/deploy/index.js.map +10 -0
- package/dist/dev/components.js +3 -0
- package/dist/dev/components.js.map +10 -0
- package/dist/dev/docs.js +3 -0
- package/dist/dev/docs.js.map +10 -0
- package/dist/dev/index.js +4 -2
- package/dist/dev/index.js.map +11 -0
- package/dist/examples.js +3 -0
- package/dist/examples.js.map +10 -0
- package/dist/fresh.js +3 -0
- package/dist/fresh.js.map +10 -0
- package/dist/generate/component-meta.js +3 -0
- package/dist/generate/component-meta.js.map +11 -0
- package/dist/generate/ide-helpers.js +5 -2
- package/dist/generate/ide-helpers.js.map +12 -0
- package/dist/generate/index.js +6 -4
- package/dist/generate/index.js.map +13 -0
- package/dist/generate/lib-entries.js +3 -0
- package/dist/generate/lib-entries.js.map +12 -0
- package/dist/generate/vscode-custom-data.js +5 -2
- package/dist/generate/vscode-custom-data.js.map +12 -0
- package/dist/helpers/component-meta.js +3 -0
- package/dist/helpers/component-meta.js.map +10 -0
- package/dist/helpers/lib-entries.js +3 -0
- package/dist/helpers/lib-entries.js.map +11 -0
- package/dist/helpers/package-json.js +3 -0
- package/dist/helpers/package-json.js.map +11 -0
- package/dist/helpers/utils.js +4 -2
- package/dist/helpers/utils.js.map +10 -0
- package/dist/helpers/vscode-custom-data.js +5 -2
- package/dist/helpers/vscode-custom-data.js.map +11 -0
- package/dist/index.js +21 -5
- package/dist/index.js.map +18 -0
- package/dist/key-generate.js +3 -0
- package/dist/key-generate.js.map +10 -0
- package/dist/lint/fix.js +3 -0
- package/dist/lint/fix.js.map +10 -0
- package/dist/lint/index.js +3 -0
- package/dist/lint/index.js.map +10 -0
- package/dist/make.js +3 -0
- package/dist/make.js.map +10 -0
- package/dist/prepublish.js +3 -0
- package/dist/prepublish.js.map +10 -0
- package/dist/release.js +21 -5
- package/dist/release.js.map +19 -0
- package/dist/test/coverage.js +3 -0
- package/dist/test/coverage.js.map +10 -0
- package/dist/test/feature.js +3 -0
- package/dist/test/feature.js.map +10 -0
- package/dist/test/ui.js +3 -0
- package/dist/test/ui.js.map +10 -0
- package/dist/test/unit.js +3 -0
- package/dist/test/unit.js.map +10 -0
- package/dist/test.js +3 -0
- package/dist/test.js.map +10 -0
- package/dist/typecheck.js +3 -0
- package/dist/typecheck.js.map +10 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +10 -0
- package/dist/upgrade/dependencies.js +3 -0
- package/dist/upgrade/dependencies.js.map +9 -0
- package/dist/upgrade/framework.js +3 -0
- package/dist/upgrade/framework.js.map +9 -0
- package/dist/upgrade/index.js +4 -2
- package/dist/upgrade/index.js.map +11 -0
- package/dist/upgrade.js +4 -1
- package/dist/upgrade.js.map +10 -0
- package/package.json +3 -3
- package/src/action.ts +18 -9
- package/src/build/server.ts +1 -1
- package/src/bump.ts +5 -5
- package/src/cdn/invalidate-cache.ts +1 -1
- package/src/deploy/index.ts +14 -6
- package/src/files/watch.ts +8 -0
- package/src/helpers/utils.ts +4 -5
- package/src/orm/generate-model.ts +814 -467
package/dist/generate/index.js
CHANGED
|
@@ -5,9 +5,8 @@ import {err} from "@stacksjs/error-handling";
|
|
|
5
5
|
import {log} from "@stacksjs/logging";
|
|
6
6
|
import * as p from "@stacksjs/path";
|
|
7
7
|
import {glob} from "@stacksjs/storage";
|
|
8
|
-
var {Glob } = globalThis.Bun;
|
|
9
8
|
async function runAction(action, options) {
|
|
10
|
-
const glob2 = new Glob("**/*.ts");
|
|
9
|
+
const glob2 = new Bun.Glob("**/*.ts");
|
|
11
10
|
const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true };
|
|
12
11
|
for await (const file of glob2.scan(scanOptions)) {
|
|
13
12
|
log.debug("file", file);
|
|
@@ -136,14 +135,14 @@ async function generateWebTypes() {
|
|
|
136
135
|
log2.info("Generating web-types.json...");
|
|
137
136
|
log2.info("This feature is not yet implemented.");
|
|
138
137
|
}
|
|
139
|
-
|
|
138
|
+
function generateComponentInfoData() {
|
|
140
139
|
const componentsData = JSON.stringify(library_default.vueComponents?.tags);
|
|
141
140
|
return `{
|
|
142
141
|
"version": 1.1,
|
|
143
142
|
"tags": ${componentsData}
|
|
144
143
|
}
|
|
145
144
|
`;
|
|
146
|
-
}
|
|
145
|
+
}
|
|
147
146
|
|
|
148
147
|
// src/generate/index.ts
|
|
149
148
|
import process from "process";
|
|
@@ -249,3 +248,6 @@ export {
|
|
|
249
248
|
generateComponentMeta,
|
|
250
249
|
generate
|
|
251
250
|
};
|
|
251
|
+
|
|
252
|
+
//# debugId=FB4F574412E43F0B64756E2164756E21
|
|
253
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/helpers/utils.ts", "../src/helpers/vscode-custom-data.ts", "../../../../../config/library.ts", "../src/generate/index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { Action as ActionType } from '@stacksjs/actions'\nimport { buddyOptions, runCommand, runCommands } from '@stacksjs/cli'\nimport { err } from '@stacksjs/error-handling'\nimport { log } from '@stacksjs/logging'\nimport * as p from '@stacksjs/path'\nimport { glob } from '@stacksjs/storage'\nimport type { ActionOptions } from '@stacksjs/types'\n\ntype ActionPath = string // TODO: narrow this by automating its generation\ntype ActionName = string // TODO: narrow this by automating its generation\ntype Action = ActionPath | ActionName | string\n\n/**\n * Run an Action the Stacks way.\n *\n * @param action The action to invoke.\n * @param options The options to pass to the command.\n * @returns The result of the command.\n */\nexport async function runAction(action: Action, options?: ActionOptions) {\n // check if action is a file anywhere in ./app/Actions/**/*.ts\n // if it is, return and await the action\n const glob = new Bun.Glob('**/*.ts')\n const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true }\n\n for await (const file of glob.scan(scanOptions)) {\n log.debug('file', file)\n if (file === `${action}.ts` || file.endsWith(`${action}.ts`))\n return ((await import(/* @vite-ignore */ p.userActionsPath(file))).default as ActionType).handle()\n\n // if a custom model name is used, we need to check for it\n const a = await import(/* @vite-ignore */ p.userActionsPath(file))\n if (a.name === action) return await a.handle()\n }\n\n // or else, just run the action normally by assuming the action is core Action, stored in p.actionsPath\n const opts = buddyOptions()\n const path = p.relativeActionsPath(`src/${action}.ts`)\n const cmd = `bun --bun ${path} ${opts}`.trimEnd()\n const optionsWithCwd = {\n cwd: options?.cwd || p.projectPath(),\n ...options,\n }\n\n log.debug('runAction:', cmd)\n log.debug('action options:', optionsWithCwd)\n\n return await runCommand(cmd, optionsWithCwd)\n}\n\n/**\n * Run Actions the Stacks way.\n *\n * @param actions The actions to invoke.\n * @param options The options to pass to the command.\n * @returns The result of the command.\n */\nexport async function runActions(actions: Action[], options?: ActionOptions) {\n log.debug('runActions:', actions, options)\n\n if (!actions.length) return err('No actions were specified')\n\n for (const action of actions) {\n log.debug(`running action \"${action}\"`)\n if (!hasAction(action)) return err(`The specified action \"${action}\" does not exist`)\n }\n\n const opts = buddyOptions()\n\n const o = {\n cwd: options?.cwd || p.projectPath(),\n ...options,\n }\n\n const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`src/${action}.ts`)} ${opts}`)\n\n log.debug('commands:', commands)\n\n return await runCommands(commands, o)\n}\n\n// looks in most common locations\nexport function hasAction(action: Action) {\n // Define patterns specifically for user actions\n const userActionPatterns = [\n `${action}.ts`,\n `${action}`,\n `Dashboard/${action}.ts`,\n `Dashboard/${action}`,\n `Buddy/${action}.ts`,\n `Buddy/${action}`,\n ]\n\n // Define patterns specifically for core actions\n const actionPatterns = [`src/${action}.ts`, `src/${action}`, `${action}.ts`, `${action}`]\n\n // Check user actions path with its specific patterns\n const userActionFiles = glob.sync(userActionPatterns.map((pattern) => p.userActionsPath(pattern)))\n\n // Check actions path with its specific patterns\n const actionFiles = glob.sync(actionPatterns.map((pattern) => p.actionsPath(pattern)))\n\n return userActionFiles.length > 0 || actionFiles.length > 0\n\n // TODO: need to loop through all user actions and check whether the name is a valid action name match\n\n // return false\n}\n",
|
|
6
|
+
"import { log } from '@stacksjs/logging'\nimport { customElementsDataPath } from '@stacksjs/path'\nimport { writeTextFile } from '@stacksjs/storage'\nimport library from '~/config/library'\n\nexport async function generateVsCodeCustomData() {\n try {\n log.info('Generating custom-elements.json...')\n // the version does not have to be set here,\n // it will be set automatically by the release script\n await writeTextFile({\n path: customElementsDataPath(),\n data: generateComponentInfoData(),\n })\n log.success('Generated custom-elements.json for IDEs.')\n } catch (err) {\n log.error('There was an error generating the custom-elements.json file.', err)\n }\n}\n\nexport async function generateWebTypes() {\n log.info('Generating web-types.json...')\n log.info('This feature is not yet implemented.')\n}\n\nfunction generateComponentInfoData() {\n const componentsData = JSON.stringify(library.vueComponents?.tags)\n\n return `{\n \"version\": 1.1,\n \"tags\": ${componentsData}\n}\n`\n}\n",
|
|
7
|
+
"import type { LibraryConfig } from '@stacksjs/types'\n\n/**\n * **Library Configuration**\n *\n * This configuration defines all of your library options. Because Stacks is fully-typed, you\n * may hover any of the options below and the definitions will be provided. In case you\n * have any questions, feel free to reach out via Discord or GitHub Discussions.\n */\nexport default {\n name: 'hello-world',\n owner: '@stacksjs', // you may or may not add the @ prefix here (it is added automatically)\n repository: 'stacksjs/stacks',\n license: 'MIT',\n author: 'Chris Breuer',\n contributors: ['Chris Breuer <chris@stacksjs.org>'],\n defaultLanguage: 'en',\n releaseable: true,\n\n vueComponents: {\n name: 'hello-world-vue',\n description: 'Your Vue component library description',\n keywords: ['component', 'library', 'vue', 'vite', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n webComponents: {\n name: 'hello-world-elements',\n description: 'Your framework agnostic web component library description.',\n keywords: ['custom-elements', 'web-components', 'library', 'framework-agnostic', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n functions: {\n name: 'hello-world-fx',\n description: 'Your function library description.',\n keywords: ['functions', 'composables', 'library', 'typescript', 'javascript'],\n shouldGenerateSourcemap: false,\n files: ['counter', 'dark'],\n },\n} satisfies LibraryConfig\n",
|
|
8
|
+
"import process from 'node:process'\nimport { runCommand } from '@stacksjs/cli'\nimport { Action, NpmScript } from '@stacksjs/enums'\nimport { log } from '@stacksjs/logging'\nimport { frameworkPath, projectPath } from '@stacksjs/path'\nimport type { GeneratorOptions } from '@stacksjs/types'\nimport { runNpmScript } from '@stacksjs/utils'\nimport { runAction } from '../helpers'\nimport { generateVsCodeCustomData as genVsCodeCustomData } from '../helpers/vscode-custom-data'\n\n// import { files } from '@stacksjs/storage'\n\nexport async function invoke(options?: GeneratorOptions) {\n if (options?.types) await generateTypes(options)\n else if (options?.entries) await generateLibEntries(options)\n else if (options?.webTypes) await generateWebTypes(options)\n else if (options?.customData) await generateVsCodeCustomData(options)\n else if (options?.ideHelpers) await generateIdeHelpers(options)\n else if (options?.componentMeta) await generateComponentMeta(options)\n else if (options?.coreSymlink) await generateCoreSymlink()\n}\n\nexport function generate(options: GeneratorOptions) {\n return invoke(options)\n}\n\nexport async function generateLibEntries(options: GeneratorOptions) {\n const result = await runAction(Action.GenerateLibraryEntries, {\n ...options,\n cwd: projectPath(),\n })\n\n if (result.isErr()) {\n log.error('There was an error generating your library entry points', result.error)\n process.exit()\n }\n\n log.success('Library entry points generated successfully')\n}\n\nexport async function generateWebTypes(options?: GeneratorOptions) {\n const result = await runNpmScript(NpmScript.GenerateWebTypes, options)\n\n if (result.isErr()) {\n log.error('There was an error generating the web-types.json file.', result.error)\n process.exit()\n }\n\n log.success('Successfully generated the web-types.json file')\n}\n\nexport async function generateVsCodeCustomData(options?: GeneratorOptions) {\n const result = await genVsCodeCustomData()\n\n if (result.isErr()) {\n log.error('There was an error generating the custom-elements.json file.', result.error)\n process.exit()\n }\n\n await runAction(Action.LintFix, { verbose: true }) // because the generated json file needs to be linted\n\n log.success('Successfully generated the custom-elements.json file')\n}\n\nexport async function generateIdeHelpers(options?: GeneratorOptions) {\n const result = await runNpmScript(NpmScript.GenerateIdeHelpers, options)\n\n if (result.isErr()) {\n log.error('There was an error generating IDE helpers.', result.error)\n process.exit()\n }\n\n await runAction(Action.LintFix, { verbose: true }) // the generated json file needs to be linted\n log.success('Successfully generated IDE helpers')\n}\n\nexport async function generateComponentMeta(options?: GeneratorOptions) {\n const result = await genVsCodeCustomData()\n\n if (result.isErr()) {\n log.error('There was an error generating your component meta information.', result.error)\n process.exit()\n }\n\n await runAction(Action.LintFix, { verbose: true }) // the generated json file needs to be linted\n log.success('Successfully generated component meta information')\n}\n\nexport async function generateTypes(options?: GeneratorOptions) {\n const result = await runNpmScript(NpmScript.GenerateTypes, {\n cwd: frameworkPath(),\n ...options,\n })\n\n if (result.isErr()) {\n log.error('There was an error generating your types.', result.error)\n process.exit()\n }\n\n log.success('Types were generated successfully')\n}\n\nexport function generatePkgxConfig() {\n // write the yaml string to a file in your project root\n // files.put(projectPath('./pkgx.yaml'), yamlStr)\n\n log.success('Successfully generated `./pkgx.yaml` based on your config')\n}\n\nexport async function generateSeeder() {\n // await seed()\n}\n\nexport async function generateCoreSymlink() {\n await runCommand(`ln -s ${frameworkPath()} ${projectPath('.stacks')}`)\n}\n"
|
|
9
|
+
],
|
|
10
|
+
"mappings": ";;AACA;AACA;AACA;AACA;AACA;AAcA,eAAsB,SAAS,CAAC,QAAgB,SAAyB;AAGvE,QAAM,QAAO,IAAI,IAAI,KAAK,SAAS;AACnC,QAAM,cAAc,EAAE,KAAO,kBAAgB,GAAG,WAAW,KAAK;AAEhE,mBAAiB,QAAQ,MAAK,KAAK,WAAW,GAAG;AAC/C,QAAI,MAAM,QAAQ,IAAI;AACtB,QAAI,SAAS,GAAG,eAAe,KAAK,SAAS,GAAG,WAAW;AACzD,cAAS,MAAgC,OAAE,kBAAgB,IAAI,IAAI,QAAuB,OAAO;AAGnG,UAAM,IAAI,MAAgC,OAAE,kBAAgB,IAAI;AAChE,QAAI,EAAE,SAAS;AAAQ,aAAO,MAAM,EAAE,OAAO;AAAA,EAC/C;AAGA,QAAM,OAAO,aAAa;AAC1B,QAAM,OAAS,sBAAoB,OAAO,WAAW;AACrD,QAAM,MAAM,aAAa,QAAQ,OAAO,QAAQ;AAChD,QAAM,iBAAiB;AAAA,IACrB,KAAK,SAAS,OAAS,cAAY;AAAA,OAChC;AAAA,EACL;AAEA,MAAI,MAAM,cAAc,GAAG;AAC3B,MAAI,MAAM,mBAAmB,cAAc;AAE3C,SAAO,MAAM,WAAW,KAAK,cAAc;AAAA;AAU7C,eAAsB,UAAU,CAAC,SAAmB,SAAyB;AAC3E,MAAI,MAAM,eAAe,SAAS,OAAO;AAEzC,OAAK,QAAQ;AAAQ,WAAO,IAAI,2BAA2B;AAE3D,aAAW,UAAU,SAAS;AAC5B,QAAI,MAAM,mBAAmB,SAAS;AACtC,SAAK,UAAU,MAAM;AAAG,aAAO,IAAI,yBAAyB,wBAAwB;AAAA,EACtF;AAEA,QAAM,O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AACtE,QAAM,SAAS,MAAM,yBAAoB;AAEzC,MAAI,OAAO,MAAM,GAAG;AAClB,SAAI,MAAM,kEAAkE,OAAO,KAAK;AACxF,YAAQ,KAAK;AAAA,EACf;AAEA,QAAM,UAAU,OAAO,SAAS,EAAE,SAAS,KAAK,CAAC;AACjD,OAAI,QAAQ,mDAAmD;AAAA;AAGjE,eAAsB,aAAa,CAAC,SAA4B;AAC9D,QAAM,SAAS,MAAM,aAAa,UAAU,eAAe;AAAA,IACzD,KAAK,cAAc;AAAA,OAChB;AAAA,EACL,CAAC;AAED,MAAI,OAAO,MAAM,GAAG;AAClB,SAAI,MAAM,6CAA6C,OAAO,KAAK;AACnE,YAAQ,KAAK;AAAA,EACf;AAEA,OAAI,QAAQ,mCAAmC;AAAA;AAG1C,SAAS,kBAAkB,GAAG;AAInC,OAAI,QAAQ,2DAA2D;AAAA;AAGzE,eAAsB,cAAc,GAAG;AAAA;AAIvC,eAAsB,mBAAmB,GAAG;AAC1C,QAAM,YAAW,SAAS,cAAc,KAAK,aAAY,SAAS,GAAG;AAAA;",
|
|
11
|
+
"debugId": "FB4F574412E43F0B64756E2164756E21",
|
|
12
|
+
"names": []
|
|
13
|
+
}
|
|
@@ -173,3 +173,6 @@ if (library2.releaseable && hasFunctions())
|
|
|
173
173
|
await generateLibEntry("functions");
|
|
174
174
|
else
|
|
175
175
|
log2.info("No functions found. Skipping building function entry point.");
|
|
176
|
+
|
|
177
|
+
//# debugId=59BE08B1557D292764756E2164756E21
|
|
178
|
+
//# sourceMappingURL=lib-entries.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/helpers/lib-entries.ts", "../../../../../config/library.ts", "../src/generate/lib-entries.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import process from 'node:process'\nimport { log } from '@stacksjs/logging'\nimport type { LibraryType } from '@stacksjs/path'\nimport { componentsPath, functionsPath, libraryEntryPath } from '@stacksjs/path'\nimport { writeTextFile } from '@stacksjs/storage'\nimport { kebabCase } from '@stacksjs/strings'\nimport { ExitCode } from '@stacksjs/types'\nimport { determineResetPreset } from '@stacksjs/utils'\nimport library from '~/config/library'\n\n/**\n * Based on the config values, this method\n * will generate the library entry points.\n *\n * @param type LibraryType\n */\nexport async function generateLibEntry(type: LibraryType) {\n await createLibraryEntryPoint(type)\n}\n\nexport async function createLibraryEntryPoint(type: LibraryType) {\n if (type === 'vue-components') await createVueLibraryEntryPoint()\n\n if (type === 'web-components') await createWebComponentLibraryEntryPoint()\n\n if (type === 'functions') await createFunctionLibraryEntryPoint()\n}\n\nexport async function createVueLibraryEntryPoint(type: LibraryType = 'vue-components') {\n log.info('Ensuring Component Library Entry Point...')\n\n await writeTextFile({\n path: libraryEntryPath(type),\n data: generateEntryPointData(type),\n }).catch((err) => {\n log.error('There was an error generating the Vue Component Library Entry Point.', err)\n process.exit(ExitCode.FatalError)\n })\n\n log.success('Created Vue Component Library Entry Point')\n}\n\nexport async function createWebComponentLibraryEntryPoint(type: LibraryType = 'web-components') {\n log.info('Ensuring Web Component Library Entry Point...')\n\n await writeTextFile({\n path: libraryEntryPath(type),\n data: generateEntryPointData(type),\n }).catch((err) => {\n log.error('There was an error generating the Web Component library entry point', err)\n process.exit(ExitCode.FatalError)\n })\n\n log.success('Created Web Component Library Entry Point')\n}\n\nexport async function createFunctionLibraryEntryPoint(type: LibraryType = 'functions') {\n log.info('Ensuring Function Library Entry Point...')\n\n await writeTextFile({\n path: libraryEntryPath(type),\n data: generateEntryPointData(type),\n }).catch((err) => {\n log.error('There was an error generating Function Library Entry Point', err)\n process.exit(ExitCode.FatalError)\n })\n\n log.success('Created Functions Library Entry Point')\n}\n\nexport function generateEntryPointData(type: LibraryType): string {\n let arr = []\n\n if (type === 'functions') {\n if (!library.functions?.files) {\n log.error(\n new Error(\n 'There are no functions defined to be built. Please check your config/library.ts file for potential adjustments',\n ),\n )\n process.exit()\n }\n\n for (const fx of library.functions.files) {\n if (Array.isArray(fx)) arr.push(`export * as ${fx[1]} from '${functionsPath(fx[0])}'`)\n else arr.push(`export * from '${functionsPath(fx)}'`)\n }\n\n // join the array into a string with each element being on a new line\n return arr.join('\\r\\n')\n }\n\n if (type === 'vue-components') {\n if (!library.vueComponents?.tags) {\n log.error(\n new Error(\n 'There are no components defined to be built. Please check your config/library.ts file for potential adjustments',\n ),\n )\n process.exit()\n }\n\n arr = determineResetPreset()\n\n for (const component of library.vueComponents.tags.map((tag) => tag.name)) {\n if (Array.isArray(component))\n arr.push(`export { default as ${component[1]} } from '${componentsPath(component[0])}.stx'`)\n else arr.push(`export { default as ${component} } from '${componentsPath(component)}.stx'`)\n }\n\n // join the array into a string with each element being on a new line\n return arr.join('\\r\\n')\n }\n\n // at this point, we know it is a Web Component we are building\n arr = determineResetPreset()\n const imports = [...arr, \"import { defineCustomElement } from 'vue'\"]\n const declarations = []\n const definitions = []\n\n if (!library.webComponents?.tags) {\n log.error(\n new Error(\n 'There are no components defined to be built. Please check your config/library.ts file for potential adjustments',\n ),\n )\n process.exit()\n }\n\n for (const component of library.webComponents.tags.map((tag) => tag.name)) {\n if (Array.isArray(component)) {\n imports.push(`import ${component[1]} from '${componentsPath(component[0])}.stx'`)\n declarations.push(`const ${component[1]}CustomElement = defineCustomElement(${component[1]})`)\n definitions.push(`customElements.define('${kebabCase(component[1] as string)}', ${component[1]}CustomElement)`)\n } else {\n imports.push(`import ${component} from '${componentsPath(component)}.stx'`)\n declarations.push(`const ${component}CustomElement = defineCustomElement(${component})`)\n definitions.push(`customElements.define('${kebabCase(component)}', ${component}CustomElement)`)\n }\n }\n\n // join the array into a string with each element being on a new line\n return [...imports, ...declarations, ...definitions].join('\\r\\n')\n}\n",
|
|
6
|
+
"import type { LibraryConfig } from '@stacksjs/types'\n\n/**\n * **Library Configuration**\n *\n * This configuration defines all of your library options. Because Stacks is fully-typed, you\n * may hover any of the options below and the definitions will be provided. In case you\n * have any questions, feel free to reach out via Discord or GitHub Discussions.\n */\nexport default {\n name: 'hello-world',\n owner: '@stacksjs', // you may or may not add the @ prefix here (it is added automatically)\n repository: 'stacksjs/stacks',\n license: 'MIT',\n author: 'Chris Breuer',\n contributors: ['Chris Breuer <chris@stacksjs.org>'],\n defaultLanguage: 'en',\n releaseable: true,\n\n vueComponents: {\n name: 'hello-world-vue',\n description: 'Your Vue component library description',\n keywords: ['component', 'library', 'vue', 'vite', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n webComponents: {\n name: 'hello-world-elements',\n description: 'Your framework agnostic web component library description.',\n keywords: ['custom-elements', 'web-components', 'library', 'framework-agnostic', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n functions: {\n name: 'hello-world-fx',\n description: 'Your function library description.',\n keywords: ['functions', 'composables', 'library', 'typescript', 'javascript'],\n shouldGenerateSourcemap: false,\n files: ['counter', 'dark'],\n },\n} satisfies LibraryConfig\n",
|
|
7
|
+
"#!/usr/bin/env bun\nimport { library } from '@stacksjs/config'\nimport { log } from '@stacksjs/logging'\nimport { hasComponents, hasFunctions } from '@stacksjs/storage'\nimport { generateLibEntry } from '../helpers/lib-entries'\n\nif (library.releaseable && hasComponents()) {\n await generateLibEntry('vue-components')\n await generateLibEntry('web-components')\n} else {\n log.info('No components found. Skipping building component entry points.')\n}\n\nif (library.releaseable && hasFunctions()) await generateLibEntry('functions')\nelse log.info('No functions found. Skipping building function entry point.')\n"
|
|
8
|
+
],
|
|
9
|
+
"mappings": ";;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;;;ACEA,IAAe;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,YAA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AAA;;;AE7IlE,mBAAS;AACT,eAAS;AACT;AAGA,IAAI,SAAQ,eAAe,cAAc,GAAG;AAC1C,QAAM,iBAAiB,gBAAgB;AACvC,QAAM,iBAAiB,gBAAgB;AACzC,OAAO;AACL,OAAI,KAAK,gEAAgE;AAAA;AAG3E,IAAI,SAAQ,eAAe,aAAa;AAAG,QAAM,iBAAiB,WAAW;AAAA;AACxE,OAAI,KAAK,6DAA6D;",
|
|
10
|
+
"debugId": "59BE08B1557D292764756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -76,14 +76,14 @@ async function generateWebTypes() {
|
|
|
76
76
|
log.info("Generating web-types.json...");
|
|
77
77
|
log.info("This feature is not yet implemented.");
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
function generateComponentInfoData() {
|
|
80
80
|
const componentsData = JSON.stringify(library_default.vueComponents?.tags);
|
|
81
81
|
return `{
|
|
82
82
|
"version": 1.1,
|
|
83
83
|
"tags": ${componentsData}
|
|
84
84
|
}
|
|
85
85
|
`;
|
|
86
|
-
}
|
|
86
|
+
}
|
|
87
87
|
|
|
88
88
|
// src/generate/vscode-custom-data.ts
|
|
89
89
|
import {log as log2} from "@stacksjs/logging";
|
|
@@ -94,3 +94,6 @@ if (hasComponents())
|
|
|
94
94
|
else
|
|
95
95
|
log2.info("No components found. Skipping VS Code custom data generation.");
|
|
96
96
|
log2.success("Generated VS Code custom data.");
|
|
97
|
+
|
|
98
|
+
//# debugId=1C6E80535DADF5D864756E2164756E21
|
|
99
|
+
//# sourceMappingURL=vscode-custom-data.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/helpers/vscode-custom-data.ts", "../../../../../config/library.ts", "../src/generate/vscode-custom-data.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { log } from '@stacksjs/logging'\nimport { customElementsDataPath } from '@stacksjs/path'\nimport { writeTextFile } from '@stacksjs/storage'\nimport library from '~/config/library'\n\nexport async function generateVsCodeCustomData() {\n try {\n log.info('Generating custom-elements.json...')\n // the version does not have to be set here,\n // it will be set automatically by the release script\n await writeTextFile({\n path: customElementsDataPath(),\n data: generateComponentInfoData(),\n })\n log.success('Generated custom-elements.json for IDEs.')\n } catch (err) {\n log.error('There was an error generating the custom-elements.json file.', err)\n }\n}\n\nexport async function generateWebTypes() {\n log.info('Generating web-types.json...')\n log.info('This feature is not yet implemented.')\n}\n\nfunction generateComponentInfoData() {\n const componentsData = JSON.stringify(library.vueComponents?.tags)\n\n return `{\n \"version\": 1.1,\n \"tags\": ${componentsData}\n}\n`\n}\n",
|
|
6
|
+
"import type { LibraryConfig } from '@stacksjs/types'\n\n/**\n * **Library Configuration**\n *\n * This configuration defines all of your library options. Because Stacks is fully-typed, you\n * may hover any of the options below and the definitions will be provided. In case you\n * have any questions, feel free to reach out via Discord or GitHub Discussions.\n */\nexport default {\n name: 'hello-world',\n owner: '@stacksjs', // you may or may not add the @ prefix here (it is added automatically)\n repository: 'stacksjs/stacks',\n license: 'MIT',\n author: 'Chris Breuer',\n contributors: ['Chris Breuer <chris@stacksjs.org>'],\n defaultLanguage: 'en',\n releaseable: true,\n\n vueComponents: {\n name: 'hello-world-vue',\n description: 'Your Vue component library description',\n keywords: ['component', 'library', 'vue', 'vite', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n webComponents: {\n name: 'hello-world-elements',\n description: 'Your framework agnostic web component library description.',\n keywords: ['custom-elements', 'web-components', 'library', 'framework-agnostic', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n functions: {\n name: 'hello-world-fx',\n description: 'Your function library description.',\n keywords: ['functions', 'composables', 'library', 'typescript', 'javascript'],\n shouldGenerateSourcemap: false,\n files: ['counter', 'dark'],\n },\n} satisfies LibraryConfig\n",
|
|
7
|
+
"#!/usr/bin/env bun\n\n/**\n * This action generates the web-types.json & custom-elements.json\n * files for the components.\n */\n\nimport { log } from '@stacksjs/logging'\nimport { hasComponents } from '@stacksjs/storage'\nimport { generateVsCodeCustomData } from '../helpers/vscode-custom-data'\n\nlog.info('Generating VS Code custom data...')\n\nif (hasComponents()) await generateVsCodeCustomData()\nelse log.info('No components found. Skipping VS Code custom data generation.')\n\nlog.success('Generated VS Code custom data.')\n"
|
|
8
|
+
],
|
|
9
|
+
"mappings": ";;;;AAAA;AACA;AACA;;;ACOA,IAAe;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,cAAc,CAAC,mCAAmC;AAAA,EAClD,iBAAiB;AAAA,EACjB,aAAa;AAAA,EAEb,eAAe;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU,CAAC,aAAa,WAAW,OAAO,QAAQ,cAAc,YAAY;AAAA,IAC5E,MAAM;AAAA,MACJ;AAAA,QACE,MAAM,CAAC,cAAc,eAAe;AAAA,QACpC,aAAa;AAAA,QACb,YAAY;AAAA,UACV;AAAA,YACE,MAAM;AAAA,YACN,aAAa;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,eAAe;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU,CAAC,mBAAmB,kBAAkB,WAAW,sBAAsB,cAAc,YAAY;AAAA,IAC3G,MAAM;AAAA,MACJ;AAAA,QACE,MAAM,CAAC,cAAc,eAAe;AAAA,QACpC,aAAa;AAAA,QACb,YAAY;AAAA,UACV;AAAA,YACE,MAAM;AAAA,YACN,aAAa;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,WAAW;AAAA,IACT,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU,CAAC,aAAa,eAAe,WAAW,cAAc,YAAY;AAAA,IAC5E,yBAAyB;AAAA,IACzB,OAAO,CAAC,WAAW,MAAM;AAAA,EAC3B;AACF;;;ADzDA,eAAsB,wBAAwB,GAAG;AAC/C,MAAI;AACF,QAAI,KAAK,oCAAoC;AAG7C,UAAM,cAAc;AAAA,MAClB,MAAM,uBAAuB;AAAA,MAC7B,MAAM,0BAA0B;AAAA,IAClC,CAAC;AACD,QAAI,QAAQ,0CAA0C;AAAA,WAC/C,KAAP;AACA,QAAI,MAAM,gEAAgE,GAAG;AAAA;AAAA;AAIjF,eAAsB,gBAAgB,GAAG;AACvC,MAAI,KAAK,8BAA8B;AACvC,MAAI,KAAK,sCAAsC;AAAA;AAGjD,SAAS,yBAAyB,GAAG;AACnC,QAAM,iBAAiB,KAAK,UAAU,gBAAQ,eAAe,IAAI;AAEjE,SAAO;AAAA;AAAA,YAEG;AAAA;AAAA;AAAA;;;AEvBZ,eAAS;AACT;AAGA,KAAI,KAAK,mCAAmC;AAE5C,IAAI,cAAc;AAAG,QAAM,yBAAyB;AAAA;AAC/C,OAAI,KAAK,+DAA+D;AAE7E,KAAI,QAAQ,gCAAgC;",
|
|
10
|
+
"debugId": "1C6E80535DADF5D864756E2164756E21",
|
|
11
|
+
"names": []
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/helpers/component-meta.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { path, frameworkPath, join, projectPath } from '@stacksjs/path'\nimport { existsSync, glob, mkdirSync, writeFileSync } from '@stacksjs/storage'\nimport MarkdownIt from 'markdown-it'\nimport { type ComponentMeta, type MetaCheckerOptions, createComponentMetaChecker } from 'vue-component-meta'\n\n/**\n * ℹ️ Useful Links\n *\n * vue-component-meta tests: https://github.com/johnsoncodehk/volar/blob/master/vue-language-tools/vue-component-meta/tests/index.spec.ts\n * Discord thread about improving vue-component-meta: https://discord.com/channels/793943652350427136/1027819645677350912\n * GitHub issue for improving vue-component-meta based on runtime/dynamic props: https://github.com/johnsoncodehk/volar/issues/1854\n * Discord chat: https://discord.com/channels/793943652350427136/1027819645677350912\n * original script: https://raw.githubusercontent.com/jd-solanki/anu/main/scripts/gen-component-meta.ts\n */\n\nexport function generateComponentMeta() {\n const md = new MarkdownIt()\n const checkerOptions: MetaCheckerOptions = {\n forceUseTs: true,\n schema: { ignore: ['MyIgnoredNestedProps'] },\n printer: { newLine: 1 },\n }\n\n const tsconfigChecker = createComponentMetaChecker(projectPath('tsconfig.json'), checkerOptions)\n\n const filterMeta = (meta: ComponentMeta): ComponentApi => {\n // const clonedMeta: ComponentMeta = JSON.parse(JSON.stringify(meta))\n\n // Exclude global props\n const props: ComponentApiProps[] = []\n meta.props.forEach((prop) => {\n if (prop?.global) return\n\n const { name, description, required, type, default: defaultValue } = prop\n\n props.push({\n name: `${name}${required ? '' : '?'}`,\n description: md.render(description),\n\n // required,\n\n type,\n default: defaultValue || 'unknown',\n })\n })\n\n return {\n props,\n events: meta.events,\n slots: meta.slots,\n }\n }\n\n const components = glob.sync(['components/*.stx', 'components/**/*.stx', 'components/*.vue', 'components/**/*.vue'], {\n cwd: projectPath(),\n absolute: true,\n })\n\n components.forEach((componentPath) => {\n // Thanks: https://futurestud.io/tutorials/node-js-get-a-file-name-with-or-without-extension\n const componentExportName = path.parse(componentPath).name\n const meta = filterMeta(tsconfigChecker.getComponentMeta(componentPath, componentExportName))\n\n const metaDirPath = frameworkPath('component-meta')\n\n // if meta dir doesn't exist create\n\n if (!existsSync(metaDirPath)) mkdirSync(metaDirPath)\n\n const metaJsonFilePath = join(metaDirPath, `${componentExportName}.json`)\n writeFileSync(metaJsonFilePath, JSON.stringify(meta, null, 4))\n })\n}\n\nexport interface ComponentApiProps {\n name: ComponentMeta['props'][number]['name']\n description: ComponentMeta['props'][number]['description']\n\n // required: ComponentMeta['props'][number]['required']\n type: ComponentMeta['props'][number]['type']\n default: ComponentMeta['props'][number]['default']\n}\n\nexport interface ComponentApi {\n props: ComponentApiProps[]\n events: ComponentMeta['events']\n slots: ComponentMeta['slots']\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAAA,gBAAS;AACT;AACA;AACA;AAYO,SAAS,qBAAqB,GAAG;AACtC,QAAM,KAAK,IAAI;AACf,QAAM,iBAAqC;AAAA,IACzC,YAAY;AAAA,IACZ,QAAQ,EAAE,QAAQ,CAAC,sBAAsB,EAAE;AAAA,IAC3C,SAAS,EAAE,SAAS,EAAE;AAAA,EACxB;AAEA,QAAM,kBAAkB,2BAA2B,YAAY,eAAe,GAAG,cAAc;AAE/F,QAAM,aAAa,CAAC,SAAsC;AAIxD,UAAM,QAA6B,CAAC;AACpC,SAAK,MAAM,QAAQ,CAAC,SAAS;AAC3B,UAAI,MAAM;AAAQ;AAElB,cAAQ,MAAM,aAAa,UAAU,MAAM,SAAS,iBAAiB;AAErE,YAAM,KAAK;AAAA,QACT,MAAM,GAAG,OAAO,WAAW,KAAK;AAAA,QAChC,aAAa,GAAG,OAAO,WAAW;AAAA,QAIlC;AAAA,QACA,SAAS,gBAAgB;AAAA,MAC3B,CAAC;AAAA,KACF;AAED,WAAO;AAAA,MACL;AAAA,MACA,QAAQ,KAAK;AAAA,MACb,OAAO,KAAK;AAAA,IACd;AAAA;AAGF,QAAM,aAAa,KAAK,KAAK,CAAC,oBAAoB,uBAAuB,oBAAoB,qBAAqB,GAAG;AAAA,IACnH,KAAK,YAAY;AAAA,IACjB,UAAU;AAAA,EACZ,CAAC;AAED,aAAW,QAAQ,CAAC,kBAAkB;AAEpC,UAAM,sBAAsB,MAAK,MAAM,aAAa,EAAE;AACtD,UAAM,OAAO,WAAW,gBAAgB,iBAAiB,eAAe,mBAAmB,CAAC;AAE5F,UAAM,cAAc,cAAc,gBAAgB;AAIlD,SAAK,WAAW,WAAW;AAAG,gBAAU,WAAW;AAEnD,UAAM,mBAAmB,KAAK,aAAa,GAAG,0BAA0B;AACxE,kBAAc,kBAAkB,KAAK,UAAU,MAAM,MAAM,CAAC,CAAC;AAAA,GAC9D;AAAA;",
|
|
8
|
+
"debugId": "A1C0D5A0FE728D3764756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/helpers/lib-entries.ts", "../../../../../config/library.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import process from 'node:process'\nimport { log } from '@stacksjs/logging'\nimport type { LibraryType } from '@stacksjs/path'\nimport { componentsPath, functionsPath, libraryEntryPath } from '@stacksjs/path'\nimport { writeTextFile } from '@stacksjs/storage'\nimport { kebabCase } from '@stacksjs/strings'\nimport { ExitCode } from '@stacksjs/types'\nimport { determineResetPreset } from '@stacksjs/utils'\nimport library from '~/config/library'\n\n/**\n * Based on the config values, this method\n * will generate the library entry points.\n *\n * @param type LibraryType\n */\nexport async function generateLibEntry(type: LibraryType) {\n await createLibraryEntryPoint(type)\n}\n\nexport async function createLibraryEntryPoint(type: LibraryType) {\n if (type === 'vue-components') await createVueLibraryEntryPoint()\n\n if (type === 'web-components') await createWebComponentLibraryEntryPoint()\n\n if (type === 'functions') await createFunctionLibraryEntryPoint()\n}\n\nexport async function createVueLibraryEntryPoint(type: LibraryType = 'vue-components') {\n log.info('Ensuring Component Library Entry Point...')\n\n await writeTextFile({\n path: libraryEntryPath(type),\n data: generateEntryPointData(type),\n }).catch((err) => {\n log.error('There was an error generating the Vue Component Library Entry Point.', err)\n process.exit(ExitCode.FatalError)\n })\n\n log.success('Created Vue Component Library Entry Point')\n}\n\nexport async function createWebComponentLibraryEntryPoint(type: LibraryType = 'web-components') {\n log.info('Ensuring Web Component Library Entry Point...')\n\n await writeTextFile({\n path: libraryEntryPath(type),\n data: generateEntryPointData(type),\n }).catch((err) => {\n log.error('There was an error generating the Web Component library entry point', err)\n process.exit(ExitCode.FatalError)\n })\n\n log.success('Created Web Component Library Entry Point')\n}\n\nexport async function createFunctionLibraryEntryPoint(type: LibraryType = 'functions') {\n log.info('Ensuring Function Library Entry Point...')\n\n await writeTextFile({\n path: libraryEntryPath(type),\n data: generateEntryPointData(type),\n }).catch((err) => {\n log.error('There was an error generating Function Library Entry Point', err)\n process.exit(ExitCode.FatalError)\n })\n\n log.success('Created Functions Library Entry Point')\n}\n\nexport function generateEntryPointData(type: LibraryType): string {\n let arr = []\n\n if (type === 'functions') {\n if (!library.functions?.files) {\n log.error(\n new Error(\n 'There are no functions defined to be built. Please check your config/library.ts file for potential adjustments',\n ),\n )\n process.exit()\n }\n\n for (const fx of library.functions.files) {\n if (Array.isArray(fx)) arr.push(`export * as ${fx[1]} from '${functionsPath(fx[0])}'`)\n else arr.push(`export * from '${functionsPath(fx)}'`)\n }\n\n // join the array into a string with each element being on a new line\n return arr.join('\\r\\n')\n }\n\n if (type === 'vue-components') {\n if (!library.vueComponents?.tags) {\n log.error(\n new Error(\n 'There are no components defined to be built. Please check your config/library.ts file for potential adjustments',\n ),\n )\n process.exit()\n }\n\n arr = determineResetPreset()\n\n for (const component of library.vueComponents.tags.map((tag) => tag.name)) {\n if (Array.isArray(component))\n arr.push(`export { default as ${component[1]} } from '${componentsPath(component[0])}.stx'`)\n else arr.push(`export { default as ${component} } from '${componentsPath(component)}.stx'`)\n }\n\n // join the array into a string with each element being on a new line\n return arr.join('\\r\\n')\n }\n\n // at this point, we know it is a Web Component we are building\n arr = determineResetPreset()\n const imports = [...arr, \"import { defineCustomElement } from 'vue'\"]\n const declarations = []\n const definitions = []\n\n if (!library.webComponents?.tags) {\n log.error(\n new Error(\n 'There are no components defined to be built. Please check your config/library.ts file for potential adjustments',\n ),\n )\n process.exit()\n }\n\n for (const component of library.webComponents.tags.map((tag) => tag.name)) {\n if (Array.isArray(component)) {\n imports.push(`import ${component[1]} from '${componentsPath(component[0])}.stx'`)\n declarations.push(`const ${component[1]}CustomElement = defineCustomElement(${component[1]})`)\n definitions.push(`customElements.define('${kebabCase(component[1] as string)}', ${component[1]}CustomElement)`)\n } else {\n imports.push(`import ${component} from '${componentsPath(component)}.stx'`)\n declarations.push(`const ${component}CustomElement = defineCustomElement(${component})`)\n definitions.push(`customElements.define('${kebabCase(component)}', ${component}CustomElement)`)\n }\n }\n\n // join the array into a string with each element being on a new line\n return [...imports, ...declarations, ...definitions].join('\\r\\n')\n}\n",
|
|
6
|
+
"import type { LibraryConfig } from '@stacksjs/types'\n\n/**\n * **Library Configuration**\n *\n * This configuration defines all of your library options. Because Stacks is fully-typed, you\n * may hover any of the options below and the definitions will be provided. In case you\n * have any questions, feel free to reach out via Discord or GitHub Discussions.\n */\nexport default {\n name: 'hello-world',\n owner: '@stacksjs', // you may or may not add the @ prefix here (it is added automatically)\n repository: 'stacksjs/stacks',\n license: 'MIT',\n author: 'Chris Breuer',\n contributors: ['Chris Breuer <chris@stacksjs.org>'],\n defaultLanguage: 'en',\n releaseable: true,\n\n vueComponents: {\n name: 'hello-world-vue',\n description: 'Your Vue component library description',\n keywords: ['component', 'library', 'vue', 'vite', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n webComponents: {\n name: 'hello-world-elements',\n description: 'Your framework agnostic web component library description.',\n keywords: ['custom-elements', 'web-components', 'library', 'framework-agnostic', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n functions: {\n name: 'hello-world-fx',\n description: 'Your function library description.',\n keywords: ['functions', 'composables', 'library', 'typescript', 'javascript'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SAAS,QAAQ;AAC1E,mBAAa,KAAK,SAAS,gDAAgD,YAAY;AACvF,kBAAY,KAAK,0BAA0B,UAAU,SAAS,OAAO,yBAAyB;AAAA;AAAA,EAElG;AAGA,SAAO,CAAC,GAAG,SAAS,GAAG,cAAc,GAAG,WAAW,EAAE,KAAK,MAAM;AAAA;",
|
|
9
|
+
"debugId": "E5FEEEA60A4C87D364756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/helpers/package-json.ts", "../../../../../config/library.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { log } from '@stacksjs/logging'\nimport { packageJsonPath } from '@stacksjs/path'\nimport { writeTextFile } from '@stacksjs/storage'\nimport library from '~/config/library'\n\ntype PackageJsonType = 'vue-components' | 'web-components' | 'functions'\n\nexport async function generatePackageJson(type: PackageJsonType) {\n let name\n let description\n let directory\n let keywords\n let config\n let prettyName\n\n if (type === 'vue-components') {\n name = library.vueComponents?.name\n description = library.vueComponents?.description\n directory = 'components'\n keywords = library.vueComponents?.keywords\n config = 'vue-components'\n } else if (type === 'web-components') {\n name = library.webComponents?.name\n description = library.webComponents?.description\n directory = 'components'\n keywords = library.webComponents?.keywords\n config = 'web-components'\n } else if (type === 'functions') {\n name = library.functions?.name\n description = library.functions?.description\n directory = 'functions'\n keywords = library.functions?.keywords\n config = 'functions'\n }\n\n try {\n // the version does not have to be set here,\n // it will be set automatically by the release script\n await writeTextFile({\n path: packageJsonPath(type),\n data: `{\n \"name\": \"${name}\",\n \"type\": \"module\",\n \"version\": \"\",\n \"packageManager\": \"bun\",\n \"description\": \"${description}\",\n \"author\": \"${library.author}\",\n \"license\": \"MIT\",\n \"homepage\": \"https://github.com/${library.repository}/tree/main/${directory}#readme\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/${library.repository}.git\",\n \"directory\": \"${directory}\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/${library.repository}/issues\"\n },\n \"keywords\": ${JSON.stringify(keywords)},\n \"contributors\": ${JSON.stringify(library.contributors)},\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"require\": \"./dist/index.cjs\",\n \"import\": \"./dist/index.js\"\n }\n },\n \"main\": \"dist/index.cjs\",\n \"module\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"files\": [\n \"dist\",\n \"README.md\"\n ],\n \"scripts\": {\n \"build\": \"vite build -c ../build/${config}.ts\",\n \"prepublishOnly\": \"bun run build\"\n },\n \"devDependencies\": {\n \"stacks\": \"workspace:*\"\n }\n}\n`,\n })\n\n if (type === 'vue-components') prettyName = 'Vue Component library'\n else if (type === 'web-components') prettyName = 'Web Component library'\n else if (type === 'functions') prettyName = 'Function Library'\n\n log.success(`Created ${prettyName} package.json file`)\n } catch (err) {\n log.error(`There was an error creating the ${prettyName} package.json`, err)\n }\n}\n",
|
|
6
|
+
"import type { LibraryConfig } from '@stacksjs/types'\n\n/**\n * **Library Configuration**\n *\n * This configuration defines all of your library options. Because Stacks is fully-typed, you\n * may hover any of the options below and the definitions will be provided. In case you\n * have any questions, feel free to reach out via Discord or GitHub Discussions.\n */\nexport default {\n name: 'hello-world',\n owner: '@stacksjs', // you may or may not add the @ prefix here (it is added automatically)\n repository: 'stacksjs/stacks',\n license: 'MIT',\n author: 'Chris Breuer',\n contributors: ['Chris Breuer <chris@stacksjs.org>'],\n defaultLanguage: 'en',\n releaseable: true,\n\n vueComponents: {\n name: 'hello-world-vue',\n description: 'Your Vue component library description',\n keywords: ['component', 'library', 'vue', 'vite', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n webComponents: {\n name: 'hello-world-elements',\n description: 'Your framework agnostic web component library description.',\n keywords: ['custom-elements', 'web-components', 'library', 'framework-agnostic', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n functions: {\n name: 'hello-world-fx',\n description: 'Your function library description.',\n keywords: ['functions', 'composables', 'library', 'typescript', 'javascript'],\n shouldGenerateSourcemap: false,\n files: ['counter', 'dark'],\n },\n} satisfies LibraryConfig\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";;AAAA;AACA;AACA;;;ACOA,IAAe;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,cAAc,CAAC,mCAAmC;AAAA,EAClD,iBAAiB;AAAA,EACjB,aAAa;AAAA,EAEb,eAAe;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU,CAAC,aAAa,WAAW,OAAO,QAAQ,cAAc,YAAY;AAAA,IAC5E,MAAM;AAAA,MACJ;AAAA,QACE,MAAM,CAAC,cAAc,eAAe;AAAA,QACpC,aAAa;AAAA,QACb,YAAY;AAAA,UACV;AAAA,YACE,MAAM;AAAA,YACN,aAAa;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,eAAe;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU,CAAC,mBAAmB,kBAAkB,WAAW,sBAAsB,cAAc,YAAY;AAAA,IAC3G,MAAM;AAAA,MACJ;AAAA,QACE,MAAM,CAAC,cAAc,eAAe;AAAA,QACpC,aAAa;AAAA,QACb,YAAY;AAAA,UACV;AAAA,YACE,MAAM;AAAA,YACN,aAAa;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,WAAW;AAAA,IACT,MAAM;AAAA,IACN,aAAa;A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a;AAAA,aACxC,SAAS;AAAa,mBAAa;AAE5C,QAAI,QAAQ,WAAW,8BAA8B;AAAA,WAC9C,KAAP;AACA,QAAI,MAAM,mCAAmC,2BAA2B,GAAG;AAAA;AAAA;",
|
|
9
|
+
"debugId": "F34EB7FD253D9D8964756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
package/dist/helpers/utils.js
CHANGED
|
@@ -5,9 +5,8 @@ import {err} from "@stacksjs/error-handling";
|
|
|
5
5
|
import {log} from "@stacksjs/logging";
|
|
6
6
|
import * as p from "@stacksjs/path";
|
|
7
7
|
import {glob} from "@stacksjs/storage";
|
|
8
|
-
var {Glob } = globalThis.Bun;
|
|
9
8
|
async function runAction(action, options) {
|
|
10
|
-
const glob2 = new Glob("**/*.ts");
|
|
9
|
+
const glob2 = new Bun.Glob("**/*.ts");
|
|
11
10
|
const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true };
|
|
12
11
|
for await (const file of glob2.scan(scanOptions)) {
|
|
13
12
|
log.debug("file", file);
|
|
@@ -65,3 +64,6 @@ export {
|
|
|
65
64
|
runAction,
|
|
66
65
|
hasAction
|
|
67
66
|
};
|
|
67
|
+
|
|
68
|
+
//# debugId=C8516F286636F7F464756E2164756E21
|
|
69
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/helpers/utils.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { Action as ActionType } from '@stacksjs/actions'\nimport { buddyOptions, runCommand, runCommands } from '@stacksjs/cli'\nimport { err } from '@stacksjs/error-handling'\nimport { log } from '@stacksjs/logging'\nimport * as p from '@stacksjs/path'\nimport { glob } from '@stacksjs/storage'\nimport type { ActionOptions } from '@stacksjs/types'\n\ntype ActionPath = string // TODO: narrow this by automating its generation\ntype ActionName = string // TODO: narrow this by automating its generation\ntype Action = ActionPath | ActionName | string\n\n/**\n * Run an Action the Stacks way.\n *\n * @param action The action to invoke.\n * @param options The options to pass to the command.\n * @returns The result of the command.\n */\nexport async function runAction(action: Action, options?: ActionOptions) {\n // check if action is a file anywhere in ./app/Actions/**/*.ts\n // if it is, return and await the action\n const glob = new Bun.Glob('**/*.ts')\n const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true }\n\n for await (const file of glob.scan(scanOptions)) {\n log.debug('file', file)\n if (file === `${action}.ts` || file.endsWith(`${action}.ts`))\n return ((await import(/* @vite-ignore */ p.userActionsPath(file))).default as ActionType).handle()\n\n // if a custom model name is used, we need to check for it\n const a = await import(/* @vite-ignore */ p.userActionsPath(file))\n if (a.name === action) return await a.handle()\n }\n\n // or else, just run the action normally by assuming the action is core Action, stored in p.actionsPath\n const opts = buddyOptions()\n const path = p.relativeActionsPath(`src/${action}.ts`)\n const cmd = `bun --bun ${path} ${opts}`.trimEnd()\n const optionsWithCwd = {\n cwd: options?.cwd || p.projectPath(),\n ...options,\n }\n\n log.debug('runAction:', cmd)\n log.debug('action options:', optionsWithCwd)\n\n return await runCommand(cmd, optionsWithCwd)\n}\n\n/**\n * Run Actions the Stacks way.\n *\n * @param actions The actions to invoke.\n * @param options The options to pass to the command.\n * @returns The result of the command.\n */\nexport async function runActions(actions: Action[], options?: ActionOptions) {\n log.debug('runActions:', actions, options)\n\n if (!actions.length) return err('No actions were specified')\n\n for (const action of actions) {\n log.debug(`running action \"${action}\"`)\n if (!hasAction(action)) return err(`The specified action \"${action}\" does not exist`)\n }\n\n const opts = buddyOptions()\n\n const o = {\n cwd: options?.cwd || p.projectPath(),\n ...options,\n }\n\n const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`src/${action}.ts`)} ${opts}`)\n\n log.debug('commands:', commands)\n\n return await runCommands(commands, o)\n}\n\n// looks in most common locations\nexport function hasAction(action: Action) {\n // Define patterns specifically for user actions\n const userActionPatterns = [\n `${action}.ts`,\n `${action}`,\n `Dashboard/${action}.ts`,\n `Dashboard/${action}`,\n `Buddy/${action}.ts`,\n `Buddy/${action}`,\n ]\n\n // Define patterns specifically for core actions\n const actionPatterns = [`src/${action}.ts`, `src/${action}`, `${action}.ts`, `${action}`]\n\n // Check user actions path with its specific patterns\n const userActionFiles = glob.sync(userActionPatterns.map((pattern) => p.userActionsPath(pattern)))\n\n // Check actions path with its specific patterns\n const actionFiles = glob.sync(actionPatterns.map((pattern) => p.actionsPath(pattern)))\n\n return userActionFiles.length > 0 || actionFiles.length > 0\n\n // TODO: need to loop through all user actions and check whether the name is a valid action name match\n\n // return false\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AACA;AACA;AACA;AACA;AACA;AAcA,eAAsB,SAAS,CAAC,QAAgB,SAAyB;AAGvE,QAAM,QAAO,IAAI,IAAI,KAAK,SAAS;AACnC,QAAM,cAAc,EAAE,KAAO,kBAAgB,GAAG,WAAW,KAAK;AAEhE,mBAAiB,QAAQ,MAAK,KAAK,WAAW,GAAG;AAC/C,QAAI,MAAM,QAAQ,IAAI;AACtB,QAAI,SAAS,GAAG,eAAe,KAAK,SAAS,GAAG,WAAW;AACzD,cAAS,MAAgC,OAAE,kBAAgB,IAAI,IAAI,QAAuB,OAAO;AAGnG,UAAM,IAAI,MAAgC,OAAE,kBAAgB,IAAI;AAChE,QAAI,EAAE,SAAS;AAAQ,aAAO,MAAM,EAAE,OAAO;AAAA,EAC/C;AAGA,QAAM,OAAO,aAAa;AAC1B,QAAM,OAAS,sBAAoB,OAAO,WAAW;AACrD,QAAM,MAAM,aAAa,QAAQ,OAAO,QAAQ;AAChD,QAAM,iBAAiB;AAAA,IACrB,KAAK,SAAS,OAAS,cAAY;AAAA,OAChC;AAAA,EACL;AAEA,MAAI,MAAM,cAAc,GAAG;AAC3B,MAAI,MAAM,mBAAmB,cAAc;AAE3C,SAAO,MAAM,WAAW,KAAK,cAAc;AAAA;AAU7C,eAAsB,UAAU,CAAC,SAAmB,SAAyB;AAC3E,MAAI,MAAM,eAAe,SAAS,OAAO;AAEzC,OAAK,QAAQ;AAAQ,WAAO,IAAI,2BAA2B;AAE3D,aAAW,UAAU,SAAS;AAC5B,QAAI,MAAM,mBAAmB,SAAS;AACtC,SAAK,UAAU,MAAM;AAAG,aAAO,IAAI,yBAAyB,wBAAwB;AAAA,EACtF;AAEA,QAAM,OAAO,aAAa;AAE1B,QAAM,IAAI;AAAA,IACR,KAAK,SAAS,OAAS,cAAY;AAAA,OAChC;AAAA,EACL;AAEA,QAAM,WAAW,QAAQ,IAAI,CAAC,WAAW,aAAe,sBAAoB,OAAO,WAAW,KAAK,MAAM;AAEzG,MAAI,MAAM,aAAa,QAAQ;AAE/B,SAAO,MAAM,YAAY,UAAU,CAAC;AAAA;AAI/B,SAAS,SAAS,CAAC,QAAgB;AAExC,QAAM,qBAAqB;AAAA,IACzB,GAAG;AAAA,IACH,GAAG;AAAA,IACH,aAAa;AAAA,IACb,aAAa;AAAA,IACb,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAGA,QAAM,iBAAiB,CAAC,OAAO,aAAa,OAAO,UAAU,GAAG,aAAa,GAAG,QAAQ;AAGxF,QAAM,kBAAkB,KAAK,KAAK,mBAAmB,IAAI,CAAC,YAAc,kBAAgB,OAAO,CAAC,CAAC;AAGjG,QAAM,cAAc,KAAK,KAAK,eAAe,IAAI,CAAC,YAAc,cAAY,OAAO,CAAC,CAAC;AAErF,SAAO,gBAAgB,SAAS,KAAK,YAAY,SAAS;AAAA;",
|
|
8
|
+
"debugId": "C8516F286636F7F464756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -74,15 +74,18 @@ async function generateWebTypes() {
|
|
|
74
74
|
log.info("Generating web-types.json...");
|
|
75
75
|
log.info("This feature is not yet implemented.");
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
function generateComponentInfoData() {
|
|
78
78
|
const componentsData = JSON.stringify(library_default.vueComponents?.tags);
|
|
79
79
|
return `{
|
|
80
80
|
"version": 1.1,
|
|
81
81
|
"tags": ${componentsData}
|
|
82
82
|
}
|
|
83
83
|
`;
|
|
84
|
-
}
|
|
84
|
+
}
|
|
85
85
|
export {
|
|
86
86
|
generateWebTypes,
|
|
87
87
|
generateVsCodeCustomData
|
|
88
88
|
};
|
|
89
|
+
|
|
90
|
+
//# debugId=A186E1972B9453C364756E2164756E21
|
|
91
|
+
//# sourceMappingURL=vscode-custom-data.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/helpers/vscode-custom-data.ts", "../../../../../config/library.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { log } from '@stacksjs/logging'\nimport { customElementsDataPath } from '@stacksjs/path'\nimport { writeTextFile } from '@stacksjs/storage'\nimport library from '~/config/library'\n\nexport async function generateVsCodeCustomData() {\n try {\n log.info('Generating custom-elements.json...')\n // the version does not have to be set here,\n // it will be set automatically by the release script\n await writeTextFile({\n path: customElementsDataPath(),\n data: generateComponentInfoData(),\n })\n log.success('Generated custom-elements.json for IDEs.')\n } catch (err) {\n log.error('There was an error generating the custom-elements.json file.', err)\n }\n}\n\nexport async function generateWebTypes() {\n log.info('Generating web-types.json...')\n log.info('This feature is not yet implemented.')\n}\n\nfunction generateComponentInfoData() {\n const componentsData = JSON.stringify(library.vueComponents?.tags)\n\n return `{\n \"version\": 1.1,\n \"tags\": ${componentsData}\n}\n`\n}\n",
|
|
6
|
+
"import type { LibraryConfig } from '@stacksjs/types'\n\n/**\n * **Library Configuration**\n *\n * This configuration defines all of your library options. Because Stacks is fully-typed, you\n * may hover any of the options below and the definitions will be provided. In case you\n * have any questions, feel free to reach out via Discord or GitHub Discussions.\n */\nexport default {\n name: 'hello-world',\n owner: '@stacksjs', // you may or may not add the @ prefix here (it is added automatically)\n repository: 'stacksjs/stacks',\n license: 'MIT',\n author: 'Chris Breuer',\n contributors: ['Chris Breuer <chris@stacksjs.org>'],\n defaultLanguage: 'en',\n releaseable: true,\n\n vueComponents: {\n name: 'hello-world-vue',\n description: 'Your Vue component library description',\n keywords: ['component', 'library', 'vue', 'vite', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n webComponents: {\n name: 'hello-world-elements',\n description: 'Your framework agnostic web component library description.',\n keywords: ['custom-elements', 'web-components', 'library', 'framework-agnostic', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n functions: {\n name: 'hello-world-fx',\n description: 'Your function library description.',\n keywords: ['functions', 'composables', 'library', 'typescript', 'javascript'],\n shouldGenerateSourcemap: false,\n files: ['counter', 'dark'],\n },\n} satisfies LibraryConfig\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";;AAAA;AACA;AACA;;;ACOA,IAAe;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,cAAc,CAAC,mCAAmC;AAAA,EAClD,iBAAiB;AAAA,EACjB,aAAa;AAAA,EAEb,eAAe;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU,CAAC,aAAa,WAAW,OAAO,QAAQ,cAAc,YAAY;AAAA,IAC5E,MAAM;AAAA,MACJ;AAAA,QACE,MAAM,CAAC,cAAc,eAAe;AAAA,QACpC,aAAa;AAAA,QACb,YAAY;AAAA,UACV;AAAA,YACE,MAAM;AAAA,YACN,aAAa;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,eAAe;AAAA,IACb,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU,CAAC,mBAAmB,kBAAkB,WAAW,sBAAsB,cAAc,YAAY;AAAA,IAC3G,MAAM;AAAA,MACJ;AAAA,QACE,MAAM,CAAC,cAAc,eAAe;AAAA,QACpC,aAAa;AAAA,QACb,YAAY;AAAA,UACV;AAAA,YACE,MAAM;AAAA,YACN,aAAa;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,WAAW;AAAA,IACT,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU,CAAC,aAAa,eAAe,WAAW,cAAc,YAAY;AAAA,IAC5E,yBAAyB;AAAA,IACzB,OAAO,CAAC,WAAW,MAAM;AAAA,EAC3B;AACF;;;ADzDA,eAAsB,wBAAwB,GAAG;AAC/C,MAAI;AACF,QAAI,KAAK,oCAAoC;AAG7C,UAAM,cAAc;AAAA,MAClB,MAAM,uBAAuB;AAAA,MAC7B,MAAM,0BAA0B;AAAA,IAClC,CAAC;AACD,QAAI,QAAQ,0CAA0C;AAAA,WAC/C,KAAP;AACA,QAAI,MAAM,gEAAgE,GAAG;AAAA;AAAA;AAIjF,eAAsB,gBAAgB,GAAG;AACvC,MAAI,KAAK,8BAA8B;AACvC,MAAI,KAAK,sCAAsC;AAAA;AAGjD,SAAS,yBAAyB,GAAG;AACnC,QAAM,iBAAiB,KAAK,UAAU,gBAAQ,eAAe,IAAI;AAEjE,SAAO;AAAA;AAAA,YAEG;AAAA;AAAA;AAAA;",
|
|
9
|
+
"debugId": "A186E1972B9453C364756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,8 @@ import {err} from "@stacksjs/error-handling";
|
|
|
5
5
|
import {log} from "@stacksjs/logging";
|
|
6
6
|
import * as p from "@stacksjs/path";
|
|
7
7
|
import {glob} from "@stacksjs/storage";
|
|
8
|
-
var {Glob } = globalThis.Bun;
|
|
9
8
|
async function runAction(action, options) {
|
|
10
|
-
const glob2 = new Glob("**/*.ts");
|
|
9
|
+
const glob2 = new Bun.Glob("**/*.ts");
|
|
11
10
|
const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true };
|
|
12
11
|
for await (const file of glob2.scan(scanOptions)) {
|
|
13
12
|
log.debug("file", file);
|
|
@@ -175,14 +174,14 @@ async function generateWebTypes() {
|
|
|
175
174
|
log3.info("Generating web-types.json...");
|
|
176
175
|
log3.info("This feature is not yet implemented.");
|
|
177
176
|
}
|
|
178
|
-
|
|
177
|
+
function generateComponentInfoData() {
|
|
179
178
|
const componentsData = JSON.stringify(library_default.vueComponents?.tags);
|
|
180
179
|
return `{
|
|
181
180
|
"version": 1.1,
|
|
182
181
|
"tags": ${componentsData}
|
|
183
182
|
}
|
|
184
183
|
`;
|
|
185
|
-
}
|
|
184
|
+
}
|
|
186
185
|
|
|
187
186
|
// src/generate/index.ts
|
|
188
187
|
import process from "process";
|
|
@@ -618,8 +617,21 @@ class Action3 {
|
|
|
618
617
|
path;
|
|
619
618
|
method;
|
|
620
619
|
validations;
|
|
620
|
+
requestFile;
|
|
621
621
|
handle;
|
|
622
|
-
constructor({
|
|
622
|
+
constructor({
|
|
623
|
+
name,
|
|
624
|
+
description,
|
|
625
|
+
validations,
|
|
626
|
+
handle,
|
|
627
|
+
rate,
|
|
628
|
+
tries,
|
|
629
|
+
backoff,
|
|
630
|
+
enabled,
|
|
631
|
+
path: path4,
|
|
632
|
+
method,
|
|
633
|
+
requestFile
|
|
634
|
+
}) {
|
|
623
635
|
this.name = name;
|
|
624
636
|
this.description = description;
|
|
625
637
|
this.validations = validations;
|
|
@@ -630,6 +642,7 @@ class Action3 {
|
|
|
630
642
|
this.path = path4;
|
|
631
643
|
this.method = method;
|
|
632
644
|
this.handle = handle;
|
|
645
|
+
this.requestFile = requestFile;
|
|
633
646
|
}
|
|
634
647
|
}
|
|
635
648
|
export {
|
|
@@ -678,3 +691,6 @@ export {
|
|
|
678
691
|
createComponent,
|
|
679
692
|
Action3 as Action
|
|
680
693
|
};
|
|
694
|
+
|
|
695
|
+
//# debugId=D0F28C13BB87BA2364756E2164756E21
|
|
696
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/helpers/utils.ts", "../src/dev/index.ts", "../src/helpers/vscode-custom-data.ts", "../../../../../config/library.ts", "../src/generate/index.ts", "../src/add.ts", "../src/commit.ts", "../src/make.ts", "../src/action.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { Action as ActionType } from '@stacksjs/actions'\nimport { buddyOptions, runCommand, runCommands } from '@stacksjs/cli'\nimport { err } from '@stacksjs/error-handling'\nimport { log } from '@stacksjs/logging'\nimport * as p from '@stacksjs/path'\nimport { glob } from '@stacksjs/storage'\nimport type { ActionOptions } from '@stacksjs/types'\n\ntype ActionPath = string // TODO: narrow this by automating its generation\ntype ActionName = string // TODO: narrow this by automating its generation\ntype Action = ActionPath | ActionName | string\n\n/**\n * Run an Action the Stacks way.\n *\n * @param action The action to invoke.\n * @param options The options to pass to the command.\n * @returns The result of the command.\n */\nexport async function runAction(action: Action, options?: ActionOptions) {\n // check if action is a file anywhere in ./app/Actions/**/*.ts\n // if it is, return and await the action\n const glob = new Bun.Glob('**/*.ts')\n const scanOptions = { cwd: p.userActionsPath(), onlyFiles: true }\n\n for await (const file of glob.scan(scanOptions)) {\n log.debug('file', file)\n if (file === `${action}.ts` || file.endsWith(`${action}.ts`))\n return ((await import(/* @vite-ignore */ p.userActionsPath(file))).default as ActionType).handle()\n\n // if a custom model name is used, we need to check for it\n const a = await import(/* @vite-ignore */ p.userActionsPath(file))\n if (a.name === action) return await a.handle()\n }\n\n // or else, just run the action normally by assuming the action is core Action, stored in p.actionsPath\n const opts = buddyOptions()\n const path = p.relativeActionsPath(`src/${action}.ts`)\n const cmd = `bun --bun ${path} ${opts}`.trimEnd()\n const optionsWithCwd = {\n cwd: options?.cwd || p.projectPath(),\n ...options,\n }\n\n log.debug('runAction:', cmd)\n log.debug('action options:', optionsWithCwd)\n\n return await runCommand(cmd, optionsWithCwd)\n}\n\n/**\n * Run Actions the Stacks way.\n *\n * @param actions The actions to invoke.\n * @param options The options to pass to the command.\n * @returns The result of the command.\n */\nexport async function runActions(actions: Action[], options?: ActionOptions) {\n log.debug('runActions:', actions, options)\n\n if (!actions.length) return err('No actions were specified')\n\n for (const action of actions) {\n log.debug(`running action \"${action}\"`)\n if (!hasAction(action)) return err(`The specified action \"${action}\" does not exist`)\n }\n\n const opts = buddyOptions()\n\n const o = {\n cwd: options?.cwd || p.projectPath(),\n ...options,\n }\n\n const commands = actions.map((action) => `bun --bun ${p.relativeActionsPath(`src/${action}.ts`)} ${opts}`)\n\n log.debug('commands:', commands)\n\n return await runCommands(commands, o)\n}\n\n// looks in most common locations\nexport function hasAction(action: Action) {\n // Define patterns specifically for user actions\n const userActionPatterns = [\n `${action}.ts`,\n `${action}`,\n `Dashboard/${action}.ts`,\n `Dashboard/${action}`,\n `Buddy/${action}.ts`,\n `Buddy/${action}`,\n ]\n\n // Define patterns specifically for core actions\n const actionPatterns = [`src/${action}.ts`, `src/${action}`, `${action}.ts`, `${action}`]\n\n // Check user actions path with its specific patterns\n const userActionFiles = glob.sync(userActionPatterns.map((pattern) => p.userActionsPath(pattern)))\n\n // Check actions path with its specific patterns\n const actionFiles = glob.sync(actionPatterns.map((pattern) => p.actionsPath(pattern)))\n\n return userActionFiles.length > 0 || actionFiles.length > 0\n\n // TODO: need to loop through all user actions and check whether the name is a valid action name match\n\n // return false\n}\n",
|
|
6
|
+
"import { Action } from '@stacksjs/enums'\nimport { log } from '@stacksjs/logging'\nimport type { DevOptions } from '@stacksjs/types'\nimport { runAction } from '../helpers'\n\nexport async function runDevServer(options: DevOptions) {\n log.info('Starting your Frontend Engine...')\n await runAction(Action.Dev, options)\n}\n\nexport async function runFrontendDevServer(options: DevOptions) {\n log.info('Starting your UI Engine...')\n await runAction(Action.Dev, options)\n}\n\nexport async function runBackendDevServer(options: DevOptions) {\n runApiDevServer(options)\n}\n\nexport async function runApiDevServer(options: DevOptions) {\n log.info('Starting your API...')\n await runAction(Action.DevApi, options)\n}\n\nexport async function runComponentsDevServer(options: DevOptions) {\n log.info('Starting your Library Engine...')\n await runAction(Action.DevComponents, options)\n}\n\nexport async function runDashboardDevServer(options: DevOptions) {\n log.info('Starting your Dashboard...')\n await runAction(Action.DevDashboard, options)\n}\n\nexport async function runSystemTrayDevServer(options: DevOptions) {\n log.info('Starting your System Tray...')\n await runAction(Action.DevSystemTray, options)\n}\n\nexport async function runDesktopDevServer(options: DevOptions) {\n log.info('Starting your Desktop Engine...')\n await runAction(Action.DevDesktop, options)\n}\n\nexport async function runDocsDevServer(options: DevOptions) {\n log.info('Starting your Docs Engine...')\n await runAction(Action.DevDocs, options)\n}\n",
|
|
7
|
+
"import { log } from '@stacksjs/logging'\nimport { customElementsDataPath } from '@stacksjs/path'\nimport { writeTextFile } from '@stacksjs/storage'\nimport library from '~/config/library'\n\nexport async function generateVsCodeCustomData() {\n try {\n log.info('Generating custom-elements.json...')\n // the version does not have to be set here,\n // it will be set automatically by the release script\n await writeTextFile({\n path: customElementsDataPath(),\n data: generateComponentInfoData(),\n })\n log.success('Generated custom-elements.json for IDEs.')\n } catch (err) {\n log.error('There was an error generating the custom-elements.json file.', err)\n }\n}\n\nexport async function generateWebTypes() {\n log.info('Generating web-types.json...')\n log.info('This feature is not yet implemented.')\n}\n\nfunction generateComponentInfoData() {\n const componentsData = JSON.stringify(library.vueComponents?.tags)\n\n return `{\n \"version\": 1.1,\n \"tags\": ${componentsData}\n}\n`\n}\n",
|
|
8
|
+
"import type { LibraryConfig } from '@stacksjs/types'\n\n/**\n * **Library Configuration**\n *\n * This configuration defines all of your library options. Because Stacks is fully-typed, you\n * may hover any of the options below and the definitions will be provided. In case you\n * have any questions, feel free to reach out via Discord or GitHub Discussions.\n */\nexport default {\n name: 'hello-world',\n owner: '@stacksjs', // you may or may not add the @ prefix here (it is added automatically)\n repository: 'stacksjs/stacks',\n license: 'MIT',\n author: 'Chris Breuer',\n contributors: ['Chris Breuer <chris@stacksjs.org>'],\n defaultLanguage: 'en',\n releaseable: true,\n\n vueComponents: {\n name: 'hello-world-vue',\n description: 'Your Vue component library description',\n keywords: ['component', 'library', 'vue', 'vite', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n webComponents: {\n name: 'hello-world-elements',\n description: 'Your framework agnostic web component library description.',\n keywords: ['custom-elements', 'web-components', 'library', 'framework-agnostic', 'typescript', 'javascript'],\n tags: [\n {\n name: ['HelloWorld', 'AppHelloWorld'],\n description: 'The Hello World custom element, built via this framework.',\n attributes: [\n {\n name: 'greeting',\n description: 'The greeting.',\n },\n ],\n },\n ],\n },\n\n functions: {\n name: 'hello-world-fx',\n description: 'Your function library description.',\n keywords: ['functions', 'composables', 'library', 'typescript', 'javascript'],\n shouldGenerateSourcemap: false,\n files: ['counter', 'dark'],\n },\n} satisfies LibraryConfig\n",
|
|
9
|
+
"import process from 'node:process'\nimport { runCommand } from '@stacksjs/cli'\nimport { Action, NpmScript } from '@stacksjs/enums'\nimport { log } from '@stacksjs/logging'\nimport { frameworkPath, projectPath } from '@stacksjs/path'\nimport type { GeneratorOptions } from '@stacksjs/types'\nimport { runNpmScript } from '@stacksjs/utils'\nimport { runAction } from '../helpers'\nimport { generateVsCodeCustomData as genVsCodeCustomData } from '../helpers/vscode-custom-data'\n\n// import { files } from '@stacksjs/storage'\n\nexport async function invoke(options?: GeneratorOptions) {\n if (options?.types) await generateTypes(options)\n else if (options?.entries) await generateLibEntries(options)\n else if (options?.webTypes) await generateWebTypes(options)\n else if (options?.customData) await generateVsCodeCustomData(options)\n else if (options?.ideHelpers) await generateIdeHelpers(options)\n else if (options?.componentMeta) await generateComponentMeta(options)\n else if (options?.coreSymlink) await generateCoreSymlink()\n}\n\nexport function generate(options: GeneratorOptions) {\n return invoke(options)\n}\n\nexport async function generateLibEntries(options: GeneratorOptions) {\n const result = await runAction(Action.GenerateLibraryEntries, {\n ...options,\n cwd: projectPath(),\n })\n\n if (result.isErr()) {\n log.error('There was an error generating your library entry points', result.error)\n process.exit()\n }\n\n log.success('Library entry points generated successfully')\n}\n\nexport async function generateWebTypes(options?: GeneratorOptions) {\n const result = await runNpmScript(NpmScript.GenerateWebTypes, options)\n\n if (result.isErr()) {\n log.error('There was an error generating the web-types.json file.', result.error)\n process.exit()\n }\n\n log.success('Successfully generated the web-types.json file')\n}\n\nexport async function generateVsCodeCustomData(options?: GeneratorOptions) {\n const result = await genVsCodeCustomData()\n\n if (result.isErr()) {\n log.error('There was an error generating the custom-elements.json file.', result.error)\n process.exit()\n }\n\n await runAction(Action.LintFix, { verbose: true }) // because the generated json file needs to be linted\n\n log.success('Successfully generated the custom-elements.json file')\n}\n\nexport async function generateIdeHelpers(options?: GeneratorOptions) {\n const result = await runNpmScript(NpmScript.GenerateIdeHelpers, options)\n\n if (result.isErr()) {\n log.error('There was an error generating IDE helpers.', result.error)\n process.exit()\n }\n\n await runAction(Action.LintFix, { verbose: true }) // the generated json file needs to be linted\n log.success('Successfully generated IDE helpers')\n}\n\nexport async function generateComponentMeta(options?: GeneratorOptions) {\n const result = await genVsCodeCustomData()\n\n if (result.isErr()) {\n log.error('There was an error generating your component meta information.', result.error)\n process.exit()\n }\n\n await runAction(Action.LintFix, { verbose: true }) // the generated json file needs to be linted\n log.success('Successfully generated component meta information')\n}\n\nexport async function generateTypes(options?: GeneratorOptions) {\n const result = await runNpmScript(NpmScript.GenerateTypes, {\n cwd: frameworkPath(),\n ...options,\n })\n\n if (result.isErr()) {\n log.error('There was an error generating your types.', result.error)\n process.exit()\n }\n\n log.success('Types were generated successfully')\n}\n\nexport function generatePkgxConfig() {\n // write the yaml string to a file in your project root\n // files.put(projectPath('./pkgx.yaml'), yamlStr)\n\n log.success('Successfully generated `./pkgx.yaml` based on your config')\n}\n\nexport async function generateSeeder() {\n // await seed()\n}\n\nexport async function generateCoreSymlink() {\n await runCommand(`ln -s ${frameworkPath()} ${projectPath('.stacks')}`)\n}\n",
|
|
10
|
+
"import { installPackage } from '@stacksjs/cli'\nimport type { AddOptions } from '@stacksjs/types'\n\nexport async function invoke(options: AddOptions) {\n if (options?.table) await addTable()\n\n if (options?.calendar) await addCalendar()\n}\n\nexport async function add(options: AddOptions) {\n return invoke(options)\n}\n\nexport async function addTable() {\n await installPackage('@stacksjs/table')\n}\n\nexport async function addCalendar() {\n await installPackage('@stacksjs/calendar')\n}\n\nexport async function installPackages(names: string[]) {\n for (const name of names) await installPackage(name)\n}\n",
|
|
11
|
+
"import { NpmScript } from '@stacksjs/enums'\nimport { log } from '@stacksjs/logging'\nimport type { CleanOptions } from '@stacksjs/types'\nimport { runNpmScript } from '@stacksjs/utils'\n\nexport async function invoke(options: CleanOptions) {\n log.info('Committing...')\n await runNpmScript(NpmScript.Commit, options)\n log.success('Committed')\n}\n\nexport async function commit(options: CleanOptions) {\n return invoke(options)\n}\n",
|
|
12
|
+
"import process from 'node:process'\nimport { italic } from '@stacksjs/cli'\nimport { log } from '@stacksjs/logging'\nimport { frameworkPath, path as p, projectPath, resolve } from '@stacksjs/path'\nimport { createFolder, doesFolderExist, writeTextFile } from '@stacksjs/storage'\nimport type { MakeOptions } from '@stacksjs/types'\n\nexport async function invoke(options: MakeOptions) {\n if (options.component) await makeComponent(options)\n if (options.database) makeDatabase(options)\n if (options.function) await makeFunction(options)\n if (options.language) await makeLanguage(options)\n\n // if (options.migration)\n // await migration(options)\n\n if (options.notification) await makeNotification(options)\n if (options.page) await makePage(options)\n if (options.stack) makeStack(options)\n}\n\nexport async function make(options: MakeOptions) {\n return invoke(options)\n}\n\nexport async function makeAction(options: MakeOptions) {\n try {\n const name = options.name\n log.info('Creating your action...')\n await createAction(options)\n log.success(`Created ${italic(name)} action`)\n } catch (error) {\n log.error('There was an error creating your action', error)\n process.exit()\n }\n}\n\nexport async function makeComponent(options: MakeOptions) {\n try {\n const name = options.name\n log.info('Creating your component...')\n await createComponent(options)\n log.success(`Created ${italic(name)} component`)\n } catch (error) {\n log.error('There was an error creating your component', error)\n process.exit()\n }\n}\n\nexport async function createAction(options: MakeOptions) {\n const name = options.name\n await writeTextFile({\n path: p.userActionsPath(`${name}.ts`),\n data: `import { Action } from '@stacksjs/actions'\n\nexport default new Action({\n name: '${name}',\n description: '${name} action',\n\n handle() {\n return 'Hello World action'\n },\n})\n`,\n })\n}\n\nexport async function createComponent(options: MakeOptions) {\n const name = options.name\n await writeTextFile({\n path: p.userComponentsPath(`${name}.stx`),\n data: `<script setup lang=\"ts\">\nconsole.log('Hello World component created')\n</script>\n\n<template>\n <div>\n Some HTML block\n </div>\n</template>\n`,\n })\n}\n\nexport function makeDatabase(options: MakeOptions) {\n try {\n const name = options.name\n log.info(`Creating your ${italic(name)} database...`)\n createDatabase(options)\n log.success(`Created ${italic(name)} database`)\n } catch (error) {\n log.error('There was an error creating your database', error)\n process.exit()\n }\n}\n\nexport function createDatabase(options: MakeOptions) {\n console.log('createDatabase options', options) // wip\n}\n\nexport function factory(options: MakeOptions) {\n try {\n const name = options.name\n log.info(`Creating your ${italic(name)} factory...`)\n createDatabase(options)\n log.success(`Created ${italic(name)} factory`)\n } catch (error) {\n log.error('There was an error creating your factory', error)\n process.exit()\n }\n}\n\nexport function createFactory(options: MakeOptions) {\n console.log('options', options) // wip\n}\n\nexport async function makeNotification(options: MakeOptions) {\n try {\n const name = options.name\n log.info(`Creating your ${italic(name)} notification...`)\n await createNotification(options)\n log.success(`Created ${italic(name)} notification`)\n } catch (error) {\n log.error('There was an error creating your notification', error)\n process.exit()\n }\n}\n\nexport async function makePage(options: MakeOptions) {\n try {\n const name = options.name\n log.info('Creating your page...')\n await createPage(options)\n log.success(`Created ${name} page`)\n } catch (error) {\n log.error('There was an error creating your page', error)\n process.exit()\n }\n}\n\nexport async function createPage(options: MakeOptions) {\n const name = options.name\n await writeTextFile({\n path: p.userViewsPath(`${name}.stx`),\n data: `<script setup lang=\"ts\">\nconsole.log('Hello World page created')\n</script>\n\n<template>\n <div>\n Visit http://127.0.0.1/${name}\n </div>\n</template>\n`,\n })\n}\n\nexport async function makeFunction(options: MakeOptions) {\n try {\n const name = options.name\n log.info('Creating your function...')\n await createFunction(options)\n log.success(`Created ${name} function`)\n } catch (error) {\n log.error('There was an error creating your function', error)\n process.exit()\n }\n}\n\nexport async function createFunction(options: MakeOptions) {\n const name = options.name\n await writeTextFile({\n path: p.userFunctionsPath(`${name}.ts`),\n data: `// reactive state\nconst ${name} = ref(0)\n\n// functions that mutate state and trigger updates\nfunction increment() {\n ${name}.value++\n}\n\nexport {\n ${name},\n increment,\n}\n`,\n })\n}\n\nexport async function makeLanguage(options: MakeOptions) {\n try {\n const name = options.name\n log.info('Creating your translation file...')\n await createLanguage(options)\n log.success(`Created ${name} translation file`)\n } catch (error) {\n log.error('There was an error creating your language.', error)\n process.exit()\n }\n}\n\nexport async function createLanguage(options: MakeOptions) {\n const name = options.name\n await writeTextFile({\n path: p.resourcesPath(`lang/${name}.yml`),\n data: `button:\n text: Copy\n`,\n })\n}\n\nexport function makeStack(options: MakeOptions) {\n try {\n const name = options.name\n log.info(`Creating your ${name} stack...`)\n const path = resolve(process.cwd(), name)\n\n // await spawn(`giget stacks ${path}`)\n log.success('Successfully scaffolded your project')\n log.info(`cd ${path} && bun install`)\n } catch (error) {\n log.error('There was an error creating your stack', error)\n process.exit()\n }\n}\n\nexport async function createNotification(options: MakeOptions) {\n const name = options.name\n try {\n let importOption = 'EmailOptions'\n\n if (!doesFolderExist('notifications')) await createFolder('./notifications')\n\n if (options.chat) importOption = 'ChatOptions'\n\n if (options.sms) importOption = 'SMSOptions'\n\n await writeTextFile({\n path: p.userNotificationsPath(`${name}.ts`),\n data: `import type { ${importOption} } from \\'@stacksjs/types\\'\n\nfunction content(): string {\n return 'example'\n}\n\nfunction send(): ${importOption} {\n return {\n content: content(),\n }\n}`,\n })\n\n return true\n } catch (error) {\n return false\n }\n}\n\nexport async function createMigration(options: MakeOptions) {\n const optionName = options.name\n // const table = options.tableName\n const table = 'dummy-name'\n\n if (!optionName[0]) throw new Error('options.name is required and cannot be empty')\n\n const name = optionName[0].toUpperCase() + optionName.slice(1)\n const path = frameworkPath(`database/migrations/${name}.ts`)\n\n try {\n await writeTextFile({\n path: `${path}`,\n data: `import { Kysely } from 'kysely'\n\nexport async function up(db: Kysely<any>): Promise<void> {\n await db.schema\n .createTable('${table}')\n .addColumn('id', 'integer', col => col.autoIncrement().primaryKey())\n .execute()\n}`,\n })\n\n log.success(`Successfully created your migration file at stacks/database/migrations/${name}.ts`)\n } catch (error: any) {\n log.error(error)\n }\n}\n\nexport async function createModel(options: MakeOptions) {\n const optionName = options.name\n\n if (!optionName[0]) throw new Error('options.name is required and cannot be empty')\n\n const name = optionName[0].toUpperCase() + optionName.slice(1)\n const path = p.userModelsPath(`${name}.ts`)\n\n try {\n await writeTextFile({\n path: `${path}`,\n data: `import { faker } from '@stacksjs/faker'\nimport { schema } from '@stacksjs/validation'\nimport type { Model } from '@stacksjs/types'\n\nexport default {\n name: '${name}',\n\n traits: {\n useTimestamps: true,\n\n useSeeder: {\n count: 10,\n },\n },\n\n attributes: {\n // your attributes here\n },\n} satisfies Model`,\n })\n\n log.success(`Model created: ${italic(`app/Models/${name}.ts`)}`)\n } catch (error: any) {\n log.error(error)\n }\n}\n",
|
|
13
|
+
"import type { JobOptions, Nullable } from '@stacksjs/types'\nimport type { ValidationBoolean, ValidationNumber, ValidationString } from '@stacksjs/validation'\nimport type { ModelRequest } from '../../../types/requests'\n\ntype ValidationKey = string\ninterface ValidationValue {\n rule: ValidationString | ValidationNumber | ValidationBoolean | Date | Nullable<any>\n message: string\n}\n\ninterface ActionOptions {\n name?: string\n description?: string\n apiResponse?: boolean\n validations?: Record<ValidationKey, ValidationValue>\n path?: string\n method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'\n rate?: JobOptions['rate']\n tries?: JobOptions['tries']\n backoff?: JobOptions['backoff']\n enabled?: JobOptions['enabled']\n handle: (request: ModelRequest) => Promise<any> | object | string\n}\n\nexport class Action {\n name?: string\n description?: string\n rate?: ActionOptions['rate']\n tries?: ActionOptions['tries']\n backoff?: ActionOptions['backoff']\n enabled?: ActionOptions['enabled']\n path?: ActionOptions['path']\n method?: ActionOptions['method']\n validations?: Record<ValidationKey, ValidationValue>\n requestFile?: string\n handle: (request: ModelRequest) => Promise<any> | object | string\n\n constructor({\n name,\n description,\n validations,\n handle,\n rate,\n tries,\n backoff,\n enabled,\n path,\n method,\n requestFile,\n }: ActionOptions) {\n // log.debug(`Action ${name} created`) // TODO: this does not yet work because the cloud does not yet have proper file system (efs) access\n\n this.name = name\n this.description = description\n this.validations = validations\n this.rate = rate\n this.tries = tries\n this.backoff = backoff\n this.enabled = enabled\n this.path = path\n this.method = method\n this.handle = handle\n this.requestFile = requestFile\n }\n}\n"
|
|
14
|
+
],
|
|
15
|
+
"mappings": ";;AACA;AACA;AACA;AACA;AACA;AAcA,eAAsB,SAAS,CAAC,QAAgB,SAAyB;AAGvE,QAAM,QAAO,IAAI,IAAI,KAAK,SAAS;AACnC,QAAM,cAAc,EAAE,KAAO,kBAAgB,GAAG,WAAW,KAAK;AAEhE,mBAAiB,QAAQ,MAAK,KAAK,WAAW,GAAG;AAC/C,QAAI,MAAM,QAAQ,IAAI;AACtB,QAAI,SAAS,GAAG,eAAe,KAAK,SAAS,GAAG,WAAW;AACzD,cAAS,MAAgC,OAAE,kBAAgB,IAAI,IAAI,QAAuB,OAAO;AAGnG,UAAM,IAAI,MAAgC,OAAE,kBAAgB,IAAI;AAChE,QAAI,EAAE,SAAS;AAAQ,aAAO,MAAM,EAAE,OAAO;AAAA,EAC/C;AAGA,QAAM,OAAO,aAAa;AAC1B,QAAM,OAAS,sBAAoB,OAAO,WAAW;AACrD,QAAM,MAAM,aAAa,QAAQ,OAAO,QAAQ;AAChD,QAAM,iBAAiB;AAAA,IACrB,KAAK,SAAS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|
package/dist/key-generate.js
CHANGED
|
@@ -8,3 +8,6 @@ import {setEnvValue} from "@stacksjs/utils";
|
|
|
8
8
|
if (!isFile(".env"))
|
|
9
9
|
await runCommand("cp .env.example .env", { cwd: projectPath() });
|
|
10
10
|
await setEnvValue("APP_KEY", generateAppKey());
|
|
11
|
+
|
|
12
|
+
//# debugId=AFF20FE618AFF0AC64756E2164756E21
|
|
13
|
+
//# sourceMappingURL=key-generate.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/key-generate.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { runCommand } from '@stacksjs/cli'\nimport { projectPath } from '@stacksjs/path'\nimport { generateAppKey } from '@stacksjs/security'\nimport { isFile } from '@stacksjs/storage'\nimport { setEnvValue } from '@stacksjs/utils'\n\nif (!isFile('.env')) await runCommand('cp .env.example .env', { cwd: projectPath() })\n\nawait setEnvValue('APP_KEY', generateAppKey())\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAAA;AACA;AACA;AACA;AACA;AAEA,KAAK,OAAO,MAAM;AAAG,QAAM,WAAW,wBAAwB,EAAE,KAAK,YAAY,EAAE,CAAC;AAEpF,MAAM,YAAY,WAAW,eAAe,CAAC;",
|
|
8
|
+
"debugId": "AFF20FE618AFF0AC64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/dist/lint/fix.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lint/fix.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { log, parseOptions, runCommand } from '@stacksjs/cli'\nimport { NpmScript } from '@stacksjs/enums'\nimport { projectPath } from '@stacksjs/path'\nimport { ExitCode } from '@stacksjs/types'\n\n// TODO: this should be a loader\nlog.info('Ensuring Code Style...')\n\nconst options = parseOptions()\n\n// const result = await runCommand(NpmScript.LintFix, {\n// cwd: projectPath(),\n// ...options,\n// })\n\n// console.log('rs', result.error)\n// if (result.isErr()) {\n// log.error('There was an error fixing your code style.', result.error)\n// process.exit(1)\n// }\n\nlog.success('Linted')\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAAA;AAMA,IAAI,KAAK,wBAAwB;AAEjC,IAAM,UAAU,aAAa;AAa7B,IAAI,QAAQ,QAAQ;",
|
|
8
|
+
"debugId": "A18794C8E7039F9664756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/dist/lint/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/lint/index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import process from 'node:process'\nimport { log, runCommands } from '@stacksjs/cli'\nimport { NpmScript } from '@stacksjs/enums'\nimport { projectPath } from '@stacksjs/path'\nimport { ExitCode } from '@stacksjs/types'\n\nlog.info('Ensuring Code Style...')\n\n// TODO: somehow, we currently cannot trigger bunx using $`` syntax\n// $.cwd(projectPath())\n\n// await $`${NpmScript.Lint}`\n// await $`${NpmScript.LintPackageJson}`\n\n// const result = await runCommands([NpmScript.Lint, NpmScript.LintPackageJson], {\n// cwd: projectPath(),\n// })\n\n// if (Array.isArray(result)) {\n// if (result.map((r) => r.isErr()).includes(true)) process.exit(ExitCode.FatalError)\n// }\n\nlog.success('Linted')\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AACA;AAKA,IAAI,KAAK,wBAAwB;AAgBjC,IAAI,QAAQ,QAAQ;",
|
|
8
|
+
"debugId": "E1974F1CB1DDA21264756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|