Skip to content

Commit fbe9cc1

Browse files
committed
chore: wip
1 parent 1b2e3a8 commit fbe9cc1

File tree

8 files changed

+60
-60
lines changed

8 files changed

+60
-60
lines changed

.stacks/auto-imports.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ declare global {
9191
const breakpointsTailwind: typeof import('./core/utils/src/vendors')['breakpointsTailwind']
9292
const breakpointsVuetify: typeof import('./core/utils/src/vendors')['breakpointsVuetify']
9393
const buildEnginePath: typeof import('./core/path/src/index')['buildEnginePath']
94-
const buildEntriesPath: typeof import('./core/path/src/index')['buildEntriesPath']
9594
const buildPath: typeof import('./core/path/src/index')['buildPath']
9695
const cache: typeof import('../config/cache')['default']
9796
const cachePath: typeof import('./core/path/src/index')['cachePath']
@@ -411,6 +410,8 @@ declare global {
411410
const lessThanOrEqual: typeof import('./core/utils/src/currency')['lessThanOrEqual']
412411
const library: typeof import('../config/library')['default']
413412
const libraryEntryPath: typeof import('./core/path/src/index')['libraryEntryPath']
413+
const libsEntriesPath: typeof import('./core/path/src/index')['libsEntriesPath']
414+
const libsPath: typeof import('./core/path/src/index')['libsPath']
414415
const lightBlue: typeof import('./core/cli/src/utilities')['lightBlue']
415416
const lightCyan: typeof import('./core/cli/src/utilities')['lightCyan']
416417
const lightGray: typeof import('./core/cli/src/utilities')['lightGray']
@@ -941,7 +942,6 @@ declare module 'vue' {
941942
readonly breakpointsTailwind: UnwrapRef<typeof import('./core/utils/src/vendors')['breakpointsTailwind']>
942943
readonly breakpointsVuetify: UnwrapRef<typeof import('./core/utils/src/vendors')['breakpointsVuetify']>
943944
readonly buildEnginePath: UnwrapRef<typeof import('./core/path/src/index')['buildEnginePath']>
944-
readonly buildEntriesPath: UnwrapRef<typeof import('./core/path/src/index')['buildEntriesPath']>
945945
readonly buildPath: UnwrapRef<typeof import('./core/path/src/index')['buildPath']>
946946
readonly cache: UnwrapRef<typeof import('../config/cache')['default']>
947947
readonly cachePath: UnwrapRef<typeof import('./core/path/src/index')['cachePath']>
@@ -1258,6 +1258,8 @@ declare module 'vue' {
12581258
readonly lessThanOrEqual: UnwrapRef<typeof import('./core/utils/src/currency')['lessThanOrEqual']>
12591259
readonly library: UnwrapRef<typeof import('../config/library')['default']>
12601260
readonly libraryEntryPath: UnwrapRef<typeof import('./core/path/src/index')['libraryEntryPath']>
1261+
readonly libsEntriesPath: UnwrapRef<typeof import('./core/path/src/index')['libsEntriesPath']>
1262+
readonly libsPath: UnwrapRef<typeof import('./core/path/src/index')['libsPath']>
12611263
readonly lightBlue: UnwrapRef<typeof import('./core/cli/src/utilities')['lightBlue']>
12621264
readonly lightCyan: UnwrapRef<typeof import('./core/cli/src/utilities')['lightCyan']>
12631265
readonly lightGray: UnwrapRef<typeof import('./core/cli/src/utilities')['lightGray']>
@@ -1776,7 +1778,6 @@ declare module '@vue/runtime-core' {
17761778
readonly breakpointsTailwind: UnwrapRef<typeof import('./core/utils/src/vendors')['breakpointsTailwind']>
17771779
readonly breakpointsVuetify: UnwrapRef<typeof import('./core/utils/src/vendors')['breakpointsVuetify']>
17781780
readonly buildEnginePath: UnwrapRef<typeof import('./core/path/src/index')['buildEnginePath']>
1779-
readonly buildEntriesPath: UnwrapRef<typeof import('./core/path/src/index')['buildEntriesPath']>
17801781
readonly buildPath: UnwrapRef<typeof import('./core/path/src/index')['buildPath']>
17811782
readonly cache: UnwrapRef<typeof import('../config/cache')['default']>
17821783
readonly cachePath: UnwrapRef<typeof import('./core/path/src/index')['cachePath']>
@@ -2093,6 +2094,8 @@ declare module '@vue/runtime-core' {
20932094
readonly lessThanOrEqual: UnwrapRef<typeof import('./core/utils/src/currency')['lessThanOrEqual']>
20942095
readonly library: UnwrapRef<typeof import('../config/library')['default']>
20952096
readonly libraryEntryPath: UnwrapRef<typeof import('./core/path/src/index')['libraryEntryPath']>
2097+
readonly libsEntriesPath: UnwrapRef<typeof import('./core/path/src/index')['libsEntriesPath']>
2098+
readonly libsPath: UnwrapRef<typeof import('./core/path/src/index')['libsPath']>
20962099
readonly lightBlue: UnwrapRef<typeof import('./core/cli/src/utilities')['lightBlue']>
20972100
readonly lightCyan: UnwrapRef<typeof import('./core/cli/src/utilities')['lightCyan']>
20982101
readonly lightGray: UnwrapRef<typeof import('./core/cli/src/utilities')['lightGray']>
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
import { log } from '@stacksjs/logging'
21
import { frameworkPath } from '@stacksjs/path'
32
import { runCommand } from '@stacksjs/cli'
3+
import { NpmScript } from '@stacksjs/types'
44

5-
log.info('Building Component Libraries...')
6-
7-
// run the `npx mkdist -d` command to build the dist folder
8-
const result = await runCommand('npx mkdist -d', { verbose: true, cwd: frameworkPath() })
9-
10-
if (result.isErr()) {
11-
log.error('There was an error running `npx mkdist -d`.', result.error)
12-
process.exit()
13-
}
14-
15-
log.success('Building Stacks was successful.')
5+
await runCommand(NpmScript.BuildComponents, { cwd: frameworkPath(), verbose: true })

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

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,76 @@
11
import { log } from '@stacksjs/logging'
22
import { kebabCase } from '@stacksjs/strings'
3+
import type { LibraryType } from '@stacksjs/path'
34
import { libraryEntryPath } from '@stacksjs/path'
45
import { writeTextFile } from '@stacksjs/storage'
56
import { determineResetPreset } from '@stacksjs/utils'
6-
import type { LibEntryType } from '@stacksjs/types'
77
import { library } from '@stacksjs/config'
8+
import { ExitCode } from '@stacksjs/types'
89

910
/**
1011
* Based on the config values, this method
1112
* will generate the library entry points.
1213
*
13-
* @param type string
14+
* @param type LibraryType
1415
*/
15-
export async function generateLibEntry(type: LibEntryType) {
16-
try {
17-
if (type === 'vue-components')
18-
await createVueLibraryEntryPoint()
16+
export async function generateLibEntry(type: LibraryType) {
17+
await createLibraryEntryPoint(type)
18+
}
1919

20-
if (type === 'web-components')
21-
await createWebComponentLibraryEntryPoint()
20+
export async function createLibraryEntryPoint(type: LibraryType) {
21+
if (type === 'vue-components')
22+
await createVueLibraryEntryPoint()
2223

23-
if (type === 'functions')
24-
await createFunctionLibraryEntryPoint()
25-
}
26-
catch (err) {
27-
log.error('There was an error generating the library entry point', err)
28-
process.exit()
29-
}
24+
if (type === 'web-components')
25+
await createWebComponentLibraryEntryPoint()
26+
27+
if (type === 'functions')
28+
await createFunctionLibraryEntryPoint()
3029
}
3130

32-
export async function createVueLibraryEntryPoint() {
31+
export async function createVueLibraryEntryPoint(type: LibraryType = 'vue-components') {
3332
log.info('Creating the Vue component library entry point...')
3433

3534
await writeTextFile({
36-
path: libraryEntryPath('vue-components'),
37-
data: generateEntryPointData('vue-components'),
35+
path: libraryEntryPath(type),
36+
data: generateEntryPointData(type),
37+
}).catch((err) => {
38+
log.error('There was an error generating the Vue component library entry point', err)
39+
process.exit(ExitCode.FatalError)
3840
})
3941

4042
log.success('Created the Vue component library entry point')
4143
}
4244

43-
export async function createWebComponentLibraryEntryPoint() {
45+
export async function createWebComponentLibraryEntryPoint(type: LibraryType = 'web-components') {
4446
log.info('Creating the Web Component library entry point...')
4547

4648
await writeTextFile({
47-
path: libraryEntryPath('web-components'),
48-
data: generateEntryPointData('web-components'),
49+
path: libraryEntryPath(type),
50+
data: generateEntryPointData(type),
51+
}).catch((err) => {
52+
log.error('There was an error generating the Web Component library entry point', err)
53+
process.exit(ExitCode.FatalError)
4954
})
5055

5156
log.success('Created Web Component library entry point')
5257
}
5358

54-
export async function createFunctionLibraryEntryPoint() {
59+
export async function createFunctionLibraryEntryPoint(type: LibraryType = 'functions') {
5560
log.info('Creating the Function library entry point...')
5661

5762
await writeTextFile({
58-
path: libraryEntryPath('functions'),
59-
data: generateEntryPointData('functions'),
63+
path: libraryEntryPath(type),
64+
data: generateEntryPointData(type),
65+
}).catch((err) => {
66+
log.error('There was an error generating the Function library entry point', err)
67+
process.exit(ExitCode.FatalError)
6068
})
6169

6270
log.success('Created Functions library entry point')
6371
}
6472

65-
export function generateEntryPointData(type: 'vue-components' | 'web-components' | 'functions'): string {
73+
export function generateEntryPointData(type: LibraryType): string {
6674
let arr = []
6775

6876
if (type === 'functions') {

.stacks/core/build/entries/README.md

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

.stacks/core/build/src/functions.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 { buildEntriesPath, frameworkPath, functionsPath, projectPath } from '@stacksjs/path'
4+
import { frameworkPath, functionsPath, libraryEntryPath, projectPath } from '@stacksjs/path'
55
import { library } from '@stacksjs/config'
66
import { alias } from '@stacksjs/alias'
77
import { autoImports } from '.'
@@ -28,7 +28,7 @@ export function functionsBuildOptions(): ViteBuildOptions {
2828
emptyOutDir: true,
2929
sourcemap: library.functions?.shouldGenerateSourcemap,
3030
lib: {
31-
entry: buildEntriesPath('functions.ts'),
31+
entry: libraryEntryPath('functions'),
3232
name: library.functions?.name,
3333
formats: ['cjs', 'es'],
3434
fileName: (format: string) => {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from 'vite'
22
import type { ViteConfig } from '@stacksjs/types'
3-
import { buildEntriesPath, frameworkPath, projectPath } from '@stacksjs/path'
3+
import { frameworkPath, libraryEntryPath, projectPath } from '@stacksjs/path'
44
import type { BuildOptions as ViteBuildOptions } from 'vite'
55
import { library } from '@stacksjs/config'
66
import { alias } from '@stacksjs/alias'
@@ -22,7 +22,7 @@ export const vueComponentsConfig: ViteConfig = {
2222
},
2323

2424
optimizeDeps: {
25-
exclude: ['vue', 'fsevents', '@novu/mandrill', '@maizzle/framework', 'browser-sync-ui'],
25+
exclude: ['vue', 'fsevents'],
2626
},
2727

2828
plugins: [
@@ -42,7 +42,7 @@ export function vueComponentsBuildOptions(): ViteBuildOptions {
4242
outDir: frameworkPath('components/vue/dist'),
4343
emptyOutDir: true,
4444
lib: {
45-
entry: buildEntriesPath('vue-components.ts'),
45+
entry: libraryEntryPath('vue-components'),
4646
name: library.vueComponents?.name,
4747
formats: ['cjs', 'es'],
4848
fileName: (format: string) => {

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

Lines changed: 3 additions & 3 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 { buildEntriesPath, componentsPath, frameworkPath, projectPath } from '@stacksjs/path'
4+
import { componentsPath, frameworkPath, libraryEntryPath, projectPath } from '@stacksjs/path'
55
import { library } from '@stacksjs/config'
66
import { server } from '@stacksjs/server'
77
import { alias } from '@stacksjs/alias'
@@ -12,7 +12,7 @@ const isWebComponent = true
1212
export const webComponentsConfig: ViteConfig = {
1313
root: componentsPath(),
1414
envDir: projectPath(),
15-
envPrefix: 'APP_',
15+
envPrefix: 'FRONTEND_',
1616

1717
server,
1818

@@ -36,7 +36,7 @@ export function webComponentsBuildOptions(): ViteBuildOptions {
3636
outDir: frameworkPath('components/web/dist'),
3737
emptyOutDir: true,
3838
lib: {
39-
entry: buildEntriesPath('web-components.ts'),
39+
entry: libraryEntryPath('web-components'),
4040
name: library.webComponents?.name,
4141
formats: ['cjs', 'es'],
4242
fileName: (format: string) => {

.stacks/core/path/src/index.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,12 @@ export function buildEnginePath(path?: string) {
7878
return buildPath(`${path || ''}`)
7979
}
8080

81-
export function buildEntriesPath(path?: string) {
82-
return buildPath(`entries/${path || ''}`)
81+
export function libsPath(path?: string) {
82+
return frameworkPath(`libs/${path || ''}`)
83+
}
84+
85+
export function libsEntriesPath(path?: string) {
86+
return libsPath(`entries/${path || ''}`)
8387
}
8488

8589
export function cachePath(path?: string) {
@@ -186,8 +190,9 @@ export function langPath(path?: string) {
186190
return resourcesPath(`lang/${path || ''}`)
187191
}
188192

189-
export function libraryEntryPath(type: 'vue-components' | 'web-components' | 'functions') {
190-
return buildEntriesPath(`${type}.ts`)
193+
export type LibraryType = 'vue-components' | 'web-components' | 'functions'
194+
export function libraryEntryPath(type: LibraryType) {
195+
return libsEntriesPath(`${type}.ts`)
191196
}
192197

193198
export function lintPath(path?: string) {
@@ -389,7 +394,7 @@ const path = {
389394
appPath,
390395
authPath,
391396
buildEnginePath,
392-
buildEntriesPath,
397+
libsEntriesPath,
393398
buildPath,
394399
cachePath,
395400
chatPath,
@@ -419,6 +424,7 @@ const path = {
419424
functionsPath,
420425
gitPath,
421426
langPath,
427+
libsPath,
422428
libraryEntryPath,
423429
lintPath,
424430
loggingPath,

0 commit comments

Comments
 (0)