Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Commit f563c04

Browse files
Goamandmo-odoo
authored andcommitted
[REF] Core: remove odoo webpack build
As we have now a build with rollup that is working nicely, we don't need the webpack build anymore.
1 parent 29b46ef commit f563c04

File tree

4 files changed

+4
-51
lines changed

4 files changed

+4
-51
lines changed

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
"description": "The best editor in the world",
55
"main": "src/index.ts",
66
"scripts": {
7-
"dev": "webpack-dev-server --config webpack-examples.config.js",
8-
"build": "rm -rf build/examples; mkdir -p build/examples/; cp -r ./examples ./build; webpack --config webpack-examples.config.js",
9-
"build-odoo": "rm -rf build/examples; mkdir -p build/examples/; cp -r ./examples ./build; webpack --config webpack-odoo.config.js",
7+
"dev": "webpack-dev-server --config webpack.config.js",
8+
"build": "rm -rf build/examples; mkdir -p build/examples/; cp -r ./examples ./build; webpack --config webpack.config.js",
109
"build:odoo": "npm run build:odoo:js; npm run build:odoo:bundle;",
1110
"build:odoo:js": "rm -rf build/odoo; mkdir -p build/odoo; cp -r packages build/odoo; find build/odoo -name '*.ts' | xargs rm; tsc --target ES2017 --module es6 --outDir build/odoo/packages",
1211
"build:odoo:bundle": "rm -rf build/rollup; rollup -c rollup.config.js",

webpack-examples.config.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

webpack-odoo.config.js

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
22
const path = require('path');
33
const glob = require('glob');
4-
const fs = require('fs');
54
/* eslint-enable @typescript-eslint/no-var-requires */
65

7-
const integrationDevPath = path.resolve(
8-
__dirname,
9-
'packages/bundle-odoo-website-editor/odoo-integration.ts',
10-
);
11-
126
const mainConfig = {
137
mode: 'development',
148
devtool: 'inline-source-map',
@@ -92,9 +86,8 @@ const entries = glob.sync(__dirname + '/examples/**/*.ts').reduce((acc, file) =>
9286
acc[fileKey] = file;
9387
return acc;
9488
}, {});
95-
entries['odoo-integration'] = integrationDevPath;
9689

97-
module.exports.examples = {
90+
const examplesConfig = {
9891
...mainConfig,
9992
entry: entries,
10093
output: {
@@ -104,41 +97,4 @@ module.exports.examples = {
10497
},
10598
};
10699

107-
// -----------------------------------------------------------------------------
108-
// Build for Odoo
109-
// -----------------------------------------------------------------------------
110-
const odooBuildPath = path.resolve(__dirname, 'build/odoo');
111-
const odooBuildFilename = 'odoo-integration.js';
112-
module.exports.odoo = {
113-
...mainConfig,
114-
entry: {
115-
'odoo-integration': integrationDevPath,
116-
},
117-
output: {
118-
path: odooBuildPath,
119-
filename: odooBuildFilename,
120-
library: 'JWEditor',
121-
},
122-
plugins: [
123-
{
124-
apply: compiler => {
125-
compiler.hooks.afterEmit.tap('AfterEmitBuildOdooIntegration', async () => {
126-
const filename = path.resolve(odooBuildPath, odooBuildFilename);
127-
fs.readFile(filename, (error, content) => {
128-
if (error) throw new Error(error);
129-
const newContent = [
130-
"odoo.define('web_editor.jabberwock', function(require) {",
131-
"'use strict';",
132-
content,
133-
'return JWEditor',
134-
'});',
135-
].join('\n');
136-
fs.writeFile(filename, newContent, error => {
137-
if (error) throw new Error(error);
138-
});
139-
});
140-
});
141-
},
142-
},
143-
],
144-
};
100+
module.exports = examplesConfig;

0 commit comments

Comments
 (0)