locize-cli 10.4.0 → 11.0.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/CHANGELOG.md +5 -0
- package/README.md +6 -0
- package/add.js +1 -8
- package/bin/locize +272 -125
- package/copyVersion.js +1 -1
- package/createBranch.js +1 -1
- package/deleteBranch.js +2 -2
- package/deleteNamespace.js +1 -1
- package/download.js +4 -4
- package/get.js +1 -2
- package/getBranches.js +1 -1
- package/getJob.js +1 -1
- package/getProjectStats.js +1 -1
- package/getRemoteLanguages.js +1 -1
- package/getRemoteNamespace.js +2 -2
- package/mergeBranch.js +2 -2
- package/migrate.js +3 -4
- package/missing.js +1 -1
- package/package.json +1 -1
- package/publishVersion.js +1 -1
- package/removeVersion.js +1 -1
- package/sync.js +9 -9
package/bin/locize
CHANGED
|
@@ -12,12 +12,15 @@ const configInHome = path.join(os.homedir(), '.locize')
|
|
|
12
12
|
const configInWorkingDirectory = path.join(process.cwd(), '.locize')
|
|
13
13
|
const dotEnvFile = path.join(process.cwd(), '.env')
|
|
14
14
|
if (fs.existsSync(dotEnvFile)) require('dotenv').config()
|
|
15
|
+
// TODO: change this to 'standard' on next major version
|
|
15
16
|
const defaultCdnType = 'pro'
|
|
17
|
+
// TODO: remove this on next major version
|
|
16
18
|
const getApiPath = (cdnType) => `https://api${(cdnType || defaultCdnType) === 'standard' ? '.lite' : ''}.locize.app`
|
|
17
19
|
const getAddPath = (cdnType) => `${getApiPath(cdnType || defaultCdnType)}/update/{{projectId}}/{{version}}/{{lng}}/{{ns}}`
|
|
18
20
|
const getGetPath = (cdnType) => `${getApiPath(cdnType || defaultCdnType)}/{{projectId}}/{{version}}/{{lng}}/{{ns}}`
|
|
19
21
|
const addPathUrl = getAddPath(defaultCdnType)
|
|
20
22
|
const getPathUrl = getGetPath(defaultCdnType)
|
|
23
|
+
|
|
21
24
|
const fixApiPath = (p, cdnType) => {
|
|
22
25
|
if (p.indexOf('.locize.app') < 0) return p
|
|
23
26
|
if (p.indexOf('.lite.locize.app') > 0) {
|
|
@@ -26,6 +29,7 @@ const fixApiPath = (p, cdnType) => {
|
|
|
26
29
|
return p.replace('.locize.app', `${(cdnType || defaultCdnType) === 'standard' ? '.lite' : ''}.locize.app`)
|
|
27
30
|
}
|
|
28
31
|
}
|
|
32
|
+
const defaultApiEndpoint = fixApiPath('https://api.locize.app', defaultCdnType)
|
|
29
33
|
|
|
30
34
|
const migrate = require('../migrate')
|
|
31
35
|
const add = require('../add')
|
|
@@ -68,7 +72,9 @@ program
|
|
|
68
72
|
.option('-L, --parse-language <true|false>', 'Parse folders as language (default: true)', 'true')
|
|
69
73
|
.option('-f, --format <json>', 'File format of namespaces (default: json)', 'json')
|
|
70
74
|
.option('-r, --replace <true|false>', 'This will empty the optionally existing namespace before saving the new translations. (default: false)', 'false')
|
|
75
|
+
// TODO: remove this on next major version
|
|
71
76
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
77
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
72
78
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
73
79
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
74
80
|
.action((options) => {
|
|
@@ -77,26 +83,37 @@ program
|
|
|
77
83
|
} catch (e) {}
|
|
78
84
|
|
|
79
85
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
86
|
+
// TODO: remove this on next major version
|
|
87
|
+
if (!cdnType) {
|
|
88
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
89
|
+
}
|
|
90
|
+
// TODO: remove this on next major version
|
|
83
91
|
let addPath = options.addPath || config.addPath
|
|
92
|
+
if (addPath) {
|
|
93
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
94
|
+
}
|
|
95
|
+
// TODO: remove this on next major version
|
|
84
96
|
if (!addPath) {
|
|
85
97
|
addPath = getAddPath(cdnType) || addPathUrl
|
|
86
98
|
} else if (cdnType) {
|
|
87
99
|
addPath = fixApiPath(addPath, cdnType)
|
|
88
100
|
}
|
|
89
101
|
|
|
102
|
+
// TODO: remove and adjust this on next major version
|
|
103
|
+
const apiPath = new URL(addPath)
|
|
104
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
105
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
106
|
+
|
|
90
107
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
91
108
|
if (!apiKey) {
|
|
92
|
-
console.error(' error: missing required argument `apiKey`')
|
|
109
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
93
110
|
process.exit(1)
|
|
94
111
|
return
|
|
95
112
|
}
|
|
96
113
|
|
|
97
114
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
98
115
|
if (!projectId) {
|
|
99
|
-
console.error(' error: missing required argument `projectId`')
|
|
116
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
100
117
|
process.exit(1)
|
|
101
118
|
return
|
|
102
119
|
}
|
|
@@ -107,13 +124,11 @@ program
|
|
|
107
124
|
options.path = path.join(process.cwd(), options.path)
|
|
108
125
|
}
|
|
109
126
|
|
|
110
|
-
const apiPath = new URL(addPath)
|
|
111
|
-
|
|
112
127
|
migrate({
|
|
113
128
|
cdnType: cdnType || defaultCdnType,
|
|
114
129
|
apiKey,
|
|
115
130
|
projectId,
|
|
116
|
-
|
|
131
|
+
apiEndpoint,
|
|
117
132
|
path: options.path,
|
|
118
133
|
language: options.language || config.language || config.lng || process.env.LOCIZE_LANGUAGE || process.env.LOCIZE_LANG || process.env.LOCIZE_LNG,
|
|
119
134
|
version,
|
|
@@ -139,7 +154,9 @@ program
|
|
|
139
154
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
140
155
|
.option('-l, --language <lng>', 'The language that should be targeted')
|
|
141
156
|
.option('-v, --ver <version>', 'The version that should be targeted (default: latest)')
|
|
157
|
+
// TODO: remove this on next major version
|
|
142
158
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
159
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
143
160
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
144
161
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
145
162
|
.action((namespace, key, value, options) => {
|
|
@@ -148,47 +165,55 @@ program
|
|
|
148
165
|
} catch (e) {}
|
|
149
166
|
|
|
150
167
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
168
|
+
// TODO: remove this on next major version
|
|
169
|
+
if (!cdnType) {
|
|
170
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
171
|
+
}
|
|
172
|
+
// TODO: remove this on next major version
|
|
155
173
|
let addPath = options.addPath || config.addPath
|
|
174
|
+
if (addPath) {
|
|
175
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
176
|
+
}
|
|
177
|
+
// TODO: remove this on next major version
|
|
156
178
|
if (!addPath) {
|
|
157
179
|
addPath = getAddPath(cdnType) || addPathUrl
|
|
158
180
|
} else if (cdnType) {
|
|
159
181
|
addPath = fixApiPath(addPath, cdnType)
|
|
160
182
|
}
|
|
161
183
|
|
|
184
|
+
// TODO: remove and adjust this on next major version
|
|
185
|
+
const apiPath = new URL(addPath)
|
|
186
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
187
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
188
|
+
|
|
162
189
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
163
190
|
if (!apiKey) {
|
|
164
|
-
console.error(' error: missing required argument `apiKey`')
|
|
191
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
165
192
|
process.exit(1)
|
|
166
193
|
return
|
|
167
194
|
}
|
|
168
195
|
|
|
169
196
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
170
197
|
if (!projectId) {
|
|
171
|
-
console.error(' error: missing required argument `projectId`')
|
|
198
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
172
199
|
process.exit(1)
|
|
173
200
|
return
|
|
174
201
|
}
|
|
175
202
|
|
|
176
203
|
const language = options.language || config.language || config.lng || process.env.LOCIZE_LANGUAGE || process.env.LOCIZE_LANG || process.env.LOCIZE_LNG
|
|
177
204
|
if (!language) {
|
|
178
|
-
console.error(' error: missing required argument `language`')
|
|
205
|
+
console.error(colors.red(' error: missing required argument `language`'))
|
|
179
206
|
process.exit(1)
|
|
180
207
|
return
|
|
181
208
|
}
|
|
182
209
|
|
|
183
210
|
const version = options.ver || config.ver || config.version || process.env.LOCIZE_VERSION || process.env.LOCIZE_VER || 'latest'
|
|
184
211
|
|
|
185
|
-
const apiPath = new URL(addPath)
|
|
186
|
-
|
|
187
212
|
add({
|
|
188
213
|
cdnType: cdnType || defaultCdnType,
|
|
189
214
|
apiKey,
|
|
190
215
|
projectId,
|
|
191
|
-
|
|
216
|
+
apiEndpoint,
|
|
192
217
|
language,
|
|
193
218
|
version,
|
|
194
219
|
namespace,
|
|
@@ -213,7 +238,9 @@ program
|
|
|
213
238
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
214
239
|
.option('-l, --language <lng>', 'The language that should be targeted (omitting this attribute will result in removing the key from all languages)')
|
|
215
240
|
.option('-v, --ver <version>', 'The version that should be targeted (default: latest)')
|
|
241
|
+
// TODO: remove this on next major version
|
|
216
242
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
243
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
217
244
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
218
245
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
219
246
|
.action((namespace, key, options) => {
|
|
@@ -222,47 +249,55 @@ program
|
|
|
222
249
|
} catch (e) {}
|
|
223
250
|
|
|
224
251
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
225
|
-
//
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
252
|
+
// TODO: remove this on next major version
|
|
253
|
+
if (!cdnType) {
|
|
254
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
255
|
+
}
|
|
256
|
+
// TODO: remove this on next major version
|
|
229
257
|
let addPath = options.addPath || config.addPath
|
|
258
|
+
if (addPath) {
|
|
259
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
260
|
+
}
|
|
261
|
+
// TODO: remove this on next major version
|
|
230
262
|
if (!addPath) {
|
|
231
263
|
addPath = getAddPath(cdnType) || addPathUrl
|
|
232
264
|
} else if (cdnType) {
|
|
233
265
|
addPath = fixApiPath(addPath, cdnType)
|
|
234
266
|
}
|
|
235
267
|
|
|
268
|
+
// TODO: remove and adjust this on next major version
|
|
269
|
+
const apiPath = new URL(addPath)
|
|
270
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
271
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
272
|
+
|
|
236
273
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
237
274
|
if (!apiKey) {
|
|
238
|
-
console.error(' error: missing required argument `apiKey`')
|
|
275
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
239
276
|
process.exit(1)
|
|
240
277
|
return
|
|
241
278
|
}
|
|
242
279
|
|
|
243
280
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
244
281
|
if (!projectId) {
|
|
245
|
-
console.error(' error: missing required argument `projectId`')
|
|
282
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
246
283
|
process.exit(1)
|
|
247
284
|
return
|
|
248
285
|
}
|
|
249
286
|
|
|
250
287
|
const language = options.language || config.language || config.lng || process.env.LOCIZE_LANGUAGE || process.env.LOCIZE_LANG || process.env.LOCIZE_LNG
|
|
251
288
|
// if (!language) {
|
|
252
|
-
// console.error(' error: missing required argument `language`');
|
|
289
|
+
// console.error(colors.red(' error: missing required argument `language`');
|
|
253
290
|
// process.exit(1);
|
|
254
291
|
// return;
|
|
255
292
|
// }
|
|
256
293
|
|
|
257
294
|
const version = options.ver || config.ver || config.version || process.env.LOCIZE_VERSION || process.env.LOCIZE_VER || 'latest'
|
|
258
295
|
|
|
259
|
-
const apiPath = new URL(addPath)
|
|
260
|
-
|
|
261
296
|
add({
|
|
262
297
|
cdnType: cdnType || defaultCdnType,
|
|
263
298
|
apiKey,
|
|
264
299
|
projectId,
|
|
265
|
-
|
|
300
|
+
apiEndpoint,
|
|
266
301
|
language,
|
|
267
302
|
version,
|
|
268
303
|
namespace,
|
|
@@ -298,7 +333,9 @@ program
|
|
|
298
333
|
.option('-up, --unpublished <true|false>', 'Downloads the current (unpublished) translations. This will generate private download costs (default: false)', 'false')
|
|
299
334
|
.option('-oo, --overridden-only <true|false>', 'Downloads only the current overridden (unpublished) translations of a tenant or branch project. This will generate private download costs (default: false)', 'false')
|
|
300
335
|
.option('-b, --branch <branch>', 'The branch name (or id) that should be targeted')
|
|
336
|
+
// TODO: remove this on next major version
|
|
301
337
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
338
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
302
339
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
303
340
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
304
341
|
.action((options) => {
|
|
@@ -307,20 +344,31 @@ program
|
|
|
307
344
|
} catch (e) {}
|
|
308
345
|
|
|
309
346
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
310
|
-
//
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
347
|
+
// TODO: remove this on next major version
|
|
348
|
+
if (!cdnType) {
|
|
349
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
350
|
+
}
|
|
351
|
+
// TODO: remove this on next major version
|
|
314
352
|
let getPath = options.getPath || config.getPath || options.addPath || config.addPath
|
|
353
|
+
if (getPath) {
|
|
354
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
355
|
+
}
|
|
356
|
+
// TODO: remove this on next major version
|
|
315
357
|
if (!getPath) {
|
|
316
358
|
getPath = getAddPath(cdnType) || getPathUrl
|
|
317
359
|
} else if (cdnType) {
|
|
318
360
|
getPath = fixApiPath(getPath, cdnType)
|
|
319
361
|
}
|
|
320
362
|
|
|
363
|
+
// TODO: remove and adjust this on next major version
|
|
364
|
+
const apiPath = new URL(getPath)
|
|
365
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
366
|
+
|
|
367
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
368
|
+
|
|
321
369
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
322
370
|
if (!projectId) {
|
|
323
|
-
console.error(' error: missing required argument `projectId`')
|
|
371
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
324
372
|
process.exit(1)
|
|
325
373
|
return
|
|
326
374
|
}
|
|
@@ -350,13 +398,11 @@ program
|
|
|
350
398
|
|
|
351
399
|
const branch = options.branch
|
|
352
400
|
|
|
353
|
-
const apiPath = new URL(getPath)
|
|
354
|
-
|
|
355
401
|
download({
|
|
356
402
|
cdnType: cdnType || defaultCdnType,
|
|
357
403
|
apiKey,
|
|
358
404
|
projectId,
|
|
359
|
-
|
|
405
|
+
apiEndpoint,
|
|
360
406
|
language,
|
|
361
407
|
languages: languages && languages.split(','),
|
|
362
408
|
version,
|
|
@@ -389,7 +435,9 @@ program
|
|
|
389
435
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
390
436
|
.option('-l, --language <lng>', 'The language that should be targeted')
|
|
391
437
|
.option('-v, --ver <version>', 'The version that should be targeted (default: latest)')
|
|
438
|
+
// TODO: remove this on next major version
|
|
392
439
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
440
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
393
441
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
394
442
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
395
443
|
.action((namespace, key, options) => {
|
|
@@ -398,37 +446,46 @@ program
|
|
|
398
446
|
} catch (e) {}
|
|
399
447
|
|
|
400
448
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
401
|
-
//
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
449
|
+
// TODO: remove this on next major version
|
|
450
|
+
if (!cdnType) {
|
|
451
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
452
|
+
}
|
|
453
|
+
// TODO: remove this on next major version
|
|
405
454
|
let getPath = options.getPath || config.getPath || options.addPath || config.addPath
|
|
455
|
+
if (getPath) {
|
|
456
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
457
|
+
}
|
|
458
|
+
// TODO: remove this on next major version
|
|
406
459
|
if (!getPath) {
|
|
407
460
|
getPath = getAddPath(cdnType) || getPathUrl
|
|
408
461
|
} else if (cdnType) {
|
|
409
462
|
getPath = fixApiPath(getPath, cdnType)
|
|
410
463
|
}
|
|
411
464
|
|
|
465
|
+
// TODO: remove and adjust this on next major version
|
|
466
|
+
const apiPath = new URL(getPath)
|
|
467
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
468
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
469
|
+
|
|
412
470
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
413
471
|
if (!projectId) {
|
|
414
|
-
console.error(' error: missing required argument `projectId`')
|
|
472
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
415
473
|
process.exit(1)
|
|
416
474
|
return
|
|
417
475
|
}
|
|
418
476
|
|
|
419
477
|
const language = options.language || config.language || config.lng || process.env.LOCIZE_LANGUAGE || process.env.LOCIZE_LANG || process.env.LOCIZE_LNG
|
|
420
478
|
if (!language) {
|
|
421
|
-
console.error(' error: missing required argument `language`')
|
|
479
|
+
console.error(colors.red(' error: missing required argument `language`'))
|
|
422
480
|
process.exit(1)
|
|
423
481
|
return
|
|
424
482
|
}
|
|
425
483
|
|
|
426
484
|
const version = options.ver || config.ver || config.version || process.env.LOCIZE_VERSION || process.env.LOCIZE_VER || 'latest'
|
|
427
485
|
|
|
428
|
-
const apiPath = new URL(getPath)
|
|
429
|
-
|
|
430
486
|
get({
|
|
431
487
|
cdnType: cdnType || defaultCdnType,
|
|
488
|
+
apiEndpoint,
|
|
432
489
|
projectId,
|
|
433
490
|
apiPath,
|
|
434
491
|
language,
|
|
@@ -476,7 +533,9 @@ program
|
|
|
476
533
|
.option('-up, --unpublished <true|false>', 'Downloads the current (unpublished) translations. This will generate private download costs (default: false)', 'false')
|
|
477
534
|
.option('-oo, --overridden-only <true|false>', 'Downloads only the current overridden (unpublished) translations of a tenant or branch project. This will generate private download costs (default: false)', 'false')
|
|
478
535
|
.option('-b, --branch <branch>', 'The branch name (or id) that should be targeted')
|
|
536
|
+
// TODO: remove this on next major version
|
|
479
537
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
538
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
480
539
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
481
540
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
482
541
|
.action((options) => {
|
|
@@ -485,27 +544,37 @@ program
|
|
|
485
544
|
} catch (e) {}
|
|
486
545
|
|
|
487
546
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
488
|
-
//
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
547
|
+
// TODO: remove this on next major version
|
|
548
|
+
if (!cdnType) {
|
|
549
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
550
|
+
}
|
|
551
|
+
// TODO: remove this on next major version
|
|
492
552
|
let getPath = options.getPath || config.getPath || options.addPath || config.addPath
|
|
553
|
+
if (getPath) {
|
|
554
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
555
|
+
}
|
|
556
|
+
// TODO: remove this on next major version
|
|
493
557
|
if (!getPath) {
|
|
494
558
|
getPath = getAddPath(cdnType) || getPathUrl
|
|
495
559
|
} else if (cdnType) {
|
|
496
560
|
getPath = fixApiPath(getPath, cdnType)
|
|
497
561
|
}
|
|
498
562
|
|
|
563
|
+
// TODO: remove and adjust this on next major version
|
|
564
|
+
const apiPath = new URL(getPath)
|
|
565
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
566
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
567
|
+
|
|
499
568
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
500
569
|
if (!apiKey) {
|
|
501
|
-
console.error(' error: missing required argument `apiKey`')
|
|
570
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
502
571
|
process.exit(1)
|
|
503
572
|
return
|
|
504
573
|
}
|
|
505
574
|
|
|
506
575
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
507
576
|
if (!projectId) {
|
|
508
|
-
console.error(' error: missing required argument `projectId`')
|
|
577
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
509
578
|
process.exit(1)
|
|
510
579
|
return
|
|
511
580
|
}
|
|
@@ -539,11 +608,9 @@ program
|
|
|
539
608
|
const backupDeletedPath = options.backupDeletedPath
|
|
540
609
|
const branch = options.branch
|
|
541
610
|
|
|
542
|
-
const apiPath = new URL(getPath)
|
|
543
|
-
|
|
544
611
|
sync({
|
|
545
612
|
cdnType: cdnType || defaultCdnType,
|
|
546
|
-
|
|
613
|
+
apiEndpoint,
|
|
547
614
|
apiKey,
|
|
548
615
|
projectId,
|
|
549
616
|
version,
|
|
@@ -595,7 +662,9 @@ program
|
|
|
595
662
|
.option('-R, --reference-language-only <true|false>', 'Check for changes in reference language only. (default: true)', 'true')
|
|
596
663
|
.option('-l, --language <lng>', 'The language that should be targeted')
|
|
597
664
|
.option('-n, --namespace <ns>', 'The namespace that should be targeted (you can also pass a comma separated list)')
|
|
665
|
+
// TODO: remove this on next major version
|
|
598
666
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
667
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
599
668
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
600
669
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
601
670
|
.action((options) => {
|
|
@@ -604,27 +673,37 @@ program
|
|
|
604
673
|
} catch (e) {}
|
|
605
674
|
|
|
606
675
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
607
|
-
//
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
676
|
+
// TODO: remove this on next major version
|
|
677
|
+
if (!cdnType) {
|
|
678
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
679
|
+
}
|
|
680
|
+
// TODO: remove this on next major version
|
|
611
681
|
let getPath = options.getPath || config.getPath || options.addPath || config.addPath
|
|
682
|
+
if (getPath) {
|
|
683
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
684
|
+
}
|
|
685
|
+
// TODO: remove this on next major version
|
|
612
686
|
if (!getPath) {
|
|
613
687
|
getPath = getAddPath(cdnType) || getPathUrl
|
|
614
688
|
} else if (cdnType) {
|
|
615
689
|
getPath = fixApiPath(getPath, cdnType)
|
|
616
690
|
}
|
|
617
691
|
|
|
692
|
+
// TODO: remove and adjust this on next major version
|
|
693
|
+
const apiPath = new URL(getPath)
|
|
694
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
695
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
696
|
+
|
|
618
697
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
619
698
|
if (!apiKey) {
|
|
620
|
-
console.error(' error: missing required argument `apiKey`')
|
|
699
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
621
700
|
process.exit(1)
|
|
622
701
|
return
|
|
623
702
|
}
|
|
624
703
|
|
|
625
704
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
626
705
|
if (!projectId) {
|
|
627
|
-
console.error(' error: missing required argument `projectId`')
|
|
706
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
628
707
|
process.exit(1)
|
|
629
708
|
return
|
|
630
709
|
}
|
|
@@ -646,11 +725,9 @@ program
|
|
|
646
725
|
const referenceLanguageOnly = options.referenceLanguageOnly !== 'false'
|
|
647
726
|
const pathMask = options.pathMask
|
|
648
727
|
|
|
649
|
-
const apiPath = new URL(getPath)
|
|
650
|
-
|
|
651
728
|
missing({
|
|
652
729
|
cdnType: cdnType || defaultCdnType,
|
|
653
|
-
|
|
730
|
+
apiEndpoint,
|
|
654
731
|
apiKey,
|
|
655
732
|
projectId,
|
|
656
733
|
version,
|
|
@@ -683,7 +760,9 @@ program
|
|
|
683
760
|
.option('-v, --ver <version>', 'The target version to be used to copy to (default: latest)')
|
|
684
761
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
685
762
|
.option('-iv, --ignore-if-version-exists <true|false>', 'The project-id that should be used (default: false)', 'false')
|
|
763
|
+
// TODO: remove this on next major version
|
|
686
764
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
765
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
687
766
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
688
767
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
689
768
|
.action((fromVersion, options) => {
|
|
@@ -692,27 +771,37 @@ program
|
|
|
692
771
|
} catch (e) {}
|
|
693
772
|
|
|
694
773
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
695
|
-
//
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
774
|
+
// TODO: remove this on next major version
|
|
775
|
+
if (!cdnType) {
|
|
776
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
777
|
+
}
|
|
778
|
+
// TODO: remove this on next major version
|
|
699
779
|
let getPath = options.getPath || config.getPath || options.addPath || config.addPath
|
|
780
|
+
if (getPath) {
|
|
781
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
782
|
+
}
|
|
783
|
+
// TODO: remove this on next major version
|
|
700
784
|
if (!getPath) {
|
|
701
785
|
getPath = getAddPath(cdnType) || getPathUrl
|
|
702
786
|
} else if (cdnType) {
|
|
703
787
|
getPath = fixApiPath(getPath, cdnType)
|
|
704
788
|
}
|
|
705
789
|
|
|
790
|
+
// TODO: remove and adjust this on next major version
|
|
791
|
+
const apiPath = new URL(getPath)
|
|
792
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
793
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
794
|
+
|
|
706
795
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
707
796
|
if (!apiKey) {
|
|
708
|
-
console.error(' error: missing required argument `apiKey`')
|
|
797
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
709
798
|
process.exit(1)
|
|
710
799
|
return
|
|
711
800
|
}
|
|
712
801
|
|
|
713
802
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
714
803
|
if (!projectId) {
|
|
715
|
-
console.error(' error: missing required argument `projectId`')
|
|
804
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
716
805
|
process.exit(1)
|
|
717
806
|
return
|
|
718
807
|
}
|
|
@@ -721,13 +810,11 @@ program
|
|
|
721
810
|
|
|
722
811
|
const ignoreIfVersionExists = options.ignoreIfVersionExists === 'true'
|
|
723
812
|
|
|
724
|
-
const apiPath = new URL(getPath)
|
|
725
|
-
|
|
726
813
|
copyVersion({
|
|
727
814
|
cdnType: cdnType || defaultCdnType,
|
|
728
815
|
apiKey,
|
|
729
816
|
projectId,
|
|
730
|
-
|
|
817
|
+
apiEndpoint,
|
|
731
818
|
fromVersion,
|
|
732
819
|
toVersion: version,
|
|
733
820
|
ignoreIfVersionExists
|
|
@@ -748,7 +835,9 @@ program
|
|
|
748
835
|
.description('remove version')
|
|
749
836
|
.option('-k, --api-key <apiKey>', 'The api-key that should be used')
|
|
750
837
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
838
|
+
// TODO: remove this on next major version
|
|
751
839
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
840
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
752
841
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
753
842
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
754
843
|
.action((version, options) => {
|
|
@@ -757,38 +846,46 @@ program
|
|
|
757
846
|
} catch (e) {}
|
|
758
847
|
|
|
759
848
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
760
|
-
//
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
849
|
+
// TODO: remove this on next major version
|
|
850
|
+
if (!cdnType) {
|
|
851
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
852
|
+
}
|
|
853
|
+
// TODO: remove this on next major version
|
|
764
854
|
let getPath = options.getPath || config.getPath || options.addPath || config.addPath
|
|
855
|
+
if (getPath) {
|
|
856
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
857
|
+
}
|
|
858
|
+
// TODO: remove this on next major version
|
|
765
859
|
if (!getPath) {
|
|
766
860
|
getPath = getAddPath(cdnType) || getPathUrl
|
|
767
861
|
} else if (cdnType) {
|
|
768
862
|
getPath = fixApiPath(getPath, cdnType)
|
|
769
863
|
}
|
|
770
864
|
|
|
865
|
+
// TODO: remove and adjust this on next major version
|
|
866
|
+
const apiPath = new URL(getPath)
|
|
867
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
868
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
869
|
+
|
|
771
870
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
772
871
|
if (!apiKey) {
|
|
773
|
-
console.error(' error: missing required argument `apiKey`')
|
|
872
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
774
873
|
process.exit(1)
|
|
775
874
|
return
|
|
776
875
|
}
|
|
777
876
|
|
|
778
877
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
779
878
|
if (!projectId) {
|
|
780
|
-
console.error(' error: missing required argument `projectId`')
|
|
879
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
781
880
|
process.exit(1)
|
|
782
881
|
return
|
|
783
882
|
}
|
|
784
883
|
|
|
785
|
-
const apiPath = new URL(getPath)
|
|
786
|
-
|
|
787
884
|
removeVersion({
|
|
788
885
|
cdnType: cdnType || defaultCdnType,
|
|
789
886
|
apiKey,
|
|
790
887
|
projectId,
|
|
791
|
-
|
|
888
|
+
apiEndpoint,
|
|
792
889
|
version
|
|
793
890
|
})
|
|
794
891
|
})
|
|
@@ -808,7 +905,9 @@ program
|
|
|
808
905
|
.option('-v, --ver <version>', 'The version to be used to publish (default: latest)')
|
|
809
906
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
810
907
|
.option('-t, --tenants <true|false>', 'Publish also tenants (if using multi-tenant setup) (default: false)', 'false')
|
|
908
|
+
// TODO: remove this on next major version
|
|
811
909
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
910
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
812
911
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
813
912
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
814
913
|
.action((options) => {
|
|
@@ -817,27 +916,37 @@ program
|
|
|
817
916
|
} catch (e) {}
|
|
818
917
|
|
|
819
918
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
820
|
-
//
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
919
|
+
// TODO: remove this on next major version
|
|
920
|
+
if (!cdnType) {
|
|
921
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
922
|
+
}
|
|
923
|
+
// TODO: remove this on next major version
|
|
824
924
|
let getPath = options.getPath || config.getPath || options.addPath || config.addPath
|
|
925
|
+
if (getPath) {
|
|
926
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
927
|
+
}
|
|
928
|
+
// TODO: remove this on next major version
|
|
825
929
|
if (!getPath) {
|
|
826
930
|
getPath = getAddPath(cdnType) || getPathUrl
|
|
827
931
|
} else if (cdnType) {
|
|
828
932
|
getPath = fixApiPath(getPath, cdnType)
|
|
829
933
|
}
|
|
830
934
|
|
|
935
|
+
// TODO: remove and adjust this on next major version
|
|
936
|
+
const apiPath = new URL(getPath)
|
|
937
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
938
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
939
|
+
|
|
831
940
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
832
941
|
if (!apiKey) {
|
|
833
|
-
console.error(' error: missing required argument `apiKey`')
|
|
942
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
834
943
|
process.exit(1)
|
|
835
944
|
return
|
|
836
945
|
}
|
|
837
946
|
|
|
838
947
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
839
948
|
if (!projectId) {
|
|
840
|
-
console.error(' error: missing required argument `projectId`')
|
|
949
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
841
950
|
process.exit(1)
|
|
842
951
|
return
|
|
843
952
|
}
|
|
@@ -846,13 +955,11 @@ program
|
|
|
846
955
|
|
|
847
956
|
const tenants = options.tenants === 'true'
|
|
848
957
|
|
|
849
|
-
const apiPath = new URL(getPath)
|
|
850
|
-
|
|
851
958
|
publishVersion({
|
|
852
959
|
cdnType: cdnType || defaultCdnType,
|
|
853
960
|
apiKey,
|
|
854
961
|
projectId,
|
|
855
|
-
|
|
962
|
+
apiEndpoint,
|
|
856
963
|
version,
|
|
857
964
|
tenants
|
|
858
965
|
})
|
|
@@ -873,7 +980,9 @@ program
|
|
|
873
980
|
.option('-k, --api-key <apiKey>', 'The api-key that should be used')
|
|
874
981
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
875
982
|
.option('-v, --ver <version>', 'The version that should be targeted (default: latest)')
|
|
983
|
+
// TODO: remove this on next major version
|
|
876
984
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
985
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
877
986
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
878
987
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
879
988
|
.action((namespace, options) => {
|
|
@@ -882,40 +991,48 @@ program
|
|
|
882
991
|
} catch (e) {}
|
|
883
992
|
|
|
884
993
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
885
|
-
//
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
994
|
+
// TODO: remove this on next major version
|
|
995
|
+
if (!cdnType) {
|
|
996
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
997
|
+
}
|
|
998
|
+
// TODO: remove this on next major version
|
|
889
999
|
let addPath = options.addPath || config.addPath
|
|
1000
|
+
if (addPath) {
|
|
1001
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
1002
|
+
}
|
|
1003
|
+
// TODO: remove this on next major version
|
|
890
1004
|
if (!addPath) {
|
|
891
1005
|
addPath = getAddPath(cdnType) || addPathUrl
|
|
892
1006
|
} else if (cdnType) {
|
|
893
1007
|
addPath = fixApiPath(addPath, cdnType)
|
|
894
1008
|
}
|
|
895
1009
|
|
|
1010
|
+
// TODO: remove and adjust this on next major version
|
|
1011
|
+
const apiPath = new URL(addPath)
|
|
1012
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
1013
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
1014
|
+
|
|
896
1015
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
897
1016
|
if (!apiKey) {
|
|
898
|
-
console.error(' error: missing required argument `apiKey`')
|
|
1017
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
899
1018
|
process.exit(1)
|
|
900
1019
|
return
|
|
901
1020
|
}
|
|
902
1021
|
|
|
903
1022
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
904
1023
|
if (!projectId) {
|
|
905
|
-
console.error(' error: missing required argument `projectId`')
|
|
1024
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
906
1025
|
process.exit(1)
|
|
907
1026
|
return
|
|
908
1027
|
}
|
|
909
1028
|
|
|
910
1029
|
const version = options.ver || config.ver || config.version || process.env.LOCIZE_VERSION || process.env.LOCIZE_VER || 'latest'
|
|
911
1030
|
|
|
912
|
-
const apiPath = new URL(addPath)
|
|
913
|
-
|
|
914
1031
|
deleteNamespace({
|
|
915
1032
|
cdnType: cdnType || defaultCdnType,
|
|
916
1033
|
apiKey,
|
|
917
1034
|
projectId,
|
|
918
|
-
|
|
1035
|
+
apiEndpoint,
|
|
919
1036
|
version,
|
|
920
1037
|
namespace
|
|
921
1038
|
})
|
|
@@ -972,7 +1089,9 @@ program
|
|
|
972
1089
|
.option('-k, --api-key <apiKey>', 'The api-key that should be used')
|
|
973
1090
|
.option('-v, --ver <version>', 'The target version to be used to copy to (default: latest)')
|
|
974
1091
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
1092
|
+
// TODO: remove this on next major version
|
|
975
1093
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
1094
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
976
1095
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
977
1096
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
978
1097
|
.action((branch, options) => {
|
|
@@ -981,40 +1100,48 @@ program
|
|
|
981
1100
|
} catch (e) {}
|
|
982
1101
|
|
|
983
1102
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
984
|
-
//
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1103
|
+
// TODO: remove this on next major version
|
|
1104
|
+
if (!cdnType) {
|
|
1105
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
1106
|
+
}
|
|
1107
|
+
// TODO: remove this on next major version
|
|
988
1108
|
let getPath = options.getPath || config.getPath || options.addPath || config.addPath
|
|
1109
|
+
if (getPath) {
|
|
1110
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
1111
|
+
}
|
|
1112
|
+
// TODO: remove this on next major version
|
|
989
1113
|
if (!getPath) {
|
|
990
1114
|
getPath = getAddPath(cdnType) || getPathUrl
|
|
991
1115
|
} else if (cdnType) {
|
|
992
1116
|
getPath = fixApiPath(getPath, cdnType)
|
|
993
1117
|
}
|
|
994
1118
|
|
|
1119
|
+
// TODO: remove and adjust this on next major version
|
|
1120
|
+
const apiPath = new URL(getPath)
|
|
1121
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
1122
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
1123
|
+
|
|
995
1124
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
996
1125
|
if (!apiKey) {
|
|
997
|
-
console.error(' error: missing required argument `apiKey`')
|
|
1126
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
998
1127
|
process.exit(1)
|
|
999
1128
|
return
|
|
1000
1129
|
}
|
|
1001
1130
|
|
|
1002
1131
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
1003
1132
|
if (!projectId) {
|
|
1004
|
-
console.error(' error: missing required argument `projectId`')
|
|
1133
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
1005
1134
|
process.exit(1)
|
|
1006
1135
|
return
|
|
1007
1136
|
}
|
|
1008
1137
|
|
|
1009
1138
|
const version = options.ver || config.ver || config.version || process.env.LOCIZE_VERSION || process.env.LOCIZE_VER || 'latest'
|
|
1010
1139
|
|
|
1011
|
-
const apiPath = new URL(getPath)
|
|
1012
|
-
|
|
1013
1140
|
createBranch({
|
|
1014
1141
|
cdnType: cdnType || defaultCdnType,
|
|
1015
1142
|
apiKey,
|
|
1016
1143
|
projectId,
|
|
1017
|
-
|
|
1144
|
+
apiEndpoint,
|
|
1018
1145
|
version,
|
|
1019
1146
|
branch
|
|
1020
1147
|
})
|
|
@@ -1035,7 +1162,9 @@ program
|
|
|
1035
1162
|
.option('-k, --api-key <apiKey>', 'The api-key that should be used')
|
|
1036
1163
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
1037
1164
|
.option('-d, --delete <true|false>', 'This will delete the branch after merging. (default: false)', 'false')
|
|
1165
|
+
// TODO: remove this on next major version
|
|
1038
1166
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
1167
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
1039
1168
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
1040
1169
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
1041
1170
|
.action((branch, options) => {
|
|
@@ -1044,38 +1173,46 @@ program
|
|
|
1044
1173
|
} catch (e) {}
|
|
1045
1174
|
|
|
1046
1175
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
1047
|
-
//
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1176
|
+
// TODO: remove this on next major version
|
|
1177
|
+
if (!cdnType) {
|
|
1178
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
1179
|
+
}
|
|
1180
|
+
// TODO: remove this on next major version
|
|
1051
1181
|
let getPath = options.getPath || config.getPath || options.addPath || config.addPath
|
|
1182
|
+
if (getPath) {
|
|
1183
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
1184
|
+
}
|
|
1185
|
+
// TODO: remove this on next major version
|
|
1052
1186
|
if (!getPath) {
|
|
1053
1187
|
getPath = getAddPath(cdnType) || getPathUrl
|
|
1054
1188
|
} else if (cdnType) {
|
|
1055
1189
|
getPath = fixApiPath(getPath, cdnType)
|
|
1056
1190
|
}
|
|
1057
1191
|
|
|
1192
|
+
// TODO: remove and adjust this on next major version
|
|
1193
|
+
const apiPath = new URL(getPath)
|
|
1194
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
1195
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
1196
|
+
|
|
1058
1197
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
1059
1198
|
if (!apiKey) {
|
|
1060
|
-
console.error(' error: missing required argument `apiKey`')
|
|
1199
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
1061
1200
|
process.exit(1)
|
|
1062
1201
|
return
|
|
1063
1202
|
}
|
|
1064
1203
|
|
|
1065
1204
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
1066
1205
|
if (!projectId) {
|
|
1067
|
-
console.error(' error: missing required argument `projectId`')
|
|
1206
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
1068
1207
|
process.exit(1)
|
|
1069
1208
|
return
|
|
1070
1209
|
}
|
|
1071
1210
|
|
|
1072
|
-
const apiPath = new URL(getPath)
|
|
1073
|
-
|
|
1074
1211
|
mergeBranch({
|
|
1075
1212
|
cdnType: cdnType || defaultCdnType,
|
|
1076
1213
|
apiKey,
|
|
1077
1214
|
projectId,
|
|
1078
|
-
|
|
1215
|
+
apiEndpoint,
|
|
1079
1216
|
delete: options.delete === 'true',
|
|
1080
1217
|
branch
|
|
1081
1218
|
})
|
|
@@ -1096,7 +1233,9 @@ program
|
|
|
1096
1233
|
.description('delete branch')
|
|
1097
1234
|
.option('-k, --api-key <apiKey>', 'The api-key that should be used')
|
|
1098
1235
|
.option('-i, --project-id <projectId>', 'The project-id that should be used')
|
|
1236
|
+
// TODO: remove this on next major version
|
|
1099
1237
|
.option('-a, --add-path <url>', `Specify the add-path url that should be used (default: ${addPathUrl})`)
|
|
1238
|
+
.option('-a, --api-endpoint <url>', `Specify the api-endpoint url that should be used (default: ${defaultApiEndpoint})`)
|
|
1100
1239
|
.option('-C, --config-path <configPath>', `Specify the path to the optional locize config file (default: ${configInWorkingDirectory} or ${configInHome})`)
|
|
1101
1240
|
.option('-ct, --cdn-type <standard|pro>', `Specify the cdn endpoint that should be used (depends on which cdn type you've in your locize project) (default: ${defaultCdnType})`)
|
|
1102
1241
|
.action((branch, options) => {
|
|
@@ -1105,38 +1244,46 @@ program
|
|
|
1105
1244
|
} catch (e) {}
|
|
1106
1245
|
|
|
1107
1246
|
const cdnType = options.cdnType || config.cdnType || process.env.LOCIZE_CDN_TYPE
|
|
1108
|
-
//
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1247
|
+
// TODO: remove this on next major version
|
|
1248
|
+
if (!cdnType) {
|
|
1249
|
+
console.error(colors.red('In the next major version, the default \'cdnType\' will be \'standard\'. Please set \'cdnType\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
1250
|
+
}
|
|
1251
|
+
// TODO: remove this on next major version
|
|
1112
1252
|
let getPath = options.getPath || config.getPath || options.addPath || config.addPath
|
|
1253
|
+
if (getPath) {
|
|
1254
|
+
console.error(colors.red('In the next major version, the \'addPath\' / \'--add-path\' option will be removed. Please set \'apiEndpoint\' / \'--api-endpoint\' explicitly in your config or environment variables or via cli parameter to avoid issues.'))
|
|
1255
|
+
}
|
|
1256
|
+
// TODO: remove this on next major version
|
|
1113
1257
|
if (!getPath) {
|
|
1114
1258
|
getPath = getAddPath(cdnType) || getPathUrl
|
|
1115
1259
|
} else if (cdnType) {
|
|
1116
1260
|
getPath = fixApiPath(getPath, cdnType)
|
|
1117
1261
|
}
|
|
1118
1262
|
|
|
1263
|
+
// TODO: remove and adjust this on next major version
|
|
1264
|
+
const apiPath = new URL(getPath)
|
|
1265
|
+
let apiEndpoint = options.apiEndpoint || config.apiEndpoint || process.env.LOCIZE_API_ENDPOINT || (apiPath.protocol + '//' + apiPath.host) || defaultApiEndpoint
|
|
1266
|
+
if (cdnType) apiEndpoint = fixApiPath(apiEndpoint, cdnType)
|
|
1267
|
+
|
|
1119
1268
|
const apiKey = options.apiKey || config.apiKey || process.env.LOCIZE_API_KEY || process.env.LOCIZE_KEY
|
|
1120
1269
|
if (!apiKey) {
|
|
1121
|
-
console.error(' error: missing required argument `apiKey`')
|
|
1270
|
+
console.error(colors.red(' error: missing required argument `apiKey`'))
|
|
1122
1271
|
process.exit(1)
|
|
1123
1272
|
return
|
|
1124
1273
|
}
|
|
1125
1274
|
|
|
1126
1275
|
const projectId = options.projectId || config.projectId || process.env.LOCIZE_PROJECTID || process.env.LOCIZE_PID
|
|
1127
1276
|
if (!projectId) {
|
|
1128
|
-
console.error(' error: missing required argument `projectId`')
|
|
1277
|
+
console.error(colors.red(' error: missing required argument `projectId`'))
|
|
1129
1278
|
process.exit(1)
|
|
1130
1279
|
return
|
|
1131
1280
|
}
|
|
1132
1281
|
|
|
1133
|
-
const apiPath = new URL(getPath)
|
|
1134
|
-
|
|
1135
1282
|
deleteBranch({
|
|
1136
1283
|
cdnType: cdnType || defaultCdnType,
|
|
1137
1284
|
apiKey,
|
|
1138
1285
|
projectId,
|
|
1139
|
-
|
|
1286
|
+
apiEndpoint,
|
|
1140
1287
|
branch
|
|
1141
1288
|
})
|
|
1142
1289
|
})
|