Skip to content

Commit

Permalink
Revert "Fix duplicate queries.json file generation"
Browse files Browse the repository at this point in the history
This reverts commit 165f3fb.

Reverted because the package deployed to npm was broken because of this.
A proper fix will land in #162.
  • Loading branch information
rubensworks committed Oct 15, 2024
1 parent 6928e65 commit ae8de80
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 43 deletions.
3 changes: 0 additions & 3 deletions bin/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ if (args.h || args.help || args._.length > 1) {
// Override the baseURL in the webpack config
webpackConfig.baseURL.replace = baseURL;

// Override the buildContext in the webpack config
webpackConfig.buildContext.dir = destinationPath;

for (const entry of webpackConfig) {
entry.mode = mode;
if (entry.output) {
Expand Down
25 changes: 0 additions & 25 deletions plugins/MoveFilePlugin.js

This file was deleted.

19 changes: 4 additions & 15 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const path = require('path');
const webpack = require('webpack');
const MoveFilePlugin = require('./plugins/MoveFilePlugin');

// First check if we can load Comunica form cwd, if not, fallback to the default
let pathToComunica;
Expand All @@ -14,7 +13,7 @@ catch {
comunicaOverride = false;
}

// Make this an object, so we can mutate it from the top level of the config
// Make this an object so we can mutate it from the top level of the config
// and have the options propagated to the plugins
const baseURL = {
search: '<%= baseURL %>',
Expand All @@ -24,12 +23,6 @@ const baseURL = {
flags: 'g'
}

// Make this an object, so we can mutate it from the top level of the config
// and have the options propagated to the plugins
const buildContext = {
dir: 'build',
}

module.exports = [
{
entry: [
Expand All @@ -48,6 +41,7 @@ module.exports = [
path.join(__dirname, './images/sparql.png'),
path.join(__dirname, './favicon.ico'),
path.join(__dirname, './solid-client-id.jsonld'),
path.join(process.cwd(), './queries.json'),
],
output: {
filename: 'scripts/ldf-client-ui.min.js',
Expand All @@ -59,11 +53,6 @@ module.exports = [
jQuery: path.join(__dirname, '/deps/jquery-2.1.0.js'),
}),
new webpack.NormalModuleReplacementPlugin(/^comunica-packagejson$/, (process.platform === 'win32' ? '' : '!!json-loader!') + path.join(pathToComunica, '../../package.json')),
// Include the generated queries.json file by moving it from the current working directory (where it was generated) to the build path.
new MoveFilePlugin(
() => path.join(process.cwd(), 'queries.json'),
() => path.join(__dirname, `${buildContext.dir}/queries.json`)
),
],
module: {
rules: [
Expand Down Expand Up @@ -166,6 +155,6 @@ module.exports = [
},
];

// Export the baseURL and buildContext objects, so we can mutate it in the generate script
// Export the baseURL object so we can mutated it
// in the generate script
module.exports.baseURL = baseURL;
module.exports.buildContext = buildContext;

0 comments on commit ae8de80

Please sign in to comment.