gtx-cli 1.1.0-alpha.2 → 1.1.0-alpha.3

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/dist/cli/base.js CHANGED
@@ -55,6 +55,7 @@ const generaltranslation_1 = require("generaltranslation");
55
55
  const findFilepath_1 = __importStar(require("../fs/findFilepath"));
56
56
  const errors_1 = require("../console/errors");
57
57
  const path_1 = __importDefault(require("path"));
58
+ const fs_1 = __importDefault(require("fs"));
58
59
  const translate_1 = require("../formats/json/translate");
59
60
  const utils_1 = require("../fs/utils");
60
61
  const generateSettings_1 = require("../config/generateSettings");
@@ -202,9 +203,16 @@ class BaseCLI {
202
203
  ],
203
204
  default: 'remote',
204
205
  });
206
+ let configFilepath = 'gt.config.json';
207
+ if (fs_1.default.existsSync('gt.config.json')) {
208
+ configFilepath = 'gt.config.json';
209
+ }
210
+ else if (fs_1.default.existsSync('src/gt.config.json')) {
211
+ configFilepath = 'src/gt.config.json';
212
+ }
205
213
  if (location === 'remote') {
206
214
  // Create gt.config.json
207
- (0, setupConfig_1.default)('gt.config.json', {
215
+ (0, setupConfig_1.default)(configFilepath, {
208
216
  defaultLocale,
209
217
  locales: locales.split(' '),
210
218
  });
@@ -236,7 +244,7 @@ class BaseCLI {
236
244
  // translationsDir/[locale].json
237
245
  const translationsDirWithFormat = path_1.default.join(translationsDir, `[locale].${dataFormat}`);
238
246
  // Create gt.config.json
239
- (0, setupConfig_1.default)('gt.config.json', {
247
+ (0, setupConfig_1.default)(configFilepath, {
240
248
  defaultLocale,
241
249
  locales: locales.split(' '),
242
250
  files: {
@@ -249,7 +257,7 @@ class BaseCLI {
249
257
  else {
250
258
  const translationsDirWithFormat = path_1.default.join(translationsDir, `[locale].json`);
251
259
  // Create gt.config.json
252
- (0, setupConfig_1.default)('gt.config.json', {
260
+ (0, setupConfig_1.default)(configFilepath, {
253
261
  defaultLocale,
254
262
  locales: locales.split(' '),
255
263
  files: {
@@ -21,6 +21,9 @@ function generateSettings(options) {
21
21
  var _a, _b;
22
22
  // Load config file
23
23
  let gtConfig = {};
24
+ if (!options.config.endsWith('.json')) {
25
+ options.config = `${options.config}.json`;
26
+ }
24
27
  if (options.config) {
25
28
  gtConfig = (0, loadConfig_1.default)(options.config);
26
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "1.1.0-alpha.2",
3
+ "version": "1.1.0-alpha.3",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/main.js",
6
6
  "scripts": {