jsql-neo 6.5.3 → 6.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/jsql +14 -14
- package/index.js +1 -1
- package/lib/star-nag.js +1 -1
- package/package.json +1 -1
- package/test/star-nag.test.js +6 -6
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> **One engine to rule them all** — a Rust-powered embedded database that speaks your language:
|
|
4
4
|
> MySQL, PostgreSQL, MongoDB, Redis, SQL, TypeScript, **and the browser**.
|
|
5
5
|
|
|
6
|
-
> **v6.5.
|
|
6
|
+
> **v6.5.4** — stable release · [github.com/vexify-org/JSQL-neo](https://github.com/vexify-org/JSQL-neo) · [jsql.vexify.top](https://jsql.vexify.top)
|
|
7
7
|
|
|
8
8
|

|
|
9
9
|

|
package/bin/jsql
CHANGED
|
@@ -201,40 +201,40 @@ const cli = yaggs({ pkg: require('../package.json') })
|
|
|
201
201
|
if (argv.reset) sn.setStarred(false);
|
|
202
202
|
const c = sn.readConfig();
|
|
203
203
|
if (c.starred) {
|
|
204
|
-
console.log(
|
|
205
|
-
console.log('Run with --reset to re-check
|
|
204
|
+
console.log(`Already confirmed starred 已确认过: ${sn.configPath()}`);
|
|
205
|
+
console.log('Run with --reset to re-check · 用 --reset 重新检查');
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
208
|
-
console.log('Opening browser to confirm your star…');
|
|
208
|
+
console.log('Opening browser to confirm your star… 正在打开浏览器确认');
|
|
209
209
|
const nonceUrl = sn.startOauthCheck(); // 打开浏览器 + 后台轮询写回 ~/.jsqlmr
|
|
210
210
|
if (!process.stdout.isTTY) console.log(' ' + nonceUrl);
|
|
211
|
-
console.log(
|
|
212
|
-
console.log('Waiting for authorization (up to 3 minutes)…');
|
|
211
|
+
console.log(`Authorization updates this config 授权后写入配置: ${sn.configPath()}`);
|
|
212
|
+
console.log('Waiting for authorization (up to 3 minutes)… 等待授权(最多 3 分钟)…');
|
|
213
213
|
// startOauthCheck 的定时器是 unref 的,命令必须自己前台等,否则接不到结果
|
|
214
214
|
const res = sn.waitForResult(nonceUrl, 180000);
|
|
215
215
|
const status = res && res.status;
|
|
216
216
|
if (status === 'starred') {
|
|
217
217
|
sn.setStarred(true);
|
|
218
|
-
console.log(`Confirmed: ${res.login}
|
|
218
|
+
console.log(`Confirmed: ${res.login} starred ${res.repo} — thanks! 已确认,谢谢!`);
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
221
|
if (status === 'not-starred') {
|
|
222
|
-
console.log(`
|
|
223
|
-
console.log(`Star it at ${sn.URL} then run \`jsql star\` again
|
|
222
|
+
console.log(`Not starred yet 还没 star: ${res.login} has not starred ${res.repo}`);
|
|
223
|
+
console.log(`Star it at ${sn.URL}, then run \`jsql star\` again · 点星后重跑 \`jsql star\``);
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
if (status === 'denied' || status === 'error') {
|
|
227
|
-
// 这不是「没 star」,是授权本身没走通(code
|
|
228
|
-
|
|
229
|
-
console.log(`Authorization ${
|
|
230
|
-
console.log('The link is single-use
|
|
227
|
+
// 这不是「没 star」,是授权本身没走通(code 过期、链接被重复打开、被拒绝)
|
|
228
|
+
const why = status === 'denied' ? 'declined 被拒绝' : 'failed 失败';
|
|
229
|
+
console.log(`Authorization ${why}: ${res.error || 'unknown reason'}`);
|
|
230
|
+
console.log('The link is single-use — run `jsql star` again · 链接一次性,请重跑 `jsql star`');
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
233
|
if (status === 'expired') {
|
|
234
|
-
console.log('The link expired
|
|
234
|
+
console.log('The link expired 链接已过期 — run `jsql star` again · 请重跑');
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
|
-
console.log('Timed out
|
|
237
|
+
console.log('Timed out 已超时 — run `jsql star` again · 请重跑');
|
|
238
238
|
})
|
|
239
239
|
.command('bench', 'Insert + query benchmark against a data directory', (sub) => {
|
|
240
240
|
sub.option('n', { type: 'number', description: 'Number of rows (default 10000)' });
|
package/index.js
CHANGED
package/lib/star-nag.js
CHANGED
|
@@ -208,7 +208,7 @@ function nag(opts = {}) {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
out.write(`\n If JSQL-NEO saved you time, a star helps others find it: ${URL}\n`);
|
|
211
|
-
out.write(`
|
|
211
|
+
out.write(` 如果帮到了你,点个 star;运行 \`jsql star\` 确认 · JSQL_NO_STAR_NAG=1 关闭提示\n\n`);
|
|
212
212
|
|
|
213
213
|
// 只记录「有没有 star」,不再写 lastNagAt —— 没有节流,写它没有意义。
|
|
214
214
|
return true;
|
package/package.json
CHANGED
package/test/star-nag.test.js
CHANGED
|
@@ -89,13 +89,13 @@ async function main() {
|
|
|
89
89
|
console.log('\n--- 假 result.php 驱动真实 CLI ---');
|
|
90
90
|
const cases = [
|
|
91
91
|
['done + starred', { state: 'done', result: { starred: true, login: 'octocat', repo: 'vexify-org/JSQL-neo' } },
|
|
92
|
-
'Confirmed: octocat
|
|
92
|
+
'Confirmed: octocat starred vexify-org/JSQL-neo'],
|
|
93
93
|
['done + 未 star', { state: 'done', result: { starred: false, login: 'octocat', repo: 'vexify-org/JSQL-neo' } },
|
|
94
|
-
'
|
|
94
|
+
'Not starred yet 还没 star: octocat has not starred vexify-org/JSQL-neo'],
|
|
95
95
|
['denied', { state: 'denied', result: { error: 'access_denied' } },
|
|
96
|
-
'Authorization
|
|
96
|
+
'Authorization declined 被拒绝: access_denied'],
|
|
97
97
|
['error(code 过期/复用)', { state: 'error', result: { error: 'The code passed is incorrect or expired.' } },
|
|
98
|
-
'Authorization failed
|
|
98
|
+
'Authorization failed 失败: The code passed is incorrect or expired.'],
|
|
99
99
|
];
|
|
100
100
|
for (const [name, resp, expect] of cases) {
|
|
101
101
|
scenario = resp; pollsLeft = 0; after = null;
|
|
@@ -111,8 +111,8 @@ async function main() {
|
|
|
111
111
|
pollsLeft = 2;
|
|
112
112
|
after = { state: 'done', result: { starred: true, login: 'octocat', repo: 'vexify-org/JSQL-neo' } };
|
|
113
113
|
const out = await runCli(path.join(mrDir, 'slow'));
|
|
114
|
-
ok('等完 pending 后正确确认', out.includes('Confirmed: octocat
|
|
115
|
-
ok('全程没有误判成完成', !/
|
|
114
|
+
ok('等完 pending 后正确确认', out.includes('Confirmed: octocat starred vexify-org/JSQL-neo'), out.trim().slice(0, 200));
|
|
115
|
+
ok('全程没有误判成完成', !/Not starred yet/.test(out), out.trim().slice(0, 200));
|
|
116
116
|
ok('全程没有 undefined', !/undefined/.test(out), out.trim().slice(0, 200));
|
|
117
117
|
}
|
|
118
118
|
|