Skip to content

Commit ef36312

Browse files
committed
chore: wip
1 parent 4c96156 commit ef36312

File tree

16 files changed

+34
-44
lines changed

16 files changed

+34
-44
lines changed

.stacks/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.nitro
22
.output
3-
components/vue/.vite-inspect
4-
core/build/entries/*.ts
3+
libs/components/vue/.vite-inspect
4+
libs/entries/*.ts
55
**/dist/*.cjs
66
**/dist/*.mjs
77
**/dist/**/*.mjs

.stacks/auto-imports.d.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ declare global {
121121
const computedSignal: typeof import('./core/signals/src/index')['computedSignal']
122122
const computedWithControl: typeof import('./core/utils/src/vendors')['computedWithControl']
123123
const config: typeof import('./core/utils/src/config')['config']
124-
const configDefaults: typeof import('./core/config/src/stacks')['configDefaults']
125124
const configPath: typeof import('./core/path/src/index')['configPath']
126125
const constantCase: typeof import('./core/strings/src/case')['constantCase']
127126
const contains: typeof import('./core/arrays/src/index')['contains']
@@ -153,7 +152,6 @@ declare global {
153152
const createSingletonPromise: typeof import('./core/utils/src/promise')['createSingletonPromise']
154153
const createTemplatePromise: typeof import('./core/utils/src/vendors')['createTemplatePromise']
155154
const createUnrefFn: typeof import('./core/utils/src/vendors')['createUnrefFn']
156-
const cronJobs: typeof import('./core/config/src/defaults')['cronJobs']
157155
const currentPage: typeof import('./core/search-engine/src/index')['currentPage']
158156
const customElementsDataPath: typeof import('./core/path/src/index')['customElementsDataPath']
159157
const customRef: typeof import('vue')['customRef']
@@ -196,7 +194,6 @@ declare global {
196194
const definePayment: typeof import('./core/utils/src/config')['definePayment']
197195
const defineSearchEngine: typeof import('./core/utils/src/config')['defineSearchEngine']
198196
const defineServices: typeof import('./core/utils/src/config')['defineServices']
199-
const defineStacksConfig: typeof import('./core/config/src/stacks')['defineStacksConfig']
200197
const defineStorage: typeof import('./core/utils/src/config')['defineStorage']
201198
const defineUi: typeof import('./core/utils/src/config')['defineUi']
202199
const del: typeof import('./core/utils/src/delete')['del']
@@ -422,8 +419,6 @@ declare global {
422419
const link: typeof import('./core/cli/src/utilities')['link']
423420
const lintPath: typeof import('./core/path/src/index')['lintPath']
424421
const listen: typeof import('./core/events/src/index')['listen']
425-
const loadConfig: typeof import('./core/config/src/index')['loadConfig']
426-
const loadStacksConfig: typeof import('./core/config/src/stacks')['loadStacksConfig']
427422
const log: typeof import('./core/cli/src/console')['log']
428423
const loggingPath: typeof import('./core/path/src/index')['loggingPath']
429424
const logicNot: typeof import('./core/utils/src/math')['logicNot']
@@ -495,7 +490,6 @@ declare global {
495490
const outro: typeof import('./core/cli/src/helpers')['outro']
496491
const p: typeof import('./core/utils/src/p')['p']
497492
const packageJsonPath: typeof import('./core/path/src/index')['packageJsonPath']
498-
const packageManager: typeof import('./core/config/src/stacks')['packageManager']
499493
const pagesPath: typeof import('./core/path/src/index')['pagesPath']
500494
const paramCase: typeof import('./core/strings/src/case')['paramCase']
501495
const parse: typeof import('./core/path/src/index')['parse']
@@ -606,7 +600,6 @@ declare global {
606600
const suite: typeof import('vitest')['suite']
607601
const syncRef: typeof import('./core/utils/src/vendors')['syncRef']
608602
const syncRefs: typeof import('./core/utils/src/vendors')['syncRefs']
609-
const tablesPath: typeof import('./core/path/src/index')['tablesPath']
610603
const tailwindConfig: typeof import('./core/notifications/src/tailwind.config')['default']
611604
const tap: typeof import('./core/utils/src/function')['tap']
612605
const teams: typeof import('./core/chat/src/index')['teams']
@@ -822,7 +815,6 @@ declare global {
822815
const watch: typeof import('vue')['watch']
823816
const watchArray: typeof import('./core/utils/src/vendors')['watchArray']
824817
const watchAtMost: typeof import('./core/utils/src/vendors')['watchAtMost']
825-
const watchConfig: typeof import('./core/config/src/index')['watchConfig']
826818
const watchDebounced: typeof import('./core/utils/src/vendors')['watchDebounced']
827819
const watchDeep: typeof import('./core/utils/src/vendors')['watchDeep']
828820
const watchEffect: typeof import('vue')['watchEffect']
@@ -837,7 +829,6 @@ declare global {
837829
const watchWithFilter: typeof import('./core/utils/src/vendors')['watchWithFilter']
838830
const whenever: typeof import('./core/utils/src/vendors')['whenever']
839831
const white: typeof import('./core/cli/src/utilities')['white']
840-
const wip: typeof import('./core/realtime/src/index')['wip']
841832
const wipRealtime: typeof import('./core/realtime/src/index')['wipRealtime']
842833
const wipSlug: typeof import('./core/slug/src/index')['wipSlug']
843834
const writeJsonFile: typeof import('./core/storage/src/index')['writeJsonFile']

.stacks/components.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
// @ts-nocheck
44
// Generated by unplugin-vue-components
55
// Read more: https://github.com/vuejs/core/pull/3399
6-
import '@vue/runtime-core'
7-
86
export {}
97

10-
declare module '@vue/runtime-core' {
8+
declare module 'vue' {
119
export interface GlobalComponents {
1210
Counter: typeof import('./../resources/components/Buttons/Counter.vue')['default']
1311
Demo: typeof import('./../resources/components/Demo.vue')['default']

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function createVueLibraryEntryPoint(type: LibraryType = 'vue-compon
3535
path: libraryEntryPath(type),
3636
data: generateEntryPointData(type),
3737
}).catch((err) => {
38-
log.error('There was an error generating the Vue component library entry point', err)
38+
log.error(new Error('There was an error generating the Vue component library entry point.', err))
3939
process.exit(ExitCode.FatalError)
4040
})
4141

@@ -49,7 +49,7 @@ export async function createWebComponentLibraryEntryPoint(type: LibraryType = 'w
4949
path: libraryEntryPath(type),
5050
data: generateEntryPointData(type),
5151
}).catch((err) => {
52-
log.error('There was an error generating the Web Component library entry point', err)
52+
log.error(new Error('There was an error generating the Web Component library entry point', err))
5353
process.exit(ExitCode.FatalError)
5454
})
5555

@@ -63,7 +63,7 @@ export async function createFunctionLibraryEntryPoint(type: LibraryType = 'funct
6363
path: libraryEntryPath(type),
6464
data: generateEntryPointData(type),
6565
}).catch((err) => {
66-
log.error('There was an error generating the Function library entry point', err)
66+
log.error(new Error('There was an error generating Function library entry point', err))
6767
process.exit(ExitCode.FatalError)
6868
})
6969

@@ -75,15 +75,15 @@ export function generateEntryPointData(type: LibraryType): string {
7575

7676
if (type === 'functions') {
7777
if (!library.functions?.functions) {
78-
log.error('There are no functions defined to be built. Please check your config/library.ts file for potential adjustments.')
78+
log.error(new Error('There are no functions defined to be built. Please check your config/library.ts file for potential adjustments'))
7979
process.exit()
8080
}
8181

8282
for (const fx of library.functions?.functions) {
8383
if (Array.isArray(fx))
84-
arr.push(`export * as ${fx[1]} from '../../../../resources/functions/${fx[0]}'`)
84+
arr.push(`export * as ${fx[1]} from '../../../../../resources/functions/${fx[0]}'`)
8585
else
86-
arr.push(`export * from '../../../../resources/functions/${fx}'`)
86+
arr.push(`export * from '../../../../../resources/functions/${fx}'`)
8787
}
8888

8989
// join the array into a string with each element being on a new line
@@ -92,17 +92,17 @@ export function generateEntryPointData(type: LibraryType): string {
9292

9393
if (type === 'vue-components') {
9494
if (!library.vueComponents?.tags) {
95-
log.error('There are no components defined to be built. Please check your config/library.ts file for potential adjustments.')
95+
log.error(new Error('There are no components defined to be built. Please check your config/library.ts file for potential adjustments'))
9696
process.exit()
9797
}
9898

9999
arr = determineResetPreset()
100100

101101
for (const component of library.vueComponents?.tags.map(tag => tag.name)) {
102102
if (Array.isArray(component))
103-
arr.push(`export { default as ${component[1]} } from '../../../../resources/components/${component[0]}.vue'`)
103+
arr.push(`export { default as ${component[1]} } from '../../../../../resources/components/${component[0]}.vue'`)
104104
else
105-
arr.push(`export { default as ${component} } from '../../../../resources/components/${component}.vue'`)
105+
arr.push(`export { default as ${component} } from '../../../../../resources/components/${component}.vue'`)
106106
}
107107

108108
// join the array into a string with each element being on a new line
@@ -116,18 +116,18 @@ export function generateEntryPointData(type: LibraryType): string {
116116
const definitions = []
117117

118118
if (!library.webComponents?.tags) {
119-
log.error('There are no components defined to be built. Please check your config/library.ts file for potential adjustments.')
119+
log.error(new Error('There are no components defined to be built. Please check your config/library.ts file for potential adjustments'))
120120
process.exit()
121121
}
122122

123123
for (const component of library.webComponents?.tags.map(tag => tag.name)) {
124124
if (Array.isArray(component)) {
125-
imports.push(`import ${component[1]} from '../../../../resources/components/${component[0]}.vue'`)
125+
imports.push(`import ${component[1]} from '../../../../../resources/components/${component[0]}.vue'`)
126126
declarations.push(`const ${component[1]}CustomElement = defineCustomElement(${component[1]})`)
127127
definitions.push(`customElements.define('${kebabCase(component[1])}', ${component[1]}CustomElement)`)
128128
}
129129
else {
130-
imports.push(`import ${component} from '../../../../resources/components/${component}.vue'`)
130+
imports.push(`import ${component} from '../../../../../resources/components/${component}.vue'`)
131131
declarations.push(`const ${component}CustomElement = defineCustomElement(${component})`)
132132
definitions.push(`customElements.define('${kebabCase(component)}', ${component}CustomElement)`)
133133
}

.stacks/core/build/src/vue-components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { alias } from '@stacksjs/alias'
77
import { autoImports, components, cssEngine, inspect, uiEngine } from './stacks'
88

99
export const vueComponentsConfig: ViteConfig = {
10-
root: frameworkPath('components/vue'),
10+
root: frameworkPath('libs/components/vue'),
1111
envDir: projectPath(),
1212
envPrefix: 'FRONTEND_',
1313

.stacks/core/build/src/web-components.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { BuildOptions as ViteBuildOptions } from 'vite'
22
import { defineConfig } from 'vite'
33
import type { ViteConfig } from '@stacksjs/types'
4-
import { componentsPath, frameworkPath, libraryEntryPath, projectPath } from '@stacksjs/path'
4+
import { frameworkPath, libraryEntryPath, projectPath } from '@stacksjs/path'
55
import { library } from '@stacksjs/config'
66
import { server } from '@stacksjs/server'
77
import { alias } from '@stacksjs/alias'
@@ -10,7 +10,7 @@ import { autoImports, components, cssEngine, inspect, uiEngine } from '.'
1010
const isWebComponent = true
1111

1212
export const webComponentsConfig: ViteConfig = {
13-
root: componentsPath(),
13+
root: frameworkPath('libs/components/web'),
1414
envDir: projectPath(),
1515
envPrefix: 'FRONTEND_',
1616

.stacks/core/config/src/defaults.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ export { default as payment } from '../../../../config/payment'
1515
export { default as notification } from '../../../../config/notification'
1616
export { default as searchEngine } from '../../../../config/search-engine'
1717
export { default as services } from '../../../../config/services'
18-
export { default as storageConfig } from '../../../../config/storage'
1918
export { default as ui } from '../../../../config/ui'

.stacks/core/config/src/stacks.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { loadConfig } from 'c12'
22
import { readPackageJson } from '@stacksjs/storage'
33
import { frameworkPath } from '@stacksjs/path'
4-
import type { ResolvedStacksOptions, StacksOptions } from '@stacksjs/types'
5-
import { app, cache, cdn, cli, database, debug, dns, docs, email, git, hashing, library, notification, payment, searchEngine, services, storageConfig as storage, ui } from './defaults'
4+
import type { ResolvedStacksOptions, StacksOptions as StacksConfig } from '@stacksjs/types'
5+
import { app, cache, cdn, cli, database, debug, dns, docs, email, git, hashing, library, notification, payment, searchEngine, services, ui } from './defaults'
66

77
export async function packageManager() {
88
const { packageManager } = await readPackageJson(frameworkPath('package.json'))
@@ -26,23 +26,23 @@ export const configDefaults: ResolvedStacksOptions = {
2626
payment,
2727
searchEngine,
2828
services,
29-
storage,
29+
// storage,
3030
ui,
3131
}
3232

33-
export async function loadStacksConfig(overrides?: Partial<StacksOptions>, cwd = process.cwd()) {
34-
const { config } = await loadConfig<StacksOptions>({
33+
export async function loadStacksConfig(overrides?: Partial<StacksConfig>, cwd = process.cwd()) {
34+
const { config } = await loadConfig<StacksConfig>({
3535
name: 'stacks',
3636
defaults: configDefaults,
3737
overrides: {
38-
...(overrides as StacksOptions),
38+
...(overrides as StacksConfig),
3939
},
4040
cwd,
4141
})
4242

4343
return config!
4444
}
4545

46-
export function defineStacksConfig(config: Partial<StacksOptions>) {
46+
export function defineStacksConfig(config: Partial<StacksConfig>) {
4747
return config
4848
}

.stacks/core/storage/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
"fs-extra": "^11.1.1",
5757
"unstorage": "^1.6.1"
5858
},
59+
"dependencies": {
60+
"@stacksjs/utils": "workspace:*"
61+
},
5962
"devDependencies": {
6063
"@stacksjs/development": "workspace:*"
6164
}

.stacks/core/storage/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,9 @@ export function updateConfigFile(filePath: string, newConfig: Record<string, unk
205205
})
206206
}
207207

208-
export { fs }
209-
210208
export const storage = {
211209
_dirname,
210+
fs,
212211
readJsonFile,
213212
readPackageJson,
214213
writeJsonFile,
@@ -225,5 +224,6 @@ export const storage = {
225224
deleteEmptyFolders,
226225
doesFolderExist,
227226
updateConfigFile,
228-
fs,
229227
}
228+
229+
export { fs }

0 commit comments

Comments
 (0)