Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build all the interfaces in one time #3945

Merged
merged 1 commit into from
Jul 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const INTERFACE_THEME = ${__import__('ujson').dumps(interfaces_theme)};

const plugins = [];
const entry = {};

Expand All @@ -14,22 +12,22 @@ const nodeEnv = process.env['NODE_ENV'] || 'development';
const dev = nodeEnv == 'development'
process.traceDeprecation = true;

const name = process.env.INTERFACE;
process.env.THEME = INTERFACE_THEME[name];

entry[name] = '${package}/apps/Controller' + name + '.js';
plugins.push(
new HtmlWebpackPlugin({
inject: false,
template: path.resolve(__dirname, '${package}_geoportal/static-ngeo/js/apps/' + name + '.html.ejs'),
chunksSortMode: 'manual',
filename: name + '.html',
chunks: [name],
vars: {
entry_point: '${entry_point}',
},
})
);
for (const filename of ls(path.resolve(__dirname, '${package}_geoportal/static-ngeo/js/apps/*.html.ejs'))) {
const name = filename.file.substr(0, filename.file.length - '.html.ejs'.length);
entry[name] = '${package}/apps/Controller' + name + '.js';
plugins.push(
new HtmlWebpackPlugin({
template: filename.full,
inject: false,
chunksSortMode: 'manual',
filename: name + '.html',
chunks: ['commons', name],
vars: {
entry_point: '${entry_point}',
},
})
);
}

const babelPresets = [['env',{
"targets": {
Expand Down Expand Up @@ -76,4 +74,10 @@ module.exports = {
{{package}}: path.resolve(__dirname, '{{package}}_geoportal/static-ngeo/js'),
}
},
optimization: {
splitChunks: {
chunks: 'all',
name: 'commons',
}
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ update_paths:
- headers.layers
- headers.shortener
- headers.login
- interfaces_theme
- shortener

no_interpreted:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@ process.traceDeprecation = true;
const name = process.env.INTERFACE;
process.env.THEME = INTERFACE_THEME[name];

entry[name] = path.resolve(__dirname, '${package}_geoportal/static-ngeo/js/apps/Controller' + name + '.js');
plugins.push(
new HtmlWebpackPlugin({
inject: false,
template: path.resolve(__dirname, '${package}_geoportal/static-ngeo/js/apps/' + name + '.html.ejs'),
chunksSortMode: 'manual',
filename: name + '.html',
chunks: [name],
})
);
for (const filename of ls(path.resolve(__dirname, '${package}_geoportal/static-ngeo/js/apps/*.html.ejs'))) {
const name = filename.file.substr(0, filename.file.length - '.html.ejs'.length);
entry[name] = '${package}/apps/Controller' + name + '.js';
plugins.push(
new HtmlWebpackPlugin({
template: filename.full,
inject: false,
chunksSortMode: 'manual',
filename: name + '.html',
chunks: ['commons', name],
vars: {
entry_point: '${entry_point}',
},
})
);
}

const babelPresets = [['env',{
"targets": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ update_paths:
- headers.layers
- headers.shortener
- headers.login
- interfaces_theme
- shortener

no_interpreted:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,22 +602,18 @@ $(APP_OUTPUT_DIR)/images/: /usr/lib/node_modules/jquery-ui/themes/base/images


.PRECIOUS: /build/apps.timestamp
/build/apps.timestamp: geoportal/webpack.apps.js $(addprefix /build/apps., $(addsuffix .timestamp, $(NGEO_INTERFACES)))
touch $@

.PRECIOUS: /build/apps.%.timestamp
/build/apps.%.timestamp: $(OL_JS_FILES) $(NGEO_JS_FILES) $(APP_JS_FILES) \
/build/apps.timestamp: geoportal/webpack.apps.js $(OL_JS_FILES) $(NGEO_JS_FILES) $(APP_JS_FILES) \
$(APP_HTML_FILES) geoportal/webpack.config.js \
$(SASS_FILES) \
$(APP_OUTPUT_DIR)/images/
$(PRERULE_CMD)
# Workaround to make Webpack working for ol/index.js
rm --force geoportal/node_modules
ln --symbolic /usr/lib/node_modules/ geoportal/
(cd geoportal; INTERFACE=$* webpack $(WEBPACK_ARGS))
(cd geoportal; webpack $(WEBPACK_ARGS))
rm geoportal/node_modules
ifeq ($(DOCKER), TRUE)
mv $(APP_OUTPUT_DIR)/$*.html $(APP_OUTPUT_DIR)/$*.html.tmpl
ls -1 $(APP_OUTPUT_DIR)/$*.*.html|while read file; do mv $${file} $${file}.tmpl; done
ls -1 $(APP_OUTPUT_DIR)/$*.*.css|while read file; do mv $${file} $${file}.tmpl; done
endif
touch $@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,6 @@ vars:

default_interface: desktop

interfaces_theme:
desktop: desktop
desktop_alt: desktop
mobile: mobile
mobile_alt: mobile
oeview: desktop
oeedit: desktop

# The dogpile.cache configuration.
#
# Do not touch if unsure.
Expand Down