removed node env variable

This commit is contained in:
lotte
2019-06-05 14:25:58 +02:00
parent 5a47c2f4a7
commit ed128d1f17
8 changed files with 273 additions and 265 deletions

View File

@@ -157,7 +157,7 @@ module.exports = {
}
},
theme: {
name: 'default',
cssClass: 'default',
name: 'mantis',
cssClass: 'mantis',
}
};

View File

@@ -25,8 +25,8 @@
"prebuild:aot": "yarn run prebuild",
"prebuild:prod": "yarn run prebuild",
"build": "node ./scripts/webpack.js --progress --mode development",
"build:aot": "yarn run syncbuilddir && node ./scripts/resolve-absolute-scss-imports.js && DSPACE_BUILD_DIR=./build node ./scripts/webpack.js --env.aot --env.server --mode development && DSPACE_BUILD_DIR=./build node ./scripts/webpack.js --env.aot --env.client --mode development",
"build:prod": "yarn run syncbuilddir && node ./scripts/resolve-absolute-scss-imports.js && DSPACE_BUILD_DIR=./build node ./scripts/webpack.js --env.aot --env.server --mode production && DSPACE_BUILD_DIR=./build node ./scripts/webpack.js --env.aot --env.client --mode production",
"build:aot": "yarn run syncbuilddir && node ./scripts/resolve-absolute-scss-imports.js && node ./scripts/webpack.js --env.aot --env.server --mode development && node ./scripts/webpack.js --env.aot --env.client --mode development",
"build:prod": "yarn run syncbuilddir && node ./scripts/resolve-absolute-scss-imports.js && node ./scripts/webpack.js --env.aot --env.server --mode production && node ./scripts/webpack.js --env.aot --env.client --mode production",
"postbuild:prod": "yarn run rollup",
"rollup": "rollup -c rollup.config.js",
"prestart": "yarn run build:prod",

View File

@@ -1,15 +1,14 @@
const webpackMerge = require('webpack-merge');
const commonPartial = require('./webpack/webpack.common');
const clientPartial = require('./webpack/webpack.client');
const { getServerWebpackPartial } = require('./webpack/webpack.server');
const prodPartial = require('./webpack/webpack.prod');
const {
getAotPlugin
} = require('./webpack/webpack.aot');
const prodPartial = require('./webpack/webpack.prod');
module.exports = function (env, options) {
env = env || {};
const commonPartial = require('./webpack/webpack.common')(env);
const clientPartial = require('./webpack/webpack.client')(env);
const {getAotPlugin} = require('./webpack/webpack.aot')(env);
const {getServerWebpackPartial} = require('./webpack/webpack.server')(env);
if (env.aot) {
console.log(`Running build for ${env.client ? 'client' : 'server'} with AoT Compilation`)
}

View File

@@ -8,9 +8,10 @@ const projectRoot = (relativePath) => {
const srcPath = projectRoot('src');
const buildRoot = (relativePath) => {
if (process.env.DSPACE_BUILD_DIR) {
return path.resolve(projectRoot(process.env.DSPACE_BUILD_DIR), relativePath);
const buildRoot = (relativePath, env) => {
console.log(env.aot);
if (env.aot) {
return path.resolve(projectRoot('./build'), relativePath);
} else {
return path.resolve(projectRoot('src'), relativePath);
}
@@ -58,10 +59,10 @@ else {
themePath = srcPath;
}
const globalCSSImports = [
buildRoot('styles/_variables.scss'),
buildRoot('styles/_mixins.scss'),
];
const globalCSSImports = (env) => { return [
buildRoot('styles/_variables.scss', env),
buildRoot('styles/_mixins.scss', env),
]};
const themeReplaceOptions =
{

View File

@@ -6,14 +6,15 @@ const {
AngularCompilerPlugin
} = require('@ngtools/webpack');
module.exports = (env) => {
const tsconfigs = {
client: buildRoot('./tsconfig.browser.json'),
server: buildRoot('./tsconfig.server.json')
client: buildRoot('./tsconfig.browser.json', env),
server: buildRoot('./tsconfig.server.json', env)
};
const aotTsconfigs = {
client: buildRoot('./tsconfig.browser.json'),
server: buildRoot('./tsconfig.server.aot.json')
client: buildRoot('./tsconfig.browser.json', env),
server: buildRoot('./tsconfig.server.aot.json', env)
};
/**
@@ -30,6 +31,7 @@ function getAotPlugin(platform, aot) {
});
}
module.exports = {
return {
getAotPlugin: getAotPlugin
}
};

View File

@@ -6,15 +6,16 @@ const {
buildRoot
} = require('./helpers');
module.exports = {
entry: buildRoot('./main.browser.ts'),
module.exports = (env) => {
return {
entry: buildRoot('./main.browser.ts', env),
output: {
filename: 'client.js'
},
target: 'web',
plugins: [
new HtmlWebpackPlugin({
template: buildRoot('./index.html'),
template: buildRoot('./index.html', env),
output: projectRoot('dist'),
inject: 'head'
}),
@@ -23,3 +24,4 @@ module.exports = {
})
]
};
}

View File

@@ -10,7 +10,8 @@ const {
themedUse
} = require('./helpers');
module.exports = {
module.exports = (env) => {
return {
mode: 'development',
devtool: 'source-map',
resolve: {
@@ -68,8 +69,8 @@ module.exports = {
test: /\.scss$/,
exclude: [
/node_modules/,
buildRoot('styles/_exposed_variables.scss'),
buildRoot('styles/_variables.scss')
buildRoot('styles/_exposed_variables.scss', env),
buildRoot('styles/_variables.scss', env)
],
use: [
{
@@ -100,7 +101,7 @@ module.exports = {
{
loader: 'sass-resources-loader',
options: {
resources: globalCSSImports
resources: globalCSSImports(env)
},
},
{
@@ -164,4 +165,5 @@ module.exports = {
}
])
]
}
};

View File

@@ -4,9 +4,10 @@ const {
buildRoot
} = require('./helpers');
module.exports = {
module.exports = (env) => {
return {
getServerWebpackPartial: function (aot) {
const entry = aot ? buildRoot('./main.server.aot.ts') : buildRoot('./main.server.ts');
const entry = aot ? buildRoot('./main.server.aot.ts', env) : buildRoot('./main.server.ts', env);
return {
entry: entry,
output: {
@@ -25,4 +26,5 @@ module.exports = {
})],
}
}
}
};