Skip to content

Commit feff898

Browse files
committed
chore: wip
1 parent 865c787 commit feff898

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+281
-241
lines changed

.stacks/core/actions/src/helpers/lib-entries.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ export function generateEntryPointData(type: 'vue-components' | 'web-components'
6767
let arr = []
6868

6969
if (type === 'functions') {
70-
if (!library.functions.functions) {
70+
if (!library.functions?.functions) {
7171
log.error('There are no functions defined to be built. Please check your config/library.ts file for potential adjustments.')
7272
process.exit()
7373
}
7474

75-
for (const fx of library.functions.functions) {
75+
for (const fx of library.functions?.functions) {
7676
if (Array.isArray(fx))
7777
arr.push(`export * as ${fx[1]} from '../../../functions/${fx[0]}'`)
7878
else
@@ -84,14 +84,14 @@ export function generateEntryPointData(type: 'vue-components' | 'web-components'
8484
}
8585

8686
if (type === 'vue-components') {
87-
if (!library.vueComponents.tags) {
87+
if (!library.vueComponents?.tags) {
8888
log.error('There are no components defined to be built. Please check your config/library.ts file for potential adjustments.')
8989
process.exit()
9090
}
9191

9292
arr = determineResetPreset()
9393

94-
for (const component of library.vueComponents.tags.map(tag => tag.name)) {
94+
for (const component of library.vueComponents?.tags.map(tag => tag.name)) {
9595
if (Array.isArray(component))
9696
arr.push(`export { default as ${component[1]} } from '../../../components/${component[0]}.vue'`)
9797
else
@@ -108,12 +108,12 @@ export function generateEntryPointData(type: 'vue-components' | 'web-components'
108108
const declarations = []
109109
const definitions = []
110110

111-
if (!library.webComponents.tags) {
111+
if (!library.webComponents?.tags) {
112112
log.error('There are no components defined to be built. Please check your config/library.ts file for potential adjustments.')
113113
process.exit()
114114
}
115115

116-
for (const component of library.webComponents.tags.map(tag => tag.name)) {
116+
for (const component of library.webComponents?.tags.map(tag => tag.name)) {
117117
if (Array.isArray(component)) {
118118
imports.push(`import ${component[1]} from '../../../components/${component[0]}.vue'`)
119119
declarations.push(`const ${component[1]}CustomElement = defineCustomElement(${component[1]})`)

.stacks/core/actions/src/helpers/package-json.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ export async function generatePackageJson(type: 'vue-components' | 'web-componen
88
let name, description, directory, keywords, config, prettyName
99

1010
if (type === 'vue-components') {
11-
name = library.vueComponents.name
12-
description = library.vueComponents.description
11+
name = library.vueComponents?.name
12+
description = library.vueComponents?.description
1313
directory = 'components'
14-
keywords = library.vueComponents.keywords
14+
keywords = library.vueComponents?.keywords
1515
config = 'vue-components'
1616
}
1717

1818
else if (type === 'web-components') {
19-
name = library.webComponents.name
20-
description = library.webComponents.description
19+
name = library.webComponents?.name
20+
description = library.webComponents?.description
2121
directory = 'components'
22-
keywords = library.webComponents.keywords
22+
keywords = library.webComponents?.keywords
2323
config = 'web-components'
2424
}
2525

2626
else if (type === 'functions') {
27-
name = library.functions.name
28-
description = library.functions.description
27+
name = library.functions?.name
28+
description = library.functions?.description
2929
directory = 'functions'
30-
keywords = library.functions.keywords
30+
keywords = library.functions?.keywords
3131
config = 'functions'
3232
}
3333

.stacks/core/actions/src/helpers/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import storage from '@stacksjs/storage'
22
import { italic, log, runCommand, runCommands } from '@stacksjs/cli'
33
import { actionsPath, functionsPath } from '@stacksjs/path'
44
import type { ActionOptions, CommandResult } from '@stacksjs/types'
5-
import { err, errAsync } from '@stacksjs/error-handling'
5+
import { err } from '@stacksjs/error-handling'
66

77
function parseOptions(options?: ActionOptions) {
88
if (!options)
@@ -30,9 +30,9 @@ export type ActionResult = CommandResult
3030
* @param options The options to pass to the command.
3131
* @returns The result of the command.
3232
*/
33-
export async function runAction(action: string, options?: ActionOptions): Promise<CommandResult | CommandResult[]> {
33+
export async function runAction(action: string, options?: ActionOptions): Promise<CommandResult> {
3434
if (!hasAction(action))
35-
return errAsync(`The specified action "${action}" does not exist.`)
35+
return err(`The specified action "${action}" does not exist`)
3636

3737
// we need to parse options here because they need to bw passed to the action
3838
const opts = parseOptions(options)
@@ -42,7 +42,7 @@ export async function runAction(action: string, options?: ActionOptions): Promis
4242
log.debug('running command:', italic(cmd))
4343

4444
return options?.showSpinner
45-
? await runCommands([cmd], options)
45+
? await runCommands([cmd], options) as CommandResult
4646
: await runCommand(cmd, options)
4747
}
4848

@@ -53,9 +53,9 @@ export async function runAction(action: string, options?: ActionOptions): Promis
5353
* @param options The options to pass to the command.
5454
* @returns The result of the command.
5555
*/
56-
export async function runActions(actions: string[], options?: ActionOptions): Promise<CommandResult> | Promise<CommandResult>[] {
56+
export async function runActions(actions: string[], options?: ActionOptions): Promise<CommandResult | CommandResult[]> {
5757
if (!actions.length)
58-
return err('No actions were specified')
58+
return err(`No actions were specified`)
5959

6060
for (const action of actions) {
6161
if (!hasAction(action))

.stacks/core/actions/src/helpers/vscode-custom-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export async function generateVsCodeCustomData() {
1818
}
1919

2020
function generateComponentInfoData() {
21-
const componentsData = JSON.stringify(library.vueComponents.tags)
21+
const componentsData = JSON.stringify(library.vueComponents?.tags)
2222

2323
return `{
2424
"version": 1.1,

.stacks/core/alias/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ const alias: Record<string, string> = {
6262
'@stacksjs/notifications/*': p.notificationsPath('src/*'),
6363
'@stacksjs/objects': p.objectsPath('src/index.ts'),
6464
'@stacksjs/objects/*': p.objectsPath('src/*'),
65+
'@stacksjs/orm': p.ormPath('src/index.ts'),
66+
'@stacksjs/orm/*': p.ormPath('src/*'),
6567
'@stacksjs/path': p.pathPath('src/index.ts'), // 🤦🏼‍♂️
6668
'@stacksjs/path/*': p.pathPath('src/*'),
6769
'@stacksjs/push': p.pushPath('src/index.ts'),

.stacks/core/buddy/bin/stacks.mjs

Lines changed: 0 additions & 4 deletions
This file was deleted.

.stacks/core/buddy/build.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { alias } from '@stacksjs/alias'
44
export default defineBuildConfig({
55
alias,
66
entries: [
7+
'./src/index',
78
'./src/cli',
89
],
9-
declaration: false,
10-
clean: false,
11-
externals: ['chokidar', '@intlify/shared', '@intlify/message-compiler', 'vite', 'gray-matter'],
10+
declaration: true,
11+
clean: true,
1212
rollup: {
1313
emitCJS: false,
1414
inlineDependencies: true,

.stacks/core/buddy/package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
"Chris Breuer <chris@ow3.org>"
4343
],
4444
"bin": {
45-
"stacks": "bin/stacks.mjs",
46-
"stx": "bin/stacks.mjs",
47-
"buddy": "bin/stacks.mjs",
48-
"bud": "bin/stacks.mjs"
45+
"stacks": "dist/cli.mjs",
46+
"stx": "dist/cli.mjs",
47+
"buddy": "dist/cli.mjs",
48+
"bud": "dist/cli.mjs"
4949
},
5050
"files": [
5151
"dist",
@@ -87,6 +87,7 @@
8787
"@stacksjs/modules": "workspace:*",
8888
"@stacksjs/notifications": "workspace:*",
8989
"@stacksjs/objects": "workspace:*",
90+
"@stacksjs/orm": "workspace:*",
9091
"@stacksjs/pages": "workspace:*",
9192
"@stacksjs/path": "workspace:*",
9293
"@stacksjs/payments": "workspace:*",

.stacks/core/buddy/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ async function installIfVersionMismatch() {
9292

9393
function errorHandler(error: Error): void {
9494
log.error(error)
95-
process.exit()
95+
process.exit(1)
9696
}

.stacks/core/buddy/src/commands/dev.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async function dev(buddy: CLI) {
7777

7878
// check if result is an error
7979
else if (result.isErr()) {
80-
outro('While running the dev:components command, there was an issue', { startTime: perf, useSeconds: true, isError: true }, result.error)
80+
outro('While running the dev:components command, there was an issue', { startTime: perf, useSeconds: true, isError: true }, result.error ?? undefined)
8181
process.exit()
8282
}
8383

@@ -103,7 +103,7 @@ async function dev(buddy: CLI) {
103103

104104
// check if result is an error
105105
else if (result.isErr()) {
106-
outro('While running the dev:components command, there was an issue', { startTime: perf, useSeconds: true, isError: true }, result.error)
106+
outro('While running the dev:components command, there was an issue', { startTime: perf, useSeconds: true, isError: true }, result.error ?? undefined)
107107
process.exit()
108108
}
109109

0 commit comments

Comments
 (0)