@fullstackunicorn/create-root 1.0.0 → 1.0.2
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/config.cmd.sh +40 -0
- package/assets/package.json +9 -0
- package/assets/root.config.app.js +56 -27
- package/index.dep.js +8 -2
- package/modules/root.init.js +23 -43
- package/package.json +2 -2
- package/assets/root.config.backend.js +0 -0
- package/assets/root.config.frontend.js +0 -43
- package/assets/root.config.server.js +0 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
# ============================================================
|
|
4
|
+
add() {
|
|
5
|
+
|
|
6
|
+
# echo "🚀 Adding Dependencies"
|
|
7
|
+
echo "🚀 Adding Dev Dependencies"
|
|
8
|
+
|
|
9
|
+
yarn add -D @fullstackunicorn/root --latest
|
|
10
|
+
yarn add -D @fullstackunicorn/reduce --latest
|
|
11
|
+
yarn add -D @fullstackunicorn/cli --latest
|
|
12
|
+
|
|
13
|
+
echo "✅ Dependencies added!"
|
|
14
|
+
}
|
|
15
|
+
# ============================================================
|
|
16
|
+
upgrade() {
|
|
17
|
+
|
|
18
|
+
# echo "🚀 Upgrading Dependency "
|
|
19
|
+
# yarn upgrade @fullstackunicorn/root --latest
|
|
20
|
+
# yarn upgrade @fullstackunicorn/reduce --latest
|
|
21
|
+
# yarn upgrade @fullstackunicorn/cli --latest
|
|
22
|
+
|
|
23
|
+
echo "🚀 Upgrading All Dependencies "
|
|
24
|
+
yarn upgrade --latest
|
|
25
|
+
|
|
26
|
+
echo "✅ Upgaded!"
|
|
27
|
+
}
|
|
28
|
+
# ============================================================
|
|
29
|
+
case "$1" in
|
|
30
|
+
add) add ;;
|
|
31
|
+
upgrade) upgrade ;;
|
|
32
|
+
*)
|
|
33
|
+
echo "❌ Unknown command: $1"
|
|
34
|
+
echo "Available commands:"
|
|
35
|
+
echo " add"
|
|
36
|
+
echo " upgrade"
|
|
37
|
+
exit 1
|
|
38
|
+
;;
|
|
39
|
+
esac
|
|
40
|
+
# ============================================================
|
|
@@ -1,36 +1,65 @@
|
|
|
1
|
-
const
|
|
1
|
+
const app = {}
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
// frontend
|
|
4
|
-
|
|
5
|
+
app.frontend = {}
|
|
5
6
|
// frontend.env
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
app.frontend.env = {}
|
|
8
|
+
app.frontend.env.port = 9000
|
|
9
|
+
app.frontend.env.name = 'root.fullstackunicorn.dev'
|
|
10
|
+
app.frontend.env.type = 'frontend'
|
|
10
11
|
// frontend.package
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
app.frontend.package = {}
|
|
13
|
+
app.frontend.package.name = app.frontend.env.name
|
|
14
|
+
app.frontend.package.homepage = 'https://root.fullstackunicorn.dev'
|
|
15
|
+
app.frontend.package.author = 'lucanigido (https://fullstackunicorn.dev/author/lucanigido)'
|
|
15
16
|
// frontend.manifest
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
app.frontend.manifest = {}
|
|
18
|
+
app.frontend.manifest.name = "Root"
|
|
19
|
+
app.frontend.manifest.short_name = "Root"
|
|
20
|
+
app.frontend.manifest.theme_color = "#ffffff"
|
|
21
|
+
app.frontend.manifest.background_color = "#ffffff"
|
|
22
|
+
// frontend.configure.logo XY → min 32 max 48 SIZE → 64x64 EXT → .svg or .png
|
|
23
|
+
app.frontend.configure = {}
|
|
24
|
+
app.frontend.configure.logo = {}
|
|
25
|
+
app.frontend.configure.logo.XY = 32
|
|
26
|
+
app.frontend.configure.logo.canonical = 'logo.png'
|
|
27
|
+
app.frontend.configure.logo.inverse = 'logo.inverse.png'
|
|
28
|
+
// frontend.configure.trademark Xmax → max 300 Y → min 10 max 32 SIZE → x min 10 max EXT → .svg or .png
|
|
29
|
+
app.frontend.configure.trademark = {}
|
|
30
|
+
app.frontend.configure.trademark.Xmax = 260
|
|
31
|
+
app.frontend.configure.trademark.Y = 18
|
|
32
|
+
app.frontend.configure.trademark.canonical = 'trademark.png'
|
|
33
|
+
app.frontend.configure.trademark.inverse = 'trademark.inverse.png'
|
|
34
|
+
// frontend.configure.cache STALE → 5 * 60 (5min) MAX → 5 * 365 * 24 * 60 * 60 (5years)
|
|
35
|
+
app.frontend.configure.cache = {}
|
|
36
|
+
app.frontend.configure.cache.STALE = 1 // 5 * 60
|
|
37
|
+
app.frontend.configure.cache.MAX = 5 * 365 * 24 * 60 * 60
|
|
38
|
+
// frontend.configure.constants
|
|
39
|
+
app.frontend.configure.constants = {}
|
|
40
|
+
app.frontend.configure.constants.IS_DEFAULT_THEME_DARK = false
|
|
41
|
+
app.frontend.configure.constants.IS_BUTTON_USER_OFF = true
|
|
42
|
+
app.frontend.configure.constants.IS_CARD_ACCOUNT_OFF = true
|
|
43
|
+
app.frontend.configure.constants.IS_CARD_LANGUAGE_OFF = true
|
|
44
|
+
app.frontend.configure.constants.IS_CARD_THEME_OFF = true
|
|
45
|
+
app.frontend.configure.constants.IS_CARD_COOKIES_OFF = true
|
|
46
|
+
app.frontend.configure.constants.IS_CARD_LEGALS_OFF = true
|
|
47
|
+
app.frontend.configure.constants.IS_BAND_CALLOUT_ON = false
|
|
48
|
+
|
|
21
49
|
|
|
22
50
|
// backend
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
51
|
+
app.backend = {}
|
|
52
|
+
app.backend.env = {}
|
|
53
|
+
app.backend.env.port = 9001
|
|
54
|
+
app.backend.env.name = 'root.fullstackunicorn.dev'
|
|
55
|
+
app.backend.env.type = 'backend'
|
|
56
|
+
|
|
28
57
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
58
|
+
// server
|
|
59
|
+
app.server = {}
|
|
60
|
+
app.server.env = {}
|
|
61
|
+
app.server.env.port = 9002
|
|
62
|
+
app.server.env.name = 'api.root.fullstackunicorn.dev'
|
|
63
|
+
app.server.env.type = 'server'
|
|
34
64
|
|
|
35
|
-
export {
|
|
36
|
-
export default config
|
|
65
|
+
export { app }
|
package/index.dep.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// NODE BUILT IN
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { default as path } from 'path'
|
|
3
|
+
import { fileURLToPath } from 'url'
|
|
4
|
+
|
|
5
|
+
// BASEPATH
|
|
6
|
+
const getBasepath = () => path.dirname(fileURLToPath(import.meta.url))
|
|
7
|
+
export const basePath = getBasepath()
|
|
8
|
+
export { path }
|
|
9
|
+
|
|
4
10
|
|
|
5
11
|
// FULLSTACKUNICORN
|
|
6
12
|
export { fsa } from '@fullstackunicorn/filesystem'
|
package/modules/root.init.js
CHANGED
|
@@ -1,60 +1,40 @@
|
|
|
1
|
-
import { path,
|
|
1
|
+
import { path, fsa, basePath } from '#@/index.dep.js'
|
|
2
2
|
|
|
3
3
|
class Init {
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
constructor () {
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
this.cwd = process.cwd()
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
this.folders = {}
|
|
10
|
+
this.folders.assets = `${basePath}/assets`
|
|
11
|
+
this.folders.target = this.cwd
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const pkgPath = path.join(targetDir, 'package.json')
|
|
17
|
-
|
|
18
|
-
if (!await fsa.exists(pkgPath)) {
|
|
19
|
-
|
|
20
|
-
const pkg = {
|
|
21
|
-
name: foldername ? String(foldername) : 'root-project',
|
|
22
|
-
private: true,
|
|
23
|
-
version: '0.0.0',
|
|
24
|
-
type: 'module',
|
|
25
|
-
devDependencies: {
|
|
26
|
-
'@fullstackunicorn/root': '^1.0.0'
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
await fsa.writeText(pkgPath, JSON.stringify(pkg, null, 4) + '\n')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// 2) copy assets from THIS npm package into targetDir (same name, same content)
|
|
34
|
-
const assetsDir = fileURLToPath(new URL('../assets/', import.meta.url))
|
|
35
|
-
|
|
36
|
-
// list them explicitly (simple + stable)
|
|
37
|
-
const files = [
|
|
13
|
+
this.files = [
|
|
14
|
+
'config.cmd.sh',
|
|
15
|
+
'package.json',
|
|
38
16
|
'root.config.app.js',
|
|
39
|
-
'root.
|
|
40
|
-
'root.config.frontend.js',
|
|
41
|
-
'root.config.server.js',
|
|
42
|
-
'root.readme.md'
|
|
17
|
+
'root.readme.md',
|
|
43
18
|
]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async run(foldername) {
|
|
44
22
|
|
|
45
|
-
|
|
23
|
+
if (foldername) this.folders.target = path.resolve(this.cwd, foldername)
|
|
24
|
+
await fsa.ensureDir(this.folders.target)
|
|
46
25
|
|
|
47
|
-
|
|
48
|
-
const dst = path.join(targetDir, file)
|
|
26
|
+
for (const file of this.files) {
|
|
49
27
|
|
|
50
|
-
const
|
|
51
|
-
|
|
28
|
+
const asset = path.join(this.folders.assets, file)
|
|
29
|
+
const target = path.join(this.folders.target, file)
|
|
52
30
|
|
|
53
|
-
await fsa.
|
|
31
|
+
const content = await fsa.readText(asset)
|
|
32
|
+
if (!content) F3.throw(`missing asset: ${file}`)
|
|
33
|
+
await fsa.writeText(target, content)
|
|
54
34
|
}
|
|
55
35
|
|
|
56
|
-
F3.logs(`✅
|
|
57
|
-
F3.logs(`👉 next
|
|
36
|
+
F3.logs(`✅ root created: ${this.folders.target}`)
|
|
37
|
+
F3.logs(`👉 next:${foldername ? ` cd ${foldername} &&` : ''} yarn && yarn root generate`)
|
|
58
38
|
}
|
|
59
39
|
}
|
|
60
40
|
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.2",
|
|
3
3
|
"name": "@fullstackunicorn/create-root",
|
|
4
4
|
"author": "lucanigido (https://fullstackunicorn.dev/author/lucanigido)",
|
|
5
5
|
"description": "create-root: bootstrapper that writes config assets and installs @fullstackunicorn/root",
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
"@fullstackunicorn/cli": "^1.0.3",
|
|
34
34
|
"@fullstackunicorn/reduce": "^1.0.20"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|
|
File without changes
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const config = {}
|
|
2
|
-
|
|
3
|
-
// LOGO: XY → min 32 max 48 SIZE → 64x64 EXT → .svg or .png
|
|
4
|
-
config.logo = {}
|
|
5
|
-
config.logo.XY = 32
|
|
6
|
-
config.logo.canonical = 'logo.png'
|
|
7
|
-
config.logo.inverse = 'logo.png'
|
|
8
|
-
|
|
9
|
-
// TRADEMARK: Xmax → max 300 Y → min 10 max 32 SIZE → x min 10 max EXT → .svg or .png
|
|
10
|
-
config.trademark = {}
|
|
11
|
-
config.trademark.Xmax = 260
|
|
12
|
-
config.trademark.Y = 18
|
|
13
|
-
config.trademark.canonical = 'trademark.png'
|
|
14
|
-
config.trademark.inverse = 'trademark.png'
|
|
15
|
-
|
|
16
|
-
// CACHE: STALE → 5 * 60 (5min) MAX → 5 * 365 * 24 * 60 * 60 (5years)
|
|
17
|
-
config.cache.STALE = 1 // 5 * 60
|
|
18
|
-
config.cache.MAX = 5 * 365 * 24 * 60 * 60
|
|
19
|
-
|
|
20
|
-
// SERVICES
|
|
21
|
-
config.constants.IS_DEFAULT_THEME_DARK = false
|
|
22
|
-
config.constants.IS_BUTTON_USER_OFF = true
|
|
23
|
-
config.constants.IS_CARD_ACCOUNT_OFF = true
|
|
24
|
-
config.constants.IS_CARD_LANGUAGE_OFF = true
|
|
25
|
-
config.constants.IS_CARD_THEME_OFF = true
|
|
26
|
-
config.constants.IS_CARD_COOKIES_OFF = true
|
|
27
|
-
config.constants.IS_CARD_LEGALS_OFF = true
|
|
28
|
-
config.constants.IS_BAND_CALLOUT_ON = false
|
|
29
|
-
|
|
30
|
-
export { config }
|
|
31
|
-
export default config
|
|
32
|
-
|
|
33
|
-
// generate codebase
|
|
34
|
-
// +
|
|
35
|
-
// generate .env
|
|
36
|
-
// generate package.json
|
|
37
|
-
// generate index.html
|
|
38
|
-
// generate assets (including manifest)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// generate config/cache
|
|
42
|
-
// generate config/constants
|
|
43
|
-
// generate config/trademarks (paths+dimensions)
|
|
File without changes
|