@twin.org/merge-locales 0.0.1-next.2 → 0.0.1-next.20

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/bin/index.js CHANGED
File without changes
@@ -85,19 +85,20 @@ async function mergeLocales(workingDirectory, config) {
85
85
  }
86
86
  cliCore.CLIDisplay.break();
87
87
  const localeDictionaries = {};
88
- if (core.Is.stringValue(packageJson.name)) {
89
- await mergePackageLocales(path.join(workingDirectory, "locales"), packageJson.name, locales, localeDictionaries);
90
- }
91
88
  for (const packageName of packageNames) {
92
89
  const packageLocalDirectory = path.join(npmRoot, packageName, "locales");
93
90
  await mergePackageLocales(packageLocalDirectory, packageName, locales, localeDictionaries);
94
91
  }
92
+ // Merge the main package last so that it can override any other packages.
93
+ if (core.Is.stringValue(packageJson.name)) {
94
+ await mergePackageLocales(path.join(workingDirectory, "locales"), packageJson.name, locales, localeDictionaries);
95
+ }
95
96
  cliCore.CLIDisplay.break();
96
97
  cliCore.CLIDisplay.task(core.I18n.formatMessage("commands.merge-locales.progress.writingMergedLocales"));
97
98
  for (const localeDictionary in localeDictionaries) {
98
99
  const localeFile = path.join(outputDirectory, `${localeDictionary}.json`);
99
100
  cliCore.CLIDisplay.value(core.I18n.formatMessage("commands.merge-locales.labels.writingLocale"), localeFile, 1);
100
- await promises.writeFile(localeFile, JSON.stringify(localeDictionaries[localeDictionary], null, 2), "utf8");
101
+ await promises.writeFile(localeFile, `${JSON.stringify(localeDictionaries[localeDictionary], undefined, "\t")}\n`, "utf8");
101
102
  }
102
103
  cliCore.CLIDisplay.break();
103
104
  }
@@ -144,6 +145,15 @@ async function findDependencies(npmRoot, packageJsonPath, packageNames) {
144
145
  }
145
146
  }
146
147
  }
148
+ if (core.Is.objectValue(packageJson?.peerDependencies)) {
149
+ for (const pkg in packageJson.peerDependencies) {
150
+ if (pkg.startsWith("@twin.org") && !packageNames.includes(pkg)) {
151
+ packageNames.push(pkg);
152
+ const packagePath = path.join(npmRoot, pkg, "package.json");
153
+ await findDependencies(npmRoot, packagePath, packageNames);
154
+ }
155
+ }
156
+ }
147
157
  return packageJson ?? {};
148
158
  }
149
159
 
@@ -157,16 +167,19 @@ class CLI extends cliCore.CLIBase {
157
167
  * Run the app.
158
168
  * @param argv The process arguments.
159
169
  * @param localesDirectory The directory for the locales, default to relative to the script.
170
+ * @param options Additional options.
171
+ * @param options.overrideOutputWidth Override the output width.
160
172
  * @returns The exit code.
161
173
  */
162
- async run(argv, localesDirectory) {
174
+ async run(argv, localesDirectory, options) {
163
175
  return this.execute({
164
176
  title: "TWIN Merge Locales",
165
177
  appName: "merge-locales",
166
- version: "0.0.1-next.2",
178
+ version: "0.0.1-next.20", // x-release-please-version
167
179
  icon: "⚙️ ",
168
- supportsEnvFiles: false
169
- }, localesDirectory ?? path.join(path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))), "../locales"), argv);
180
+ supportsEnvFiles: false,
181
+ overrideOutputWidth: options?.overrideOutputWidth
182
+ }, localesDirectory ?? path.join(path.dirname(node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))), "../locales"), argv);
170
183
  }
171
184
  /**
172
185
  * Configure any options or actions at the root program level.
@@ -82,19 +82,20 @@ async function mergeLocales(workingDirectory, config) {
82
82
  }
83
83
  CLIDisplay.break();
84
84
  const localeDictionaries = {};
85
- if (Is.stringValue(packageJson.name)) {
86
- await mergePackageLocales(path.join(workingDirectory, "locales"), packageJson.name, locales, localeDictionaries);
87
- }
88
85
  for (const packageName of packageNames) {
89
86
  const packageLocalDirectory = path.join(npmRoot, packageName, "locales");
90
87
  await mergePackageLocales(packageLocalDirectory, packageName, locales, localeDictionaries);
91
88
  }
89
+ // Merge the main package last so that it can override any other packages.
90
+ if (Is.stringValue(packageJson.name)) {
91
+ await mergePackageLocales(path.join(workingDirectory, "locales"), packageJson.name, locales, localeDictionaries);
92
+ }
92
93
  CLIDisplay.break();
93
94
  CLIDisplay.task(I18n.formatMessage("commands.merge-locales.progress.writingMergedLocales"));
94
95
  for (const localeDictionary in localeDictionaries) {
95
96
  const localeFile = path.join(outputDirectory, `${localeDictionary}.json`);
96
97
  CLIDisplay.value(I18n.formatMessage("commands.merge-locales.labels.writingLocale"), localeFile, 1);
97
- await writeFile(localeFile, JSON.stringify(localeDictionaries[localeDictionary], null, 2), "utf8");
98
+ await writeFile(localeFile, `${JSON.stringify(localeDictionaries[localeDictionary], undefined, "\t")}\n`, "utf8");
98
99
  }
99
100
  CLIDisplay.break();
100
101
  }
@@ -141,6 +142,15 @@ async function findDependencies(npmRoot, packageJsonPath, packageNames) {
141
142
  }
142
143
  }
143
144
  }
145
+ if (Is.objectValue(packageJson?.peerDependencies)) {
146
+ for (const pkg in packageJson.peerDependencies) {
147
+ if (pkg.startsWith("@twin.org") && !packageNames.includes(pkg)) {
148
+ packageNames.push(pkg);
149
+ const packagePath = path.join(npmRoot, pkg, "package.json");
150
+ await findDependencies(npmRoot, packagePath, packageNames);
151
+ }
152
+ }
153
+ }
144
154
  return packageJson ?? {};
145
155
  }
146
156
 
@@ -154,15 +164,18 @@ class CLI extends CLIBase {
154
164
  * Run the app.
155
165
  * @param argv The process arguments.
156
166
  * @param localesDirectory The directory for the locales, default to relative to the script.
167
+ * @param options Additional options.
168
+ * @param options.overrideOutputWidth Override the output width.
157
169
  * @returns The exit code.
158
170
  */
