google-spreadsheet-translation-sync 1.5.1 → 1.5.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/interaction.js +24 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "google-spreadsheet-translation-sync",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "A plugin to read and write i18n translationsfrom and to google spreadsheets ",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,6 +4,8 @@
4
4
  * @param {function} callback
5
5
  */
6
6
 
7
+ const prompts = require("@inquirer/prompts");
8
+
7
9
  module.exports = async function () {
8
10
  const async= require('async')
9
11
  const path = require('path');
@@ -12,6 +14,7 @@ module.exports = async function () {
12
14
 
13
15
  const options = {
14
16
  keyId: 'key',
17
+ spreadsheetId: '',
15
18
  gid: '0',
16
19
  credentials: require('../test/data/access'),
17
20
  fileBaseName: '',
@@ -95,9 +98,29 @@ module.exports = async function () {
95
98
  switch (await prompts.select({
96
99
  message: 'What would you like to do?',
97
100
  choices: [
98
- {value: 'export_key', name: "Export a single key"}
101
+ {value: 'export_key', name: "Export a single key"},
102
+ {value: 'import', name: "Import from Spreadsheet"}
99
103
  ]
100
104
  })) {
105
+ case 'import':
106
+ options.spreadsheetId = await prompts.input({
107
+ message: 'Which Spreadsheet Id?'
108
+ });
109
+ options.gid = await prompts.input({
110
+ message: 'Which gid?',
111
+ default: options.gid
112
+ });
113
+
114
+ const importer = require('./import-from-spreadsheet');
115
+
116
+ importer(folder, options, (err) => {
117
+ if (err) {
118
+ console.error(err);
119
+ } else {
120
+ console.log('Import done');
121
+ }
122
+ });
123
+ break;
101
124
  case 'export_key':
102
125
 
103
126
  const key = await prompts.input({