Skip to content

Commit 03291e7

Browse files
committed
chore: wip
chore: wip chore: wip chore: wip chore: wip chore: wip
1 parent 77198ac commit 03291e7

File tree

26 files changed

+222
-327
lines changed

26 files changed

+222
-327
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ APP_KEY=
44
APP_DEBUG=true
55
APP_URL=stacks.localhost
66
APP_PORT=3333
7+
APP_MAINTENANCE=false
78

89
DB_CONNECTION=sqlite
910
DB_HOST=127.0.0.1

.stacks/core/desktop/engine/tauri.conf.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"build": {
44
"beforeBuildCommand": "bun run build",
55
"beforeDevCommand": "bun run dev",
6-
"devPath": "http://stacks.test:3333",
6+
"devPath": "http://stacks.localhost:3333",
77
"distDir": "../../../views/desktop/dashboard/dist",
88
"withGlobalTauri": true
99
},
@@ -117,7 +117,7 @@
117117
"icons/icon.icns",
118118
"icons/icon.ico"
119119
],
120-
"identifier": "com.stacks.test",
120+
"identifier": "com.stacks.localhost",
121121
"longDescription": "",
122122
"macOS": {
123123
"entitlements": null,

.stacks/core/docs/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const frameworkDefaults = {
1515
cacheDir: p.projectStoragePath('framework/cache/docs'),
1616
assetsDir: p.assetsPath(),
1717
// sitemap: {
18-
// hostname: 'stacks.test',
18+
// hostname: 'stacks.localhost',
1919
// },
2020

2121
vite: {
@@ -39,7 +39,7 @@ export const frameworkDefaults = {
3939
server.printUrls = () => { // eslint-disable-next-line no-console
4040
console.log(` ${c.blue(c.bold('STACKS'))} ${c.blue(version)}`)
4141

42-
// console.log(` ${c.green('➜')} ${c.bold('Docs')}: ${c.green('http://stacks.test:3333/docs')}`)
42+
// console.log(` ${c.green('➜')} ${c.bold('Docs')}: ${c.green('http://stacks.localhost:3333/docs')}`)
4343
// eslint-disable-next-line no-console
4444
console.log(` ${c.green('➜')} ${c.bold('Docs')}: ${c.green('https://stacks.localhost/docs')}`)
4545
// eslint-disable-next-line no-console

.stacks/core/types/src/app.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export interface AppOptions {
5757
* the Buddy command line tool. You should set this to the root of
5858
* your application so that it is used when running Buddy tasks.
5959
*
60-
* @default string "stacks.test"
60+
* @default string "stacks.localhost"
6161
* @example "my-project.test"
6262
*/
6363
url: string
@@ -85,6 +85,16 @@ export interface AppOptions {
8585
*/
8686
debug: boolean
8787

88+
/**
89+
* **Maintenance Mode**
90+
*
91+
* When your application is in maintenance mode, a simple maintenance
92+
* page will be shown on every request into your application.
93+
*
94+
* @default false
95+
*/
96+
maintenanceMode: boolean
97+
8898
/**
8999
* **Encryption Key**
90100
*

.stacks/core/ui/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { log, runCommand } from '@stacksjs/cli'
22

3-
const result = await runCommand('bun build ./src/index.ts --outdir dist --format esm --external @stacksjs/config --external unocss --external @julr/unocss-preset-forms --external @unocss/transformer-compile-class --external vue --external pinia --target bun', {
3+
const result = await runCommand('bun build ./src/index.ts --outdir dist --format esm --external @stacksjs/config --external unocss --external @julr/unocss-preset-forms --external vue --external pinia --target bun', {
44
cwd: import.meta.dir,
55
})
66

.stacks/core/ui/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"@stacksjs/config": "workspace:*",
6262
"@stacksjs/router": "workspace:*",
6363
"@stacksjs/vite-plugin-vue-layouts": "workspace:*",
64-
"@unocss/transformer-compile-class": "^0.57.7",
6564
"pinia": "^2.1.7",
6665
"unocss": "^0.57.7",
6766
"vue": "^3.3.8",
@@ -77,7 +76,6 @@
7776
"@stacksjs/router": "workspace:*",
7877
"@stacksjs/vite-plugin-vue-layouts": "workspace:*",
7978
"@unhead/vue": "^1.8.8",
80-
"@unocss/transformer-compile-class": "^0.57.7",
8179
"add": "^2.0.6",
8280
"pinia": "^2.1.7",
8381
"unhead": "^1.8.8",

.stacks/core/ui/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as CssEngine from 'unocss'
22
import { presetForms } from '@julr/unocss-preset-forms'
3-
import transformerCompileClass from '@unocss/transformer-compile-class'
43
import * as UiEngine from 'vue'
54
import * as Store from 'pinia'
65
import { ui } from '@stacksjs/config'
@@ -11,7 +10,6 @@ export {
1110
UiEngine,
1211
Store,
1312
presetForms,
14-
transformerCompileClass,
1513
UnocssConfig,
1614
ui,
1715
}

.stacks/core/ui/src/uno.config.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
import { defineConfig, presetIcons, presetTypography, presetWebFonts, presetWind, transformerDirectives, transformerVariantGroup } from 'unocss'
1+
import {
2+
defineConfig,
3+
// presetAttributify,
4+
presetIcons,
5+
presetTypography,
6+
presetWind,
7+
presetWebFonts,
8+
transformerDirectives,
9+
transformerVariantGroup,
10+
transformerCompileClass,
11+
} from 'unocss'
212
import { presetForms } from '@julr/unocss-preset-forms'
3-
import transformerCompileClass from '@unocss/transformer-compile-class'
413
import { ui } from '@stacksjs/config'
514

615
export default defineConfig({
@@ -23,11 +32,13 @@ export default defineConfig({
2332
presetWebFonts({
2433
provider: 'bunny', // privacy-friendly Google Web Fonts proxy
2534
fonts: {
26-
// these will extend the default theme
2735
sans: 'Inter',
36+
serif: 'Inter',
2837
mono: 'Inter',
2938
},
3039
}),
40+
41+
// presetAttributify(),
3142
],
3243

3344
transformers: [

.stacks/core/vite/src/uno.config.ts

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

.stacks/core/vite/src/views.ts

Lines changed: 158 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,180 @@
1-
import type { ViteConfig } from '@stacksjs/types'
21
import { path as p } from '@stacksjs/path'
3-
import { alias } from '@stacksjs/alias'
2+
import { defineConfig } from 'vite'
3+
import Vue from '@vitejs/plugin-vue'
44
import generateSitemap from 'vite-ssg-sitemap'
5-
import { autoImports, components, cssEngine, inspect, layouts, pages, uiEngine } from './stacks'
6-
import { defineConfig } from './'
5+
import { server } from '@stacksjs/server'
6+
import { alias } from '@stacksjs/alias'
7+
// @ts-expect-error missing types
8+
import Layouts from 'vite-plugin-vue-layouts'
9+
import Components from 'unplugin-vue-components/vite'
10+
import AutoImport from 'unplugin-auto-import/vite'
11+
import Markdown from 'unplugin-vue-markdown/vite'
12+
import VueMacros from 'unplugin-vue-macros/vite'
13+
import VueI18n from '@intlify/unplugin-vue-i18n/vite'
14+
import { VitePWA } from 'vite-plugin-pwa'
15+
import VueDevTools from 'vite-plugin-vue-devtools'
16+
import LinkAttributes from 'markdown-it-link-attributes'
17+
import Unocss from 'unocss/vite'
18+
import Shiki from 'markdown-it-shikiji'
19+
import WebfontDownload from 'vite-plugin-webfont-dl'
20+
import VueRouter from 'unplugin-vue-router/vite'
21+
import { VueRouterAutoImports } from 'unplugin-vue-router'
722

8-
export const pagesConfig = {
9-
root: p.projectStoragePath('framework/web'),
10-
envDir: p.projectPath(),
11-
envPrefix: 'FRONTEND_',
23+
export default defineConfig({
24+
root: p.frameworkStoragePath('views'),
25+
publicDir: p.publicPath(),
26+
27+
server: server({
28+
type: 'frontend',
29+
}),
1230

1331
resolve: {
1432
alias,
1533
},
1634

17-
server: server({
18-
type: 'views',
19-
}),
20-
2135
plugins: [
22-
// preview(),
23-
uiEngine(),
24-
pages({
25-
dirs: p.resourcesPath('views'),
26-
}),
27-
cssEngine(),
28-
components(),
29-
layouts({
30-
layoutsDirs: p.resourcesPath('layouts'),
31-
}),
32-
autoImports(),
33-
inspect(),
36+
VueMacros({
37+
plugins: {
38+
vue: Vue({
39+
include: [/\.vue$/, /\.md$/],
40+
}),
41+
},
42+
}),
43+
44+
// https://github.com/posva/unplugin-vue-router
45+
VueRouter({
46+
extensions: ['.vue', '.md'],
47+
dts: p.frameworkStoragePath('types/router.d.ts'),
48+
routesFolder: p.resourcesPath('views'),
49+
}),
50+
51+
// https://github.com/JohnCampionJr/vite-plugin-vue-layouts
52+
Layouts({
53+
layoutsDir: p.resourcesPath('layouts'),
54+
}),
55+
56+
// https://github.com/antfu/unplugin-auto-import
57+
AutoImport({
58+
imports: [
59+
'vue',
60+
'vue-i18n',
61+
'@vueuse/head',
62+
'@vueuse/core',
63+
VueRouterAutoImports,
64+
{
65+
// add any other imports you were relying on
66+
'vue-router/auto': ['useLink'],
67+
},
68+
],
69+
dts: p.frameworkStoragePath('types/auto-imports.d.ts'),
70+
dirs: [
71+
p.resourcesPath('functions'),
72+
p.resourcesPath('stores'),
73+
],
74+
vueTemplate: true,
75+
}),
76+
77+
// https://github.com/antfu/unplugin-vue-components
78+
Components({
79+
// allow auto load markdown components under `./resources/components/`
80+
extensions: ['vue', 'md'],
81+
// allow auto import and register components used in markdown
82+
include: [/\.vue$/, /\.vue\?vue/, /\.md$/],
83+
dts: p.frameworkStoragePath('types/components.d.ts'),
84+
dirs: [
85+
p.resourcesPath('components'),
86+
],
87+
}),
88+
89+
// https://github.com/antfu/unocss
90+
// see uno.config.ts for config
91+
Unocss({
92+
configFile: p.uiPath('src/uno.config.ts'),
93+
}),
94+
95+
// https://github.com/unplugin/unplugin-vue-markdown
96+
Markdown({
97+
wrapperClasses: 'prose prose-sm m-auto text-left',
98+
headEnabled: true,
99+
async markdownItSetup(md) {
100+
md.use(LinkAttributes, {
101+
matcher: (link: string) => /^https?:\/\//.test(link),
102+
attrs: {
103+
target: '_blank',
104+
rel: 'noopener',
105+
},
106+
})
107+
md.use(await Shiki({
108+
defaultColor: false,
109+
themes: {
110+
light: 'vitesse-light',
111+
dark: 'vitesse-dark',
112+
},
113+
}))
114+
},
115+
}),
116+
117+
// https://github.com/antfu/vite-plugin-pwa
118+
VitePWA({
119+
srcDir: p.publicPath(),
120+
registerType: 'autoUpdate',
121+
includeAssets: ['favicon.svg', 'safari-pinned-tab.svg'],
122+
manifest: {
123+
name: 'Stacks',
124+
short_name: 'Stacks',
125+
theme_color: '#ffffff',
126+
icons: [
127+
{
128+
src: '/pwa-192x192.png',
129+
sizes: '192x192',
130+
type: 'image/png',
131+
},
132+
{
133+
src: '/pwa-512x512.png',
134+
sizes: '512x512',
135+
type: 'image/png',
136+
},
137+
{
138+
src: '/pwa-512x512.png',
139+
sizes: '512x512',
140+
type: 'image/png',
141+
purpose: 'any maskable',
142+
},
143+
],
144+
},
145+
}),
146+
147+
// https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n
148+
VueI18n({
149+
runtimeOnly: true,
150+
compositionOnly: true,
151+
fullInstall: true,
152+
include: [
153+
p.resolve(__dirname, '../../../../lang/**')
154+
],
155+
}),
156+
157+
// https://github.com/feat-agency/vite-plugin-webfont-dl
158+
WebfontDownload(),
159+
160+
// https://github.com/webfansplz/vite-plugin-vue-devtools
161+
VueDevTools(),
34162
],
35163

36164
// https://github.com/antfu/vite-ssg
37165
ssgOptions: {
38166
script: 'async',
39167
formatting: 'minify',
40-
onFinished() { generateSitemap() },
168+
crittersOptions: {
169+
reduceInlineStyles: false,
170+
},
171+
onFinished() {
172+
generateSitemap()
173+
},
41174
},
42175

43176
ssr: {
44177
// TODO: workaround until they support native ESM
45178
noExternal: ['workbox-window', /vue-i18n/],
46179
},
47-
} satisfies ViteConfig
48-
49-
export default defineConfig(({ command }) => {
50-
if (command === 'serve')
51-
return pagesConfig
52-
53-
// command === 'build'
54-
return pagesConfig
55180
})

0 commit comments

Comments
 (0)