159
- async run(argv, localesDirectory) {
171
+ async run(argv, localesDirectory, options) {
160
172
  return this.execute({
161
173
  title: "TWIN Merge Locales",
162
174
  appName: "merge-locales",
163
- version: "0.0.1-next.2",
175
+ version: "0.0.1-next.20", // x-release-please-version
164
176
  icon: "⚙️ ",
165
- supportsEnvFiles: false
177
+ supportsEnvFiles: false,
178
+ overrideOutputWidth: options?.overrideOutputWidth
166
179
  }, localesDirectory ?? path.join(path.dirname(fileURLToPath(import.meta.url)), "../locales"), argv);
167
180
  }
168
181
  /**
@@ -1,244 +1,261 @@
1
1
  {
2
- "error": {
3
- "commands": {
4
- "merge-locales": {
5
- "configFailed": "Configuration failed to load."
6
- },
7
- "common": {
8
- "missingEnv": "The \"{option}\" option is configured as an environment variable, but there is no environment variable with the name \"{value}\" set.",
9
- "optionInvalidHex": "The \"{option}\" does not appear to be hex. \"{value}\"",
10
- "optionInvalidBase64": "The \"{option}\" does not appear to be base64. \"{value}\"",
11
- "optionInvalidHexBase64": "The \"{option}\" does not appear to be hex or base64. \"{value}\"",
12
- "optionInvalidBech32": "The \"{option}\" does not appear to be bech32. \"{value}\"",
13
- "optionMinValue": "The \"{option}\" option must be greater than or equal to {minValue}, it is {value}.",
14
- "optionMaxValue": "The \"{option}\" option must be less than or equal to {maxValue}, it is {value}."
15
- }
16
- },
17
- "validation": {
18
- "beEmpty": "{fieldName} must be empty",
19
- "beNotEmpty": "{fieldName} must not be empty",
20
- "beText": "{fieldName} must be text",
21
- "beTextValue": "{fieldName} must contain some text",
22
- "beTextMinMax": "{fieldName} must be longer than {minLength} and shorter than {maxLength} characters",
23
- "beTextMin": "{fieldName} must be longer than {minLength} characters",
24
- "beTextMax": "{fieldName} must be shorter than {maxLength} characters",
25
- "beNumber": "{fieldName} must be a number",
26
- "beNumberMinMax": "{fieldName} must be >= {minValue} and <= {maxValue}",
27
- "beNumberMin": "{fieldName} must be >= {minValue}",
28
- "beNumberMax": "{fieldName} must be <= {maxValue}",
29
- "beWholeNumber": "{fieldName} must be a whole number",
30
- "beWholeNumberMinMax": "{fieldName} must be a whole number >= {minValue} and <= {maxValue}",
31
- "beWholeNumberMin": "{fieldName} must be a whole number >= {minValue}",
32
- "beWholeNumberMax": "{fieldName} must be a whole number <= {maxValue}",
33
- "beBigInteger": "{fieldName} must be a bigint",
34
- "beBigIntegerMinMax": "{fieldName} must be a bigint >= {minValue} and <= {maxValue}",
35
- "beBigIntegerMin": "{fieldName} must be a bigint >= {minValue}",
36
- "beBigIntegerMax": "{fieldName} must be a bigint <= {maxValue}",
37
- "beBoolean": "{fieldName} must be true or false",
38
- "beDate": "{fieldName} must be a date",
39
- "beDateTime": "{fieldName} must be a date/time",
40
- "beTime": "{fieldName} must be a time",
41
- "beTimestampMilliseconds": "{fieldName} must be a timestamp in milliseconds",
42
- "beTimestampSeconds": "{fieldName} must be a timestamp in seconds",
43
- "beObject": "{fieldName} must be an object",
44
- "beArray": "{fieldName} must be an array",
45
- "beArrayValue": "{fieldName} must be an array with at least one item",
46
- "beIncluded": "{fieldName} is unrecognised",
47
- "beByteArray": "{fieldName} must be a byte array",
48
- "beUrn": "{fieldName} must be a correctly formatted urn",
49
- "beUrl": "{fieldName} must be a correctly formatted url",
50
- "beJSON": "{fieldName} must be correctly formatted JSON",
51
- "beEmail": "{fieldName} must be a correctly formatted e-mail address",
52
- "failed": "Validation failed",
53
- "failedObject": "Validation of \"{objectName}\" failed"
54
- },
55
- "guard": {
56
- "undefined": "Property \"{property}\" must be defined, it is \"{value}\"",
57
- "string": "Property \"{property}\" must be a string, it is \"{value}\"",
58
- "stringEmpty": "Property \"{property}\" must have a value, it is empty",
59
- "stringBase64": "Property \"{property}\" must be a base64 encoded string, it is \"{value}\"",
60
- "stringBase64Url": "Property \"{property}\" must be a base64 url encoded string, it is \"{value}\"",
61
- "stringHex": "Property \"{property}\" must be a hex string, it is \"{value}\"",
62
- "stringHexLength": "Property \"{property}\" must be a hex string of length \"{options}\", it is \"{value}\"",
63
- "number": "Property \"{property}\" must be a number, it is \"{value}\"",
64
- "integer": "Property \"{property}\" must be an integer, it is \"{value}\"",
65
- "bigint": "Property \"{property}\" must be a bigint, it is \"{value}\"",
66
- "boolean": "Property \"{property}\" must be a boolean, it is \"{value}\"",
67
- "date": "Property \"{property}\" must be a date, it is \"{value}\"",
68
- "timestampMilliseconds": "Property \"{property}\" must be a timestamp in milliseconds, it is \"{value}\"",
69
- "timestampSeconds": "Property \"{property}\" must be a timestamp in seconds, it is \"{value}\"",
70
- "objectUndefined": "Property \"{property}\" must be an object, it is \"undefined\"",
71
- "object": "Property \"{property}\" must be an object, it is \"{value}\"",
72
- "objectValue": "Property \"{property}\" must be an object, with at least one property, it is \"{value}\"",
73
- "array": "Property \"{property}\" must be an array, it is \"{value}\"",
74
- "arrayValue": "Property \"{property}\" must be an array with at least one item",
75
- "arrayOneOf": "Property \"{property}\" must be one of [{options}], it is \"{value}\"",
76
- "uint8Array": "Property \"{property}\" must be a Uint8Array, it is \"{value}\"",
77
- "function": "Property \"{property}\" must be a function, it is \"{value}\"",
78
- "urn": "Property \"{property}\" must be a Urn formatted string, it is \"{value}\"",
79
- "url": "Property \"{property}\" must be a Url formatted string, it is \"{value}\"",
80
- "email": "Property \"{property}\" must be string in e-mail format, it is \"{value}\"",
81
- "length32Multiple": "Property \"{property}\" should be a multiple of 32, it is {value}",
82
- "lengthEntropy": "Property \"{property}\" should be a multiple of 4, >=16 and <= 32, it is {value}",
83
- "length3Multiple": "Property \"{property}\" should be a multiple of 3, it is {value}",
84
- "greaterThan0": "Property \"{property}\" must be greater than zero, it is {value}"
85
- },
86
- "objectHelper": {
87
- "failedBytesToJSON": "Failed converting bytes to JSON"
88
- },
89
- "common": {
90
- "notImplementedMethod": "The method \"{method}\" has not been implemented",
91
- "validation": "Validation failed"
92
- },
93
- "factory": {
94
- "noUnregister": "There is no {typeName} registered with the name \"{name}\"",
95
- "noGet": "The requested {typeName} \"{name}\" does not exist in the factory"
96
- },
97
- "bitString": {
98
- "outOfRange": "The index should be >= 0 and less than the length of the bit string"
99
- },
100
- "bip39": {
101
- "missingMnemonicWord": "The mnemonic contains a word not in the wordlist, \"{value}\"",
102
- "checksumMismatch": "The checksum does not match \"{newChecksum}\" != \"{checksumBits}\""
103
- },
104
- "ed25519": {
105
- "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
106
- "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
107
- },
108
- "secp256k1": {
109
- "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
110
- "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
111
- },
112
- "x25519": {
113
- "invalidPublicKey": "Invalid Ed25519 Public Key"
114
- },
115
- "blake2b": {
116
- "outputLength64": "The output length should be between 1 and 64, it is \"{outputLength}\"",
117
- "keyLength64": "The key length should be between 1 and 64, it is \"{keyLength}\""
118
- },
119
- "sha512": {
120
- "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
121
- },
122
- "sha256": {
123
- "bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
124
- },
125
- "hmacSha256": {
126
- "bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
127
- },
128
- "hmacSha512": {
129
- "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
130
- },
131
- "base32": {
132
- "invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
133
- },
134
- "base64": {
135
- "length4Multiple": "Invalid length should be a multiple of 4, it is \"{value}\""
136
- },
137
- "bech32": {
138
- "decodeFailed": "The address contains decoding failed for address \"{bech32}\"",
139
- "invalidChecksum": "The address contains an invalid checksum in address, \"{bech32}\"",
140
- "separatorMisused": "The separator character '1' should only be used between hrp and data, \"{bech32}\"",
141
- "lowerUpper": "The address my use either lowercase or uppercase, \"{bech32}\"",
142
- "dataTooShort": "The address does not contain enough data to decode, \"{bech32}\""
143
- },
144
- "pbkdf2": {
145
- "keyTooLong": "The requested key length \"{keyLength}\" is too long, based on the \"{macLength}\""
146
- },
147
- "chaCha20Poly1305": {
148
- "noAadWithData": "You can not set the aad when there is already data",
149
- "noAuthTag": "Can not finalise when the auth tag is not set",
150
- "authenticationFailed": "The data could not be authenticated",
151
- "authTagDecrypting": "Can not get the auth tag when decrypting",
152
- "authTagEncrypting": "Can not set the auth tag when encrypting",
153
- "noAuthTagSet": "The auth tag has not been set"
154
- },
155
- "bip44": {
156
- "unsupportedKeyType": "The key type \"{keyType}\" is not supported"
157
- },
158
- "slip0010": {
159
- "invalidSeed": "The seed is invalid \"{seed}\""
160
- }
161
- },
162
- "commands": {
163
- "merge-locales": {
164
- "options": {
165
- "config": {
166
- "param": "--config '<'file'>'",
167
- "description": "Path to the JSON configuration file."
168
- }
169
- },
170
- "progress": {
171
- "loadingConfigJson": "Loading Config JSON",
172
- "creatingOutputDirectory": "Creating Output Directory",
173
- "writingMergedLocales": "Writing Merged Locales",
174
- "mergingLocalesForPackage": "Merging Locales for Package"
175
- },
176
- "labels": {
177
- "configJson": "Config JSON",
178
- "workingDirectory": "Working Directory",
179
- "outputDirectory": "Output Directory",
180
- "npmRoot": "NPM Root",
181
- "sourcePackages": "Source Packages",
182
- "writingLocale": "Writing Locale",
183
- "mergingLocale": "Merging Locale"
184
- }
185
- }
186
- },
187
- "cli": {
188
- "progress": {
189
- "done": "Done.",
190
- "error": "Error",
191
- "loadingEnvFiles": "Loading env files",
192
- "pleaseWait": "Please wait...",
193
- "writingJsonFile": "Writing JSON file",
194
- "writingEnvFile": "Writing env file",
195
- "readingJsonFile": "Reading JSON file",
196
- "readingEnvFile": "Reading env file"
197
- },
198
- "options": {
199
- "lang": {
200
- "param": "--lang '<'lang'>'",
201
- "description": "The language to display the output in."
202
- },
203
- "load-env": {
204
- "param": "--load-env [env...]",
205
- "description": "Load the env files to initialise any environment variables."
206
- },
207
- "no-console": {
208
- "param": "--no-console",
209
- "description": "Hides the output in the console."
210
- },
211
- "json": {
212
- "param": "--json '<'filename'>'",
213
- "description": "Creates a JSON file containing the output."
214
- },
215
- "env": {
216
- "param": "--env '<'filename'>'",
217
- "description": "Creates an env file containing the output."
218
- },
219
- "merge-json": {
220
- "param": "--merge-json",
221
- "description": "If the JSON file already exists merge the data instead of overwriting."
222
- },
223
- "merge-env": {
224
- "param": "--merge-env",
225
- "description": "If the env file already exists merge the data instead of overwriting."
226
- }
227
- }
228
- },
229
- "errorNames": {
230
- "error": "Error",
231
- "generalError": "General",
232
- "guardError": "Guard",
233
- "conflictError": "Conflict",
234
- "notFoundError": "Not Found",
235
- "notSupportedError": "Not Supported",
236
- "alreadyExistsError": "Already Exists",
237
- "notImplementedError": "Not Implemented",
238
- "validationError": "Validation",
239
- "unprocessableError": "Unprocessable"
240
- },
241
- "validation": {
242
- "defaultFieldName": "The field"
243
- }
244
- }
2
+ "error": {
3
+ "commands": {
4
+ "common": {
5
+ "missingEnv": "The \"{option}\" option is configured as an environment variable, but there is no environment variable with the name \"{value}\" set.",
6
+ "optionInvalidHex": "The \"{option}\" does not appear to be hex. \"{value}\"",
7
+ "optionInvalidBase64": "The \"{option}\" does not appear to be base64. \"{value}\"",
8
+ "optionInvalidHexBase64": "The \"{option}\" does not appear to be hex or base64. \"{value}\"",
9
+ "optionInvalidBech32": "The \"{option}\" does not appear to be bech32. \"{value}\"",
10
+ "optionMinValue": "The \"{option}\" option must be greater than or equal to {minValue}, it is {value}.",
11
+ "optionMaxValue": "The \"{option}\" option must be less than or equal to {maxValue}, it is {value}."
12
+ },
13
+ "merge-locales": {
14
+ "configFailed": "Configuration failed to load."
15
+ }
16
+ },
17
+ "validation": {
18
+ "beEmpty": "{fieldName} must be empty",
19
+ "beNotEmpty": "{fieldName} must not be empty",
20
+ "beText": "{fieldName} must be text",
21
+ "beTextValue": "{fieldName} must contain some text",
22
+ "beTextMinMax": "{fieldName} must be longer than {minLength} and shorter than {maxLength} characters",
23
+ "beTextMin": "{fieldName} must be longer than {minLength} characters",
24
+ "beTextMax": "{fieldName} must be shorter than {maxLength} characters",
25
+ "beTextBase58": "{fieldName} must be text formatted using Base58 characters",
26
+ "beTextBase64": "{fieldName} must be text formatted using Base64 characters",
27
+ "beTextHex": "{fieldName} must be text formatted using Hex characters",
28
+ "beTextRegExp": "{fieldName} must be text formatted using the matching pattern {format}",
29
+ "beNumber": "{fieldName} must be a number",
30
+ "beNumberMinMax": "{fieldName} must be >= {minValue} and <= {maxValue}",
31
+ "beNumberMin": "{fieldName} must be >= {minValue}",
32
+ "beNumberMax": "{fieldName} must be <= {maxValue}",
33
+ "beWholeNumber": "{fieldName} must be a whole number",
34
+ "beWholeNumberMinMax": "{fieldName} must be a whole number >= {minValue} and <= {maxValue}",
35
+ "beWholeNumberMin": "{fieldName} must be a whole number >= {minValue}",
36
+ "beWholeNumberMax": "{fieldName} must be a whole number <= {maxValue}",
37
+ "beBigInteger": "{fieldName} must be a bigint",
38
+ "beBigIntegerMinMax": "{fieldName} must be a bigint >= {minValue} and <= {maxValue}",
39
+ "beBigIntegerMin": "{fieldName} must be a bigint >= {minValue}",
40
+ "beBigIntegerMax": "{fieldName} must be a bigint <= {maxValue}",
41
+ "beBoolean": "{fieldName} must be true or false",
42
+ "beDate": "{fieldName} must be a date",
43
+ "beDateTime": "{fieldName} must be a date/time",
44
+ "beTime": "{fieldName} must be a time",
45
+ "beTimestampMilliseconds": "{fieldName} must be a timestamp in milliseconds",
46
+ "beTimestampSeconds": "{fieldName} must be a timestamp in seconds",
47
+ "beObject": "{fieldName} must be an object",
48
+ "beArray": "{fieldName} must be an array",
49
+ "beArrayValue": "{fieldName} must be an array with at least one item",
50
+ "beIncluded": "{fieldName} is unrecognised",
51
+ "beByteArray": "{fieldName} must be a byte array",
52
+ "beUrn": "{fieldName} must be a correctly formatted urn",
53
+ "beUrl": "{fieldName} must be a correctly formatted url",
54
+ "beJSON": "{fieldName} must be correctly formatted JSON",
55
+ "beEmail": "{fieldName} must be a correctly formatted e-mail address",
56
+ "failed": "Validation failed",
57
+ "failedObject": "Validation of \"{objectName}\" failed"
58
+ },
59
+ "guard": {
60
+ "undefined": "Property \"{property}\" must be defined, it is \"{value}\"",
61
+ "string": "Property \"{property}\" must be a string, it is \"{value}\"",
62
+ "stringEmpty": "Property \"{property}\" must have a value, it is empty",
63
+ "stringBase64": "Property \"{property}\" must be a base64 encoded string, it is \"{value}\"",
64
+ "stringBase64Url": "Property \"{property}\" must be a base64 url encoded string, it is \"{value}\"",
65
+ "stringBase58": "Property \"{property}\" must be a base58 encoded string, it is \"{value}\"",
66
+ "stringHex": "Property \"{property}\" must be a hex string, it is \"{value}\"",
67
+ "stringHexLength": "Property \"{property}\" must be a hex string of length \"{options}\", it is \"{value}\"",
68
+ "stringJson": "Property \"{property}\" must be a JSON string",
69
+ "number": "Property \"{property}\" must be a number, it is \"{value}\"",
70
+ "integer": "Property \"{property}\" must be an integer, it is \"{value}\"",
71
+ "bigint": "Property \"{property}\" must be a bigint, it is \"{value}\"",
72
+ "boolean": "Property \"{property}\" must be a boolean, it is \"{value}\"",
73
+ "date": "Property \"{property}\" must be a date, it is \"{value}\"",
74
+ "timestampMilliseconds": "Property \"{property}\" must be a timestamp in milliseconds, it is \"{value}\"",
75
+ "timestampSeconds": "Property \"{property}\" must be a timestamp in seconds, it is \"{value}\"",
76
+ "objectUndefined": "Property \"{property}\" must be an object, it is \"undefined\"",
77
+ "object": "Property \"{property}\" must be an object, it is \"{value}\"",
78
+ "objectValue": "Property \"{property}\" must be an object, with at least one property, it is \"{value}\"",
79
+ "array": "Property \"{property}\" must be an array, it is \"{value}\"",
80
+ "arrayValue": "Property \"{property}\" must be an array with at least one item",
81
+ "arrayOneOf": "Property \"{property}\" must be one of [{options}], it is \"{value}\"",
82
+ "uint8Array": "Property \"{property}\" must be a Uint8Array, it is \"{value}\"",
83
+ "function": "Property \"{property}\" must be a function, it is \"{value}\"",
84
+ "urn": "Property \"{property}\" must be a Urn formatted string, it is \"{value}\"",
85
+ "url": "Property \"{property}\" must be a Url formatted string, it is \"{value}\"",
86
+ "email": "Property \"{property}\" must be string in e-mail format, it is \"{value}\"",
87
+ "length32Multiple": "Property \"{property}\" should be a multiple of 32, it is {value}",
88
+ "lengthEntropy": "Property \"{property}\" should be a multiple of 4, >=16 and <= 32, it is {value}",
89
+ "length3Multiple": "Property \"{property}\" should be a multiple of 3, it is {value}",
90
+ "greaterThan0": "Property \"{property}\" must be greater than zero, it is {value}"
91
+ },
92
+ "objectHelper": {
93
+ "failedBytesToJSON": "Failed converting bytes to JSON",
94
+ "cannotSetArrayIndex": "Cannot set property \"{property}\" using index \"{index}\" as it is not an array",
95
+ "cannotSetProperty": "Cannot set property \"{property}\" when the target is not an object"
96
+ },
97
+ "common": {
98
+ "notImplementedMethod": "The method \"{method}\" has not been implemented",
99
+ "validation": "Validation failed"
100
+ },
101
+ "factory": {
102
+ "noUnregister": "There is no {typeName} registered with the name \"{name}\"",
103
+ "noGet": "The requested {typeName} \"{name}\" does not exist in the factory"
104
+ },
105
+ "bitString": {
106
+ "outOfRange": "The index should be >= 0 and less than the length of the bit string"
107
+ },
108
+ "base32": {
109
+ "invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
110
+ },
111
+ "base64": {
112
+ "length4Multiple": "Invalid length should be a multiple of 4, it is \"{value}\""
113
+ },
114
+ "base58": {
115
+ "invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
116
+ },
117
+ "jsonHelper": {
118
+ "failedPatch": "Failed to patch the JSON object, patch index \"{index}\" failed"
119
+ },
120
+ "bip39": {
121
+ "missingMnemonicWord": "The mnemonic contains a word not in the wordlist, \"{value}\"",
122
+ "checksumMismatch": "The checksum does not match \"{newChecksum}\" != \"{checksumBits}\""
123
+ },
124
+ "ed25519": {
125
+ "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
126
+ "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
127
+ },
128
+ "secp256k1": {
129
+ "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
130
+ "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
131
+ },
132
+ "x25519": {
133
+ "invalidPublicKey": "Invalid Ed25519 Public Key"
134
+ },
135
+ "blake2b": {
136
+ "outputLength64": "The output length should be between 1 and 64, it is \"{outputLength}\"",
137
+ "keyLength64": "The key length should be between 1 and 64, it is \"{keyLength}\""
138
+ },
139
+ "sha512": {
140
+ "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
141
+ },
142
+ "sha256": {
143
+ "bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
144
+ },
145
+ "sha3": {
146
+ "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
147
+ },
148
+ "hmacSha256": {
149
+ "bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
150
+ },
151
+ "hmacSha512": {
152
+ "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
153
+ },
154
+ "bech32": {
155
+ "decodeFailed": "The address contains decoding failed for address \"{bech32}\"",
156
+ "invalidChecksum": "The address contains an invalid checksum in address, \"{bech32}\"",
157
+ "separatorMisused": "The separator character '1' should only be used between hrp and data, \"{bech32}\"",
158
+ "lowerUpper": "The address my use either lowercase or uppercase, \"{bech32}\"",
159
+ "dataTooShort": "The address does not contain enough data to decode, \"{bech32}\""
160
+ },
161
+ "pbkdf2": {
162
+ "keyTooLong": "The requested key length \"{keyLength}\" is too long, based on the \"{macLength}\""
163
+ },
164
+ "chaCha20Poly1305": {
165
+ "noAadWithData": "You can not set the aad when there is already data",
166
+ "noAuthTag": "Can not finalise when the auth tag is not set",
167
+ "authenticationFailed": "The data could not be authenticated",
168
+ "authTagDecrypting": "Can not get the auth tag when decrypting",
169
+ "authTagEncrypting": "Can not set the auth tag when encrypting",
170
+ "noAuthTagSet": "The auth tag has not been set"
171
+ },
172
+ "bip44": {
173
+ "unsupportedKeyType": "The key type \"{keyType}\" is not supported"
174
+ },
175
+ "slip0010": {
176
+ "invalidSeed": "The seed is invalid \"{seed}\""
177
+ }
178
+ },
179
+ "cli": {
180
+ "progress": {
181
+ "done": "Done.",
182
+ "error": "Error",
183
+ "loadingEnvFiles": "Loading env files",
184
+ "pleaseWait": "Please wait...",
185
+ "writingJsonFile": "Writing JSON file",
186
+ "writingEnvFile": "Writing env file",
187
+ "readingJsonFile": "Reading JSON file",
188
+ "readingEnvFile": "Reading env file"
189
+ },
190
+ "options": {
191
+ "lang": {
192
+ "param": "--lang '<'lang'>'",
193
+ "description": "The language to display the output in."
194
+ },
195
+ "load-env": {
196
+ "param": "--load-env [env...]",
197
+ "description": "Load the env files to initialise any environment variables."
198
+ },
199
+ "no-console": {
200
+ "param": "--no-console",
201
+ "description": "Hides the output in the console."
202
+ },
203
+ "json": {
204
+ "param": "--json '<'filename'>'",
205
+ "description": "Creates a JSON file containing the output."
206
+ },
207
+ "env": {
208
+ "param": "--env '<'filename'>'",
209
+ "description": "Creates an env file containing the output."
210
+ },
211
+ "merge-json": {
212
+ "param": "--merge-json",
213
+ "description": "If the JSON file already exists merge the data instead of overwriting."
214
+ },
215
+ "merge-env": {
216
+ "param": "--merge-env",
217
+ "description": "If the env file already exists merge the data instead of overwriting."
218
+ }
219
+ }
220
+ },
221
+ "errorNames": {
222
+ "error": "Error",
223
+ "generalError": "General",
224
+ "guardError": "Guard",
225
+ "conflictError": "Conflict",
226
+ "notFoundError": "Not Found",
227
+ "notSupportedError": "Not Supported",
228
+ "alreadyExistsError": "Already Exists",
229
+ "notImplementedError": "Not Implemented",
230
+ "validationError": "Validation",
231
+ "unprocessableError": "Unprocessable"
232
+ },
233
+ "validation": {
234
+ "defaultFieldName": "The field"
235
+ },
236
+ "commands": {
237
+ "merge-locales": {
238
+ "options": {
239
+ "config": {
240
+ "param": "--config '<'file'>'",
241
+ "description": "Path to the JSON configuration file."
242
+ }
243
+ },
244
+ "progress": {
245
+ "loadingConfigJson": "Loading Config JSON",
246
+ "creatingOutputDirectory": "Creating Output Directory",
247
+ "writingMergedLocales": "Writing Merged Locales",
248
+ "mergingLocalesForPackage": "Merging Locales for Package"
249
+ },
250
+ "labels": {
251
+ "configJson": "Config JSON",
252
+ "workingDirectory": "Working Directory",
253
+ "outputDirectory": "Output Directory",
254
+ "npmRoot": "NPM Root",
255
+ "sourcePackages": "Source Packages",
256
+ "writingLocale": "Writing Locale",
257
+ "mergingLocale": "Merging Locale"
258
+ }
259
+ }
260
+ }
261
+ }
@@ -8,9 +8,13 @@ export declare class CLI extends CLIBase {
8
8
  * Run the app.
9
9
  * @param argv The process arguments.
10
10
  * @param localesDirectory The directory for the locales, default to relative to the script.
11
+ * @param options Additional options.
12
+ * @param options.overrideOutputWidth Override the output width.
11
13
  * @returns The exit code.
12
14
  */
13
- run(argv: string[], localesDirectory?: string): Promise<number>;
15
+ run(argv: string[], localesDirectory?: string, options?: {
16
+ overrideOutputWidth?: number;
17
+ }): Promise<number>;
14
18
  /**
15
19
  * Configure any options or actions at the root program level.
16
20
  * @param program The root program command.
@@ -12,4 +12,10 @@ export interface IPackageJson {
12
12
  dependencies?: {
13
13
  [id: string]: string;
14
14
  };
15
+ /**
16
+ * The peer dependencies for the package.
17
+ */
18
+ peerDependencies?: {
19
+ [id: string]: string;
20
+ };
15
21
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @twin.org/ts-to-openapi - Changelog
2
2
 
3
- ## v0.0.1-next.2
3
+ ## [0.0.1-next.20](https://github.com/twinfoundation/tools/compare/merge-locales-v0.0.1-next.19...merge-locales-v0.0.1-next.20) (2025-03-28)
4
+
5
+
6
+ ### Miscellaneous Chores
7
+
8
+ * **merge-locales:** Synchronize repo versions
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/nameof bumped from 0.0.1-next.19 to 0.0.1-next.20
16
+ * devDependencies
17
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.19 to 0.0.1-next.20
18
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.19 to 0.0.1-next.20
19
+
20
+ ## [0.0.1-next.19](https://github.com/twinfoundation/tools/compare/merge-locales-v0.0.1-next.18...merge-locales-v0.0.1-next.19) (2025-03-26)
21
+
22
+
23
+ ### Miscellaneous Chores
24
+
25
+ * **merge-locales:** Synchronize repo versions
26
+
27
+
28
+ ### Dependencies
29
+
30
+ * The following workspace dependencies were updated
31
+ * dependencies
32
+ * @twin.org/nameof bumped from 0.0.1-next.18 to 0.0.1-next.19
33
+ * devDependencies
34
+ * @twin.org/nameof-transformer bumped from 0.0.1-next.18 to 0.0.1-next.19
35
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.1-next.18 to 0.0.1-next.19
36
+
37
+ ## v0.0.1-next.18
4
38
 
5
39
  - Initial Release
@@ -24,20 +24,34 @@ The main entry point for the CLI.
24
24
 
25
25
  ### run()
26
26
 
27
- > **run**(`argv`, `localesDirectory`?): `Promise`\<`number`\>
27
+ > **run**(`argv`, `localesDirectory`?, `options`?): `Promise`\<`number`\>
28
28
 
29
29
  Run the app.
30
30
 
31
31
  #### Parameters
32
32
 
33
- **argv**: `string`[]
33
+ ##### argv
34
+
35
+ `string`[]
34
36
 
35
37
  The process arguments.
36
38
 
37
- **localesDirectory?**: `string`
39
+ ##### localesDirectory?
40
+
41
+ `string`
38
42
 
39
43
  The directory for the locales, default to relative to the script.
40
44
 
45
+ ##### options?
46
+
47
+ Additional options.
48
+
49
+ ###### overrideOutputWidth?
50
+
51
+ `number`
52
+
53
+ Override the output width.
54
+
41
55
  #### Returns
42
56
 
43
57
  `Promise`\<`number`\>
@@ -54,7 +68,9 @@ Configure any options or actions at the root program level.
54
68
 
55
69
  #### Parameters
56
70
 
57
- **program**: `Command`
71
+ ##### program
72
+
73
+ `Command`
58
74
 
59
75
  The root program command.
60
76
 
@@ -6,11 +6,13 @@ Action the root command.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **opts**
9
+ ### opts
10
10
 
11
11
  The options for the command.
12
12
 
13
- **opts.config?**: `string`
13
+ #### config?
14
+
15
+ `string`
14
16
 
15
17
  The optional configuration file.
16
18
 
@@ -6,7 +6,9 @@ Build the root command to be consumed by the CLI.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **program**: `Command`
9
+ ### program
10
+
11
+ `Command`
10
12
 
11
13
  The command to build on.
12
14
 
@@ -6,11 +6,15 @@ Merge the locales.
6
6
 
7
7
  ## Parameters
8
8
 
9
- **workingDirectory**: `string`
9
+ ### workingDirectory
10
+
11
+ `string`
10
12
 
11
13
  The folder the app was run from.
12
14
 
13
- **config**: [`IMergeLocalesConfig`](../interfaces/IMergeLocalesConfig.md)
15
+ ### config
16
+
17
+ [`IMergeLocalesConfig`](../interfaces/IMergeLocalesConfig.md)
14
18
 
15
19
  The configuration for the app.
16
20
 
package/locales/en.json CHANGED
@@ -35,6 +35,12 @@
35
35
  "progress": {
36
36
  "done": "Done.",
37
37
  "error": "Error"
38
+ },
39
+ "options": {
40
+ "lang": {
41
+ "param": "--lang '<'lang'>'",
42
+ "description": "The language to display the output in."
43
+ }
38
44
  }
39
45
  }
