@unsetsoft/ryunix-presets 1.0.16 → 1.0.18
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/package.json +5 -4
- package/webpack/bin/compiler.mjs +6 -6
- package/webpack/bin/index.mjs +115 -115
- package/webpack/bin/prerender.mjs +138 -138
- package/webpack/bin/serve.mjs +112 -101
- package/webpack/config.d.ts +85 -85
- package/webpack/eslint.config.mjs +31 -31
- package/webpack/index.js +6 -6
- package/webpack/template/index.html +19 -19
- package/webpack/utils/config.cjs +190 -190
- package/webpack/utils/envExist.cjs +14 -14
- package/webpack/utils/index.mjs +210 -203
- package/webpack/utils/settingfile.cjs +33 -33
- package/webpack/webpack.config.mjs +286 -279
package/webpack/utils/config.cjs
CHANGED
|
@@ -1,190 +1,190 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
const { getConfig } = require('./settingfile.cjs')
|
|
3
|
-
const reactPlugin = require('eslint-plugin-react')
|
|
4
|
-
const config = getConfig()
|
|
5
|
-
|
|
6
|
-
const defaultSettings = {
|
|
7
|
-
experimental: {
|
|
8
|
-
ssg: {
|
|
9
|
-
sitemap: {
|
|
10
|
-
// allow sitemap generation
|
|
11
|
-
enable: config?.experimental?.ssg?.sitemap?.enable
|
|
12
|
-
? config.experimental.ssg.sitemap.enable
|
|
13
|
-
: false,
|
|
14
|
-
// base url. ex: https://example.com
|
|
15
|
-
baseURL: config?.experimental?.ssg?.sitemap?.baseURL
|
|
16
|
-
? config.experimental.ssg.sitemap.baseURL
|
|
17
|
-
: false,
|
|
18
|
-
// global settings for the sitemap.
|
|
19
|
-
settings: config?.experimental?.ssg?.sitemap?.settings
|
|
20
|
-
? {
|
|
21
|
-
changefreq: config.experimental.ssg.sitemap.settings.changefreq
|
|
22
|
-
? config.experimental.ssg.sitemap.settings.changefreq
|
|
23
|
-
: 'weekly',
|
|
24
|
-
priority: config.experimental.ssg.sitemap.settings.priority
|
|
25
|
-
? config.experimental.ssg.sitemap.settings.priority
|
|
26
|
-
: '0.7',
|
|
27
|
-
}
|
|
28
|
-
: {
|
|
29
|
-
// default values
|
|
30
|
-
changefreq: 'weekly',
|
|
31
|
-
priority: '0.7',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
// prerendered pages
|
|
35
|
-
// TODO: better form to import from routing system. but for now is the best method.
|
|
36
|
-
// NEXT: rename this! :)
|
|
37
|
-
prerender: config?.experimental?.ssg?.prerender
|
|
38
|
-
? config.experimental.ssg.prerender
|
|
39
|
-
: [],
|
|
40
|
-
},
|
|
41
|
-
env: config?.experimental?.env ? config.experimental.env : {},
|
|
42
|
-
},
|
|
43
|
-
static: {
|
|
44
|
-
favicon: config?.static?.favicon ? config.static.favicon : false,
|
|
45
|
-
// if is true, public/index.html are required.
|
|
46
|
-
customTemplate: config?.static?.customTemplate
|
|
47
|
-
? config.static.customTemplate
|
|
48
|
-
: false,
|
|
49
|
-
|
|
50
|
-
// global SEO.
|
|
51
|
-
seo: {
|
|
52
|
-
pageLang: config?.static?.seo?.pageLang
|
|
53
|
-
? config.static.seo.pageLang
|
|
54
|
-
: 'en',
|
|
55
|
-
title: config?.static?.seo?.title
|
|
56
|
-
? config.static.seo.title
|
|
57
|
-
: 'Ryunix App',
|
|
58
|
-
meta: config?.static?.seo?.meta ? config.static.seo.meta : {},
|
|
59
|
-
},
|
|
60
|
-
ssg: {}, // TODO: Move experimental.ssg here.
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
eslint: {
|
|
64
|
-
files: config?.eslint?.files ? config.eslint.files : ['**/*.ryx'],
|
|
65
|
-
plugins: config?.eslint?.plugins
|
|
66
|
-
? {
|
|
67
|
-
react: reactPlugin,
|
|
68
|
-
...config.eslint.plugins,
|
|
69
|
-
}
|
|
70
|
-
: {
|
|
71
|
-
react: reactPlugin,
|
|
72
|
-
},
|
|
73
|
-
rules: config?.eslint?.rules
|
|
74
|
-
? {
|
|
75
|
-
'max-len': config.eslint.rules['max-len']
|
|
76
|
-
? config.eslint.rules['max-len']
|
|
77
|
-
: ['error', { code: 400 }],
|
|
78
|
-
camelcase: config.eslint.rules.camelcase
|
|
79
|
-
? config.eslint.rules.camelcase
|
|
80
|
-
: 'off',
|
|
81
|
-
'no-unused-vars': config.eslint.rules['no-unused-vars']
|
|
82
|
-
? config.eslint.rules['no-unused-vars']
|
|
83
|
-
: 'warn',
|
|
84
|
-
'no-console': config.eslint.rules['no-console']
|
|
85
|
-
? config.eslint.rules['no-console']
|
|
86
|
-
: 'off',
|
|
87
|
-
'no-underscore-dangle': config.eslint.rules['no-underscore-dangle']
|
|
88
|
-
? config.eslint.rules['no-underscore-dangle']
|
|
89
|
-
: ['error', { allow: ['id_', '_id'] }],
|
|
90
|
-
'arrow-body-style': config.eslint.rules['arrow-body-style']
|
|
91
|
-
? config.eslint.rules['arrow-body-style']
|
|
92
|
-
: 'off',
|
|
93
|
-
indent: config.eslint.rules.indent
|
|
94
|
-
? config.eslint.rules.indent
|
|
95
|
-
: 'warn',
|
|
96
|
-
'consistent-return': config.eslint.rules['consistent-return']
|
|
97
|
-
? config.eslint.rules['consistent-return']
|
|
98
|
-
: 'off',
|
|
99
|
-
'no-else-return': config.eslint.rules['no-else-return']
|
|
100
|
-
? config.eslint.rules['no-else-return']
|
|
101
|
-
: 'off',
|
|
102
|
-
'global-require': config.eslint.rules['global-require']
|
|
103
|
-
? config.eslint.rules['global-require']
|
|
104
|
-
: 'off',
|
|
105
|
-
'no-param-reassign': config.eslint.rules['no-param-reassign']
|
|
106
|
-
? config.eslint.rules['no-param-reassign']
|
|
107
|
-
: ['error', { props: false }],
|
|
108
|
-
'new-cap': config.eslint.rules['new-cap']
|
|
109
|
-
? config.eslint.rules['new-cap']
|
|
110
|
-
: 'off',
|
|
111
|
-
'arrow-parens': config.eslint.rules['arrow-parens']
|
|
112
|
-
? config.eslint.rules['arrow-parens']
|
|
113
|
-
: 'off',
|
|
114
|
-
'prefer-destructuring': config.eslint.rules['prefer-destructuring']
|
|
115
|
-
? config.eslint.rules['prefer-destructuring']
|
|
116
|
-
: 'warn',
|
|
117
|
-
'no-nested-ternary': config.eslint.rules['no-nested-ternary']
|
|
118
|
-
? config.eslint.rules['no-nested-ternary']
|
|
119
|
-
: 'off',
|
|
120
|
-
'react/jsx-uses-vars': config.eslint.rules['react/jsx-uses-vars']
|
|
121
|
-
? config.eslint.rules['react/jsx-uses-vars']
|
|
122
|
-
: 'warn',
|
|
123
|
-
// by default only this
|
|
124
|
-
'react/jsx-uses-react': 'off',
|
|
125
|
-
'react/react-in-jsx-scope': 'off',
|
|
126
|
-
...config.eslint.rules,
|
|
127
|
-
}
|
|
128
|
-
: {
|
|
129
|
-
'max-len': ['error', { code: 400 }],
|
|
130
|
-
camelcase: 'off',
|
|
131
|
-
'no-unused-vars': 'warn',
|
|
132
|
-
'no-console': 'off',
|
|
133
|
-
'no-underscore-dangle': ['error', { allow: ['id_', '_id'] }],
|
|
134
|
-
'arrow-body-style': 'off',
|
|
135
|
-
indent: 'warn',
|
|
136
|
-
'consistent-return': 'off',
|
|
137
|
-
'no-else-return': 'off',
|
|
138
|
-
'global-require': 'off',
|
|
139
|
-
'no-param-reassign': ['error', { props: false }],
|
|
140
|
-
'new-cap': 'off',
|
|
141
|
-
'arrow-parens': 'off',
|
|
142
|
-
'prefer-destructuring': 'warn',
|
|
143
|
-
'no-nested-ternary': 'off',
|
|
144
|
-
'react/jsx-uses-vars': 'warn',
|
|
145
|
-
'react/jsx-uses-react': 'off',
|
|
146
|
-
'react/react-in-jsx-scope': 'off',
|
|
147
|
-
},
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
webpack: {
|
|
151
|
-
production: config?.webpack?.production ?? false,
|
|
152
|
-
root: config?.webpack?.root ? config.webpack.root : 'src',
|
|
153
|
-
output: {
|
|
154
|
-
buildDirectory: config?.webpack?.output?.buildDirectory
|
|
155
|
-
? config.webpack.output.buildDirectory
|
|
156
|
-
: '.ryunix',
|
|
157
|
-
},
|
|
158
|
-
target: config?.webpack?.target ? config.webpack.target : 'web',
|
|
159
|
-
resolve: {
|
|
160
|
-
alias: config?.webpack?.resolve?.alias
|
|
161
|
-
? config.webpack.resolve.alias
|
|
162
|
-
: {},
|
|
163
|
-
fallback: config?.webpack?.resolve?.fallback
|
|
164
|
-
? config.webpack.resolve.fallback
|
|
165
|
-
: {},
|
|
166
|
-
extensions: config?.webpack?.resolve?.extensions
|
|
167
|
-
? config.webpack.resolve.extensions
|
|
168
|
-
: [],
|
|
169
|
-
},
|
|
170
|
-
plugins: config?.webpack?.plugins ? config.webpack.plugins : [],
|
|
171
|
-
devServer: {
|
|
172
|
-
port: config?.webpack?.server?.port ? config.webpack.server.port : 3000,
|
|
173
|
-
proxy: config?.webpack?.server?.proxy ? config.webpack.server.proxy : [],
|
|
174
|
-
allowedHosts: config?.webpack?.server?.allowedHosts
|
|
175
|
-
? config.webpack.server.allowedHosts
|
|
176
|
-
: 'auto',
|
|
177
|
-
},
|
|
178
|
-
externals: config?.webpack?.externals ? config.webpack.externals : [{}],
|
|
179
|
-
module: {
|
|
180
|
-
rules: config?.webpack?.module?.rules ? config.webpack.module.rules : [],
|
|
181
|
-
},
|
|
182
|
-
experiments: {
|
|
183
|
-
lazyCompilation: config?.webpack?.experiments?.lazyCompilation
|
|
184
|
-
? config.webpack.experiments.lazyCompilation
|
|
185
|
-
: false,
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
module.exports = defaultSettings
|
|
1
|
+
'use strict'
|
|
2
|
+
const { getConfig } = require('./settingfile.cjs')
|
|
3
|
+
const reactPlugin = require('eslint-plugin-react')
|
|
4
|
+
const config = getConfig()
|
|
5
|
+
|
|
6
|
+
const defaultSettings = {
|
|
7
|
+
experimental: {
|
|
8
|
+
ssg: {
|
|
9
|
+
sitemap: {
|
|
10
|
+
// allow sitemap generation
|
|
11
|
+
enable: config?.experimental?.ssg?.sitemap?.enable
|
|
12
|
+
? config.experimental.ssg.sitemap.enable
|
|
13
|
+
: false,
|
|
14
|
+
// base url. ex: https://example.com
|
|
15
|
+
baseURL: config?.experimental?.ssg?.sitemap?.baseURL
|
|
16
|
+
? config.experimental.ssg.sitemap.baseURL
|
|
17
|
+
: false,
|
|
18
|
+
// global settings for the sitemap.
|
|
19
|
+
settings: config?.experimental?.ssg?.sitemap?.settings
|
|
20
|
+
? {
|
|
21
|
+
changefreq: config.experimental.ssg.sitemap.settings.changefreq
|
|
22
|
+
? config.experimental.ssg.sitemap.settings.changefreq
|
|
23
|
+
: 'weekly',
|
|
24
|
+
priority: config.experimental.ssg.sitemap.settings.priority
|
|
25
|
+
? config.experimental.ssg.sitemap.settings.priority
|
|
26
|
+
: '0.7',
|
|
27
|
+
}
|
|
28
|
+
: {
|
|
29
|
+
// default values
|
|
30
|
+
changefreq: 'weekly',
|
|
31
|
+
priority: '0.7',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
// prerendered pages
|
|
35
|
+
// TODO: better form to import from routing system. but for now is the best method.
|
|
36
|
+
// NEXT: rename this! :)
|
|
37
|
+
prerender: config?.experimental?.ssg?.prerender
|
|
38
|
+
? config.experimental.ssg.prerender
|
|
39
|
+
: [],
|
|
40
|
+
},
|
|
41
|
+
env: config?.experimental?.env ? config.experimental.env : {},
|
|
42
|
+
},
|
|
43
|
+
static: {
|
|
44
|
+
favicon: config?.static?.favicon ? config.static.favicon : false,
|
|
45
|
+
// if is true, public/index.html are required.
|
|
46
|
+
customTemplate: config?.static?.customTemplate
|
|
47
|
+
? config.static.customTemplate
|
|
48
|
+
: false,
|
|
49
|
+
|
|
50
|
+
// global SEO.
|
|
51
|
+
seo: {
|
|
52
|
+
pageLang: config?.static?.seo?.pageLang
|
|
53
|
+
? config.static.seo.pageLang
|
|
54
|
+
: 'en',
|
|
55
|
+
title: config?.static?.seo?.title
|
|
56
|
+
? config.static.seo.title
|
|
57
|
+
: 'Ryunix App',
|
|
58
|
+
meta: config?.static?.seo?.meta ? config.static.seo.meta : {},
|
|
59
|
+
},
|
|
60
|
+
ssg: {}, // TODO: Move experimental.ssg here.
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
eslint: {
|
|
64
|
+
files: config?.eslint?.files ? config.eslint.files : ['**/*.ryx'],
|
|
65
|
+
plugins: config?.eslint?.plugins
|
|
66
|
+
? {
|
|
67
|
+
react: reactPlugin,
|
|
68
|
+
...config.eslint.plugins,
|
|
69
|
+
}
|
|
70
|
+
: {
|
|
71
|
+
react: reactPlugin,
|
|
72
|
+
},
|
|
73
|
+
rules: config?.eslint?.rules
|
|
74
|
+
? {
|
|
75
|
+
'max-len': config.eslint.rules['max-len']
|
|
76
|
+
? config.eslint.rules['max-len']
|
|
77
|
+
: ['error', { code: 400 }],
|
|
78
|
+
camelcase: config.eslint.rules.camelcase
|
|
79
|
+
? config.eslint.rules.camelcase
|
|
80
|
+
: 'off',
|
|
81
|
+
'no-unused-vars': config.eslint.rules['no-unused-vars']
|
|
82
|
+
? config.eslint.rules['no-unused-vars']
|
|
83
|
+
: 'warn',
|
|
84
|
+
'no-console': config.eslint.rules['no-console']
|
|
85
|
+
? config.eslint.rules['no-console']
|
|
86
|
+
: 'off',
|
|
87
|
+
'no-underscore-dangle': config.eslint.rules['no-underscore-dangle']
|
|
88
|
+
? config.eslint.rules['no-underscore-dangle']
|
|
89
|
+
: ['error', { allow: ['id_', '_id'] }],
|
|
90
|
+
'arrow-body-style': config.eslint.rules['arrow-body-style']
|
|
91
|
+
? config.eslint.rules['arrow-body-style']
|
|
92
|
+
: 'off',
|
|
93
|
+
indent: config.eslint.rules.indent
|
|
94
|
+
? config.eslint.rules.indent
|
|
95
|
+
: 'warn',
|
|
96
|
+
'consistent-return': config.eslint.rules['consistent-return']
|
|
97
|
+
? config.eslint.rules['consistent-return']
|
|
98
|
+
: 'off',
|
|
99
|
+
'no-else-return': config.eslint.rules['no-else-return']
|
|
100
|
+
? config.eslint.rules['no-else-return']
|
|
101
|
+
: 'off',
|
|
102
|
+
'global-require': config.eslint.rules['global-require']
|
|
103
|
+
? config.eslint.rules['global-require']
|
|
104
|
+
: 'off',
|
|
105
|
+
'no-param-reassign': config.eslint.rules['no-param-reassign']
|
|
106
|
+
? config.eslint.rules['no-param-reassign']
|
|
107
|
+
: ['error', { props: false }],
|
|
108
|
+
'new-cap': config.eslint.rules['new-cap']
|
|
109
|
+
? config.eslint.rules['new-cap']
|
|
110
|
+
: 'off',
|
|
111
|
+
'arrow-parens': config.eslint.rules['arrow-parens']
|
|
112
|
+
? config.eslint.rules['arrow-parens']
|
|
113
|
+
: 'off',
|
|
114
|
+
'prefer-destructuring': config.eslint.rules['prefer-destructuring']
|
|
115
|
+
? config.eslint.rules['prefer-destructuring']
|
|
116
|
+
: 'warn',
|
|
117
|
+
'no-nested-ternary': config.eslint.rules['no-nested-ternary']
|
|
118
|
+
? config.eslint.rules['no-nested-ternary']
|
|
119
|
+
: 'off',
|
|
120
|
+
'react/jsx-uses-vars': config.eslint.rules['react/jsx-uses-vars']
|
|
121
|
+
? config.eslint.rules['react/jsx-uses-vars']
|
|
122
|
+
: 'warn',
|
|
123
|
+
// by default only this
|
|
124
|
+
'react/jsx-uses-react': 'off',
|
|
125
|
+
'react/react-in-jsx-scope': 'off',
|
|
126
|
+
...config.eslint.rules,
|
|
127
|
+
}
|
|
128
|
+
: {
|
|
129
|
+
'max-len': ['error', { code: 400 }],
|
|
130
|
+
camelcase: 'off',
|
|
131
|
+
'no-unused-vars': 'warn',
|
|
132
|
+
'no-console': 'off',
|
|
133
|
+
'no-underscore-dangle': ['error', { allow: ['id_', '_id'] }],
|
|
134
|
+
'arrow-body-style': 'off',
|
|
135
|
+
indent: 'warn',
|
|
136
|
+
'consistent-return': 'off',
|
|
137
|
+
'no-else-return': 'off',
|
|
138
|
+
'global-require': 'off',
|
|
139
|
+
'no-param-reassign': ['error', { props: false }],
|
|
140
|
+
'new-cap': 'off',
|
|
141
|
+
'arrow-parens': 'off',
|
|
142
|
+
'prefer-destructuring': 'warn',
|
|
143
|
+
'no-nested-ternary': 'off',
|
|
144
|
+
'react/jsx-uses-vars': 'warn',
|
|
145
|
+
'react/jsx-uses-react': 'off',
|
|
146
|
+
'react/react-in-jsx-scope': 'off',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
|
|
150
|
+
webpack: {
|
|
151
|
+
production: config?.webpack?.production ?? false,
|
|
152
|
+
root: config?.webpack?.root ? config.webpack.root : 'src',
|
|
153
|
+
output: {
|
|
154
|
+
buildDirectory: config?.webpack?.output?.buildDirectory
|
|
155
|
+
? config.webpack.output.buildDirectory
|
|
156
|
+
: '.ryunix',
|
|
157
|
+
},
|
|
158
|
+
target: config?.webpack?.target ? config.webpack.target : 'web',
|
|
159
|
+
resolve: {
|
|
160
|
+
alias: config?.webpack?.resolve?.alias
|
|
161
|
+
? config.webpack.resolve.alias
|
|
162
|
+
: {},
|
|
163
|
+
fallback: config?.webpack?.resolve?.fallback
|
|
164
|
+
? config.webpack.resolve.fallback
|
|
165
|
+
: {},
|
|
166
|
+
extensions: config?.webpack?.resolve?.extensions
|
|
167
|
+
? config.webpack.resolve.extensions
|
|
168
|
+
: [],
|
|
169
|
+
},
|
|
170
|
+
plugins: config?.webpack?.plugins ? config.webpack.plugins : [],
|
|
171
|
+
devServer: {
|
|
172
|
+
port: config?.webpack?.server?.port ? config.webpack.server.port : 3000,
|
|
173
|
+
proxy: config?.webpack?.server?.proxy ? config.webpack.server.proxy : [],
|
|
174
|
+
allowedHosts: config?.webpack?.server?.allowedHosts
|
|
175
|
+
? config.webpack.server.allowedHosts
|
|
176
|
+
: 'auto',
|
|
177
|
+
},
|
|
178
|
+
externals: config?.webpack?.externals ? config.webpack.externals : [{}],
|
|
179
|
+
module: {
|
|
180
|
+
rules: config?.webpack?.module?.rules ? config.webpack.module.rules : [],
|
|
181
|
+
},
|
|
182
|
+
experiments: {
|
|
183
|
+
lazyCompilation: config?.webpack?.experiments?.lazyCompilation
|
|
184
|
+
? config.webpack.experiments.lazyCompilation
|
|
185
|
+
: false,
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
module.exports = defaultSettings
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
const fs = require('fs')
|
|
3
|
-
const path = require('path')
|
|
4
|
-
|
|
5
|
-
const envPath = path.join(process.cwd(), '.env')
|
|
6
|
-
|
|
7
|
-
const envExist = () => {
|
|
8
|
-
if (fs.existsSync(envPath)) {
|
|
9
|
-
return true
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return false
|
|
13
|
-
}
|
|
14
|
-
module.exports = envExist
|
|
1
|
+
'use strict'
|
|
2
|
+
const fs = require('fs')
|
|
3
|
+
const path = require('path')
|
|
4
|
+
|
|
5
|
+
const envPath = path.join(process.cwd(), '.env')
|
|
6
|
+
|
|
7
|
+
const envExist = () => {
|
|
8
|
+
if (fs.existsSync(envPath)) {
|
|
9
|
+
return true
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return false
|
|
13
|
+
}
|
|
14
|
+
module.exports = envExist
|