mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-06 05:26:22 -07:00
Replace Gulp with Parcel for js bundling
This commit is contained in:
parent
1848e2f073
commit
d423398eff
10 changed files with 6252 additions and 13436 deletions
9
frontend/.parcelrc
Normal file
9
frontend/.parcelrc
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
// this is here since parcel and babel don't seem to get along
|
||||
"extends": "@parcel/config-default",
|
||||
"transformers": {
|
||||
"*.js": [
|
||||
"@parcel/transformer-js"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
import browserify from "browserify";
|
||||
import buffer from "vinyl-buffer"
|
||||
import fancy_log from "fancy-log";
|
||||
import glob from "glob";
|
||||
import gulp from "gulp";
|
||||
import stdio from "stdio";
|
||||
import uglify from "gulp-uglify";
|
||||
import source from "vinyl-source-stream";
|
||||
import watchify from "watchify";
|
||||
import sourcemaps from 'gulp-sourcemaps';
|
||||
|
||||
const args = stdio.getopt({
|
||||
"watch": {key: "w", description: "Automatically rebuild when you change a file"},
|
||||
"minify": {key: "m", description: "minify generated gochan.js"}
|
||||
});
|
||||
|
||||
let builder = browserify({
|
||||
entries: glob.sync("src/**/*.js")
|
||||
});
|
||||
|
||||
function buildTask(minify) {
|
||||
fancy_log("Building gochan frontend");
|
||||
let babelOptions = {
|
||||
presets: ["@babel/preset-env"],
|
||||
comments: false
|
||||
}
|
||||
|
||||
let out = builder.transform("babelify", babelOptions)
|
||||
.bundle()
|
||||
.pipe(source("gochan.js"))
|
||||
.pipe(buffer())
|
||||
.pipe(sourcemaps.init({ loadMaps: true }))
|
||||
|
||||
if(minify)
|
||||
out = out.pipe(uglify());
|
||||
|
||||
return out
|
||||
.pipe(sourcemaps.write('./maps/'))
|
||||
.pipe(gulp.dest("../html/js/", {overwrite: true}));
|
||||
}
|
||||
|
||||
gulp.task("default", () => {
|
||||
if(args.watch) {
|
||||
builder = watchify(builder);
|
||||
builder.on("update", () => {
|
||||
return buildTask(args.minify)
|
||||
});
|
||||
}
|
||||
return buildTask(args.minify);
|
||||
});
|
19373
frontend/package-lock.json
generated
19373
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,46 +1,37 @@
|
|||
{
|
||||
"name": "gochan.js",
|
||||
"version": "2.11.1",
|
||||
"version": "3.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "jest --verbose",
|
||||
"build": "gulp",
|
||||
"build-minify": "gulp -m",
|
||||
"build-watch": "gulp -w",
|
||||
"build-minify-watch": "gulp -m -w"
|
||||
"type": "module",
|
||||
"source": "src/gochan.js",
|
||||
"main": "../html/js/gochan.js",
|
||||
"targets": {
|
||||
"frontend": {
|
||||
"source": "src/gochan.js",
|
||||
"distDir": "../html/js/"
|
||||
}
|
||||
},
|
||||
"browserslist": "> 0.5%, last 2 versions, not dead",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "parcel build --no-cache",
|
||||
"watch": "parcel watch",
|
||||
"test": "jest --verbose"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Eggbertx",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"core-js": "^3.20.1",
|
||||
"gulp-sourcemaps": "^2.6.5",
|
||||
"jquery": "^3.5.1",
|
||||
"jqueryui": "^1.11.1",
|
||||
"regenerator-runtime": "^0.13.9"
|
||||
"jqueryui": "^1.11.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.10.1",
|
||||
"@babel/core": "^7.10.2",
|
||||
"@babel/preset-env": "^7.10.2",
|
||||
"@babel/register": "^7.10.1",
|
||||
"@babel/preset-env": "^7.16.11",
|
||||
"@jest/globals": "^27.4.6",
|
||||
"@types/jquery": "^3.3.38",
|
||||
"@types/jqueryui": "^1.12.13",
|
||||
"babel-jest": "^27.4.6",
|
||||
"babelify": "^10.0.0",
|
||||
"browserify": "^16.5.0",
|
||||
"fancy-log": "^1.3.3",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-babel": "^8.0.0",
|
||||
"gulp-uglify": "^3.0.2",
|
||||
"babel-jest": "^27.5.1",
|
||||
"jest": "^27.4.7",
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"stdio": "^0.2.7",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"vinyl-source-stream": "^2.0.0",
|
||||
"watchify": "^4.0.0",
|
||||
"parcel": "^2.4.0",
|
||||
"yargs-parser": ">=5.0.0-security.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
// needed for Promise stuff
|
||||
import "core-js/stable";
|
||||
import "regenerator-runtime/runtime";
|
||||
|
||||
import { handleActions, handleKeydown } from "./boardevents";
|
||||
import { initCookies, getCookie } from "./cookies";
|
||||
import { initStaff, createStaffMenu } from "./manage";
|
Loading…
Add table
Add a link
Reference in a new issue