mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
removed node env variable
This commit is contained in:
@@ -157,7 +157,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
name: 'default',
|
name: 'mantis',
|
||||||
cssClass: 'default',
|
cssClass: 'mantis',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -25,8 +25,8 @@
|
|||||||
"prebuild:aot": "yarn run prebuild",
|
"prebuild:aot": "yarn run prebuild",
|
||||||
"prebuild:prod": "yarn run prebuild",
|
"prebuild:prod": "yarn run prebuild",
|
||||||
"build": "node ./scripts/webpack.js --progress --mode development",
|
"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: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 && 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: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",
|
"postbuild:prod": "yarn run rollup",
|
||||||
"rollup": "rollup -c rollup.config.js",
|
"rollup": "rollup -c rollup.config.js",
|
||||||
"prestart": "yarn run build:prod",
|
"prestart": "yarn run build:prod",
|
||||||
|
@@ -1,46 +1,45 @@
|
|||||||
const webpackMerge = require('webpack-merge');
|
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 prodPartial = require('./webpack/webpack.prod');
|
||||||
|
|
||||||
const {
|
module.exports = function (env, options) {
|
||||||
getAotPlugin
|
|
||||||
} = require('./webpack/webpack.aot');
|
|
||||||
|
|
||||||
module.exports = function(env, options) {
|
|
||||||
env = env || {};
|
env = env || {};
|
||||||
if (env.aot) {
|
const commonPartial = require('./webpack/webpack.common')(env);
|
||||||
console.log(`Running build for ${env.client ? 'client' : 'server'} with AoT Compilation`)
|
const clientPartial = require('./webpack/webpack.client')(env);
|
||||||
}
|
const {getAotPlugin} = require('./webpack/webpack.aot')(env);
|
||||||
|
const {getServerWebpackPartial} = require('./webpack/webpack.server')(env);
|
||||||
|
|
||||||
let serverPartial = getServerWebpackPartial(env.aot);
|
if (env.aot) {
|
||||||
|
console.log(`Running build for ${env.client ? 'client' : 'server'} with AoT Compilation`)
|
||||||
|
}
|
||||||
|
|
||||||
let serverConfig = webpackMerge({}, commonPartial, serverPartial, {
|
let serverPartial = getServerWebpackPartial(env.aot);
|
||||||
plugins: [
|
|
||||||
getAotPlugin('server', !!env.aot)
|
|
||||||
]
|
|
||||||
});
|
|
||||||
|
|
||||||
let clientConfig = webpackMerge({}, commonPartial, clientPartial, {
|
let serverConfig = webpackMerge({}, commonPartial, serverPartial, {
|
||||||
plugins: [
|
plugins: [
|
||||||
getAotPlugin('client', !!env.aot)
|
getAotPlugin('server', !!env.aot)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
if (options.mode === 'production') {
|
|
||||||
serverConfig = webpackMerge({}, serverConfig, prodPartial);
|
|
||||||
clientConfig = webpackMerge({}, clientConfig, prodPartial);
|
|
||||||
}
|
|
||||||
|
|
||||||
const configs = [];
|
let clientConfig = webpackMerge({}, commonPartial, clientPartial, {
|
||||||
|
plugins: [
|
||||||
|
getAotPlugin('client', !!env.aot)
|
||||||
|
]
|
||||||
|
});
|
||||||
|
if (options.mode === 'production') {
|
||||||
|
serverConfig = webpackMerge({}, serverConfig, prodPartial);
|
||||||
|
clientConfig = webpackMerge({}, clientConfig, prodPartial);
|
||||||
|
}
|
||||||
|
|
||||||
if (!env.aot) {
|
const configs = [];
|
||||||
configs.push(clientConfig, serverConfig);
|
|
||||||
} else if (env.client) {
|
|
||||||
configs.push(clientConfig);
|
|
||||||
} else if (env.server) {
|
|
||||||
configs.push(serverConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
return configs;
|
if (!env.aot) {
|
||||||
|
configs.push(clientConfig, serverConfig);
|
||||||
|
} else if (env.client) {
|
||||||
|
configs.push(clientConfig);
|
||||||
|
} else if (env.server) {
|
||||||
|
configs.push(serverConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
return configs;
|
||||||
};
|
};
|
||||||
|
@@ -8,9 +8,10 @@ const projectRoot = (relativePath) => {
|
|||||||
|
|
||||||
const srcPath = projectRoot('src');
|
const srcPath = projectRoot('src');
|
||||||
|
|
||||||
const buildRoot = (relativePath) => {
|
const buildRoot = (relativePath, env) => {
|
||||||
if (process.env.DSPACE_BUILD_DIR) {
|
console.log(env.aot);
|
||||||
return path.resolve(projectRoot(process.env.DSPACE_BUILD_DIR), relativePath);
|
if (env.aot) {
|
||||||
|
return path.resolve(projectRoot('./build'), relativePath);
|
||||||
} else {
|
} else {
|
||||||
return path.resolve(projectRoot('src'), relativePath);
|
return path.resolve(projectRoot('src'), relativePath);
|
||||||
}
|
}
|
||||||
@@ -58,10 +59,10 @@ else {
|
|||||||
themePath = srcPath;
|
themePath = srcPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
const globalCSSImports = [
|
const globalCSSImports = (env) => { return [
|
||||||
buildRoot('styles/_variables.scss'),
|
buildRoot('styles/_variables.scss', env),
|
||||||
buildRoot('styles/_mixins.scss'),
|
buildRoot('styles/_mixins.scss', env),
|
||||||
];
|
]};
|
||||||
|
|
||||||
const themeReplaceOptions =
|
const themeReplaceOptions =
|
||||||
{
|
{
|
||||||
|
@@ -1,35 +1,37 @@
|
|||||||
const {
|
const {
|
||||||
buildRoot
|
buildRoot
|
||||||
} = require('./helpers');
|
} = require('./helpers');
|
||||||
|
|
||||||
const {
|
const {
|
||||||
AngularCompilerPlugin
|
AngularCompilerPlugin
|
||||||
} = require('@ngtools/webpack');
|
} = require('@ngtools/webpack');
|
||||||
|
|
||||||
const tsconfigs = {
|
module.exports = (env) => {
|
||||||
client: buildRoot('./tsconfig.browser.json'),
|
const tsconfigs = {
|
||||||
server: buildRoot('./tsconfig.server.json')
|
client: buildRoot('./tsconfig.browser.json', env),
|
||||||
};
|
server: buildRoot('./tsconfig.server.json', env)
|
||||||
|
};
|
||||||
|
|
||||||
const aotTsconfigs = {
|
const aotTsconfigs = {
|
||||||
client: buildRoot('./tsconfig.browser.json'),
|
client: buildRoot('./tsconfig.browser.json', env),
|
||||||
server: buildRoot('./tsconfig.server.aot.json')
|
server: buildRoot('./tsconfig.server.aot.json', env)
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a AotPlugin for @ngtools/webpack
|
* Generates a AotPlugin for @ngtools/webpack
|
||||||
*
|
*
|
||||||
* @param {string} platform Should either be client or server
|
* @param {string} platform Should either be client or server
|
||||||
* @param {boolean} aot Enables/Disables AoT Compilation
|
* @param {boolean} aot Enables/Disables AoT Compilation
|
||||||
* @returns {AotPlugin} Configuration of AotPlugin
|
* @returns {AotPlugin} Configuration of AotPlugin
|
||||||
*/
|
*/
|
||||||
function getAotPlugin(platform, aot) {
|
function getAotPlugin(platform, aot) {
|
||||||
return new AngularCompilerPlugin({
|
return new AngularCompilerPlugin({
|
||||||
tsConfigPath: aot ? aotTsconfigs[platform] : tsconfigs[platform],
|
tsConfigPath: aot ? aotTsconfigs[platform] : tsconfigs[platform],
|
||||||
skipCodeGeneration: !aot
|
skipCodeGeneration: !aot
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
return {
|
||||||
getAotPlugin: getAotPlugin
|
getAotPlugin: getAotPlugin
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@@ -6,20 +6,22 @@ const {
|
|||||||
buildRoot
|
buildRoot
|
||||||
} = require('./helpers');
|
} = require('./helpers');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = (env) => {
|
||||||
entry: buildRoot('./main.browser.ts'),
|
return {
|
||||||
output: {
|
entry: buildRoot('./main.browser.ts', env),
|
||||||
filename: 'client.js'
|
output: {
|
||||||
},
|
filename: 'client.js'
|
||||||
target: 'web',
|
},
|
||||||
plugins: [
|
target: 'web',
|
||||||
new HtmlWebpackPlugin({
|
plugins: [
|
||||||
template: buildRoot('./index.html'),
|
new HtmlWebpackPlugin({
|
||||||
output: projectRoot('dist'),
|
template: buildRoot('./index.html', env),
|
||||||
inject: 'head'
|
output: projectRoot('dist'),
|
||||||
}),
|
inject: 'head'
|
||||||
new ScriptExtPlugin({
|
}),
|
||||||
defaultAttribute: 'defer'
|
new ScriptExtPlugin({
|
||||||
})
|
defaultAttribute: 'defer'
|
||||||
]
|
})
|
||||||
};
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@@ -1,167 +1,169 @@
|
|||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const {
|
const {
|
||||||
projectRoot,
|
projectRoot,
|
||||||
buildRoot,
|
buildRoot,
|
||||||
globalCSSImports,
|
globalCSSImports,
|
||||||
themeReplaceOptions,
|
themeReplaceOptions,
|
||||||
themePath,
|
themePath,
|
||||||
themedTest,
|
themedTest,
|
||||||
themedUse
|
themedUse
|
||||||
} = require('./helpers');
|
} = require('./helpers');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = (env) => {
|
||||||
mode: 'development',
|
return {
|
||||||
devtool: 'source-map',
|
mode: 'development',
|
||||||
resolve: {
|
devtool: 'source-map',
|
||||||
extensions: ['.ts', '.js', '.json']
|
resolve: {
|
||||||
},
|
extensions: ['.ts', '.js', '.json']
|
||||||
output: {
|
},
|
||||||
path: projectRoot('dist')
|
output: {
|
||||||
},
|
path: projectRoot('dist')
|
||||||
watchOptions: {
|
},
|
||||||
aggregateTimeout: 50,
|
watchOptions: {
|
||||||
},
|
aggregateTimeout: 50,
|
||||||
node: {
|
},
|
||||||
fs: "empty",
|
node: {
|
||||||
module: "empty"
|
fs: "empty",
|
||||||
},
|
module: "empty"
|
||||||
module: {
|
},
|
||||||
rules: [
|
module: {
|
||||||
{
|
rules: [
|
||||||
test: (filePath) => themedTest(filePath, 'scss'),
|
{
|
||||||
use: (info) => themedUse(info.resource, 'scss')
|
test: (filePath) => themedTest(filePath, 'scss'),
|
||||||
},
|
use: (info) => themedUse(info.resource, 'scss')
|
||||||
{
|
},
|
||||||
test: (filePath) => themedTest(filePath, 'html'),
|
{
|
||||||
use: (info) => themedUse(info.resource, 'html')
|
test: (filePath) => themedTest(filePath, 'html'),
|
||||||
},
|
use: (info) => themedUse(info.resource, 'html')
|
||||||
{
|
},
|
||||||
test: /\.ts$/,
|
{
|
||||||
loader: '@ngtools/webpack'
|
test: /\.ts$/,
|
||||||
},
|
loader: '@ngtools/webpack'
|
||||||
{
|
},
|
||||||
test: /\.css$/,
|
{
|
||||||
use: [
|
test: /\.css$/,
|
||||||
{
|
use: [
|
||||||
loader: 'to-string-loader',
|
{
|
||||||
options: {
|
loader: 'to-string-loader',
|
||||||
sourceMap: true
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true,
|
||||||
|
modules: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'postcss-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.scss$/,
|
||||||
|
exclude: [
|
||||||
|
/node_modules/,
|
||||||
|
buildRoot('styles/_exposed_variables.scss', env),
|
||||||
|
buildRoot('styles/_variables.scss', env)
|
||||||
|
],
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'raw-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'postcss-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'resolve-url-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true,
|
||||||
|
includePaths: [path.join(themePath, 'styles')]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-resources-loader',
|
||||||
|
options: {
|
||||||
|
resources: globalCSSImports(env)
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'string-replace-loader',
|
||||||
|
options: themeReplaceOptions
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /(_exposed)?_variables.scss$/,
|
||||||
|
exclude: [/node_modules/],
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true,
|
||||||
|
modules: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'postcss-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'resolve-url-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'sass-loader',
|
||||||
|
options: {
|
||||||
|
sourceMap: true,
|
||||||
|
includePaths: [path.join(themePath, 'styles')]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'string-replace-loader',
|
||||||
|
options: themeReplaceOptions
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.html$/,
|
||||||
|
loader: 'raw-loader'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new CopyWebpackPlugin([{
|
||||||
|
from: path.join(__dirname, '..', 'node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'),
|
||||||
|
to: path.join('assets', 'fonts')
|
||||||
|
}, {
|
||||||
|
from: path.join(__dirname, '..', 'resources', 'images'),
|
||||||
|
to: path.join('assets', 'images')
|
||||||
|
}, {
|
||||||
|
from: path.join(__dirname, '..', 'resources', 'i18n'),
|
||||||
|
to: path.join('assets', 'i18n')
|
||||||
}
|
}
|
||||||
},
|
])
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true,
|
|
||||||
modules: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.scss$/,
|
|
||||||
exclude: [
|
|
||||||
/node_modules/,
|
|
||||||
buildRoot('styles/_exposed_variables.scss'),
|
|
||||||
buildRoot('styles/_variables.scss')
|
|
||||||
],
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: 'raw-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'resolve-url-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'sass-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true,
|
|
||||||
includePaths: [path.join(themePath, 'styles')]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'sass-resources-loader',
|
|
||||||
options: {
|
|
||||||
resources: globalCSSImports
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'string-replace-loader',
|
|
||||||
options: themeReplaceOptions
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /(_exposed)?_variables.scss$/,
|
|
||||||
exclude: [/node_modules/],
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true,
|
|
||||||
modules: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'postcss-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'resolve-url-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'sass-loader',
|
|
||||||
options: {
|
|
||||||
sourceMap: true,
|
|
||||||
includePaths: [path.join(themePath, 'styles')]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'string-replace-loader',
|
|
||||||
options: themeReplaceOptions
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.html$/,
|
|
||||||
loader: 'raw-loader'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new CopyWebpackPlugin([{
|
|
||||||
from: path.join(__dirname, '..', 'node_modules', '@fortawesome', 'fontawesome-free', 'webfonts'),
|
|
||||||
to: path.join('assets', 'fonts')
|
|
||||||
}, {
|
|
||||||
from: path.join(__dirname, '..', 'resources', 'images'),
|
|
||||||
to: path.join('assets', 'images')
|
|
||||||
}, {
|
|
||||||
from: path.join(__dirname, '..', 'resources', 'i18n'),
|
|
||||||
to: path.join('assets', 'i18n')
|
|
||||||
}
|
}
|
||||||
])
|
|
||||||
]
|
|
||||||
};
|
};
|
||||||
|
@@ -4,25 +4,27 @@ const {
|
|||||||
buildRoot
|
buildRoot
|
||||||
} = require('./helpers');
|
} = require('./helpers');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = (env) => {
|
||||||
getServerWebpackPartial: function (aot) {
|
return {
|
||||||
const entry = aot ? buildRoot('./main.server.aot.ts') : buildRoot('./main.server.ts');
|
getServerWebpackPartial: function (aot) {
|
||||||
return {
|
const entry = aot ? buildRoot('./main.server.aot.ts', env) : buildRoot('./main.server.ts', env);
|
||||||
entry: entry,
|
return {
|
||||||
output: {
|
entry: entry,
|
||||||
filename: 'server.js'
|
output: {
|
||||||
},
|
filename: 'server.js'
|
||||||
target: 'node',
|
},
|
||||||
externals: [nodeExternals({
|
target: 'node',
|
||||||
whitelist: [
|
externals: [nodeExternals({
|
||||||
/@angular/,
|
whitelist: [
|
||||||
/@ng/,
|
/@angular/,
|
||||||
/angular2-text-mask/,
|
/@ng/,
|
||||||
/ng2-file-upload/,
|
/angular2-text-mask/,
|
||||||
/angular-sortablejs/,
|
/ng2-file-upload/,
|
||||||
/sortablejs/,
|
/angular-sortablejs/,
|
||||||
/ngx/]
|
/sortablejs/,
|
||||||
})],
|
/ngx/]
|
||||||
|
})],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user