Skip to content

Commit e10986a

Browse files
committed
Delete queries.json config linefor build configuration
1 parent 108802e commit e10986a

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

bin/generate.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,25 +50,29 @@ if (args.h || args.help || args._.length > 1) {
5050
const settingsFile = args.s || path.join(__dirname, '..', 'settings.json');
5151
const outputFile = 'queries.json';
5252
compileSettings(queryDir, settingsFile, outputFile);
53-
53+
5454
// Compile Web version
5555
const destinationPath = args.d || 'build';
5656
const mode = args.m || 'production';
5757
const baseURL = args.b || 'https://query.linkeddatafragments.org/';
5858
const webpackConfig = require(args.w ? path.resolve(process.cwd(), args.w) : '../webpack.config.js');
5959

60+
// Remove the location of queries.json which shouldn't be present in the build configuration.
61+
webpackConfig[0].entry=webpackConfig[0].entry.filter(x => !x.endsWith('queries.json'));
62+
6063
// Override the baseURL in the webpack config
6164
webpackConfig.baseURL.replace = baseURL;
62-
65+
6366
// Override the buildContext in the webpack config
6467
webpackConfig.buildContext.dir = destinationPath;
65-
68+
6669
for (const entry of webpackConfig) {
6770
entry.mode = mode;
6871
if (entry.output) {
6972
entry.output.path = path.resolve(process.cwd(), destinationPath);
7073
}
7174
}
75+
7276
webpack(webpackConfig, (err, stats) => {
7377
if (err) {
7478
console.error(err.stack || err);
@@ -77,14 +81,15 @@ if (args.h || args.help || args._.length > 1) {
7781
}
7882
process.exit(1);
7983
}
80-
84+
8185
console.error(stats.toString({ colors: true }));
8286
if (stats.hasErrors()) {
8387
process.exit(1);
8488
}
85-
89+
8690
fs.unlinkSync('.tmp-comunica-engine.js');
8791
});
92+
8893
if (fs.existsSync(path.join(process.cwd(), 'queries.json'))) {
8994
fs.renameSync(path.join(process.cwd(), 'queries.json'), path.join(process.cwd(), `${destinationPath}/queries.json`));
9095
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
],
5252
"scripts": {
5353
"lint": "eslint src/*.js",
54-
"dev-prod": "comunica-compile-config config/config-default.json > .tmp-comunica-engine.js && ./bin/queries-to-json.js && webpack serve --config webpack.config.js --mode production",
54+
"dev-prod": "comunica-compile-config config/config-default.json > .tmp-comunica-engine.js && ./bin/queries-to-json.js && webpack serve --config webpack.config.dev.js --mode production",
5555
"dev": "comunica-compile-config config/config-default.json > .tmp-comunica-engine.js && ./bin/queries-to-json.js && webpack serve --config webpack.config.js --mode development",
5656
"build": "node ./bin/generate.js",
5757
"version": "manual-git-changelog onversion"

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = [
4747
path.join(__dirname, './images/sparql.png'),
4848
path.join(__dirname, './favicon.ico'),
4949
path.join(__dirname, './solid-client-id.jsonld'),
50-
path.join(process.cwd(), './queries.json'),
50+
path.join(__dirname, './queries.json'),
5151
],
5252
output: {
5353
filename: 'scripts/ldf-client-ui.min.js',

0 commit comments

Comments
 (0)