@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
@@ -0,0 +1,3 @@
1
+ import { generateCoreSymlink } from '@stacksjs/actions'
2
+
3
+ await generateCoreSymlink()
@@ -30,7 +30,7 @@ export async function createLibraryEntryPoint(type: LibraryType) {
30
30
  }
31
31
 
32
32
  export async function createVueLibraryEntryPoint(type: LibraryType = 'vue-components') {
33
- log.info('Creating Vue Component Library Entry Point...')
33
+ log.info('Ensuring Component Library Entry Point...')
34
34
 
35
35
  await writeTextFile({
36
36
  path: libraryEntryPath(type),
@@ -44,7 +44,7 @@ export async function createVueLibraryEntryPoint(type: LibraryType = 'vue-compon
44
44
  }
45
45
 
46
46
  export async function createWebComponentLibraryEntryPoint(type: LibraryType = 'web-components') {
47
- log.info('Creating Web Component Library Entry Point...')
47
+ log.info('Ensuring Web Component Library Entry Point...')
48
48
 
49
49
  await writeTextFile({
50
50
  path: libraryEntryPath(type),
@@ -58,7 +58,7 @@ export async function createWebComponentLibraryEntryPoint(type: LibraryType = 'w
58
58
  }
59
59
 
60
60
  export async function createFunctionLibraryEntryPoint(type: LibraryType = 'functions') {
61
- log.info('Creating Function Library Entry Point...')
61
+ log.info('Ensuring Function Library Entry Point...')
62
62
 
63
63
  await writeTextFile({
64
64
  path: libraryEntryPath(type),
@@ -1,10 +1,9 @@
1
- import * as storage from '@stacksjs/storage'
2
1
  import { buddyOptions, runCommand, runCommands } from '@stacksjs/cli'
2
+ import { storage } from '@stacksjs/storage'
3
3
  import { log } from '@stacksjs/logging'
4
+ import { err } from '@stacksjs/error-handling'
4
5
  import * as p from '@stacksjs/path'
5
- import type { ActionOptions, Subprocess } from '@stacksjs/types'
6
- import type { Result } from '@stacksjs/error-handling'
7
- import { err, handleError } from '@stacksjs/error-handling'
6
+ import type { ActionOptions } from '@stacksjs/types'
8
7
 
9
8
  /**
10
9
  * Run an Action the Stacks way.
@@ -13,9 +12,9 @@ import { err, handleError } from '@stacksjs/error-handling'
13
12
  * @param options The options to pass to the command.
14
13
  * @returns The result of the command.
15
14
  */
16
- export async function runAction(action: string, options?: ActionOptions): Promise<Result<Subprocess, Error>> {
15
+ export async function runAction(action: string, options?: ActionOptions) {
17
16
  const opts = buddyOptions()
18
- const path = p.relativeActionsPath(`${action}.ts`)
17
+ const path = p.relativeActionsPath(`src/${action}.ts`)
19
18
  const cmd = `bun --bun ${path} ${opts}`.trimEnd()
20
19
  const optionsWithCwd = {
21
20
  cwd: options?.cwd || p.projectPath(),
@@ -25,9 +24,6 @@ export async function runAction(action: string, options?: ActionOptions): Promis
25
24
  log.debug('runAction:', cmd)
26
25
  log.debug('action options:', optionsWithCwd)
27
26
 
28
- if (!hasAction(action))
29
- return err(handleError(`The specified action "${action}" does not exist`))
30
-
31
27
  return await runCommand(cmd, optionsWithCwd)
32
28
  }
33
29
 
@@ -46,6 +42,7 @@ export async function runActions(actions: string[], options?: ActionOptions) {
46
42
  return err('No actions were specified')
47
43
 
48
44
  for (const action of actions) {
45
+ log.debug(`running action "${action}"`)
49
46
  if (!hasAction(action))
50
47
  return err(`The specified action "${action}" does not exist`)
51
48
  }
@@ -57,14 +54,13 @@ export async function runActions(actions: string[], options?: ActionOptions) {
57
54
  ...options,
58
55
  }
59
56
 
60
- const commands = actions.map(action => `bun --bun ${p.relativeActionsPath(`${action}.ts`)} ${opts}`)
57
+ const commands = actions.map(action => `bun --bun ${p.relativeActionsPath(`src/${action}.ts`)} ${opts}`)
58
+
59
+ log.debug('commands:', commands)
61
60
 
62
61
  return await runCommands(commands, o)
63
62
  }
64
63
 
65
64
  export function hasAction(action: string) {
66
- if (storage.isFile(p.functionsPath(`actions/${action}.ts`)))
67
- return true
68
-
69
- return storage.isFile(p.actionsPath(`${action}.ts`))
65
+ return storage.isFile(p.actionsPath(`src/${action}.ts`))
70
66
  }
package/src/index.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  export * from './action'
2
2
  export * from './dev'
3
3
  export * from './generate'
4
- export * from './helpers'
4
+ export * from './helpers/utils'
5
5
 
6
- export { examples as runExample } from './examples'
7
6
  export { commit as runCommit } from './commit'
8
7
  export { add as runAdd } from './add'
9
8
 
package/src/lint/fix.ts CHANGED
@@ -2,6 +2,7 @@ import { log, parseOptions, runCommand } from '@stacksjs/cli'
2
2
  import { projectPath } from '@stacksjs/path'
3
3
  import { NpmScript } from '@stacksjs/enums'
4
4
 
5
+ // TODO: this should be a loader
5
6
  log.info('Ensuring Code Style...')
6
7
 
7
8
  const options = parseOptions()
@@ -0,0 +1,43 @@
1
+ import process from 'node:process'
2
+ import { path } from '@stacksjs/path'
3
+ import { runCommand } from '@stacksjs/cli'
4
+ import { log } from '@stacksjs/logging'
5
+ import { fs, storage } from '@stacksjs/storage'
6
+
7
+ /**
8
+ * Move the `stacks` binary to the user's home directory.
9
+ */
10
+
11
+ const source = path.buddyPath('dist/stacks')
12
+ const destination = path.homeDir('.stacks/bin/stacks')
13
+ const destinationDir = path.homeDir('.stacks/bin/')
14
+
15
+ log.info('Upgrading `stacks`...')
16
+
17
+ // ensure the latest binary is generated
18
+ const result = await runCommand('bun compile.ts', { cwd: path.buddyPath() })
19
+
20
+ if (result.isErr()) {
21
+ log.error('There was an error compiling the binary', result.error)
22
+ process.exit()
23
+ }
24
+
25
+ // Check if the source exists (it should be, because bun compile.ts was successful)
26
+ if (await storage.exists(source)) {
27
+ try {
28
+ log.info('Updating Binary...')
29
+ log.info(`Source: ${source}`) // TODO: should be debug
30
+ log.info(`Destination: ${destination}`) // TODO: should be debug
31
+
32
+ await fs.ensureDir(destinationDir) // Ensure the destination directory exists
33
+ await fs.move(source, destination, { overwrite: true })
34
+
35
+ log.success('Binary Latest Version Is Used')
36
+ }
37
+ catch (err: any) {
38
+ log.error(err)
39
+ }
40
+ }
41
+ else {
42
+ log.error(`Binary source not found: ${source}`)
43
+ }
@@ -16,6 +16,12 @@ if (options?.dependencies || options?.all)
16
16
  if (options?.bun || options?.all)
17
17
  await runAction(Action.UpgradeBun, options)
18
18
 
19
+ if (options?.shell || options?.all)
20
+ await runAction(Action.UpgradeShell, options)
21
+
22
+ if (options?.binary || options?.all)
23
+ await runAction(Action.UpgradeBinary, options)
24
+
19
25
  process.exit(ExitCode.InvalidArgument)
20
26
 
21
27
  // TODO: also update CI files & configurations, and other files, possibly (taze?)
@@ -0,0 +1,64 @@
1
+ import process from 'node:process'
2
+ import { $ } from 'bun'
3
+ import { path as p } from '@stacksjs/path'
4
+ import { log } from '@stacksjs/logging'
5
+ import { ExitCode } from '@stacksjs/types'
6
+ import { writeFile } from '@stacksjs/storage'
7
+ import { italic, runCommand } from '@stacksjs/cli'
8
+
9
+ const homePath = (await $`echo $HOME`.text()).trim()
10
+ const zshrcPath = p.join(homePath, '.zshrc')
11
+ const pluginPath = p.shellPath('src/buddy.plugin.zsh')
12
+ const customPath = p.join(homePath, '.oh-my-zsh/custom/plugins/buddy/')
13
+
14
+ log.info(`Setting up Oh My Zsh via ${zshrcPath}...`)
15
+ $.cwd(p.dirname(zshrcPath))
16
+ let data = await $`cat ${p.basename(zshrcPath)}`.text()
17
+
18
+ // Manipulate the data
19
+ const pluginLineRegex = /^(?!#).*plugins=\(([^)]+)\)/m // ensure it's not a comment
20
+ const match = data.match(pluginLineRegex)
21
+
22
+ if (match) {
23
+ // Split the captured group by any whitespace and filter out empty strings
24
+ const plugins = match[1]?.split(/\s+/).filter(Boolean)
25
+ if (!plugins) {
26
+ log.error('Maybe the plugins line in your .zshrc file could not be found? If this continues being an issue, please reach out to us on Discord.')
27
+ process.exit(ExitCode.FatalError)
28
+ }
29
+
30
+ // 2. Add buddy to the list of plugins if it's not already there
31
+ if (!plugins.includes('buddy')) {
32
+ plugins.push('buddy')
33
+ // Trim each plugin name and ensure it's formatted correctly
34
+ const formattedPlugins = plugins.map(plugin => plugin.trim()).join('\n ')
35
+ const newPluginLine = `plugins=(\n ${formattedPlugins}\n)`
36
+ // Replace the old plugin line with the new one
37
+ data = data.replace(pluginLineRegex, newPluginLine)
38
+ // Write the data back to the file
39
+ await writeFile(zshrcPath, data)
40
+
41
+ // need to copy plugin to ~/.oh-my-zsh/custom/plugins
42
+ log.info(`Copying buddy zsh plugin ${pluginPath} to ${customPath}...`)
43
+
44
+ // create customPath if it doesn't exist
45
+ await runCommand(`mkdir -p ${customPath}`)
46
+ await runCommand(`cp -rf ${pluginPath} ${customPath}`)
47
+ // await runCommand(`source ${customPath}/src/buddy.plugin.zsh`)
48
+
49
+ log.success('Copied buddy zsh plugin')
50
+ }
51
+ else {
52
+ log.info('Buddy is already set up') // in other words, it is integrated in their shell
53
+ log.info('Ensuring `buddy` is updated...')
54
+ await runCommand(`cp -rf ${pluginPath} ${customPath}`)
55
+ log.success('Updated buddy zsh plugin to latest version')
56
+ }
57
+ }
58
+
59
+ log.success('Oh My Zsh Setup Complete')
60
+ log.info(italic('To see changes reflect, you may need to open a new terminal window'))
61
+
62
+ // if using the vscode terminal, show the message
63
+ if (process.env.TERM_PROGRAM === 'vscode')
64
+ log.info('⌘⇧P terminal.create.new.terminal')
package/dist/src/add.js DELETED
@@ -1,29 +0,0 @@
1
- // @bun
2
- // src/add.ts
3
- import {installPackage} from "@stacksjs/cli";
4
- async function invoke(options) {
5
- if (options?.table)
6
- await addTable();
7
- if (options?.calendar)
8
- await addCalendar();
9
- }
10
- async function add(options) {
11
- return invoke(options);
12
- }
13
- async function addTable() {
14
- await installPackage("@stacksjs/table");
15
- }
16
- async function addCalendar() {
17
- await installPackage("@stacksjs/calendar");
18
- }
19
- async function installPackages(names) {
20
- for (const name of names)
21
- await installPackage(name);
22
- }
23
- export {
24
- invoke,
25
- installPackages,
26
- addTable,
27
- addCalendar,
28
- add
29
- };
@@ -1,6 +0,0 @@
1
- // @bun
2
- // src/build/component-libs.ts
3
- import {frameworkPath} from "@stacksjs/path";
4
- import {runCommand} from "@stacksjs/cli";
5
- import {NpmScript} from "@stacksjs/enums";
6
- await runCommand(NpmScript.BuildComponents, { cwd: frameworkPath(), verbose: true });
@@ -1,21 +0,0 @@
1
- // @bun
2
- // src/build/core.ts
3
- import process from "process";
4
- import {glob} from "@stacksjs/storage";
5
- import {dim, italic, log} from "@stacksjs/cli";
6
- import {corePath} from "@stacksjs/path";
7
- import {ExitCode} from "@stacksjs/types";
8
- var {$ } = globalThis.Bun;
9
- log.info("Building core packages");
10
- var dirs = (await glob([corePath("*")], { onlyDirectories: true })).sort();
11
- if (dirs.length === 0) {
12
- log.info("No core packages found");
13
- process.exit(ExitCode.FatalError);
14
- }
15
- for (const folder of dirs) {
16
- log.info(`\uD83C\uDFD7\uFE0F Building ${italic(dim(folder))}`);
17
- $.cwd(folder);
18
- await $`bun run build`;
19
- log.success(`${italic(dim(folder))} built`);
20
- console.log(``);
21
- }
@@ -1,8 +0,0 @@
1
- // @bun
2
- // src/build/stacks.ts
3
- import {frameworkPath} from "@stacksjs/path";
4
- import {runCommands} from "@stacksjs/cli";
5
- await runCommands([
6
- "bun build:cli",
7
- "bun build:core"
8
- ], { verbose: true, cwd: frameworkPath() });
package/dist/src/build.js DELETED
@@ -1,213 +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
- // src/generate/index.ts
45
- import process from "process";
46
- import {log as log2} from "@stacksjs/logging";
47
- import {Action, NpmScript} from "@stacksjs/enums";
48
- import {runNpmScript} from "@stacksjs/utils";
49
- import {frameworkPath, projectPath as projectPath2} from "@stacksjs/path";
50
- async function invoke(options) {
51
- if (options?.types)
52
- await generateTypes(options);
53
- else if (options?.entries)
54
- await generateLibEntries(options);
55
- else if (options?.webTypes)
56
- await generateWebTypes(options);
57
- else if (options?.customData)
58
- await generateVsCodeCustomData(options);
59
- else if (options?.ideHelpers)
60
- await generateIdeHelpers(options);
61
- else if (options?.componentMeta)
62
- await generateComponentMeta(options);
63
- }
64
- function generate(options) {
65
- return invoke(options);
66
- }
67
- async function generateLibEntries(options) {
68
- const result = await runAction(Action.GenerateLibraryEntries, {
69
- ...options,
70
- cwd: projectPath2()
71
- });
72
- if (result.isErr()) {
73
- log2.error("There was an error generating your library entry points", result.error);
74
- process.exit();
75
- }
76
- log2.success("Library entry points generated successfully");
77
- }
78
- async function generateWebTypes(options) {
79
- const result = await runNpmScript(NpmScript.GenerateWebTypes, options);
80
- if (result.isErr()) {
81
- log2.error("There was an error generating the web-types.json file.", result.error);
82
- process.exit();
83
- }
84
- log2.success("Successfully generated the web-types.json file");
85
- }
86
- async function generateVsCodeCustomData(options) {
87
- const result = await runNpmScript(NpmScript.GenerateVsCodeCustomData, {
88
- cwd: frameworkPath(),
89
- ...options
90
- });
91
- if (result.isErr()) {
92
- log2.error("There was an error generating the custom-elements.json file.", result.error);
93
- process.exit();
94
- }
95
- await runAction(Action.LintFix, { verbose: true });
96
- log2.success("Successfully generated the custom-elements.json file");
97
- }
98
- async function generateIdeHelpers(options) {
99
- const result = await runNpmScript(NpmScript.GenerateIdeHelpers, options);
100
- if (result.isErr()) {
101
- log2.error("There was an error generating IDE helpers.", result.error);
102
- process.exit();
103
- }
104
- await runAction(Action.LintFix, { verbose: true });
105
- log2.success("Successfully generated IDE helpers");
106
- }
107
- async function generateComponentMeta(options) {
108
- const result = await runNpmScript(NpmScript.GenerateComponentMeta, options);
109
- if (result.isErr()) {
110
- log2.error("There was an error generating your component meta information.", result.error);
111
- process.exit();
112
- }
113
- await runAction(Action.LintFix, { verbose: true });
114
- log2.success("Successfully generated component meta information");
115
- }
116
- async function generateTypes(options) {
117
- const result = await runNpmScript(NpmScript.GenerateTypes, {
118
- cwd: frameworkPath(),
119
- ...options
120
- });
121
- if (result.isErr()) {
122
- log2.error("There was an error generating your types.", result.error);
123
- process.exit();
124
- }
125
- log2.success("Types were generated successfully");
126
- }
127
- function generateMigrations() {
128
- log2.success("Successfully updated migrations");
129
- }
130
- function generatePkgxConfig() {
131
- log2.success("Successfully generated `./pkgx.yaml` based on your configs");
132
- }
133
- async function generateSeeder() {
134
- }
135
-
136
- // src/build.ts
137
- import {log as log3} from "@stacksjs/logging";
138
- import {hasComponents, hasFunctions} from "@stacksjs/storage";
139
- import {runNpmScript as runNpmScript2} from "@stacksjs/utils";
140
- import {NpmScript as NpmScript2} from "@stacksjs/enums";
141
- async function invoke2(options) {
142
- if (options.components)
143
- await componentLibraries(options);
144
- else if (options.vueComponents)
145
- await vueComponentLibrary(options);
146
- else if (options.webComponents || options.elements)
147
- await webComponentLibrary(options);
148
- else if (options.functions)
149
- await functionsLibrary(options);
150
- else if (options.docs)
151
- await docs(options);
152
- else if (options.stacks)
153
- await stacks(options);
154
- await generateTypes();
155
- }
156
- async function build(options) {
157
- return invoke2(options);
158
- }
159
- async function componentLibraries(options) {
160
- await runNpmScript2(NpmScript2.GenerateEntries, options);
161
- await vueComponentLibrary(options);
162
- await webComponentLibrary(options);
163
- }
164
- async function vueComponentLibrary(options) {
165
- if (hasComponents()) {
166
- log3.info("Building your component library...");
167
- await runNpmScript2(NpmScript2.BuildComponents, options);
168
- log3.success("Your component library was built successfully");
169
- } else {
170
- log3.warn("No components found.");
171
- log3.info("Before you can build components,");
172
- log3.info("you need to have created some in the ./components folder.");
173
- }
174
- }
175
- async function webComponentLibrary(options) {
176
- log3.info("Building your component library for production use & npm/CDN distribution...");
177
- if (hasComponents()) {
178
- await runNpmScript2(NpmScript2.BuildWebComponents, options);
179
- log3.success("Your Web Component library was built successfully");
180
- } else {
181
- log3.info("No components found.");
182
- }
183
- }
184
- async function docs(options) {
185
- log3.info("Building the documentation site...");
186
- await runNpmScript2(NpmScript2.BuildDocs, options);
187
- log3.success("Docs built successfully");
188
- }
189
- async function stacks(options) {
190
- log3.info("Building the Stacks Framework...");
191
- await runNpmScript2(NpmScript2.BuildStacks, options);
192
- log3.success("Stacks built successfully");
193
- }
194
- async function functionsLibrary(options) {
195
- if (hasFunctions()) {
196
- log3.info("Building your functions library for production usages...");
197
- log3.info("Production usages include: manual npm distribution and/or CDN distribution");
198
- await runNpmScript2(NpmScript2.BuildFunctions, options);
199
- log3.success("Functions library built successfully");
200
- } else {
201
- log3.info("No functions found");
202
- }
203
- }
204
- export {
205
- webComponentLibrary,
206
- vueComponentLibrary,
207
- stacks,
208
- invoke2 as invoke,
209
- functionsLibrary,
210
- docs,
211
- componentLibraries,
212
- build
213
- };
package/dist/src/bump.js DELETED
@@ -1,14 +0,0 @@
1
- // @bun
2
- // src/bump.ts
3
- import {parseOptions, runCommand} from "@stacksjs/cli";
4
- import {path as p} from "@stacksjs/path";
5
- var options = parseOptions();
6
- var changelogCommand = options?.dryRun ? "buddy changelog --quiet --dry-run" : "buddy changelog --quiet";
7
- await runCommand(changelogCommand, {
8
- cwd: p.projectPath()
9
- });
10
- var bumpCommand = options?.dryRun ? "bunx bumpp ./package.json ./core/**/package.json ./ide/vscode/package.json --no-push" : "bunx bumpp ./package.json ./core/**/package.json ./ide/vscode/package.json --all";
11
- await runCommand(bumpCommand, {
12
- cwd: p.frameworkPath(),
13
- stdin: "inherit"
14
- });
@@ -1,17 +0,0 @@
1
- // @bun
2
- // src/changelog.ts
3
- import {execSync, log, parseOptions, runCommand} from "@stacksjs/cli";
4
- import {projectPath} from "@stacksjs/path";
5
- log.debug("Generating changelog");
6
- var fromRevision = await execSync("git describe --abbrev=0 --tags HEAD^");
7
- log.debug("FromRevision", fromRevision);
8
- var toRevision = await execSync("git describe");
9
- log.debug("ToRevision", toRevision);
10
- var options = parseOptions();
11
- log.debug("Changelog Options", options);
12
- var command = options?.dryRun ? `bunx changelogen --no-output --from ${fromRevision} --to ${toRevision}` : `bunx changelogen --output CHANGELOG.md --from ${fromRevision} --to ${toRevision}`;
13
- await runCommand(command, {
14
- cwd: projectPath(),
15
- quiet: options?.quiet,
16
- verbose: options?.verbose
17
- });
package/dist/src/clean.js DELETED
@@ -1,6 +0,0 @@
1
- // @bun
2
- // src/clean.ts
3
- import {log} from "@stacksjs/logging";
4
- import {cleanProject} from "@stacksjs/utils";
5
- log.info("Running clean command...");
6
- await cleanProject();
@@ -1,17 +0,0 @@
1
- // @bun
2
- // src/commit.ts
3
- import {log} from "@stacksjs/logging";
4
- import {runNpmScript} from "@stacksjs/utils";
5
- import {NpmScript} from "@stacksjs/enums";
6
- async function invoke(options) {
7
- log.info("Committing...");
8
- await runNpmScript(NpmScript.Commit, options);
9
- log.success("Committed");
10
- }
11
- async function commit(options) {
12
- return invoke(options);
13
- }
14
- export {
15
- invoke,
16
- commit
17
- };
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env bun
2
- // @bun
3
-
4
- // src/copy-types.ts
5
- import {frameworkPath} from "@stacksjs/path";
6
- import {copyFolder} from "@stacksjs/storage";
7
- var destinations = [
8
- [frameworkPath("dist/types/components"), frameworkPath("components/vue/dist/types")],
9
- [frameworkPath("dist/types/components"), frameworkPath("components/web/dist/types")],
10
- [frameworkPath("dist/types/functions"), frameworkPath("functions/dist/types")]
11
- ];
12
- destinations.forEach(([src, dest]) => {
13
- copyFolder(src, dest);
14
- });
@@ -1 +0,0 @@
1
- // @bun
@@ -1,31 +0,0 @@
1
- // @bun
2
- // src/deploy/index.ts
3
- import process from "process";
4
- import {log, runCommand} from "@stacksjs/cli";
5
- import {config as config2} from "@stacksjs/config";
6
- import {path as p} from "@stacksjs/path";
7
- import {storage as storage2} from "@stacksjs/storage";
8
- await runCommand("bun run build", {
9
- cwd: p.frameworkPath()
10
- });
11
- if (storage2.hasFiles(p.projectPath("docs"))) {
12
- await runCommand("bun run build", {
13
- cwd: p.frameworkPath("docs")
14
- });
15
- }
16
- if (config2.app.docMode !== true) {
17
- await runCommand("bun run build", {
18
- cwd: p.frameworkPath("views")
19
- });
20
- }
21
- await runCommand("bun build.ts", {
22
- cwd: p.frameworkPath("server")
23
- });
24
- await runCommand("bun zip.ts", {
25
- cwd: p.cloudPath()
26
- });
27
- log.info("Preparing Deployment...");
28
- var profile = process.env.AWS_PROFILE || "stacks";
29
- await runCommand(`bunx cdk deploy --require-approval never --profile="${profile}"`, {
30
- cwd: p.frameworkCloudPath()
31
- });
@@ -1,11 +0,0 @@
1
- // @bun
2
- // src/dev/components.ts
3
- import {frameworkPath, vitePath} from "@stacksjs/path";
4
- import {parseOptions, runCommand} from "@stacksjs/cli";
5
- var options = parseOptions();
6
- if (options.verbose)
7
- console.log("dev components options", options);
8
- await runCommand(`bunx vite --config ${vitePath("src/components.ts")}`, {
9
- ...options,
10
- cwd: frameworkPath()
11
- });
@@ -1,7 +0,0 @@
1
- // @bun
2
- // src/dev/docs.ts
3
- import {runCommand} from "@stacksjs/cli";
4
- import {frameworkPath} from "@stacksjs/path";
5
- await runCommand("bun run dev", {
6
- cwd: frameworkPath("docs")
7
- });