lino-i18n 0.5.0 → 0.5.1
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/CHANGELOG.md +6 -0
- package/bin/lino-i18n.js +11 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# lino-i18n Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7be5c34: Fix the `lino-i18n` CLI doing nothing and exiting with code 0 when run through the npm bin symlink (`npx lino-i18n`, `node_modules/.bin/lino-i18n`, npm scripts). The entry-point check now compares real paths, so `lino-i18n check` reports out-of-sync catalogs again.
|
|
8
|
+
|
|
3
9
|
## 0.5.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/bin/lino-i18n.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
//
|
|
5
5
|
// Configuration priority: CLI flags > JSON `--config` file > defaults.
|
|
6
6
|
|
|
7
|
-
import { promises as fs } from 'node:fs';
|
|
7
|
+
import { promises as fs, realpathSync } from 'node:fs';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { fileURLToPath, URL } from 'node:url';
|
|
10
10
|
|
|
@@ -386,12 +386,19 @@ function unknownCommand(command, flags, rest, log, err) {
|
|
|
386
386
|
return 1;
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
|
|
390
|
-
|
|
389
|
+
// npm installs the bin as a symlink (`node_modules/.bin/lino-i18n ->
|
|
390
|
+
// ../lino-i18n/bin/lino-i18n.js`). Node keeps the symlink path in
|
|
391
|
+
// `process.argv[1]` while `import.meta.url` is the resolved real path, so both
|
|
392
|
+
// sides must be compared after resolving symlinks.
|
|
393
|
+
export function isCliEntryPoint(
|
|
394
|
+
argvPath = process.argv[1],
|
|
395
|
+
modulePath = fileURLToPath(import.meta.url)
|
|
396
|
+
) {
|
|
397
|
+
if (!argvPath) {
|
|
391
398
|
return false;
|
|
392
399
|
}
|
|
393
400
|
try {
|
|
394
|
-
return
|
|
401
|
+
return realpathSync(argvPath) === realpathSync(modulePath);
|
|
395
402
|
} catch {
|
|
396
403
|
return false;
|
|
397
404
|
}
|