@fullstackunicorn/root 1.0.19 → 2.0.0
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.
- package/assets/blank/backend/index.js +9 -0
- package/assets/blank/backend/package.json +9 -0
- package/assets/blank/frontend/@configs/style/colors.js +5 -0
- package/assets/blank/frontend/@configs/style/fonts.js +5 -0
- package/assets/blank/frontend/@configs/style/presets.js +6 -0
- package/assets/blank/frontend/@configs/vite/build.js +7 -0
- package/assets/blank/frontend/@configs/vite/plugins.js +5 -0
- package/assets/blank/frontend/App.js +7 -0
- package/assets/blank/frontend/base/language/@use.js +2 -0
- package/assets/blank/frontend/base/layout/Header.js +5 -0
- package/assets/blank/frontend/base/layout/Header.pod.js +35 -0
- package/assets/blank/frontend/base/loader/Initial.js +1 -0
- package/assets/blank/frontend/base/loader/Loader.js +9 -0
- package/assets/blank/frontend/base/theme/@use.js +1 -0
- package/assets/blank/frontend/config.style.js +18 -0
- package/assets/blank/frontend/imports/core/Img.js +1 -0
- package/assets/blank/frontend/imports/core/Img.pod.js +11 -0
- package/assets/blank/frontend/imports/core/Link.js +105 -0
- package/assets/blank/frontend/imports/core/View.js +13 -0
- package/assets/blank/frontend/imports/router.js +1 -0
- package/assets/blank/frontend/index.html +18 -0
- package/assets/blank/frontend/modules/core/Link.js +35 -0
- package/assets/blank/frontend/modules/core/Link.pod.js +28 -0
- package/assets/blank/frontend/modules/trademarks/Logo.js +10 -0
- package/assets/blank/frontend/modules/trademarks/Trademark.js +9 -0
- package/assets/blank/frontend/modules/trademarks/Trademark.pod.js +17 -0
- package/assets/blank/frontend/package.json +24 -0
- package/assets/blank/frontend/pages/home/Home.js +3 -0
- package/assets/blank/frontend/pages/home/page.abs.js +3 -0
- package/assets/blank/frontend/root/routes.js +4 -0
- package/assets/blank/frontend/style/@use.js +8 -0
- package/assets/blank/frontend/templates/index.js +1 -0
- package/assets/blank/frontend/vite.config.js +18 -0
- package/assets/blank/frontend/vite.jsx.js +10 -0
- package/index.cmd.js +8 -44
- package/index.js +1 -4
- package/modules/bootstrap.js +99 -0
- package/package.json +11 -18
- package/package.md +20 -0
- package/assets/templates/.devtools/git.sh +0 -12
- package/assets/templates/.devtools/gitlab.sh +0 -11
- package/assets/templates/assets/.env +0 -6
- package/assets/templates/assets/modules/sync.auth.js +0 -3
- package/assets/templates/assets/package.json +0 -19
- package/assets/templates/backend/.env +0 -15
- package/assets/templates/backend/package.json +0 -22
- package/assets/templates/backend/server/middleware.auth.js +0 -4
- package/assets/templates/frontend/.env +0 -3
- package/assets/templates/frontend/assets/index.webmanifest +0 -21
- package/assets/templates/frontend/configure/cache.json +0 -3
- package/assets/templates/frontend/configure/env.json +0 -8
- package/assets/templates/frontend/configure/env.prod.json +0 -8
- package/assets/templates/frontend/configure/layout.json +0 -9
- package/assets/templates/frontend/configure/logo.json +0 -5
- package/assets/templates/frontend/configure/services.json +0 -10
- package/assets/templates/frontend/configure/trademark.json +0 -6
- package/assets/templates/frontend/package.json +0 -23
- package/assets/templates/gitignore +0 -55
- package/assets/templates/manager/.env +0 -15
- package/assets/templates/manager/package.json +0 -22
- package/assets/templates/manager/server/middleware.auth.js +0 -4
- package/index.def.js +0 -71
- package/index.dep.js +0 -16
- package/modules/generate.js +0 -76
- package/modules/initialize.js +0 -60
- package/modules/targets/@tools.js +0 -176
- package/modules/targets/assets.js +0 -38
- package/modules/targets/backend.js +0 -38
- package/modules/targets/devtools.js +0 -31
- package/modules/targets/frontend.js +0 -111
- package/modules/targets/manager.js +0 -38
- package/modules/upgrade.js +0 -187
- package/modules/verify.js +0 -6
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createServer } from 'node:http'
|
|
2
|
+
|
|
3
|
+
const server = createServer((request, response) => {
|
|
4
|
+
response.setHeader('Content-Type', 'application/json')
|
|
5
|
+
response.statusCode = request.url === '/api/pulse' ? 200 : 404
|
|
6
|
+
response.end(JSON.stringify(request.url === '/api/pulse' ? { ok: true } : { error: 'not_found' }))
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
server.listen(Number(process.env.SERVER_PORT), process.env.SERVER_HOST)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { createRoot } from 'react-dom/client'
|
|
3
|
+
import { RouterProvider } from '#@/imports/router.js'
|
|
4
|
+
import { Loader } from '#@/base/loader/Loader.js'
|
|
5
|
+
import '#@/style/@use.scss'
|
|
6
|
+
|
|
7
|
+
createRoot(document.getElementById('root')).render(<RouterProvider><Loader /></RouterProvider>)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useStyle } from '#@/style/@use'
|
|
2
|
+
import { View } from '#@/imports/core/View'
|
|
3
|
+
|
|
4
|
+
export const HeaderPod = ({ auth, center, back, logo, svg }) => {
|
|
5
|
+
|
|
6
|
+
const { s, c, f, t, F, B, S, I, H } = useStyle()
|
|
7
|
+
|
|
8
|
+
H.icon = [[c.base_NN_W700]]
|
|
9
|
+
|
|
10
|
+
S.header = [s.col_sY, s.X100p, s.positionRelative, s.Z1, c.base_WW]
|
|
11
|
+
S.box = [s.row_cY, s.X100p, s.Y64]
|
|
12
|
+
S.one = [s.row_sX, s.X64]
|
|
13
|
+
S.middle = [s.row_cXcY, s.Xr]
|
|
14
|
+
S.two = [s.row_eX, s.X64]
|
|
15
|
+
S.icon = [c.item_WW]
|
|
16
|
+
S.line = [s.Y2, s.Xc, c.base_NN_W700]
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View classes={S.header}>
|
|
20
|
+
<View classes={S.box}>
|
|
21
|
+
<View classes={S.one}>
|
|
22
|
+
{back}
|
|
23
|
+
{logo}
|
|
24
|
+
</View>
|
|
25
|
+
<View classes={S.middle}>
|
|
26
|
+
{center}
|
|
27
|
+
</View>
|
|
28
|
+
<View classes={S.two}>
|
|
29
|
+
{auth}
|
|
30
|
+
</View>
|
|
31
|
+
</View>
|
|
32
|
+
<View classes={S.line}/>
|
|
33
|
+
</View>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Header as Initial } from '#@/base/layout/Header.js'
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Routes, Route, Navigate } from '#@/imports/router.js'
|
|
2
|
+
import { routes } from '#@/root/routes.js'
|
|
3
|
+
import { Home } from '#@/pages/home/Home.js'
|
|
4
|
+
import settings from '#@/configure/site.js'
|
|
5
|
+
|
|
6
|
+
export const Loader = () => <Routes>
|
|
7
|
+
<Route path={routes.public.home.path} element={<Home />} />
|
|
8
|
+
<Route path="/" element={<Navigate replace to={'/' + settings.language + '/home'} />} />
|
|
9
|
+
</Routes>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const useGetIsDark = () => false
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import fonts from '#@/@configs/style/fonts.js'
|
|
2
|
+
import colors from '#@/@configs/style/colors.js'
|
|
3
|
+
import presets from '#@/@configs/style/presets.js'
|
|
4
|
+
|
|
5
|
+
const setup = {}
|
|
6
|
+
|
|
7
|
+
setup.BASE_PATH = './'
|
|
8
|
+
setup.LOGS_PATH = './.devtools'
|
|
9
|
+
setup.isWeb = true
|
|
10
|
+
setup.isNative = false
|
|
11
|
+
|
|
12
|
+
setup.fontFamily = fonts
|
|
13
|
+
setup.saturation = colors.saturation
|
|
14
|
+
setup.hues = colors.hues
|
|
15
|
+
setup.staticHues = colors.staticHues
|
|
16
|
+
setup.defaultSass = presets.defaultSass
|
|
17
|
+
|
|
18
|
+
export default setup
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ImgDataPod as ImgData } from '#@/imports/core/Img.pod.js'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { View } from '#@/imports/core/View.js'
|
|
2
|
+
|
|
3
|
+
export const ImgDataPod = ({ classes=[], inline={}, onPress, setIsHover, src, alt }) => {
|
|
4
|
+
|
|
5
|
+
return (
|
|
6
|
+
<View classes={classes} inline={{overflow:'hidden', ...inline}} onPress={onPress} setIsHover={setIsHover}>
|
|
7
|
+
<img style={{width:'100%', height:'100%'}} src={src} alt={alt}/>
|
|
8
|
+
</View>
|
|
9
|
+
)
|
|
10
|
+
}
|
|
11
|
+
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// export const Link = ({ classes, inline={}, children, linkTo, onPress, setIsHover }) => {
|
|
2
|
+
|
|
3
|
+
// const props = F3.isFnc(setIsHover) ? {
|
|
4
|
+
// onMouseEnter: () => setIsHover(true),
|
|
5
|
+
// onMouseLeave: () => setIsHover(false),
|
|
6
|
+
// } : {}
|
|
7
|
+
|
|
8
|
+
// props.className = classes?.join(' ')
|
|
9
|
+
// props.style = inline
|
|
10
|
+
|
|
11
|
+
// if (!linkTo) return <span {...props}>{children}</span>
|
|
12
|
+
|
|
13
|
+
// props.href = linkTo
|
|
14
|
+
// props.onClick = async e => {
|
|
15
|
+
// e.preventDefault()
|
|
16
|
+
// if (F3.isFnc(onPress)) await onPress()
|
|
17
|
+
// }
|
|
18
|
+
|
|
19
|
+
// return <a {...props}>{children}</a>
|
|
20
|
+
// }
|
|
21
|
+
|
|
22
|
+
import { useState } from 'react'
|
|
23
|
+
import { useNavigate } from '#@/imports/router.js'
|
|
24
|
+
|
|
25
|
+
export const Link = ({
|
|
26
|
+
children, classes = [], inline = {}, hover = [], isExternal = false, isView = false,
|
|
27
|
+
isDraggable = false, setIsHover = null, onPress = null, linkTo = '', navigateOptions = {}
|
|
28
|
+
}) => {
|
|
29
|
+
|
|
30
|
+
const navigate = useNavigate()
|
|
31
|
+
|
|
32
|
+
const [isHoverLocal, setIsHoverLocal] = useState(false)
|
|
33
|
+
|
|
34
|
+
const hoverClasses = isHoverLocal && hover ? hover : []
|
|
35
|
+
const className = [...classes, ...hoverClasses].join(' ')
|
|
36
|
+
|
|
37
|
+
if (isView || !linkTo) {
|
|
38
|
+
return (
|
|
39
|
+
<div
|
|
40
|
+
className={className}
|
|
41
|
+
style={inline}
|
|
42
|
+
draggable={isDraggable}
|
|
43
|
+
onMouseEnter={() => {
|
|
44
|
+
setIsHoverLocal(true)
|
|
45
|
+
if (setIsHover) setIsHover(true)
|
|
46
|
+
}}
|
|
47
|
+
onMouseLeave={() => {
|
|
48
|
+
setIsHoverLocal(false)
|
|
49
|
+
if (setIsHover) setIsHover(false)
|
|
50
|
+
}}
|
|
51
|
+
onClick={onPress}
|
|
52
|
+
>
|
|
53
|
+
{children}
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (isExternal) {
|
|
59
|
+
return (
|
|
60
|
+
<a
|
|
61
|
+
className={className}
|
|
62
|
+
style={inline}
|
|
63
|
+
href={linkTo}
|
|
64
|
+
draggable={isDraggable}
|
|
65
|
+
onMouseEnter={() => {
|
|
66
|
+
setIsHoverLocal(true)
|
|
67
|
+
if (setIsHover) setIsHover(true)
|
|
68
|
+
}}
|
|
69
|
+
onMouseLeave={() => {
|
|
70
|
+
setIsHoverLocal(false)
|
|
71
|
+
if (setIsHover) setIsHover(false)
|
|
72
|
+
}}
|
|
73
|
+
onClick={onPress}
|
|
74
|
+
>
|
|
75
|
+
{children}
|
|
76
|
+
</a>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const handleClick = async e => {
|
|
81
|
+
e.preventDefault()
|
|
82
|
+
if (onPress) await onPress()
|
|
83
|
+
navigate(linkTo, navigateOptions)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<a
|
|
88
|
+
className={className}
|
|
89
|
+
style={inline}
|
|
90
|
+
href={linkTo}
|
|
91
|
+
draggable={isDraggable}
|
|
92
|
+
onMouseEnter={() => {
|
|
93
|
+
setIsHoverLocal(true)
|
|
94
|
+
if (setIsHover) setIsHover(true)
|
|
95
|
+
}}
|
|
96
|
+
onMouseLeave={() => {
|
|
97
|
+
setIsHoverLocal(false)
|
|
98
|
+
if (setIsHover) setIsHover(false)
|
|
99
|
+
}}
|
|
100
|
+
onClick={handleClick}
|
|
101
|
+
>
|
|
102
|
+
{children}
|
|
103
|
+
</a>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const View = ({
|
|
2
|
+
classes = [], inline = {}, children,
|
|
3
|
+
viewRef = null, setIsHover = () => { } }) => {
|
|
4
|
+
return (
|
|
5
|
+
<div className={classes.join(' ')} style={inline}
|
|
6
|
+
ref={viewRef}
|
|
7
|
+
onMouseEnter={() => setIsHover(true)}
|
|
8
|
+
onMouseLeave={() => setIsHover(false)}
|
|
9
|
+
>
|
|
10
|
+
{children}
|
|
11
|
+
</div>
|
|
12
|
+
)
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BrowserRouter as RouterProvider, Routes, Route, Navigate, useNavigate, useLocation } from 'react-router-dom'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<!-- {{language}} -->
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
7
|
+
<!-- runtime-environment -->
|
|
8
|
+
<!-- {{metadata}} -->
|
|
9
|
+
<!-- {{languages}} -->
|
|
10
|
+
<!-- {{schema}} -->
|
|
11
|
+
<!-- {{opengraph}} -->
|
|
12
|
+
<!-- {{twitter}} -->
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<div id="root"></div>
|
|
16
|
+
<script type="module" src="/App.js"></script>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { useNavigate } from '#@/imports/router'
|
|
3
|
+
import { LinkPod } from './Link.pod.js'
|
|
4
|
+
|
|
5
|
+
export const Link = ({
|
|
6
|
+
classes=[], inline={},
|
|
7
|
+
onPress= async ()=>{}, onLongPress,
|
|
8
|
+
children, linkTo, hover,
|
|
9
|
+
setIsHover:parentSetIsHover=false
|
|
10
|
+
}) => {
|
|
11
|
+
|
|
12
|
+
const [isHover, setIsHover] = useState(false)
|
|
13
|
+
|
|
14
|
+
const navigate = useNavigate()
|
|
15
|
+
|
|
16
|
+
const onAction = async () => {
|
|
17
|
+
const result = await onPress()
|
|
18
|
+
if(linkTo && !result) navigate(linkTo)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<LinkPod
|
|
23
|
+
linkTo={linkTo}
|
|
24
|
+
classes={classes}
|
|
25
|
+
inline={inline}
|
|
26
|
+
onPress={onAction}
|
|
27
|
+
onLongPress={onLongPress}
|
|
28
|
+
setIsHover={parentSetIsHover?parentSetIsHover:setIsHover}
|
|
29
|
+
isHover={isHover}
|
|
30
|
+
hover={hover}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</LinkPod>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useStyle } from '#@/style/@use'
|
|
2
|
+
import { Link } from '#@/imports/core/Link'
|
|
3
|
+
|
|
4
|
+
export const LinkPod = ({
|
|
5
|
+
classes=[], inline={}, children, linkTo,
|
|
6
|
+
isHover, setIsHover, hover=[],
|
|
7
|
+
onPress, onLongPress
|
|
8
|
+
}) => {
|
|
9
|
+
|
|
10
|
+
const { s, c, f, t, F, B, S, I, H } = useStyle()
|
|
11
|
+
|
|
12
|
+
B.hover = isHover ? hover[0] || [] : hover[1] || []
|
|
13
|
+
|
|
14
|
+
S.classes = [...classes, ...B.hover]
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Link
|
|
18
|
+
linkTo={linkTo}
|
|
19
|
+
classes={S.classes}
|
|
20
|
+
inline={inline}
|
|
21
|
+
onPress={onPress}
|
|
22
|
+
onLongPress={onLongPress}
|
|
23
|
+
setIsHover={setIsHover}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</Link>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import settings from '#@/configure/site.js'
|
|
2
|
+
import { ImgData } from '#@/imports/core/Img.js'
|
|
3
|
+
import { useStyle } from '#@/style/@use.js'
|
|
4
|
+
|
|
5
|
+
export const Logo = () => {
|
|
6
|
+
const { s } = useStyle()
|
|
7
|
+
return settings.logo.visible ? <div className={[s.XY64, s.row_cXcY].join(' ')}>
|
|
8
|
+
<ImgData src={settings.logo.src} inline={{ width: settings.logo.size, height: settings.logo.size }} />
|
|
9
|
+
</div> : null
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import settings from '#@/configure/site.js'
|
|
2
|
+
import { TrademarkPod } from '#@/modules/trademarks/Trademark.pod.js'
|
|
3
|
+
|
|
4
|
+
export const Trademark = () => <TrademarkPod
|
|
5
|
+
src={settings.trademark.src}
|
|
6
|
+
width={settings.trademark.width}
|
|
7
|
+
height={settings.trademark.height}
|
|
8
|
+
linkHome={'/' + settings.language + '/home'}
|
|
9
|
+
/>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useStyle } from '#@/style/@use.js'
|
|
2
|
+
import { Link } from '#@/modules/core/Link.js'
|
|
3
|
+
import { ImgData } from '#@/imports/core/Img.js'
|
|
4
|
+
|
|
5
|
+
export const TrademarkPod = ({ src, width, height, linkHome }) => {
|
|
6
|
+
|
|
7
|
+
const { s, c, f, t, F, B, S, I, H } = useStyle()
|
|
8
|
+
|
|
9
|
+
S.link = [s.marginX16]
|
|
10
|
+
I.img = { width, height }
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Link classes={S.link} inline={I.img} linkTo={linkHome}>
|
|
14
|
+
<ImgData classes={S.img} inline={I.img} src={src}/>
|
|
15
|
+
</Link>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fullstackunicorn/blank",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"imports": {
|
|
7
|
+
"#@": "./",
|
|
8
|
+
"#@/*": "./*"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"style": "style",
|
|
12
|
+
"build": "npm run style && vite build"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"react": "19.3.1",
|
|
16
|
+
"react-dom": "19.3.1",
|
|
17
|
+
"react-router-dom": "7.18.4"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@fullstackunicorn/style": "1.0.13",
|
|
21
|
+
"vite": "8.3.7",
|
|
22
|
+
"sass": "1.106.1"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { web_classes_fixed as fixed } from '#@/style/web_classes_fixed.js'
|
|
2
|
+
import { web_classes_directional as directional } from '#@/style/web_classes_directional.js'
|
|
3
|
+
import { web_classes_color as color } from '#@/style/web_classes_color.js'
|
|
4
|
+
|
|
5
|
+
export const useStyle = () => ({
|
|
6
|
+
s: { ...fixed, ...directional(false) }, c: color(true),
|
|
7
|
+
f: {}, t: {}, F: {}, B: {}, S: {}, I: {}, H: {},
|
|
8
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const templates = (s, c, t) => t
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import { defineConfig } from 'vite'
|
|
3
|
+
import plugins from '#@/@configs/vite/plugins.js'
|
|
4
|
+
import build from '#@/@configs/vite/build.js'
|
|
5
|
+
|
|
6
|
+
const config = {}
|
|
7
|
+
|
|
8
|
+
config.plugins = plugins
|
|
9
|
+
config.resolve = {}
|
|
10
|
+
config.resolve.alias = {}
|
|
11
|
+
config.resolve.alias['#@'] = fileURLToPath(new URL('./', import.meta.url))
|
|
12
|
+
config.publicDir = 'assets'
|
|
13
|
+
config.assetsInclude = ['**/*.svg', '**/*.png', '**/*.jpg', '**/*.jpeg', '**/*.ico']
|
|
14
|
+
config.build = build
|
|
15
|
+
config.define = {}
|
|
16
|
+
config.define['process.env'] = {}
|
|
17
|
+
|
|
18
|
+
export default defineConfig(config)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { transformWithOxc } from 'vite'
|
|
2
|
+
|
|
3
|
+
export const jsxPlugin = () => ({
|
|
4
|
+
name: 'jsx-plugin',
|
|
5
|
+
enforce: 'pre',
|
|
6
|
+
async transform(code, id) {
|
|
7
|
+
if (!id.match(/.*\.js$/)) return null
|
|
8
|
+
return await transformWithOxc(code, id, { lang: 'jsx', jsx: { runtime: 'automatic' } })
|
|
9
|
+
},
|
|
10
|
+
})
|
package/index.cmd.js
CHANGED
|
@@ -1,47 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import '
|
|
3
|
-
F3.service = '@fullstackunicorn/root'
|
|
4
|
-
import { generate, verify, upgrade, initialize } from '#@/index.js'
|
|
5
|
-
|
|
6
|
-
const [nodePath, nodeScriptPath, command, ...args] = process.argv
|
|
7
|
-
|
|
8
|
-
if (!command) {
|
|
9
|
-
console.error('Error: invalid arguments. See documentation.')
|
|
10
|
-
console.error('Usage: yarn root <generate|verify|upgrade> [args...]')
|
|
11
|
-
process.exit(1)
|
|
12
|
-
}
|
|
2
|
+
import { generate } from '#@/modules/bootstrap.js'
|
|
13
3
|
|
|
4
|
+
const [command, domain, flag, config] = process.argv.slice(2)
|
|
14
5
|
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (command === 'verify') {
|
|
22
|
-
await verify.run(...args)
|
|
23
|
-
process.exit(0)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (command === 'upgrade') {
|
|
27
|
-
await upgrade.run(...args)
|
|
28
|
-
process.exit(0)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (command === 'initialize') {
|
|
32
|
-
await initialize.run(...args)
|
|
33
|
-
process.exit(0)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
console.error(`Error: command "${command}" not found.`)
|
|
37
|
-
console.error('Available commands:')
|
|
38
|
-
console.error(' - initialize')
|
|
39
|
-
console.error(' - generate')
|
|
40
|
-
console.error(' - verify')
|
|
41
|
-
console.error(' - upgrade')
|
|
42
|
-
process.exit(1)
|
|
43
|
-
|
|
44
|
-
} catch (err) {
|
|
45
|
-
console.error('Error:', err)
|
|
46
|
-
process.exit(1)
|
|
47
|
-
}
|
|
6
|
+
if (command !== 'generate' || flag !== '--config' || !config) throw new Error('Usage: root generate <domain> --config <file.json>')
|
|
7
|
+
console.log(JSON.stringify(await generate({ domain, config })))
|
|
8
|
+
} catch (error) {
|
|
9
|
+
console.error(error.message)
|
|
10
|
+
process.exitCode = 1
|
|
11
|
+
}
|
package/index.js
CHANGED