40
46
  }
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@twin.org/merge-locales",
3
- "version": "0.0.1-next.2",
3
+ "version": "0.0.1-next.20",
4
4
  "description": "Tool to merge locale files from all dependencies",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/twinfoundation/tools.git",
8
- "directory": "packages/merge-locales"
8
+ "directory": "apps/merge-locales"
9
9
  },
10
10
  "author": "martyn.janes@iota.org",
11
11
  "license": "Apache-2.0",
@@ -13,49 +13,21 @@
13
13
  "engines": {
14
14
  "node": ">=20.0.0"
15
15
  },
16
- "scripts": {
17
- "clean": "rimraf dist coverage",
18
- "build": "tspc",
19
- "merge-locales": "copyfiles locales/en.json dist && npm run bundle:esm && node bin/index.js",
20
- "test": "vitest --run --config ./vitest.config.ts --no-cache",
21
- "coverage": "vitest --run --coverage --config ./vitest.config.ts --no-cache",
22
- "bundle:esm": "rollup --config rollup.config.mjs --environment MODULE:esm",
23
- "bundle:cjs": "rollup --config rollup.config.mjs --environment MODULE:cjs",
24
- "bundle": "npm run bundle:esm && npm run bundle:cjs",
25
- "docs:clean": "rimraf docs/reference",
26
- "docs:generate": "typedoc",
27
- "docs": "npm run docs:clean && npm run docs:generate",
28
- "dist": "npm run clean && npm run build && npm run merge-locales && npm run test && npm run bundle && npm run docs"
29
- },
30
16
  "dependencies": {
31
17
  "@twin.org/cli-core": "next",
32
18
  "@twin.org/core": "next",
33
- "@twin.org/nameof": "0.0.1-next.2",
34
- "commander": "12.1.0",
35
- "glob": "11.0.0"
36
- },
37
- "devDependencies": {
38
- "@twin.org/nameof-transformer": "0.0.1-next.2",
39
- "@types/node": "22.5.5",
40
- "@vitest/coverage-v8": "2.1.1",
41
- "copyfiles": "2.4.1",
42
- "rimraf": "6.0.1",
43
- "rollup": "4.21.3",
44
- "rollup-plugin-typescript2": "0.36.0",
45
- "ts-patch": "3.2.1",
46
- "typedoc": "0.26.7",
47
- "typedoc-plugin-markdown": "4.2.7",
48
- "typescript": "5.6.2",
49
- "vitest": "2.1.1"
19
+ "@twin.org/nameof": "0.0.1-next.20",
20
+ "commander": "13.1.0",
21
+ "glob": "11.0.1"
50
22
  },
51
23
  "main": "./dist/cjs/index.cjs",
52
24
  "module": "./dist/esm/index.mjs",
53
25
  "types": "./dist/types/index.d.ts",
54
26
  "exports": {
55
27
  ".": {
28
+ "types": "./dist/types/index.d.ts",
56
29
  "require": "./dist/cjs/index.cjs",
57
- "import": "./dist/esm/index.mjs",
58
- "types": "./dist/types/index.d.ts"
30
+ "import": "./dist/esm/index.mjs"
59
31
  }
60
32
  },
61
33
  "files": [