google-spreadsheet-translation-sync 1.5.1 → 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 +1 -1
  2. package/src/interaction.js +20 -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.2",
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,25 @@ 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 (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;
101
120
  case 'export_key':
102
121
 
103
122
  const key = await prompts.input({