Deploy: upgrade chill bundles and adapt skeleton
All checks were successful
continuous-integration/drone/tag Build is passing
All checks were successful
continuous-integration/drone/tag Build is passing
This commit is contained in:
@@ -3,9 +3,9 @@ const { resolve, parse } = require('path');
|
||||
const { readdir } = require('fs').promises;
|
||||
|
||||
/**
|
||||
* get the file names inside given directory recursively, limiting to
|
||||
* get the file names inside given directory recursively, limiting to
|
||||
* a given depth in the recursion
|
||||
*
|
||||
*
|
||||
* @param string dir the directory
|
||||
* @param int depth the maximum depth to look into
|
||||
*/
|
||||
@@ -28,22 +28,22 @@ async function* getFiles(dir, depth, ignored) {
|
||||
/**
|
||||
* populate the config of encore in directories inside `'./src'` and
|
||||
* `'./vendor'` and letting them to alter the encore config.
|
||||
*
|
||||
*
|
||||
* if a file `chill.webpack.config.js` is found, the default function is
|
||||
* imported and executed. This function receive two arguments:
|
||||
*
|
||||
* imported and executed. This function receive two arguments:
|
||||
*
|
||||
* - `Encore`, the main encore object
|
||||
* - `chillEntries`: the entries which will be appended to the main `chill` module,
|
||||
* resulting in a chill.js and chill.css file.
|
||||
*
|
||||
*
|
||||
*/
|
||||
async function populateConfig(Encore, chillEntries) {
|
||||
// chill-main contains some bootstrap that must be loaded first.
|
||||
// we register them first and, then, store this chill.webpack.config.js file
|
||||
// into `toIgnore`, ignoring it when we loop on other folders.
|
||||
let
|
||||
let
|
||||
toIgnore = [];
|
||||
|
||||
|
||||
// loop into chill main
|
||||
for await (const f of getFiles('./vendor/chill-project/chill-bundles/src/Bundle/ChillMainBundle/', 1, [])) {
|
||||
let filename = parse(f).base;
|
||||
@@ -53,7 +53,7 @@ async function populateConfig(Encore, chillEntries) {
|
||||
toIgnore.push(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// loop into other chill bundles
|
||||
for await (const f of getFiles('./vendor/chill-project/chill-bundles/src/Bundle', 2, toIgnore)) {
|
||||
let filename = parse(f).base;
|
||||
@@ -62,7 +62,7 @@ async function populateConfig(Encore, chillEntries) {
|
||||
configure(Encore, chillEntries);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// loop into other vendors
|
||||
for await (const f of getFiles('./vendor/', 3, toIgnore)) {
|
||||
let filename = parse(f).base;
|
||||
@@ -71,7 +71,7 @@ async function populateConfig(Encore, chillEntries) {
|
||||
configure(Encore, chillEntries);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// loop into src directory
|
||||
for await (const f of getFiles('./src', 3, [])) {
|
||||
let filename = parse(f).base;
|
||||
@@ -84,23 +84,37 @@ async function populateConfig(Encore, chillEntries) {
|
||||
|
||||
// export the final configuration
|
||||
module.exports = (async () => {
|
||||
|
||||
// Manually configure the runtime environment if not already configured yet by the "encore" command.
|
||||
// It's useful when you use tools that rely on webpack.config.js file.
|
||||
if (!Encore.isRuntimeEnvironmentConfigured()) {
|
||||
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
|
||||
}
|
||||
// basic encore configuration
|
||||
Encore
|
||||
.setOutputPath('public/build/')
|
||||
.setPublicPath('/build')
|
||||
.enableSassLoader()
|
||||
.enableVueLoader(() => {}, {
|
||||
.enableVueLoader(() => {}, {
|
||||
version: 3
|
||||
})
|
||||
.enableTypeScriptLoader(function (tsConfig){
|
||||
tsConfig.appendTsSuffixTo = [/\.vue$/];
|
||||
tsConfig.appendTsxSuffixTo = [/\.vue$/];
|
||||
// temporary fix for https://github.com/vuejs/vue-loader/issues/1915 and https://github.com/vuejs/core/issues/2855
|
||||
tsConfig.compilerOptions = {strict: !Encore.isProduction()};
|
||||
tsConfig.silent = false;
|
||||
})
|
||||
//.enableForkedTypeScriptTypesChecking()
|
||||
.autoProvidejQuery()
|
||||
.enableSourceMaps(!Encore.isProduction())
|
||||
.cleanupOutputBeforeBuild()
|
||||
.enableVersioning()
|
||||
.enableSingleRuntimeChunk()
|
||||
.splitEntryChunks()
|
||||
.addLoader({ test: /\.pdf$/, loader: 'file-loader', options: { name: '[name]_[hash].[ext]', outputPath: 'pdf/' } })
|
||||
//.addLoader({ test: /\.pdf$/, loader: 'file-loader', options: { name: '[name]_[hash].[ext]', outputPath: 'pdf/' } })
|
||||
;
|
||||
|
||||
|
||||
// populate config with chill entries
|
||||
let chillEntries = [];
|
||||
await populateConfig(Encore, chillEntries);
|
||||
@@ -109,7 +123,7 @@ module.exports = (async () => {
|
||||
if (!Encore.isProduction()) {
|
||||
Encore
|
||||
.addEntry('swagger', __dirname + '/assets/swagger-ui/index.js')
|
||||
.addLoader({
|
||||
.addLoader({
|
||||
test: /\.yaml$/,
|
||||
type: 'json',
|
||||
use: [
|
||||
|
Reference in New Issue
Block a user