build not working

This commit is contained in:
Cris Stringfellow 2023-01-12 12:21:24 +08:00
parent ad2384e4de
commit 9c80cb8dc2
No known key found for this signature in database
6 changed files with 5898 additions and 293 deletions

6138
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,16 +4,16 @@
"type": "module",
"description": "Library server and an archivist browser controller.",
"main": "src/app.js",
"module": "dist/22120-module.js",
"module": "module/22120-module.js",
"bin": {
"diskernet": "build/22120.js"
"diskernet": "dist/22120.cjs"
},
"scripts": {
"bundle": "npx rollup --config",
"start": "node src/app.js",
"setup": "bash ./scripts/build_setup.sh",
"build": "echo 'please run ./scripts/build_setup.sh first (one time only) and then ./scripts/compile.sh'",
"clean": "rm -rf build/* bin/*",
"super-clean": "npm run clean || : && rm -rf node_modules || : && rm package-lock.json",
"test": "nodemon src/app.js",
"save": "nodemon src/app.js 22120 save",
"serve": "nodemon src/app.js 22120 serve",
@ -27,8 +27,8 @@
"url": "git+https://github.com/dosyago/22120.git"
},
"pkg": {
"scripts": "build/*.js",
"assets": "public/**/*",
"scripts": "dist/**/*.js",
"assets": ["dist/**/*.js", "public/**/*"],
"outputPath": "bin"
},
"keywords": [

View File

@ -1,16 +0,0 @@
import path from 'path';
//import commonjs from '@rollup/plugin-commonjs';
import terser from "@rollup/plugin-terser";
export default {
input: path.resolve('src', 'app.js'),
output: {
file: path.resolve('dist', '22120-module.js'),
format: 'es',
generatedCode: 'es2015'
},
plugins: [
//commonjs(),
terser()
]
};

View File

@ -34,7 +34,6 @@ if [[ ! -z "$patch_required" ]]; then
done <<< $files
fi
npm run bundle
echo "Bundling javascript..."
export NODE_ENV='production'
npx webpack

View File

@ -15,7 +15,9 @@
import readline from 'readline';
// search related
import FlexSearch from 'flexsearch';
//import FlexSearch from 'flexsearch';
//const {Index: FTSIndex} = FlexSearch;
const {Index: FTSIndex} = require('flexsearch');
import {
createIndex as NDX,
addDocumentToIndex as ndx,
@ -69,7 +71,6 @@
//const termFilter = s => s.toLocaleLowerCase();
// FlexSearch
const {Index: FTSIndex, /*registerCharset, registerLanguage*/} = FlexSearch;
const FLEX_OPTS = {
charset: "utf8",
context: true,

View File

@ -2,10 +2,10 @@ const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: "./dist/22120-module.js",
entry: "./src/app.js",
output: {
path: path.resolve(__dirname, 'build'),
filename: "22120.js"
path: path.resolve(__dirname, 'dist'),
filename: "22120.cjs"
},
optimization: {
minimize: false
@ -14,7 +14,20 @@ module.exports = {
node: {
__dirname: false
},
externalsPresets: {
node: true
},
externals: [
],
plugins: [
new webpack.BannerPlugin({ banner: "#!/usr/bin/env node", raw: true }),
]
],
module: {
rules: [
{
test: /\.node$/,
loader: 'node-loader',
},
],
},
};