Skip to content

Commit 4b4e22f

Browse files
authored
Merge pull request #179 from NodeSecure/bump-i18n
chore: bump i18n
2 parents f7ceab1 + d9b6038 commit 4b4e22f

12 files changed

Lines changed: 164 additions & 157 deletions

File tree

bin/index.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ import * as commands from "../src/commands/index.js";
2020
const require = createRequire(import.meta.url);
2121
const manifest = require("../package.json");
2222

23-
console.log(kleur.grey().bold(`\n > ${i18n.getToken("cli.executing_at")}: ${kleur.yellow().bold(process.cwd())}\n`));
23+
await i18n.getLocalLang();
24+
25+
console.log(kleur.grey().bold(`\n > ${i18n.getTokenSync("cli.executing_at")}: ${kleur.yellow().bold(process.cwd())}\n`));
2426

2527
const minVersion = semver.minVersion(manifest.engines.node);
2628
if (semver.lt(process.versions.node, minVersion)) {
27-
console.log(kleur.red().bold(` [!] ${i18n.getToken("cli.min_nodejs_version", minVersion)}\n`));
29+
console.log(kleur.red().bold(` [!] ${i18n.getTokenSync("cli.min_nodejs_version", minVersion)}\n`));
2830
process.exit(0);
2931
}
3032

@@ -34,58 +36,58 @@ const prog = sade("nsecure").version(manifest.version);
3436

3537
prog
3638
.command("hydrate-db")
37-
.describe(i18n.getToken("cli.commands.hydrate_db.desc"))
39+
.describe(i18n.getTokenSync("cli.commands.hydrate_db.desc"))
3840
.action(commands.vulnerability.hydrate);
3941

4042
defaultScannerCommand("cwd", { strategy: vuln.strategies.NPM_AUDIT })
41-
.describe(i18n.getToken("cli.commands.cwd.desc"))
42-
.option("-n, --nolock", i18n.getToken("cli.commands.cwd.option_nolock"), false)
43-
.option("-f, --full", i18n.getToken("cli.commands.cwd.option_full"), false)
43+
.describe(i18n.getTokenSync("cli.commands.cwd.desc"))
44+
.option("-n, --nolock", i18n.getTokenSync("cli.commands.cwd.option_nolock"), false)
45+
.option("-f, --full", i18n.getTokenSync("cli.commands.cwd.option_full"), false)
4446
.action(async(...options) => {
4547
checkNodeSecureToken();
4648
await commands.scanner.cwd(...options);
4749
});
4850

4951
defaultScannerCommand("from <package>")
50-
.describe(i18n.getToken("cli.commands.from.desc"))
52+
.describe(i18n.getTokenSync("cli.commands.from.desc"))
5153
.action(async(...options) => {
5254
checkNodeSecureToken();
5355
await commands.scanner.from(...options);
5456
});
5557

5658
defaultScannerCommand("auto [package]", { includeOutput: false, strategy: vuln.strategies.SECURITY_WG })
57-
.describe(i18n.getToken("cli.commands.auto.desc"))
58-
.option("-k, --keep", i18n.getToken("cli.commands.auto.option_keep"), false)
59+
.describe(i18n.getTokenSync("cli.commands.auto.desc"))
60+
.option("-k, --keep", i18n.getTokenSync("cli.commands.auto.option_keep"), false)
5961
.action(commands.scanner.auto);
6062

6163
prog
6264
.command("open [json]")
63-
.describe(i18n.getToken("cli.commands.open.desc"))
64-
.option("-p, --port", i18n.getToken("cli.commands.open.option_port"), process.env.PORT)
65+
.describe(i18n.getTokenSync("cli.commands.open.desc"))
66+
.option("-p, --port", i18n.getTokenSync("cli.commands.open.option_port"), process.env.PORT)
6567
.action(commands.http.start);
6668

