@chipmobilesdk/rn-i18n-tooling 0.1.0 → 0.1.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 CHANGED
@@ -1,4 +1,29 @@
1
- # @chipmobilesdk/rn-i18n-tooling
1
+ # @chipmobilesdk/rn-i18n-tooling
2
+
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - `chip-i18n` runs on Linux and macOS again. ([#27](https://github.com/operationd8979/chip-mobile-sdk/pull/27))
8
+
9
+ Every line of `bin/chip-i18n.mjs` in 0.1.0 ends in CRLF, the shebang included, so the
10
+ kernel reads the interpreter name as `node\r` and the command dies before it starts:
11
+
12
+ ```
13
+ $ npx chip-i18n --help
14
+ /usr/bin/env: 'node\r': No such file or directory
15
+ ```
16
+
17
+ Only away from Windows. 0.1.0 had to be published by hand — npm's trusted publishing
18
+ cannot create a package that does not exist yet — and `npm pack` ships the working tree
19
+ as it stands, which on a Windows checkout (`core.autocrlf`) had every line rewritten. The
20
+ package's own smoke test installs the tarball and runs the binary, but it passes on
21
+ Windows, where CRLF is fine, and in CI, where the checkout is LF: the broken artifact
22
+ exists only in between.
23
+
24
+ `.gitattributes` now pins `packages/*/bin/**` to LF so no checkout can rewrite it, and
25
+ `npm run check:manifests` fails on a `bin` target that contains a carriage return or is
26
+ missing its shebang. Nothing else in the package changed.
2
27
 
3
28
  ## 0.1.0
4
29
 
package/README.md CHANGED
@@ -1,65 +1,65 @@
1
- # @chipmobilesdk/rn-i18n-tooling
2
-
3
- The `chip-i18n` CLI: it scans a React Native app's source for translation keys and
4
- synchronises the app's locale JSON files against what it finds.
5
-
6
- - **Node, not React Native.** Nothing here runs on a device, and the package is a
7
- `devDependency` of the app. The runtime library is
8
- [`@chipmobilesdk/rn-i18n`](../rn-i18n/README.md).
9
- - **Ships JavaScript.** The tarball carries `lib/` built from TypeScript plus the
10
- `bin/chip-i18n.mjs` entry. This package exists because the tooling used to ship as
11
- `.ts` source inside the runtime tarball, where the documented command — `node
12
- --experimental-strip-types node_modules/@chipmobilesdk/rn-i18n/src/tooling/cli.ts` —
13
- worked in this monorepo and nowhere else (I18N-01, DEP-02).
14
- - **Public package.** Published under the `@chipmobilesdk` npm organization. The
15
- license is `UNLICENSED`: the code is readable on npm, but
16
- no open-source license is granted.
17
- - **Version**: see [CHANGELOG](CHANGELOG.md)
18
-
19
- ## Install
20
-
21
- ```sh
22
- npm i -D @chipmobilesdk/rn-i18n-tooling
23
- ```
24
-
25
- Node `>=22.13.0`.
26
-
27
- ## Use
28
-
29
- ```sh
30
- npx chip-i18n sync # i18n-sync.config.json
31
- npx chip-i18n sync --config other.config.json
32
- npx chip-i18n --help
33
- ```
34
-
35
- The configuration file, the key patterns, the runtime-only key policy and the generated
36
- typed-key contract are documented in the runtime package's README, under
37
- `## Extraction & synchronization CLI` — the CLI reads the same config it always did.
38
-
39
- Exit codes: `0` success or warnings, `1` blocking findings (a key with two different
40
- default texts, a malformed locale file), `2` invalid configuration or usage.
41
-
42
- A run that finds nothing to change **writes no file**: each locale file is compared
43
- with what would be written and left alone when it matches. That makes the command safe
44
- in a watch loop or a pre-commit hook, where rewriting identical bytes used to churn
45
- mtimes and show work in `git status` that had not happened.
46
-
47
- ## Programmatic use
48
-
49
- The same functions are importable, for a repository that wants to drive extraction from
50
- its own script:
51
-
52
- ```ts
53
- import { runSync, renderReport, scanSource } from '@chipmobilesdk/rn-i18n-tooling';
54
- ```
55
-
56
- `runSync(rootDir, config)` returns the report and whether the generated keys file
57
- changed; `scanSource` is the scanner on its own. Both are the ones the CLI uses.
58
-
59
- ## Repository layout
60
-
61
- | | |
62
- |---|---|
63
- | `src/` | TypeScript sources; `cli.ts` is the command |
64
- | `lib/` | build output (`npm run build`), git-ignored, published |
65
- | `bin/chip-i18n.mjs` | the published binary, a wrapper over `lib/cli.js` |
1
+ # @chipmobilesdk/rn-i18n-tooling
2
+
3
+ The `chip-i18n` CLI: it scans a React Native app's source for translation keys and
4
+ synchronises the app's locale JSON files against what it finds.
5
+
6
+ - **Node, not React Native.** Nothing here runs on a device, and the package is a
7
+ `devDependency` of the app. The runtime library is
8
+ [`@chipmobilesdk/rn-i18n`](../rn-i18n/README.md).
9
+ - **Ships JavaScript.** The tarball carries `lib/` built from TypeScript plus the
10
+ `bin/chip-i18n.mjs` entry. This package exists because the tooling used to ship as
11
+ `.ts` source inside the runtime tarball, where the documented command — `node
12
+ --experimental-strip-types node_modules/@chipmobilesdk/rn-i18n/src/tooling/cli.ts` —
13
+ worked in this monorepo and nowhere else (I18N-01, DEP-02).
14
+ - **Public package.** Published under the `@chipmobilesdk` npm organization. The
15
+ license is `UNLICENSED`: the code is readable on npm, but
16
+ no open-source license is granted.
17
+ - **Version**: see [CHANGELOG](CHANGELOG.md)
18
+
19
+ ## Install
20
+
21
+ ```sh
22
+ npm i -D @chipmobilesdk/rn-i18n-tooling
23
+ ```
24
+
25
+ Node `>=22.13.0`.
26
+
27
+ ## Use
28
+
29
+ ```sh
30
+ npx chip-i18n sync # i18n-sync.config.json
31
+ npx chip-i18n sync --config other.config.json
32
+ npx chip-i18n --help
33
+ ```
34
+
35
+ The configuration file, the key patterns, the runtime-only key policy and the generated
36
+ typed-key contract are documented in the runtime package's README, under
37
+ `## Extraction & synchronization CLI` — the CLI reads the same config it always did.
38
+
39
+ Exit codes: `0` success or warnings, `1` blocking findings (a key with two different
40
+ default texts, a malformed locale file), `2` invalid configuration or usage.
41
+
42
+ A run that finds nothing to change **writes no file**: each locale file is compared
43
+ with what would be written and left alone when it matches. That makes the command safe
44
+ in a watch loop or a pre-commit hook, where rewriting identical bytes used to churn
45
+ mtimes and show work in `git status` that had not happened.
46
+
47
+ ## Programmatic use
48
+
49
+ The same functions are importable, for a repository that wants to drive extraction from
50
+ its own script:
51
+
52
+ ```ts
53
+ import { runSync, renderReport, scanSource } from '@chipmobilesdk/rn-i18n-tooling';
54
+ ```
55
+
56
+ `runSync(rootDir, config)` returns the report and whether the generated keys file
57
+ changed; `scanSource` is the scanner on its own. Both are the ones the CLI uses.
58
+
59
+ ## Repository layout
60
+
61
+ | | |
62
+ |---|---|
63
+ | `src/` | TypeScript sources; `cli.ts` is the command |
64
+ | `lib/` | build output (`npm run build`), git-ignored, published |
65
+ | `bin/chip-i18n.mjs` | the published binary, a wrapper over `lib/cli.js` |
package/bin/chip-i18n.mjs CHANGED
@@ -1,17 +1,17 @@
1
- #!/usr/bin/env node
2
- // The published entry point for `npx chip-i18n`. It is a hand-written wrapper
3
- // rather than the built `lib/cli.js` directly: a shebang in a TypeScript source
4
- // file is at the mercy of the emitter, and this file is also where the error for
5
- // "installed but never built" belongs.
6
- import { existsSync } from 'node:fs';
7
- import { fileURLToPath } from 'node:url';
8
-
9
- const cli = new URL('../lib/cli.js', import.meta.url);
10
- if (!existsSync(fileURLToPath(cli))) {
11
- console.error(
12
- '[chip-i18n] This package was installed without its build output. Reinstall it from npm, or run `npm run build` in packages/rn-i18n-tooling.',
13
- );
14
- process.exitCode = 2;
15
- } else {
16
- await import(cli.href);
17
- }
1
+ #!/usr/bin/env node
2
+ // The published entry point for `npx chip-i18n`. It is a hand-written wrapper
3
+ // rather than the built `lib/cli.js` directly: a shebang in a TypeScript source
4
+ // file is at the mercy of the emitter, and this file is also where the error for
5
+ // "installed but never built" belongs.
6
+ import { existsSync } from 'node:fs';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const cli = new URL('../lib/cli.js', import.meta.url);
10
+ if (!existsSync(fileURLToPath(cli))) {
11
+ console.error(
12
+ '[chip-i18n] This package was installed without its build output. Reinstall it from npm, or run `npm run build` in packages/rn-i18n-tooling.',
13
+ );
14
+ process.exitCode = 2;
15
+ } else {
16
+ await import(cli.href);
17
+ }
package/lib/cli.js CHANGED
@@ -13,10 +13,10 @@ import path from 'node:path';
13
13
  import process from 'node:process';
14
14
  import { renderReport } from "./report.js";
15
15
  import { SyncConfigError, runSync } from "./runner.js";
16
- const USAGE = `Usage: chip-i18n sync [--config <path>]
17
-
18
- sync Scan the configured source globs, update the locale files and report.
19
- --config defaults to i18n-sync.config.json, resolved from the current
16
+ const USAGE = `Usage: chip-i18n sync [--config <path>]
17
+
18
+ sync Scan the configured source globs, update the locale files and report.
19
+ --config defaults to i18n-sync.config.json, resolved from the current
20
20
  working directory.`;
21
21
  export function parseArgs(argv) {
22
22
  let configPath = 'i18n-sync.config.json';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipmobilesdk/rn-i18n-tooling",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "license": "UNLICENSED",
6
6
  "description": "The chip-i18n CLI: extracts translation keys from a React Native app's source and synchronises its locale files.",