Skip to content

Commit 0e5bbe4

Browse files
committed
fix: deepword: require json -> import json
1 parent cd25142 commit 0e5bbe4

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

bin/deepword.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
#!/usr/bin/env node
22

3-
import {createRequire} from 'node:module';
4-
import {dirname} from 'node:path';
53
import process from 'node:process';
64
import fs from 'node:fs';
7-
import {fileURLToPath} from 'node:url';
85
import http from 'node:http';
6+
import {fileURLToPath} from 'node:url';
7+
import {dirname} from 'node:path';
8+
import info from '../package.json' with {
9+
type: 'json',
10+
};
11+
import bin from '../json/bin.json' with {
12+
type: 'json',
13+
};
914

1015
const __filename = fileURLToPath(import.meta.url);
1116
const __dirname = dirname(__filename);
12-
const require = createRequire(import.meta.url);
1317
const [name] = process.argv.slice(2);
1418

1519
if (!name)
@@ -52,9 +56,9 @@ async function main(name) {
5256
app
5357
.use(express.static(DIR))
5458
.use(deepword({
55-
diff: true,
56-
zip: true,
57-
}));
59+
diff: true,
60+
zip: true,
61+
}));
5862

5963
server.listen(port, ip);
6064

@@ -87,18 +91,14 @@ function checkFile(name, callback) {
8791
}
8892

8993
function version() {
90-
console.log(`v${info().version}`);
94+
console.log(`v${info.version}`);
9195
}
9296

93-
const info = () => require('../package');
94-
9597
function usage() {
96-
console.log(`Usage: ${info().name} [filename]`);
98+
console.log(`Usage: ${info.name} [filename]`);
9799
}
98100

99101
function help() {
100-
const bin = require('../json/bin');
101-
102102
usage();
103103
console.log('Options:');
104104

0 commit comments

Comments
 (0)