5htp 0.0.6 → 0.0.8
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 +4 -2
- package/readme.md +30 -0
- package/skeleton/.github/workflows/ci.yml +93 -0
- package/skeleton/.github/workflows/ecs-task.json +77 -0
- package/skeleton/Dockerfile +20 -0
- package/skeleton/docker-compose.yml +45 -0
- package/skeleton/identity.yaml +17 -0
- package/skeleton/package-lock.json +6139 -0
- package/skeleton/package.json +30 -0
- package/skeleton/src/client/assets/identity/logo.svg +64 -0
- package/skeleton/src/client/assets/identity/logoAndText.svg +105 -0
- package/skeleton/src/client/assets/illustration/launch.jpg +0 -0
- package/skeleton/src/client/assets/logos/google-play-store.svg +1 -0
- package/skeleton/src/client/assets/logos/googleauth.svg +9 -0
- package/skeleton/src/client/assets/patterns/interlaced.png +0 -0
- package/skeleton/src/client/assets/theme.less +278 -0
- package/skeleton/src/client/components/LoginModal.tsx +45 -0
- package/skeleton/src/client/pages/app/_layout/index.less +20 -0
- package/skeleton/src/client/pages/app/_layout/index.tsx +33 -0
- package/skeleton/src/client/pages/app/index.tsx +57 -0
- package/skeleton/src/client/pages/landing/_layout/index.less +145 -0
- package/skeleton/src/client/pages/landing/_layout/index.tsx +63 -0
- package/skeleton/src/client/pages/landing/index.tsx +73 -0
- package/skeleton/src/client/pages/preload.json +3 -0
- package/skeleton/src/client/tsconfig.json +32 -0
- package/skeleton/src/common/tsconfig.json +10 -0
- package/skeleton/src/server/config.ts +125 -0
- package/skeleton/src/server/index.ts +23 -0
- package/skeleton/src/server/routes/general.ts +66 -0
- package/skeleton/src/server/services/auth/index.ts +88 -0
- package/skeleton/src/server/tsconfig.json +34 -0
- package/src/{utils → app}/config.ts +20 -2
- package/src/app/index.ts +75 -0
- package/src/commands/build.ts +6 -1
- package/src/commands/deploy/web.ts +3 -3
- package/src/commands/dev.ts +11 -9
- package/src/commands/init.ts +85 -0
- package/src/compiler/client/identite.ts +7 -5
- package/src/compiler/client/index.ts +21 -18
- package/src/compiler/common/babel/index.ts +209 -201
- package/src/compiler/common/babel/plugins/injection-dependances/index.ts +2 -2
- package/src/compiler/common/babel/plugins/pages.ts +4 -2
- package/src/compiler/common/files/autres.ts +3 -1
- package/src/compiler/common/files/images.ts +2 -1
- package/src/compiler/common/files/style.ts +6 -4
- package/src/compiler/common/index.ts +13 -7
- package/src/compiler/common/plugins/indexage/icones-svg/index.ts +45 -37
- package/src/compiler/common/plugins/indexage/injection-dependances/index.ts +1 -1
- package/src/compiler/index.ts +24 -3
- package/src/compiler/server/index.ts +19 -19
- package/src/index.ts +4 -18
- package/src/paths.ts +12 -33
- package/tsconfig.json +1 -2
|
@@ -11,8 +11,8 @@ import * as types from '@babel/types'
|
|
|
11
11
|
import PluginIndexage from '../plugins/indexage';
|
|
12
12
|
import BabelGlobImports from './plugins/importations';
|
|
13
13
|
|
|
14
|
-
import cli from '
|
|
15
|
-
import { TAppSide } from '
|
|
14
|
+
import cli from '@cli';
|
|
15
|
+
import type { TAppSide, default as App } from '@cli/app';
|
|
16
16
|
|
|
17
17
|
// Const
|
|
18
18
|
const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
@@ -23,239 +23,247 @@ const routesToPreload = require( cli.paths.appRoot + '/src/client/pages/preload.
|
|
|
23
23
|
/*----------------------------------
|
|
24
24
|
- REGLES
|
|
25
25
|
----------------------------------*/
|
|
26
|
-
module.exports = (side: TAppSide, dev: boolean): webpack.RuleSetRule[] =>
|
|
27
|
-
loader: 'babel-loader',
|
|
28
|
-
options: {
|
|
29
|
-
|
|
30
|
-
// https://github.com/babel/babel-loader#options
|
|
26
|
+
module.exports = (app: App, side: TAppSide, dev: boolean): webpack.RuleSetRule[] => {
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
const pkg = {
|
|
29
|
+
app: require(app.paths.root + '/package.json'),
|
|
30
|
+
core: require(cli.paths.core.root + '/package.json'),
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return [{
|
|
34
|
+
loader: 'babel-loader',
|
|
35
|
+
options: {
|
|
36
|
+
|
|
37
|
+
// https://github.com/babel/babel-loader#options
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
// ATTENTION: Ne prend pas toujours compte des màj des plugins babel
|
|
40
|
+
cacheDirectory: cli.args.cache === true,
|
|
41
|
+
// Désactive car ralenti compilation
|
|
42
|
+
cacheCompression: false,
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
metadataSubscribers: [
|
|
45
|
+
PluginIndexage.metadataContextFunctionName
|
|
46
|
+
],
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
babelrc: false,
|
|
45
|
-
presets: [
|
|
48
|
+
compact: !dev,
|
|
46
49
|
|
|
47
|
-
// https://
|
|
48
|
-
|
|
50
|
+
// https://babeljs.io/docs/usage/options/
|
|
51
|
+
babelrc: false,
|
|
52
|
+
presets: [
|
|
49
53
|
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
"useBuiltIns": "usage", // alternative mode: "entry"
|
|
53
|
-
"corejs": 3, // default would be 2
|
|
54
|
+
// https://github.com/babel/babel-preset-env
|
|
55
|
+
[require('@babel/preset-env'), side === 'client' ? {
|
|
54
56
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
modules: false,
|
|
60
|
-
debug: false,
|
|
61
|
-
} : {
|
|
62
|
-
targets: {
|
|
63
|
-
node: true,//pkg.engines.node.match(/(\d+\.?)+/)[0],
|
|
64
|
-
},
|
|
65
|
-
modules: false,
|
|
66
|
-
useBuiltIns: false,
|
|
67
|
-
debug: false,
|
|
68
|
-
}],
|
|
57
|
+
// Ajoute automatiquement les polyfills babel
|
|
58
|
+
// https://stackoverflow.com/a/61517521/12199605
|
|
59
|
+
"useBuiltIns": "usage", // alternative mode: "entry"
|
|
60
|
+
"corejs": 3, // default would be 2
|
|
69
61
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
targets: {
|
|
63
|
+
browsers: pkg.app.browserslist,
|
|
64
|
+
},
|
|
65
|
+
forceAllTransforms: !dev, // for UglifyJS
|
|
66
|
+
modules: false,
|
|
67
|
+
debug: false,
|
|
68
|
+
} : {
|
|
69
|
+
targets: {
|
|
70
|
+
node: true,//pkg.engines.node.match(/(\d+\.?)+/)[0],
|
|
71
|
+
},
|
|
72
|
+
modules: false,
|
|
73
|
+
useBuiltIns: false,
|
|
74
|
+
debug: false,
|
|
75
|
+
}],
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}],
|
|
77
|
+
[require("@babel/preset-typescript"), {
|
|
78
|
+
useDefineForClassFields: true,
|
|
79
|
+
//jsxPragma: "h"
|
|
80
|
+
}],
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
// JSX
|
|
83
|
+
// https://github.com/babel/babel/tree/master/packages/babel-preset-react
|
|
84
|
+
[require('@babel/preset-react'), {
|
|
85
|
+
//pragma: "h"
|
|
86
|
+
}],
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
],
|
|
89
|
+
plugins: [
|
|
86
90
|
|
|
91
|
+
// NOTE: On résoud les plugins et presets directement ici
|
|
92
|
+
// Autrement, babel-loader les cherchera dans projet/node_modules
|
|
87
93
|
|
|
88
|
-
[require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
|
89
94
|
|
|
90
|
-
|
|
95
|
+
[require("@babel/plugin-proposal-decorators"), { "legacy": true }],
|
|
91
96
|
|
|
92
|
-
|
|
97
|
+
[require('@babel/plugin-proposal-class-properties'), { "loose": true }],
|
|
93
98
|
|
|
94
|
-
|
|
95
|
-
[require('@babel/plugin-proposal-private-property-in-object'), { "loose": true }],
|
|
99
|
+
[require('@babel/plugin-proposal-private-methods'), { "loose": true }],
|
|
96
100
|
|
|
97
|
-
|
|
101
|
+
// Masque erreur associée à @babel/plugin-proposal-decorators legacy: true
|
|
102
|
+
[require('@babel/plugin-proposal-private-property-in-object'), { "loose": true }],
|
|
98
103
|
|
|
99
|
-
...(
|
|
104
|
+
...(dev ? [
|
|
100
105
|
|
|
101
|
-
|
|
102
|
-
//['@prefresh/babel-plugin'],
|
|
106
|
+
...(side === 'client' ? [
|
|
103
107
|
|
|
104
|
-
|
|
108
|
+
// HMR Preact avec support des hooks
|
|
109
|
+
//['@prefresh/babel-plugin'],
|
|
105
110
|
|
|
106
|
-
|
|
111
|
+
] : [])
|
|
107
112
|
|
|
108
|
-
|
|
113
|
+
] : [
|
|
109
114
|
|
|
110
|
-
|
|
111
|
-
// https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types
|
|
112
|
-
[require('babel-plugin-transform-react-remove-prop-types')],
|
|
113
|
-
// Treat React JSX elements as value types and hoist them to the highest scope
|
|
114
|
-
// https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-constant-elements
|
|
115
|
-
[require('@babel/plugin-transform-react-constant-elements')],
|
|
115
|
+
// Les 3 plugins suivants sont tirés de https://github.com/jamiebuilds/babel-react-optimize
|
|
116
116
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
}]
|
|
125
|
-
]),
|
|
126
|
-
|
|
127
|
-
BabelGlobImports({
|
|
128
|
-
debug: false,
|
|
129
|
-
removeAliases: (source: string) => cli.paths.withoutAlias(source, side)
|
|
130
|
-
}, [{
|
|
131
|
-
test: (request) => {
|
|
132
|
-
if (request.source === '@models') {
|
|
133
|
-
request.source = cli.paths.app.src + '/server/models/**/*.ts';
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
return false;
|
|
137
|
-
},
|
|
138
|
-
replace: (request, matches, t) => {
|
|
139
|
-
// Preserve default behavior
|
|
140
|
-
}
|
|
141
|
-
}, {
|
|
142
|
-
test: (request) => (
|
|
143
|
-
side === 'client'
|
|
144
|
-
&&
|
|
145
|
-
(
|
|
146
|
-
request.source === '@/client/pages/**/*.tsx'
|
|
147
|
-
||
|
|
148
|
-
request.source === '@client/pages/**/*.tsx'
|
|
149
|
-
)
|
|
150
|
-
&&
|
|
151
|
-
request.type === 'import'
|
|
152
|
-
),
|
|
153
|
-
replace: (request, matches, t) => {
|
|
154
|
-
|
|
155
|
-
if (!('default' in request) || request.default === undefined)
|
|
156
|
-
return;
|
|
157
|
-
|
|
158
|
-
const imports: types.ImportDeclaration[] = [];
|
|
159
|
-
|
|
160
|
-
// const routes = {
|
|
161
|
-
// <chunkId1>: () => import(/* webpackChunkName: '<chunkId>' */ "<file>"),
|
|
162
|
-
// <chunkId2>: () => require("<file>").default,
|
|
163
|
-
// }
|
|
164
|
-
|
|
165
|
-
const pageLoaders: types.ObjectProperty[] = [];
|
|
166
|
-
for (const file of matches) {
|
|
167
|
-
|
|
168
|
-
// Exclude layouts
|
|
169
|
-
if (file.filename.includes("/_layout/")) {
|
|
170
|
-
//console.log("Exclude", file, 'from pages loaders (its a layout)');
|
|
171
|
-
continue;
|
|
172
|
-
}
|
|
117
|
+
// Remove unnecessary React propTypes from the production build
|
|
118
|
+
// https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types
|
|
119
|
+
[require('babel-plugin-transform-react-remove-prop-types')],
|
|
120
|
+
// Treat React JSX elements as value types and hoist them to the highest scope
|
|
121
|
+
// https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-constant-elements
|
|
122
|
+
[require('@babel/plugin-transform-react-constant-elements')],
|
|
173
123
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
124
|
+
// Pour du tree shaking manuel
|
|
125
|
+
// https://www.npmjs.com/package/babel-plugin-transform-imports
|
|
126
|
+
[require("babel-plugin-transform-imports"), {
|
|
127
|
+
"lodash": {
|
|
128
|
+
"transform": "lodash/${member}",
|
|
129
|
+
"preventFullImport": true
|
|
179
130
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
[t.importDefaultSpecifier( t.identifier(chunkId) )],
|
|
192
|
-
t.stringLiteral(file.filename)
|
|
193
|
-
)
|
|
194
|
-
);
|
|
195
|
-
|
|
196
|
-
// { <chunkId>: <chunkId> }
|
|
197
|
-
pageLoaders.push(
|
|
198
|
-
t.objectProperty(
|
|
199
|
-
t.stringLiteral(chunkId),
|
|
200
|
-
t.identifier(chunkId)
|
|
201
|
-
)
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
} else {
|
|
205
|
-
|
|
206
|
-
// <chunkId>: () => ...
|
|
207
|
-
pageLoaders.push(
|
|
208
|
-
t.objectProperty(
|
|
209
|
-
|
|
210
|
-
t.stringLiteral(chunkId),
|
|
211
|
-
// () => import(/* webpackChunkName: '<chunkId>' */ "<file>")
|
|
212
|
-
t.arrowFunctionExpression([], t.callExpression(
|
|
213
|
-
|
|
214
|
-
t.import(), [t.addComment(
|
|
215
|
-
t.stringLiteral(file.filename),
|
|
216
|
-
"leading",
|
|
217
|
-
"webpackChunkName: '" + chunkId + "'"
|
|
218
|
-
)]
|
|
219
|
-
))
|
|
220
|
-
)
|
|
221
|
-
)
|
|
131
|
+
}]
|
|
132
|
+
]),
|
|
133
|
+
|
|
134
|
+
BabelGlobImports({
|
|
135
|
+
debug: false,
|
|
136
|
+
removeAliases: (source: string) => app.paths.withoutAlias(source, side)
|
|
137
|
+
}, [{
|
|
138
|
+
test: (request) => {
|
|
139
|
+
if (request.source === '@models') {
|
|
140
|
+
request.source = app.paths.src + '/server/models/**/*.ts';
|
|
141
|
+
return true;
|
|
222
142
|
}
|
|
143
|
+
return false;
|
|
144
|
+
},
|
|
145
|
+
replace: (request, matches, t) => {
|
|
146
|
+
// Preserve default behavior
|
|
223
147
|
}
|
|
148
|
+
}, {
|
|
149
|
+
test: (request) => (
|
|
150
|
+
side === 'client'
|
|
151
|
+
&&
|
|
152
|
+
(
|
|
153
|
+
request.source === '@/client/pages/**/*.tsx'
|
|
154
|
+
||
|
|
155
|
+
request.source === '@client/pages/**/*.tsx'
|
|
156
|
+
)
|
|
157
|
+
&&
|
|
158
|
+
request.type === 'import'
|
|
159
|
+
),
|
|
160
|
+
replace: (request, matches, t) => {
|
|
161
|
+
|
|
162
|
+
if (!('default' in request) || request.default === undefined)
|
|
163
|
+
return;
|
|
164
|
+
|
|
165
|
+
const imports: types.ImportDeclaration[] = [];
|
|
166
|
+
|
|
167
|
+
// const routes = {
|
|
168
|
+
// <chunkId1>: () => import(/* webpackChunkName: '<chunkId>' */ "<file>"),
|
|
169
|
+
// <chunkId2>: () => require("<file>").default,
|
|
170
|
+
// }
|
|
171
|
+
|
|
172
|
+
const pageLoaders: types.ObjectProperty[] = [];
|
|
173
|
+
for (const file of matches) {
|
|
174
|
+
|
|
175
|
+
// Exclude layouts
|
|
176
|
+
if (file.filename.includes("/_layout/")) {
|
|
177
|
+
//console.log("Exclude", file, 'from pages loaders (its a layout)');
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Excliude components
|
|
182
|
+
const filename = path.basename( file.filename );
|
|
183
|
+
if (alphabet.includes(filename[0]) && filename[0] === filename[0].toUpperCase()) {
|
|
184
|
+
//console.log("Exclude", file, 'from pages loaders (its a component)');
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Page config
|
|
189
|
+
const { chunkId } = cli.paths.getPageChunk(app, file.filename);
|
|
190
|
+
const preloadPage = routesToPreload.includes(chunkId);
|
|
191
|
+
|
|
192
|
+
// Import type according to preloading option
|
|
193
|
+
if (preloadPage) {
|
|
194
|
+
|
|
195
|
+
// import <chunkId> from "<file>";
|
|
196
|
+
imports.push(
|
|
197
|
+
t.importDeclaration(
|
|
198
|
+
[t.importDefaultSpecifier( t.identifier(chunkId) )],
|
|
199
|
+
t.stringLiteral(file.filename)
|
|
200
|
+
)
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
// { <chunkId>: <chunkId> }
|
|
204
|
+
pageLoaders.push(
|
|
205
|
+
t.objectProperty(
|
|
206
|
+
t.stringLiteral(chunkId),
|
|
207
|
+
t.identifier(chunkId)
|
|
208
|
+
)
|
|
209
|
+
);
|
|
210
|
+
|
|
211
|
+
} else {
|
|
212
|
+
|
|
213
|
+
// <chunkId>: () => ...
|
|
214
|
+
pageLoaders.push(
|
|
215
|
+
t.objectProperty(
|
|
216
|
+
|
|
217
|
+
t.stringLiteral(chunkId),
|
|
218
|
+
// () => import(/* webpackChunkName: '<chunkId>' */ "<file>")
|
|
219
|
+
t.arrowFunctionExpression([], t.callExpression(
|
|
220
|
+
|
|
221
|
+
t.import(), [t.addComment(
|
|
222
|
+
t.stringLiteral(file.filename),
|
|
223
|
+
"leading",
|
|
224
|
+
"webpackChunkName: '" + chunkId + "'"
|
|
225
|
+
)]
|
|
226
|
+
))
|
|
227
|
+
)
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
}
|
|
224
231
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
232
|
+
return [
|
|
233
|
+
...imports,
|
|
234
|
+
// const routes = { ... }
|
|
235
|
+
t.variableDeclaration("const", [t.variableDeclarator(
|
|
236
|
+
t.identifier(request.default),
|
|
237
|
+
t.objectExpression(pageLoaders)
|
|
238
|
+
)])
|
|
239
|
+
]
|
|
233
240
|
|
|
234
|
-
|
|
235
|
-
|
|
241
|
+
}
|
|
242
|
+
}])
|
|
236
243
|
|
|
237
|
-
|
|
244
|
+
],
|
|
238
245
|
|
|
239
|
-
|
|
246
|
+
overrides: [
|
|
240
247
|
|
|
241
|
-
|
|
248
|
+
require("./plugins/pages")({ side }),
|
|
242
249
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
250
|
+
require("./plugins/models")({ side }),
|
|
251
|
+
|
|
252
|
+
require('./plugins/icones-svg'),
|
|
253
|
+
|
|
254
|
+
require('./plugins/form'),
|
|
248
255
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
256
|
+
/*
|
|
257
|
+
|
|
258
|
+
...(side === 'client' ? [
|
|
252
259
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
260
|
+
] : [
|
|
261
|
+
require('./plugins/queries');
|
|
262
|
+
require('./plugins/injection-dependances'),
|
|
263
|
+
]),
|
|
257
264
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}]
|
|
265
|
+
*/
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
}]
|
|
269
|
+
}
|
|
@@ -12,9 +12,9 @@ import cli from '@cli';
|
|
|
12
12
|
/*----------------------------------
|
|
13
13
|
- WEBPACK RULE
|
|
14
14
|
----------------------------------*/
|
|
15
|
-
const globServices =
|
|
15
|
+
const globServices = app.paths.root + '/src/server/services/**/*.ts';
|
|
16
16
|
const globModuleService = '@app/server/services/**';
|
|
17
|
-
const globRoutes =
|
|
17
|
+
const globRoutes = app.paths.root + '/src/server/routes/**/*.ts';
|
|
18
18
|
|
|
19
19
|
module.exports = {
|
|
20
20
|
test: [globRoutes, globServices],
|
|
@@ -9,7 +9,7 @@ import generate from '@babel/generator';
|
|
|
9
9
|
|
|
10
10
|
// Core
|
|
11
11
|
import cli from '@cli';
|
|
12
|
-
import { TAppSide } from '
|
|
12
|
+
import App, { TAppSide } from '../../../../app';
|
|
13
13
|
|
|
14
14
|
/*----------------------------------
|
|
15
15
|
- WEBPACK RULE
|
|
@@ -33,6 +33,8 @@ const debug = false;
|
|
|
33
33
|
----------------------------------*/
|
|
34
34
|
function Plugin(babel, { side }: TOptions) {
|
|
35
35
|
|
|
36
|
+
const app = new App();
|
|
37
|
+
|
|
36
38
|
const t = babel.types as typeof types;
|
|
37
39
|
let program: NodePath<types.Program>;
|
|
38
40
|
|
|
@@ -112,7 +114,7 @@ function Plugin(babel, { side }: TOptions) {
|
|
|
112
114
|
} else
|
|
113
115
|
routeArgs.unshift(t.objectExpression([]));
|
|
114
116
|
|
|
115
|
-
const { filepath, chunkId } = cli.paths.getPageChunk(filename);
|
|
117
|
+
const { filepath, chunkId } = cli.paths.getPageChunk(app, filename);
|
|
116
118
|
debug && console.log(`[routes]`, filename, '=>', chunkId);
|
|
117
119
|
|
|
118
120
|
// Add object property
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { staticAssetName } from '../../../paths';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type App from '../../../app';
|
|
4
|
+
|
|
5
|
+
module.exports = (app: App, dev: boolean, client: boolean) => ([
|
|
4
6
|
|
|
5
7
|
// Allow to use ?raw at the end of the module path to iport the raw content only
|
|
6
8
|
// Example: import VisualParserSource from './Parsers/visual.js?raw';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { staticAssetName } from '../../../paths';
|
|
2
2
|
import type webpack from 'webpack';
|
|
3
|
+
import type App from '../../../app';
|
|
3
4
|
|
|
4
|
-
module.exports = (dev: boolean, client: boolean): webpack.RuleSetRule[] => {
|
|
5
|
+
module.exports = (app: App, dev: boolean, client: boolean): webpack.RuleSetRule[] => {
|
|
5
6
|
|
|
6
7
|
return [{
|
|
7
8
|
test: /\.(bmp|gif|jpg|jpeg|png|ico|svg)$/,
|
|
@@ -5,9 +5,11 @@ import lessToJs from 'less-vars-to-js';
|
|
|
5
5
|
import fs from 'fs-extra';
|
|
6
6
|
import cli from '@cli';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import type App from '../../../app';
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
module.exports = (app: App, dev: Boolean, client: boolean) => {
|
|
11
|
+
|
|
12
|
+
const paletteLess = fs.readFileSync( app.paths.src + '/client/assets/theme.less', 'utf8');
|
|
11
13
|
const themeVars = lessToJs(paletteLess, { resolveVariables: true, stripPrefix: true });
|
|
12
14
|
|
|
13
15
|
return [
|
|
@@ -19,7 +21,7 @@ module.exports = (dev: Boolean, client: boolean) => {
|
|
|
19
21
|
|
|
20
22
|
// Process external/third-party styles
|
|
21
23
|
{
|
|
22
|
-
exclude: [/*process.env.framework + '/kernel', */
|
|
24
|
+
exclude: [/*process.env.framework + '/kernel', */app.paths.src],
|
|
23
25
|
loader: 'css-loader',
|
|
24
26
|
options: {
|
|
25
27
|
sourceMap: dev
|
|
@@ -28,7 +30,7 @@ module.exports = (dev: Boolean, client: boolean) => {
|
|
|
28
30
|
|
|
29
31
|
// Process internal/project styles (from src folder)
|
|
30
32
|
{
|
|
31
|
-
include: [/*process.env.framework + '/kernel', */
|
|
33
|
+
include: [/*process.env.framework + '/kernel', */app.paths.src],
|
|
32
34
|
loader: 'css-loader',
|
|
33
35
|
options: {
|
|
34
36
|
// CSS Loader https://github.com/webpack/css-loader
|
|
@@ -13,9 +13,12 @@ import IconesSvg from './plugins/indexage/icones-svg';
|
|
|
13
13
|
import InjectDeps from './plugins/indexage/injection-dependances';
|
|
14
14
|
|
|
15
15
|
// Core
|
|
16
|
-
import { TAppSide } from '@cli';
|
|
17
16
|
import cli from '../..';
|
|
18
17
|
|
|
18
|
+
// Type
|
|
19
|
+
import type App from '../../app';
|
|
20
|
+
import type { TAppSide } from '../../app';
|
|
21
|
+
|
|
19
22
|
/*----------------------------------
|
|
20
23
|
- CONSTANTS
|
|
21
24
|
----------------------------------*/
|
|
@@ -38,19 +41,22 @@ export type TCompileMode = 'dev' | 'prod'
|
|
|
38
41
|
- BASE CONFIG
|
|
39
42
|
----------------------------------*/
|
|
40
43
|
|
|
41
|
-
export default function createCommonConfig( side: TAppSide, mode: TCompileMode ): webpack.Configuration {
|
|
44
|
+
export default function createCommonConfig( app: App, side: TAppSide, mode: TCompileMode ): webpack.Configuration {
|
|
42
45
|
|
|
43
46
|
const dev = mode === 'dev';
|
|
44
47
|
const config: webpack.Configuration = {
|
|
45
48
|
|
|
46
49
|
// Project root
|
|
47
|
-
context:
|
|
50
|
+
context: app.paths.root,
|
|
48
51
|
|
|
49
52
|
mode: dev ? 'development' : 'production',
|
|
50
53
|
|
|
51
54
|
resolveLoader: {
|
|
52
55
|
// Recherche des loaders dans framework/node_modules (psinon, webpack cherche dans le projet)
|
|
53
56
|
modules: [
|
|
57
|
+
// The line below is not necessary
|
|
58
|
+
// By default, webpack is supposed to search in the project directory at first
|
|
59
|
+
//cli.paths.appRoot + '/node_modules',
|
|
54
60
|
cli.paths.core.root + '/node_modules',
|
|
55
61
|
cli.paths.core.cli + '/node_modules',
|
|
56
62
|
],
|
|
@@ -67,13 +73,13 @@ export default function createCommonConfig( side: TAppSide, mode: TCompileMode )
|
|
|
67
73
|
BUILD_DATE: JSON.stringify(dayjs().format('YY.MM.DD-HH.mm')),
|
|
68
74
|
|
|
69
75
|
CORE_PATH: JSON.stringify(cli.paths.core.root),
|
|
70
|
-
APP_PATH: JSON.stringify(
|
|
71
|
-
APP_NAME: JSON.stringify(
|
|
76
|
+
APP_PATH: JSON.stringify(app.paths.root),
|
|
77
|
+
APP_NAME: JSON.stringify(app.identity.web.title),
|
|
72
78
|
|
|
73
79
|
}),
|
|
74
80
|
|
|
75
81
|
new PluginIndexage(side === 'client' ? {
|
|
76
|
-
'icones-svg': new IconesSvg,
|
|
82
|
+
'icones-svg': new IconesSvg(app),
|
|
77
83
|
} : {
|
|
78
84
|
//'injection-dependances': new InjectDeps,
|
|
79
85
|
}),
|
|
@@ -107,7 +113,7 @@ export default function createCommonConfig( side: TAppSide, mode: TCompileMode )
|
|
|
107
113
|
|
|
108
114
|
/*modules: [
|
|
109
115
|
cli.paths.core.root + '/node_modules',
|
|
110
|
-
|
|
116
|
+
app.paths.root + '/node_modules',
|
|
111
117
|
]*/
|
|
112
118
|
},
|
|
113
119
|
|