fix: copy non-ugilified tiddlywiki source to the dist

This commit is contained in:
林一二 2021-06-02 22:02:55 +08:00
parent a646610d23
commit ee7cf2c5f7
3 changed files with 20 additions and 2 deletions

6
package-lock.json generated
View file

@ -9439,6 +9439,12 @@
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
"dev": true
},
"event-hooks-webpack-plugin": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/event-hooks-webpack-plugin/-/event-hooks-webpack-plugin-2.2.0.tgz",
"integrity": "sha512-r3j2Zez2Y8dRtSFCdNzmkN1m3p651a3VHi5A77zbhAP0Y08YTQaNx6vadCVaZ/szup9uBrVRlvUVgOW6pSINgg==",
"dev": true
},
"event-stream": {
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz",

View file

@ -29,7 +29,7 @@
"unpack": "**/.webpack/main/*.worker.*"
},
"extraResource": [
"node_modules/@tiddlygit/tiddlywiki",
".webpack/node_modules",
"localization",
"template/wiki",
"build-resources/menubar@2x.png",
@ -160,6 +160,7 @@
"@types/electron-window-state": "5.0.0",
"@types/eslint": "7.2.12",
"@types/eslint-plugin-prettier": "3.1.0",
"@types/event-hooks-webpack-plugin": "^2.2.1",
"@types/file-loader": "5.0.0",
"@types/fs-extra": "9.0.11",
"@types/i18next-fs-backend": "1.0.0",
@ -207,6 +208,7 @@
"eslint-plugin-security": "1.4.0",
"eslint-plugin-security-node": "1.0.14",
"eslint-plugin-unicorn": "32.0.1",
"event-hooks-webpack-plugin": "^2.2.0",
"file-loader": "6.2.0",
"fork-ts-checker-webpack-plugin": "6.2.10",
"graphql-hooks": "5.1.2",

View file

@ -4,17 +4,27 @@ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const CspHtmlWebpackPlugin = require('csp-html-webpack-plugin');
const CircularDependencyPlugin = require('circular-dependency-plugin');
const path = require('path');
const fs = require('fs-extra');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const ThreadsPlugin = require('threads-plugin');
const ExternalsPlugin = require('webpack5-externals-plugin');
const EventHooksPlugin = require('event-hooks-webpack-plugin');
exports.main = [
// we only need one instance of TsChecker, it will check main and renderer all together
new ForkTsCheckerWebpackPlugin(),
new CopyPlugin({
// to is relative to ./.webpack/main/
patterns: [{ from: 'localization', to: 'localization' }],
patterns: [
{ from: 'localization', to: 'localization' },
],
}),
new EventHooksPlugin({
'afterEmit': (compilation, done) => {
console.log('Copying tiddlywiki dependency to dist');
void fs.copy('node_modules/@tiddlygit/tiddlywiki', './.webpack/node_modules/@tiddlygit/tiddlywiki', done);
},
}),
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp