mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-04 16:20:26 +00:00
Migrated from webpack to esbuild
This commit is contained in:
parent
87a5340a05
commit
ac83c349da
5 changed files with 132 additions and 3341 deletions
3329
package-lock.json
generated
3329
package-lock.json
generated
File diff suppressed because it is too large
Load diff
12
package.json
12
package.json
|
@ -4,9 +4,9 @@
|
||||||
"build:css:dev": "sass ./resources/sass:./public/dist",
|
"build:css:dev": "sass ./resources/sass:./public/dist",
|
||||||
"build:css:watch": "sass ./resources/sass:./public/dist --watch",
|
"build:css:watch": "sass ./resources/sass:./public/dist --watch",
|
||||||
"build:css:production": "sass ./resources/sass:./public/dist -s compressed",
|
"build:css:production": "sass ./resources/sass:./public/dist -s compressed",
|
||||||
"build:js:dev": "webpack",
|
"build:js:dev": "esbuild --bundle ./resources/js/index.js --outfile=public/dist/app.js --sourcemap --target=es2020",
|
||||||
"build:js:watch": "webpack --watch",
|
"build:js:watch": "chokidar \"./resources/**/*.js\" -c \"npm run build:js:dev\"",
|
||||||
"build:js:production": "NODE_ENV=production webpack",
|
"build:js:production": "NODE_ENV=production esbuild --bundle ./resources/js/index.js --outfile=public/dist/app.js --sourcemap --minify",
|
||||||
"build": "npm-run-all --parallel build:*:dev",
|
"build": "npm-run-all --parallel build:*:dev",
|
||||||
"production": "npm-run-all --parallel build:*:production",
|
"production": "npm-run-all --parallel build:*:production",
|
||||||
"dev": "npm-run-all --parallel watch livereload",
|
"dev": "npm-run-all --parallel watch livereload",
|
||||||
|
@ -15,11 +15,11 @@
|
||||||
"permissions": "chown -R $USER:$USER bootstrap/cache storage public/uploads"
|
"permissions": "chown -R $USER:$USER bootstrap/cache storage public/uploads"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"chokidar-cli": "^2.1.0",
|
||||||
|
"esbuild": "^0.6.20",
|
||||||
"livereload": "^0.9.1",
|
"livereload": "^0.9.1",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"sass": "^1.26.10",
|
"sass": "^1.26.10"
|
||||||
"webpack": "^4.44.0",
|
|
||||||
"webpack-cli": "^3.3.12"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"clipboard": "^2.0.6",
|
"clipboard": "^2.0.6",
|
||||||
|
|
|
@ -51,7 +51,7 @@ All development on BookStack is currently done on the master branch. When it's t
|
||||||
|
|
||||||
* [Node.js](https://nodejs.org/en/) v10.0+
|
* [Node.js](https://nodejs.org/en/) v10.0+
|
||||||
|
|
||||||
This project uses SASS for CSS development and this is built, along with the JavaScript, using webpack. The below npm commands can be used to install the dependencies & run the build tasks:
|
This project uses SASS for CSS development and this is built, along with the JavaScript, using a range of npm scripts. The below npm commands can be used to install the dependencies & run the build tasks:
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
# Install NPM Dependencies
|
# Install NPM Dependencies
|
||||||
|
|
|
@ -1,12 +1,106 @@
|
||||||
const componentMapping = {};
|
import addRemoveRows from "./add-remove-rows.js"
|
||||||
|
import ajaxDeleteRow from "./ajax-delete-row.js"
|
||||||
|
import ajaxForm from "./ajax-form.js"
|
||||||
|
import attachments from "./attachments.js"
|
||||||
|
import autoSuggest from "./auto-suggest.js"
|
||||||
|
import backToTop from "./back-to-top.js"
|
||||||
|
import bookSort from "./book-sort.js"
|
||||||
|
import breadcrumbListing from "./breadcrumb-listing.js"
|
||||||
|
import chapterToggle from "./chapter-toggle.js"
|
||||||
|
import codeEditor from "./code-editor.js"
|
||||||
|
import codeHighlighter from "./code-highlighter.js"
|
||||||
|
import collapsible from "./collapsible.js"
|
||||||
|
import customCheckbox from "./custom-checkbox.js"
|
||||||
|
import detailsHighlighter from "./details-highlighter.js"
|
||||||
|
import dropdown from "./dropdown.js"
|
||||||
|
import dropzone from "./dropzone.js"
|
||||||
|
import editorToolbox from "./editor-toolbox.js"
|
||||||
|
import entityPermissionsEditor from "./entity-permissions-editor.js"
|
||||||
|
import entitySearch from "./entity-search.js"
|
||||||
|
import entitySelector from "./entity-selector.js"
|
||||||
|
import entitySelectorPopup from "./entity-selector-popup.js"
|
||||||
|
import eventEmitSelect from "./event-emit-select.js"
|
||||||
|
import expandToggle from "./expand-toggle.js"
|
||||||
|
import headerMobileToggle from "./header-mobile-toggle.js"
|
||||||
|
import homepageControl from "./homepage-control.js"
|
||||||
|
import imageManager from "./image-manager.js"
|
||||||
|
import imagePicker from "./image-picker.js"
|
||||||
|
import index from "./index.js"
|
||||||
|
import listSortControl from "./list-sort-control.js"
|
||||||
|
import markdownEditor from "./markdown-editor.js"
|
||||||
|
import newUserPassword from "./new-user-password.js"
|
||||||
|
import notification from "./notification.js"
|
||||||
|
import optionalInput from "./optional-input.js"
|
||||||
|
import pageComments from "./page-comments.js"
|
||||||
|
import pageDisplay from "./page-display.js"
|
||||||
|
import pageEditor from "./page-editor.js"
|
||||||
|
import pagePicker from "./page-picker.js"
|
||||||
|
import permissionsTable from "./permissions-table.js"
|
||||||
|
import popup from "./popup.js"
|
||||||
|
import settingAppColorPicker from "./setting-app-color-picker.js"
|
||||||
|
import settingColorPicker from "./setting-color-picker.js"
|
||||||
|
import shelfSort from "./shelf-sort.js"
|
||||||
|
import sidebar from "./sidebar.js"
|
||||||
|
import sortableList from "./sortable-list.js"
|
||||||
|
import tabs from "./tabs.js"
|
||||||
|
import tagManager from "./tag-manager.js"
|
||||||
|
import templateManager from "./template-manager.js"
|
||||||
|
import toggleSwitch from "./toggle-switch.js"
|
||||||
|
import triLayout from "./tri-layout.js"
|
||||||
|
import wysiwygEditor from "./wysiwyg-editor.js"
|
||||||
|
|
||||||
const definitionFiles = require.context('./', false, /\.js$/);
|
const componentMapping = {
|
||||||
for (const fileName of definitionFiles.keys()) {
|
"add-remove-rows": addRemoveRows,
|
||||||
const name = fileName.replace('./', '').split('.')[0];
|
"ajax-delete-row": ajaxDeleteRow,
|
||||||
if (name !== 'index') {
|
"ajax-form": ajaxForm,
|
||||||
componentMapping[name] = definitionFiles(fileName).default;
|
"attachments": attachments,
|
||||||
}
|
"auto-suggest": autoSuggest,
|
||||||
}
|
"back-to-top": backToTop,
|
||||||
|
"book-sort": bookSort,
|
||||||
|
"breadcrumb-listing": breadcrumbListing,
|
||||||
|
"chapter-toggle": chapterToggle,
|
||||||
|
"code-editor": codeEditor,
|
||||||
|
"code-highlighter": codeHighlighter,
|
||||||
|
"collapsible": collapsible,
|
||||||
|
"custom-checkbox": customCheckbox,
|
||||||
|
"details-highlighter": detailsHighlighter,
|
||||||
|
"dropdown": dropdown,
|
||||||
|
"dropzone": dropzone,
|
||||||
|
"editor-toolbox": editorToolbox,
|
||||||
|
"entity-permissions-editor": entityPermissionsEditor,
|
||||||
|
"entity-search": entitySearch,
|
||||||
|
"entity-selector": entitySelector,
|
||||||
|
"entity-selector-popup": entitySelectorPopup,
|
||||||
|
"event-emit-select": eventEmitSelect,
|
||||||
|
"expand-toggle": expandToggle,
|
||||||
|
"header-mobile-toggle": headerMobileToggle,
|
||||||
|
"homepage-control": homepageControl,
|
||||||
|
"image-manager": imageManager,
|
||||||
|
"image-picker": imagePicker,
|
||||||
|
"index": index,
|
||||||
|
"list-sort-control": listSortControl,
|
||||||
|
"markdown-editor": markdownEditor,
|
||||||
|
"new-user-password": newUserPassword,
|
||||||
|
"notification": notification,
|
||||||
|
"optional-input": optionalInput,
|
||||||
|
"page-comments": pageComments,
|
||||||
|
"page-display": pageDisplay,
|
||||||
|
"page-editor": pageEditor,
|
||||||
|
"page-picker": pagePicker,
|
||||||
|
"permissions-table": permissionsTable,
|
||||||
|
"popup": popup,
|
||||||
|
"setting-app-color-picker": settingAppColorPicker,
|
||||||
|
"setting-color-picker": settingColorPicker,
|
||||||
|
"shelf-sort": shelfSort,
|
||||||
|
"sidebar": sidebar,
|
||||||
|
"sortable-list": sortableList,
|
||||||
|
"tabs": tabs,
|
||||||
|
"tag-manager": tagManager,
|
||||||
|
"template-manager": templateManager,
|
||||||
|
"toggle-switch": toggleSwitch,
|
||||||
|
"tri-layout": triLayout,
|
||||||
|
"wysiwyg-editor": wysiwygEditor,
|
||||||
|
};
|
||||||
|
|
||||||
window.components = {};
|
window.components = {};
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
const path = require('path');
|
|
||||||
const dev = process.env.NODE_ENV !== 'production';
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
target: 'web',
|
|
||||||
mode: dev? 'development' : 'production',
|
|
||||||
entry: {
|
|
||||||
app: './resources/js/index.js',
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: '[name].js',
|
|
||||||
path: path.resolve(__dirname, 'public/dist')
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
if (dev) {
|
|
||||||
config['devtool'] = 'inline-source-map';
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = config;
|
|
Loading…
Add table
Add a link
Reference in a new issue