google-spreadsheet-translation-sync 1.5.0 → 1.5.2

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.
Files changed (2) hide show
  1. package/package.json +4 -4
  2. package/src/interaction.js +20 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "google-spreadsheet-translation-sync",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "A plugin to read and write i18n translationsfrom and to google spreadsheets ",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -43,16 +43,16 @@
43
43
  "shell": "^0.5.0"
44
44
  },
45
45
  "dependencies": {
46
- "@inquirer/prompts": "^3.0.3",
46
+ "@inquirer/prompts": "^8.0.1",
47
47
  "async": "^2.6.3",
48
48
  "fast-csv": "^4.3",
49
49
  "gettext-parser": "^4.0.2",
50
50
  "google-auth-library": "^9.15.1",
51
51
  "google-spreadsheet": "^4.1.4",
52
- "js-yaml": "^4.1.0",
52
+ "js-yaml": "^4.1.1",
53
53
  "mkdirp": "^0.5.5",
54
54
  "properties-reader": "^2.2.0",
55
55
  "shelljs": "^0.8.5",
56
- "tmp": "^0.1.0"
56
+ "tmp": "^0.2.5"
57
57
  }
58
58
  }
@@ -3,9 +3,8 @@
3
3
  * @param {{translationFormat: string, mode: string, spreadsheetId: string, gid : string, credentials: {}, keyId: string, fileBaseName: string, namespaces: boolean, defaultLocaleName: string}} options
4
4
  * @param {function} callback
5
5
  */
6
- const fs = require("fs");
7
- const async = require("async");
8
- const path = require("path");
6
+
7
+ const prompts = require("@inquirer/prompts");
9
8
 
10
9
  module.exports = async function () {
11
10
  const async= require('async')
@@ -15,6 +14,7 @@ module.exports = async function () {
15
14
 
16
15
  const options = {
17
16
  keyId: 'key',
17
+ spreadsheetId: '',
18
18
  gid: '0',
19
19
  credentials: require('../test/data/access'),
20
20
  fileBaseName: '',
@@ -98,9 +98,25 @@ module.exports = async function () {
98
98
  switch (await prompts.select({
99
99
  message: 'What would you like to do?',
100
100
  choices: [
101
- {value: 'export_key', name: "Export a single key"}
101
+ {value: 'export_key', name: "Export a single key"},
102
+ {value: 'import', name: "Import from Spreadsheet"}
102
103
  ]
103
104
  })) {
105
+ case 'import':
106
+ options.spreadsheetId = await prompts.input({
107
+ message: 'Which Spreadsheet Id (first sheet for now only)?'
108
+ });
109
+
110
+ const importer = require('./import-from-spreadsheet');
111
+
112
+ importer(folder, options, (err) => {
113
+ if (err) {
114
+ console.error(err);
115
+ } else {
116
+ console.log('Import done');
117
+ }
118
+ });
119
+ break;
104
120
  case 'export_key':
105
121
 
106
122
  const key = await prompts.input({