@vocab/cli
Advanced tools
Comparing version 0.0.8 to 0.0.9
# @vocab/cli | ||
## 0.0.9 | ||
### Patch Changes | ||
- [`5f5c581`](https://github.com/seek-oss/vocab/commit/5f5c581a65bff28729ee19e1ec0bdea488a9d6c2) [#19](https://github.com/seek-oss/vocab/pull/19) Thanks [@jahredhope](https://github.com/jahredhope)! - Compile useable TypeScript importable files with `vocab compile`. | ||
The new `vocab compile` step replaces `vocab generate-types` in creating a fully functional **translations.ts** file. | ||
This allows vocab to be used **without the Webpack Plugin**, however use of the plugin is still heavily advised to ensure optimal loading of translation content on the web. | ||
Support for unit testing is now better than ever! The newly created **translations.ts** means your unit test code will see the same code as available while rendering. | ||
See the [documentation](https://github.com/seek-oss/vocab) for further usage details. | ||
- Updated dependencies [[`5f5c581`](https://github.com/seek-oss/vocab/commit/5f5c581a65bff28729ee19e1ec0bdea488a9d6c2), [`02f943c`](https://github.com/seek-oss/vocab/commit/02f943ca892913b41f9e4720a72400777cf14b3d)]: | ||
- @vocab/core@0.0.4 | ||
- @vocab/phrase@0.0.4 | ||
## 0.0.8 | ||
@@ -4,0 +22,0 @@ |
@@ -49,3 +49,3 @@ 'use strict'; | ||
}).command({ | ||
command: 'generate-types', | ||
command: 'compile', | ||
builder: () => yargs__default['default'].options({ | ||
@@ -60,3 +60,3 @@ watch: { | ||
}) => { | ||
await core.generateAllTypes({ | ||
await core.compile({ | ||
watch | ||
@@ -63,0 +63,0 @@ }, config); |
@@ -49,3 +49,3 @@ 'use strict'; | ||
}).command({ | ||
command: 'generate-types', | ||
command: 'compile', | ||
builder: () => yargs__default['default'].options({ | ||
@@ -60,3 +60,3 @@ watch: { | ||
}) => { | ||
await core.generateAllTypes({ | ||
await core.compile({ | ||
watch | ||
@@ -63,0 +63,0 @@ }, config); |
import { push, pull } from '@vocab/phrase'; | ||
import { resolveConfig, generateAllTypes, validate } from '@vocab/core'; | ||
import { resolveConfig, compile, validate } from '@vocab/core'; | ||
import yargs from 'yargs'; | ||
@@ -42,3 +42,3 @@ import envCi from 'env-ci'; | ||
}).command({ | ||
command: 'generate-types', | ||
command: 'compile', | ||
builder: () => yargs.options({ | ||
@@ -53,3 +53,3 @@ watch: { | ||
}) => { | ||
await generateAllTypes({ | ||
await compile({ | ||
watch | ||
@@ -56,0 +56,0 @@ }, config); |
{ | ||
"name": "@vocab/cli", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"main": "dist/vocab-cli.cjs.js", | ||
@@ -13,4 +13,4 @@ "module": "dist/vocab-cli.esm.js", | ||
"@types/env-ci": "^3.1.0", | ||
"@vocab/core": "^0.0.3", | ||
"@vocab/phrase": "^0.0.3", | ||
"@vocab/core": "^0.0.4", | ||
"@vocab/phrase": "^0.0.4", | ||
"env-ci": "^5.0.2", | ||
@@ -17,0 +17,0 @@ "fast-glob": "^3.2.4", |
@@ -71,4 +71,6 @@ # Vocab | ||
**./translations.json** | ||
**Note:** Currently, to create a new translation it must be placed inside a **`__translations__`** folder, this folder name can be configured with `translationsDirname` configuration. | ||
**`./__translations__/translations.json`** | ||
```json | ||
@@ -83,2 +85,5 @@ { | ||
Then run `vocab compile`. Or `vocab compile --watch`. | ||
This will create new `translation.ts` files for each `translation.json` file. | ||
You can then import these translations into your React components. Translations can be used by calling the `t` function returned by `useTranslation`. | ||
@@ -90,3 +95,3 @@ | ||
import { useTranslation } from '@vocab/react'; | ||
import translations from './translations.json'; | ||
import translations from './translations'; | ||
@@ -156,3 +161,3 @@ function MyComponent({ children }) { | ||
Vocab generates custom `translation.json.d.ts` files that give your React components strongly typed translations to work with. | ||
Vocab generates custom `translation.ts` files that give your React components strongly typed translations to work with. | ||
@@ -162,5 +167,11 @@ To generate these types run: | ||
```bash | ||
$ vocab generate-types | ||
$ vocab compile | ||
``` | ||
Or to rerun the compiler when files change use: | ||
```bash | ||
$ vocab compile --watch | ||
``` | ||
## External translation tooling | ||
@@ -167,0 +178,0 @@ |
/* eslint-disable no-console */ | ||
import type { UserConfig } from '@vocab/types'; | ||
import { pull, push } from '@vocab/phrase'; | ||
import { resolveConfig, generateAllTypes, validate } from '@vocab/core'; | ||
import { resolveConfig, compile, validate } from '@vocab/core'; | ||
import yargs from 'yargs'; | ||
@@ -45,3 +45,3 @@ | ||
.command({ | ||
command: 'generate-types', | ||
command: 'compile', | ||
builder: () => | ||
@@ -52,3 +52,3 @@ yargs.options({ | ||
handler: async ({ watch }) => { | ||
await generateAllTypes({ watch }, config!); | ||
await compile({ watch }, config!); | ||
}, | ||
@@ -55,0 +55,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18033
188
+ Added@vocab/core@0.0.4(transitive)
+ Added@vocab/phrase@0.0.4(transitive)
+ Added@vocab/types@0.0.5(transitive)
- Removed@vocab/core@0.0.3(transitive)
- Removed@vocab/phrase@0.0.3(transitive)
- Removed@vocab/types@0.0.4(transitive)
Updated@vocab/core@^0.0.4
Updated@vocab/phrase@^0.0.4