Skip to content

Commit d89ebfb

Browse files
authored
revert nodejs
1 parent 91366fe commit d89ebfb

22 files changed

+12827
-0
lines changed

Diff for: nodejs/babel.config.cjs

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
modules: false,
7+
},
8+
],
9+
],
10+
plugins: [['@babel/plugin-transform-runtime']],
11+
};

Diff for: nodejs/esbuild-config.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import * as esbuild from 'esbuild';
2+
import fs from 'fs';
3+
import { createHash } from 'crypto';
4+
5+
esbuild.build({
6+
entryPoints: ['src/index.config.js'],
7+
outfile: 'dist/index.config.js',
8+
bundle: true,
9+
minify: false,
10+
write: true,
11+
charset: 'utf8',
12+
format: 'cjs',
13+
platform: 'node',
14+
target: 'node18',
15+
sourcemap: true,
16+
plugins: [genMd5()],
17+
});
18+
19+
function genMd5() {
20+
return {
21+
name: 'gen-output-file-md5',
22+
setup(build) {
23+
build.onEnd(async (_) => {
24+
const md5 = createHash('md5').update(fs.readFileSync('dist/index.config.js')).digest('hex');
25+
fs.writeFileSync('dist/index.config.js.md5', md5);
26+
});
27+
},
28+
};
29+
}

Diff for: nodejs/esbuild.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import * as esbuild from 'esbuild';
2+
import fs from 'fs';
3+
import { createHash } from 'crypto';
4+
5+
esbuild.build({
6+
entryPoints: ['src/index.js'],
7+
outfile: 'dist/index.js',
8+
bundle: true,
9+
minify: true,
10+
write: true,
11+
format: 'cjs',
12+
platform: 'node',
13+
target: 'node18',
14+
sourcemap: true,
15+
plugins: [genMd5()],
16+
});
17+
18+
function genMd5() {
19+
return {
20+
name: 'gen-output-file-md5',
21+
setup(build) {
22+
build.onEnd(async (_) => {
23+
const md5 = createHash('md5').update(fs.readFileSync('dist/index.js')).digest('hex');
24+
fs.writeFileSync('dist/index.js.md5', md5);
25+
});
26+
},
27+
};
28+
}

Diff for: nodejs/nodemon.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"restartable": "rs",
3+
"ignore": [".git", "node_modules/", "dist/"],
4+
"watch": ["src/"],
5+
"execMap": {
6+
"js": "node"
7+
},
8+
"env": {
9+
"NODE_ENV": "development"
10+
},
11+
"ext": "js,json"
12+
}

0 commit comments

Comments
 (0)