6769
prog
6870
.command("verify [package]")
69-
.describe(i18n.getToken("cli.commands.verify.desc"))
70-
.option("-j, --json", i18n.getToken("cli.commands.verify.option_json"), false)
71+
.describe(i18n.getTokenSync("cli.commands.verify.desc"))
72+
.option("-j, --json", i18n.getTokenSync("cli.commands.verify.option_json"), false)
7173
.action(async(...options) => {
7274
checkNodeSecureToken();
7375
await commands.verify.main(...options);
7476
});
7577

7678
prog
7779
.command("summary [json]")
78-
.describe(i18n.getToken("cli.commands.summary.desc"))
80+
.describe(i18n.getTokenSync("cli.commands.summary.desc"))
7981
.action(commands.summary.main);
8082

8183
prog
8284
.command("scorecard [repository]")
83-
.describe(i18n.getToken("cli.commands.scorecard.desc"))
85+
.describe(i18n.getTokenSync("cli.commands.scorecard.desc"))
8486
.action(commands.scorecard.main);
8587

8688
prog
8789
.command("lang")
88-
.describe(i18n.getToken("cli.commands.lang.desc"))
90+
.describe(i18n.getTokenSync("cli.commands.lang.desc"))
8991
.action(commands.lang.set);
9092

9193
prog
@@ -105,14 +107,14 @@ function defaultScannerCommand(name, options = {}) {
105107
const { includeOutput = true, strategy = null } = options;
106108

107109
const cmd = prog.command(name)
108-
.option("-d, --depth", i18n.getToken("cli.commands.option_depth"), 4)
110+
.option("-d, --depth", i18n.getTokenSync("cli.commands.option_depth"), 4)
109111
.option("--silent", "enable silent mode which disable CLI spinners", false);
110112

111113
if (includeOutput) {
112-
cmd.option("-o, --output", i18n.getToken("cli.commands.option_output"), "nsecure-result");
114+
cmd.option("-o, --output", i18n.getTokenSync("cli.commands.option_output"), "nsecure-result");
113115
}
114116
if (strategy !== null) {
115-
cmd.option("-s, --vulnerabilityStrategy", i18n.getToken("cli.commands.strategy"), strategy);
117+
cmd.option("-s, --vulnerabilityStrategy", i18n.getTokenSync("cli.commands.strategy"), strategy);
116118
}
117119

118120
return cmd;

package.json

Lines changed: 108 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,108 +1,108 @@
1-
{
2-
"name": "@nodesecure/cli",
3-
"version": "2.1.2",
4-
"description": "Node.js security CLI",
5-
"main": "./bin/index.js",
6-
"bin": {
7-
"node-secure": "./bin/index.js",
8-
"nsecure": "./bin/index.js"
9-
},
10-
"type": "module",
11-
"engines": {
12-
"node": ">=16.1.0"
13-
},
14-
"scripts": {
15-
"eslint": "eslint bin src test",
16-
"eslint-fix": "npm run eslint -- --fix",
17-
"prepublishOnly": "npm run build && pkg-ok",
18-
"build": "node ./esbuild.config.js",
19-
"test": "npm run test-only && npm run eslint",
20-
"test-only": "cross-env NODE_OPTIONS=--loader=esmock tap --test-regex='.spec.js' --no-check-coverage",
21-
"coverage": "cross-env NODE_OPTIONS=--loader=esmock c8 -r html tap --test-regex='.spec.js' --no-coverage"
22-
},
23-
"files": [
24-
"bin",
25-
"dist",
26-
"src",
27-
"views"
28-
],
29-
"repository": {
30-
"type": "git",
31-
"url": "git+https://github.com/NodeSecure/cli.git"
32-
},
33-
"keywords": [
34-
"node",
35-
"nodejs",
36-
"security",
37-
"cli",
38-
"sast",
39-
"scanner",
40-
"static",
41-
"code",
42-
"analysis",
43-
"node_modules",
44-
"tree",
45-
"npm",
46-
"registry",
47-
"graph",
48-
"visualization",
49-
"dependencies"
50-
],
51-
"author": "GENTILHOMME Thomas <gentilhomme.thomas@gmail.com>",
52-
"license": "MIT",
53-
"bugs": {
54-
"url": "https://github.com/NodeSecure/cli/issues"
55-
},
56-
"homepage": "https://github.com/NodeSecure/cli#readme",
57-
"devDependencies": {
58-
"@istanbuljs/esm-loader-hook": "^0.2.0",
59-
"@myunisoft/httpie": "^1.9.2",
60-
"@nodesecure/eslint-config": "^1.5.0",
61-
"@nodesecure/size-satisfies": "^1.0.2",
62-
"@nodesecure/vis-network": "^1.4.0",
63-
"@openally/result": "^1.0.0",
64-
"@types/node": "^18.11.9",
65-
"c8": "^7.12.0",
66-
"cross-env": "^7.0.3",
67-
"esbuild": "^0.17.3",
68-
"eslint": "^8.27.0",
69-
"esmock": "^2.1.0",
70-
"pkg-ok": "^3.0.0",
71-
"pretty-bytes": "^5.6.0",
72-
"strip-ansi": "^7.0.1",
73-
"tap": "^16.3.4"
74-
},
75-
"dependencies": {
76-
"@nodesecure/documentation-ui": "^1.3.0",
77-
"@nodesecure/flags": "^2.4.0",
78-
"@nodesecure/i18n": "^2.2.0",
79-
"@nodesecure/npm-registry-sdk": "^1.4.1",
80-
"@nodesecure/ossf-scorecard-sdk": "^1.1.0",
81-
"@nodesecure/rc": "^1.2.1",
82-
"@nodesecure/scanner": "^3.8.0",
83-
"@nodesecure/utils": "^1.0.0",
84-
"@nodesecure/vuln": "^1.7.0",
85-
"@polka/send-type": "^0.5.2",
86-
"@topcli/cliui": "^1.1.0",
87-
"@topcli/spinner": "^2.0.0",
88-
"cacache": "^17.0.4",
89-
"dotenv": "^16.0.3",
90-
"filenamify": "^5.1.1",
91-
"ini": "^3.0.1",
92-
"kleur": "^4.1.4",
93-
"ms": "^2.1.3",
94-
"open": "^8.4.0",
95-
"polka": "^0.5.2",
96-
"qoa": "^0.2.0",
97-
"sade": "^1.8.1",
98-
"semver": "^7.3.8",
99-
"sirv": "^2.0.2",
100-
"zup": "0.0.1"
101-
},
102-
"tap": {
103-
"node-arg": [
104-
"--experimental-loader",
105-
"@istanbuljs/esm-loader-hook"
106-
]
107-
}
108-
}
1+
{
2+
"name": "@nodesecure/cli",
3+
"version": "2.1.2",
4+
"description": "Node.js security CLI",
5+
"main": "./bin/index.js",
6+
"bin": {
7+
"node-secure": "./bin/index.js",
8+
"nsecure": "./bin/index.js"
9+
},
10+
"type": "module",
11+
"engines": {
12+
"node": ">=16.1.0"
13+
},
14+
"scripts": {
15+
"eslint": "eslint bin src test",
16+
"eslint-fix": "npm run eslint -- --fix",
17+
"prepublishOnly": "npm run build && pkg-ok",
18+
"build": "node ./esbuild.config.js",
19+
"test": "npm run test-only && npm run eslint",
20+
"test-only": "cross-env NODE_OPTIONS=--loader=esmock tap --test-regex='.spec.js' --no-check-coverage",
21+
"coverage": "cross-env NODE_OPTIONS=--loader=esmock c8 -r html tap --test-regex='.spec.js' --no-coverage"
22+
},
23+
"files": [
24+
"bin",
25+
"dist",
26+
"src",
27+
"views"
28+
],
29+
"repository": {
30+
"type": "git",
31+
"url": "git+https://github.com/NodeSecure/cli.git"
32+
},
33+
"keywords": [
34+
"node",
35+
"nodejs",
36+
"security",
37+
"cli",
38+
"sast",
39+
"scanner",
40+
"static",
41+
"code",
42+
"analysis",
43+
"node_modules",
44+
"tree",
45+
"npm",
46+
"registry",
47+
"graph",
48+
"visualization",
49+
"dependencies"
50+
],
51+
"author": "GENTILHOMME Thomas <gentilhomme.thomas@gmail.com>",
52+
"license": "MIT",
53+
"bugs": {
54+
"url": "https://github.com/NodeSecure/cli/issues"
55+
},
56+
"homepage": "https://github.com/NodeSecure/cli#readme",
57+
"devDependencies": {
58+
"@istanbuljs/esm-loader-hook": "^0.2.0",
59+
"@myunisoft/httpie": "^1.9.2",
60+
"@nodesecure/eslint-config": "^1.7.0",
61+
"@nodesecure/size-satisfies": "^1.0.2",
62+
"@nodesecure/vis-network": "^1.4.0",
63+
"@openally/result": "^1.0.0",
64+
"@types/node": "^18.11.9",
65+
"c8": "^7.12.0",
66+
"cross-env": "^7.0.3",
67+
"esbuild": "^0.17.3",
68+
"eslint": "^8.27.0",
69+
"esmock": "^2.1.0",
70+
"pkg-ok": "^3.0.0",
71+
"pretty-bytes": "^5.6.0",
72+
"strip-ansi": "^7.0.1",
73+
"tap": "^16.3.4"
74+
},
75+
"dependencies": {
76+
"@nodesecure/documentation-ui": "^1.3.0",
77+
"@nodesecure/flags": "^2.4.0",
78+
"@nodesecure/i18n": "^3.1.0",
79+
"@nodesecure/npm-registry-sdk": "^1.4.1",
80+
"@nodesecure/ossf-scorecard-sdk": "^1.1.0",
81+
"@nodesecure/rc": "^1.2.1",
82+
"@nodesecure/scanner": "^3.8.0",
83+
"@nodesecure/utils": "^1.0.0",
84+
"@nodesecure/vuln": "^1.7.0",
85+
"@polka/send-type": "^0.5.2",
86+
"@topcli/cliui": "^1.1.0",
87+
"@topcli/spinner": "^2.0.0",
88+
"cacache": "^17.0.4",
89+
"dotenv": "^16.0.3",
90+
"filenamify": "^5.1.1",
91+
"ini": "^3.0.1",
92+
"kleur": "^4.1.4",
93+
"ms": "^2.1.3",
94+
"open": "^8.4.0",
95+
"polka": "^0.5.2",
96+
"qoa": "^0.2.0",
97+
"sade": "^1.8.1",
98+
"semver": "^7.3.8",
99+
"sirv": "^2.0.2",
100+
"zup": "0.0.1"
101+
},
102+
"tap": {
103+
"node-arg": [
104+
"--experimental-loader",
105+
"@istanbuljs/esm-loader-hook"
106+
]
107+
}
108+
}

src/commands/lang.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ import kleur from "kleur";
55

66
export async function set() {
77
console.log("");
8+
const langs = await i18n.getLanguages();
89
const { selectedLang } = await qoa.interactive({
9-
query: kleur.green().bold(` ${i18n.getToken("cli.commands.lang.question_text")}`),
10+
query: kleur.green().bold(` ${i18n.getTokenSync("cli.commands.lang.question_text")}`),
1011
handle: "selectedLang",
11-
menu: i18n.getLanguages()
12+
menu: langs
1213
});
1314

1415
await i18n.setLocalLang(selectedLang);
16+
await i18n.getLocalLang();
17+
1518
console.log(
16-
kleur.white().bold(`\n ${i18n.getToken("cli.commands.lang.new_selection", kleur.yellow().bold(selectedLang))}`)
19+
kleur.white().bold(`\n ${i18n.getTokenSync("cli.commands.lang.new_selection", kleur.yellow().bold(selectedLang))}`)
1720
);
1821
console.log("");
1922
}

0 commit comments

Comments
 (0)