Skip to content

Commit 3d2aefd

Browse files
committed
Delete queries.json config linefor build configuration
1 parent 3e68e3d commit 3d2aefd

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

bin/generate.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +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+
66+
// Override the buildContext in the webpack config
67+
webpackConfig.buildContext.dir = destinationPath;
68+
6369
for (const entry of webpackConfig) {
6470
entry.mode = mode;
6571
if (entry.output) {
6672
entry.output.path = path.resolve(process.cwd(), destinationPath);
6773
}
6874
}
75+
6976
webpack(webpackConfig, (err, stats) => {
7077
if (err) {
7178
console.error(err.stack || err);
@@ -74,14 +81,15 @@ if (args.h || args.help || args._.length > 1) {
7481
}
7582
process.exit(1);
7683
}
77-
84+
7885
console.error(stats.toString({ colors: true }));
7986
if (stats.hasErrors()) {
8087
process.exit(1);
8188
}
82-
89+
8390
fs.unlinkSync('.tmp-comunica-engine.js');
8491
});
92+
8593
if (fs.existsSync(path.join(process.cwd(), 'queries.json'))) {
8694
fs.renameSync(path.join(process.cwd(), 'queries.json'), path.join(process.cwd(), `${destinationPath}/queries.json`));
8795
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"lint": "eslint src/*.js",
5555
"dev-prod-ci": "comunica-compile-config config/config-default.json > .tmp-comunica-engine.js && ./bin/queries-to-json.js && webpack --config webpack.config.js --mode production",
5656
"dev-ci": "comunica-compile-config config/config-default.json > .tmp-comunica-engine.js && ./bin/queries-to-json.js && webpack --config webpack.config.js --mode development",
57-
"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",
57+
"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",
5858
"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",
5959
"build": "node ./bin/generate.js",
6060
"version": "manual-git-changelog onversion"

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = [
4141
path.join(__dirname, './images/sparql.png'),
4242
path.join(__dirname, './favicon.ico'),
4343
path.join(__dirname, './solid-client-id.jsonld'),
44-
path.join(process.cwd(), './queries.json'),
44+
path.join(__dirname, './queries.json'),
4545
],
4646
output: {
4747
filename: 'scripts/ldf-client-ui.min.js',

0 commit comments

Comments
 (0)