i18nexus-cli 3.3.1 → 3.4.0

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 CHANGED
@@ -6,14 +6,15 @@
6
6
 
7
7
  [i18nexus](https://i18nexus.com) is a translation management web application designed for use with i18next, next-intl, and react-intl. Learn more with these quick tutorials:
8
8
 
9
- - [next-i18next Walkthrough](https://i18nexus.com/tutorials/nextjs/next-i18next)
10
- - [next-intl Walkthrough](https://i18nexus.com/tutorials/nextjs/next-intl)
11
9
  - [react-i18next Walkthrough](https://i18nexus.com/tutorials/react/react-i18next)
12
10
  - [react-intl Walkthrough](https://i18nexus.com/tutorials/react/react-intl)
11
+ - [next-intl for Next.js App Router Walkthrough](https://i18nexus.com/tutorials/nextjs/next-intl)
12
+ - [react-i18next for Next.js App Router Walkthrough](https://i18nexus.com/tutorials/nextjs/react-i18next)
13
+ - [next-i18next for Next.js Pages Router Walkthrough](https://i18nexus.com/tutorials/nextjs/next-i18next)
13
14
 
14
15
  ## Who is this CLI meant for?
15
16
 
16
- - Developers who prefer to download and bundle their translation files with their app (especially useful for those who use SSR/SSG and libraries like Next.js).
17
+ - Developers who prefer to download and bundle their translation files with their app (especially useful for those who use SSR/SSG frameworks such as Next.js).
17
18
  - Developers who wish to add, edit, or delete strings in their i18nexus project from the command line.
18
19
 
19
20
  ## Installation
@@ -89,6 +90,7 @@ If you wish to download your files to a different directory, you can use the `--
89
90
  | `--api-key` or `-k` | |
90
91
  | `--path` or `-p` | (See above) |
91
92
  | `--ver` or `-v` | `latest` |
93
+ | `--confirmed` | `false` |
92
94
  | `--clean` | `false` |
93
95
 
94
96
  ### Notes
@@ -102,6 +104,9 @@ The path to the destination folder in which translation files will be downloaded
102
104
  `--ver`
103
105
  The version of your project's translations to be downloaded (Can also be set using environment variable `I18NEXUS_VERSION`)
104
106
 
107
+ `--confirmed`
108
+ Downloads only translations that have been confirmed in i18nexus
109
+
105
110
  `--clean`
106
111
  Before download, clears your destination folder specified in --path. As a safety precaution, this only deletes folders with names that match a simple language code regex. You should still ensure you are not storing any files in your destination folder that you do not want deleted.
107
112
 
package/bin/index.js CHANGED
@@ -36,6 +36,11 @@ program
36
36
  '-p, --path <path>',
37
37
  'The path to the destination folder in which translation files will be downloaded'
38
38
  )
39
+ .option(
40
+ '--confirmed',
41
+ 'Only downloads confirmed translations (Cannot be used with `version`)',
42
+ false
43
+ )
39
44
  .option(
40
45
  '--clean',
41
46
  'Removes and rebuilds destination folder before download',
@@ -46,7 +51,8 @@ program
46
51
  apiKey: options.apiKey,
47
52
  version: options.ver,
48
53
  path: options.path,
49
- clean: options.clean
54
+ clean: options.clean,
55
+ confirmed: options.confirmed
50
56
  });
51
57
  });
52
58
 
package/commands/pull.js CHANGED
@@ -17,7 +17,7 @@ const cleanDirectory = path => {
17
17
 
18
18
  contents.forEach(name => {
19
19
  if (regex.test(name)) {
20
- fs.rmdirSync(`${path}/${name}`, { recursive: true });
20
+ fs.rmSync(`${path}/${name}`, { recursive: true });
21
21
  }
22
22
  });
23
23
  };
@@ -61,6 +61,11 @@ const pull = async opt => {
61
61
 
62
62
  const usingVersion = opt.version !== 'latest';
63
63
 
64
+ if (usingVersion && opt.confirmed) {
65
+ console.log(colors.red('The --confirmed flag cannot be used with version'));
66
+ return process.exit(1);
67
+ }
68
+
64
69
  console.log(`Downloading translations to ${path}...`);
65
70
 
66
71
  const lngResponse = await handleFetch(
@@ -91,6 +96,10 @@ const pull = async opt => {
91
96
 
92
97
  url += `?api_key=${opt.apiKey}`;
93
98
 
99
+ if (opt.confirmed) {
100
+ url += '&confirmed=true';
101
+ }
102
+
94
103
  const response = await handleFetch(url);
95
104
 
96
105
  if (response.status !== 200) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18nexus-cli",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
4
4
  "description": "Command line interface (CLI) for accessing the i18nexus API",
5
5
  "main": "index.js",
6
6
  "bin": {