@dittowords/cli 3.10.1 → 4.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/README.md +125 -36
- package/bin/add-project.js +101 -33
- package/bin/add-project.js.map +1 -1
- package/bin/api.js +49 -15
- package/bin/api.js.map +1 -1
- package/bin/component-folders.js +56 -7
- package/bin/component-folders.js.map +1 -1
- package/bin/config.js +206 -170
- package/bin/config.js.map +1 -1
- package/bin/config.test.js +92 -0
- package/bin/config.test.js.map +1 -0
- package/bin/consts.js +64 -18
- package/bin/consts.js.map +1 -1
- package/bin/ditto.js +250 -200
- package/bin/ditto.js.map +1 -1
- package/bin/generate-suggestions.js +155 -78
- package/bin/generate-suggestions.js.map +1 -1
- package/bin/generate-suggestions.test.js +189 -0
- package/bin/generate-suggestions.test.js.map +1 -0
- package/bin/http/fetchComponentFolders.js +60 -8
- package/bin/http/fetchComponentFolders.js.map +1 -1
- package/bin/http/fetchComponents.js +65 -18
- package/bin/http/fetchComponents.js.map +1 -1
- package/bin/http/fetchVariants.js +74 -14
- package/bin/http/fetchVariants.js.map +1 -1
- package/bin/http/importComponents.js +100 -49
- package/bin/http/importComponents.js.map +1 -1
- package/bin/importComponents.js +61 -10
- package/bin/importComponents.js.map +1 -1
- package/bin/init/init.js +120 -44
- package/bin/init/init.js.map +1 -1
- package/bin/init/project.js +160 -83
- package/bin/init/project.js.map +1 -1
- package/bin/init/project.test.js +49 -0
- package/bin/init/project.test.js.map +1 -0
- package/bin/init/token.js +134 -74
- package/bin/init/token.js.map +1 -1
- package/bin/init/token.test.js +69 -0
- package/bin/init/token.test.js.map +1 -0
- package/bin/output.js +72 -30
- package/bin/output.js.map +1 -1
- package/bin/pull.js +424 -213
- package/bin/pull.js.map +1 -1
- package/bin/pull.test.js +410 -0
- package/bin/pull.test.js.map +1 -0
- package/bin/remove-project.js +91 -27
- package/bin/remove-project.js.map +1 -1
- package/bin/replace.js +140 -100
- package/bin/replace.js.map +1 -1
- package/bin/replace.test.js +155 -0
- package/bin/replace.test.js.map +1 -0
- package/bin/sentry-test.js.map +1 -0
- package/bin/types.js +20 -2
- package/bin/types.js.map +1 -1
- package/bin/utils/cleanFileName.js +32 -8
- package/bin/utils/cleanFileName.js.map +1 -1
- package/bin/utils/createSentryContext.js +43 -0
- package/bin/utils/createSentryContext.js.map +1 -0
- package/bin/utils/generateJsDriver.js +114 -51
- package/bin/utils/generateJsDriver.js.map +1 -1
- package/bin/utils/getSelectedProjects.js +58 -52
- package/bin/utils/getSelectedProjects.js.map +1 -1
- package/bin/utils/processMetaOption.js +36 -11
- package/bin/utils/processMetaOption.js.map +1 -1
- package/bin/utils/processMetaOption.test.js +45 -0
- package/bin/utils/processMetaOption.test.js.map +1 -0
- package/bin/utils/projectsToText.js +52 -19
- package/bin/utils/projectsToText.js.map +1 -1
- package/bin/utils/promptForProject.js +89 -36
- package/bin/utils/promptForProject.js.map +1 -1
- package/bin/utils/quit.js +36 -7
- package/bin/utils/quit.js.map +1 -1
- package/bin/utils/sourcesToText.js +51 -19
- package/bin/utils/sourcesToText.js.map +1 -1
- package/etsc.config.js +13 -0
- package/lib/config.ts +27 -8
- package/lib/ditto.ts +6 -0
- package/lib/init/project.ts +3 -3
- package/lib/pull.ts +190 -52
- package/lib/types.ts +24 -7
- package/lib/utils/createSentryContext.ts +20 -0
- package/lib/utils/generateJsDriver.ts +40 -6
- package/lib/utils/quit.ts +2 -3
- package/package.json +10 -6
- package/tsconfig.json +4 -1
- package/bin/lib/add-project.js +0 -36
- package/bin/lib/add-project.js.map +0 -1
- package/bin/lib/api.js +0 -20
- package/bin/lib/api.js.map +0 -1
- package/bin/lib/config.js +0 -202
- package/bin/lib/config.js.map +0 -1
- package/bin/lib/consts.js +0 -21
- package/bin/lib/consts.js.map +0 -1
- package/bin/lib/ditto.js +0 -121
- package/bin/lib/ditto.js.map +0 -1
- package/bin/lib/generate-suggestions.js +0 -71
- package/bin/lib/generate-suggestions.js.map +0 -1
- package/bin/lib/http/fetchComponents.js +0 -13
- package/bin/lib/http/fetchComponents.js.map +0 -1
- package/bin/lib/http/fetchVariants.js +0 -26
- package/bin/lib/http/fetchVariants.js.map +0 -1
- package/bin/lib/init/init.js +0 -50
- package/bin/lib/init/init.js.map +0 -1
- package/bin/lib/init/project.js +0 -108
- package/bin/lib/init/project.js.map +0 -1
- package/bin/lib/init/token.js +0 -91
- package/bin/lib/init/token.js.map +0 -1
- package/bin/lib/output.js +0 -34
- package/bin/lib/output.js.map +0 -1
- package/bin/lib/pull.js +0 -264
- package/bin/lib/pull.js.map +0 -1
- package/bin/lib/remove-project.js +0 -35
- package/bin/lib/remove-project.js.map +0 -1
- package/bin/lib/replace.js +0 -107
- package/bin/lib/replace.js.map +0 -1
- package/bin/lib/types.js +0 -3
- package/bin/lib/types.js.map +0 -1
- package/bin/lib/utils/cleanFileName.js +0 -11
- package/bin/lib/utils/cleanFileName.js.map +0 -1
- package/bin/lib/utils/generateJsDriver.js +0 -56
- package/bin/lib/utils/generateJsDriver.js.map +0 -1
- package/bin/lib/utils/getSelectedProjects.js +0 -61
- package/bin/lib/utils/getSelectedProjects.js.map +0 -1
- package/bin/lib/utils/processMetaOption.js +0 -15
- package/bin/lib/utils/processMetaOption.js.map +0 -1
- package/bin/lib/utils/projectsToText.js +0 -25
- package/bin/lib/utils/projectsToText.js.map +0 -1
- package/bin/lib/utils/promptForProject.js +0 -43
- package/bin/lib/utils/promptForProject.js.map +0 -1
- package/bin/lib/utils/quit.js +0 -10
- package/bin/lib/utils/quit.js.map +0 -1
- package/bin/lib/utils/sourcesToText.js +0 -25
- package/bin/lib/utils/sourcesToText.js.map +0 -1
- package/bin/package.json +0 -76
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ npm install --save-dev @dittowords/cli
|
|
|
14
14
|
npm install --global @dittowords/cli
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
The installed binary is named `ditto-cli`. You can execute it directly in `node_modules/.bin/ditto-cli` or using [npx](https://www.npmjs.com/package/npx)
|
|
17
|
+
The installed binary is named `ditto-cli`. You can execute it directly in `node_modules/.bin/ditto-cli` or using [npx](https://www.npmjs.com/package/npx) like `npx @dittowords/cli`.
|
|
18
18
|
|
|
19
19
|
The first time you run the CLI, you'll be asked to provide an API key (found at [https://app.dittowords.com/account/user](https://app.dittowords.com/account/user) under **API Keys**):
|
|
20
20
|
|
|
@@ -35,7 +35,7 @@ Thanks for authenticating.
|
|
|
35
35
|
We'll save the key to: /Users/{username}/.config/ditto
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Once you've successfully authenticated, you'll be asked to choose a source (a project or your component library) to pull data
|
|
38
|
+
Once you've successfully authenticated, you'll be asked to choose a source (a project or your component library) to pull data from:
|
|
39
39
|
|
|
40
40
|
```
|
|
41
41
|
Looks like there are no Ditto sources selected for your current directory: /Users/ditto
|
|
@@ -46,15 +46,15 @@ Looks like there are no Ditto sources selected for your current directory: /User
|
|
|
46
46
|
...
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
After selecting a source, a configuration file will automatically be created at the path `./ditto/config.yml` relative to your current working directory. The CLI will attempt to read from this file every time a command is executed. See the [config.yml documentation](#files)
|
|
49
|
+
After selecting a source, a configuration file will automatically be created at the path `./ditto/config.yml` relative to your current working directory. The CLI will attempt to read from this file every time a command is executed. See the [config.yml documentation](#files) for a full reference of how the CLI can be configured.
|
|
50
50
|
|
|
51
|
-
Once you've successfully authenticated and a config file has been created, you’re ready to start fetching copy! If you need to use the CLI with multiple configurations, simply
|
|
51
|
+
Once you've successfully authenticated and a config file has been created, you’re ready to start fetching copy! If you need to use the CLI with multiple configurations, simply initialize it in multiple directories.
|
|
52
52
|
|
|
53
53
|
## API Keys
|
|
54
54
|
|
|
55
55
|
The CLI will not prompt for an API key if a value is provided in the environment variable `DITTO_API_KEY`.
|
|
56
56
|
|
|
57
|
-
If the `DITTO_API_KEY` environment variable is not set, the CLI will
|
|
57
|
+
If the `DITTO_API_KEY` environment variable is not set, the CLI will look for an API token in [your authentication file](#authentication). If this file does not exist or does not contain a valid API key, the CLI will prompt for one.
|
|
58
58
|
|
|
59
59
|
We don't recommend editing the authentication file by hand; if you need to remove a saved API key or swap one key with another, it's better to fully delete the file and then re-run the CLI.
|
|
60
60
|
|
|
@@ -66,7 +66,7 @@ We don't recommend editing the authentication file by hand; if you need to remov
|
|
|
66
66
|
|
|
67
67
|
**Action:** Pulls data from Ditto according to configured sources.
|
|
68
68
|
|
|
69
|
-
Generate files your local `ditto/` folder
|
|
69
|
+
Generate files your local `ditto/` folder. File extension is determined by the `format` property specified in `config.yml`.
|
|
70
70
|
|
|
71
71
|
If no format is specified, the `flat` format will be used by default. Each time text is pulled from Ditto, the existing files in the `ditto/` directory are removed before new files are created in their place.
|
|
72
72
|
|
|
@@ -88,7 +88,9 @@ For more details on files generated by this command, see [Output Files](#output-
|
|
|
88
88
|
|
|
89
89
|
**Usage:** `ditto-cli component-folders`
|
|
90
90
|
|
|
91
|
-
**Action:** List component folders in your workspace.
|
|
91
|
+
**Action:** List component folders in your workspace.
|
|
92
|
+
|
|
93
|
+
More information about component folders in Ditto can be found [here](https://www.dittowords.com/docs/component-folders).
|
|
92
94
|
|
|
93
95
|
### Import components
|
|
94
96
|
|
|
@@ -129,7 +131,7 @@ variants: true
|
|
|
129
131
|
|
|
130
132
|
A list of places the CLI should pull text data from. For the CLI to function, at least one source type (`projects` or `components`) is required.
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
##### `sources.projects`
|
|
133
135
|
|
|
134
136
|
A list of projects to pull text from.
|
|
135
137
|
|
|
@@ -144,28 +146,79 @@ sources:
|
|
|
144
146
|
|
|
145
147
|
The `name` property is used for display purposes when referencing a project in the CLI, but does not have to be an exact match with the project name in Ditto.
|
|
146
148
|
|
|
147
|
-
|
|
149
|
+
An `exclude_components` property can be added on a per-project basis to indicate that text items should only be pulled which are not associated with a component:
|
|
150
|
+
|
|
151
|
+
```yml
|
|
152
|
+
sources:
|
|
153
|
+
projects:
|
|
154
|
+
- id: 61b8d26105f8f400e97fdd14
|
|
155
|
+
name: Landing Page Copy
|
|
156
|
+
exclude_components: true
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
##### `sources.components`
|
|
160
|
+
|
|
161
|
+
A boolean or configuration object indicating how component data should be pulled from your component library.
|
|
162
|
+
|
|
163
|
+
The simplest configuration is a boolean, which indicates that all components in your component library should be fetched:
|
|
164
|
+
|
|
165
|
+
```yml
|
|
166
|
+
sources:
|
|
167
|
+
components: true
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
You can also pass an object that supports two complementary properties: `root` and `folders`.
|
|
171
|
+
|
|
172
|
+
- `root` controls behavior for components that are NOT in folders (i.e. that are at the _root_ of the component library)
|
|
173
|
+
- `folders` controls behavior for components that are ARE in folders
|
|
148
174
|
|
|
149
|
-
|
|
175
|
+
If `root` is `true` and `folders` is unspecified, **only components not in folders** will be fetched:
|
|
150
176
|
|
|
151
177
|
```yml
|
|
152
178
|
sources:
|
|
153
179
|
components:
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
#
|
|
157
|
-
# if set to true, enables pulling data from the component
|
|
158
|
-
# library. if set to false, CLI behaves as if `sources.components`
|
|
159
|
-
# is not defined
|
|
160
|
-
enabled: true
|
|
180
|
+
root: true
|
|
181
|
+
```
|
|
161
182
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
183
|
+
If `root` is `false` and `folders` is unspecified, **only components in any folder** will be fetched:
|
|
184
|
+
|
|
185
|
+
```yml
|
|
186
|
+
sources:
|
|
187
|
+
components:
|
|
188
|
+
root: false
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
If `root` is unspecified and `folders` contains a list of component folders, **only components in the specified folders** will be fetched:
|
|
192
|
+
|
|
193
|
+
```yml
|
|
194
|
+
sources:
|
|
195
|
+
components:
|
|
166
196
|
folders:
|
|
167
|
-
- id:
|
|
168
|
-
name:
|
|
197
|
+
- id: folder-api-id-1
|
|
198
|
+
name: Folder 1
|
|
199
|
+
- id: folder-api-id-2
|
|
200
|
+
name: Folder 2
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
If `root` is `true` and `folders` contains a list of component folders, **non-folder components and components in the specified folders** will be fetched:
|
|
204
|
+
|
|
205
|
+
```yml
|
|
206
|
+
sources:
|
|
207
|
+
components:
|
|
208
|
+
folders:
|
|
209
|
+
- id: folder-api-id-1
|
|
210
|
+
name: Folder 1
|
|
211
|
+
- id: folder-api-id-2
|
|
212
|
+
name: Folder 2
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
`root` can also be specified as a configuration object with a `status` property to indicate that non-folder components should be fetched that have the indicated status:
|
|
216
|
+
|
|
217
|
+
```yml
|
|
218
|
+
sources:
|
|
219
|
+
components:
|
|
220
|
+
root:
|
|
221
|
+
status: WIP
|
|
169
222
|
```
|
|
170
223
|
|
|
171
224
|
#### Variants
|
|
@@ -178,7 +231,7 @@ Defaults to `false` if not specified.
|
|
|
178
231
|
variants: true
|
|
179
232
|
```
|
|
180
233
|
|
|
181
|
-
|
|
234
|
+
#### Format
|
|
182
235
|
|
|
183
236
|
The format that text data should be generated in. Accepted values:
|
|
184
237
|
|
|
@@ -202,26 +255,56 @@ format:
|
|
|
202
255
|
- ios-stringsdict
|
|
203
256
|
```
|
|
204
257
|
|
|
258
|
+
You should not specify multiple JSON formats in the same configuration, as they will overwrite one another when writing to disk.
|
|
259
|
+
|
|
205
260
|
#### Status
|
|
206
261
|
|
|
207
|
-
If
|
|
262
|
+
If specified, only source data with the indicated status will be fetched. Accepted values:
|
|
208
263
|
|
|
209
264
|
- `NONE`
|
|
210
265
|
- `WIP`
|
|
211
266
|
- `REVIEW`
|
|
212
267
|
- `FINAL`
|
|
213
268
|
|
|
269
|
+
If `status` is specified at the top level of the configuration, it will apply to all sources:
|
|
270
|
+
|
|
214
271
|
```yml
|
|
215
272
|
status: FINAL
|
|
273
|
+
sources:
|
|
274
|
+
components: true
|
|
275
|
+
projects:
|
|
276
|
+
- id: project-1
|
|
277
|
+
name: Project 1
|
|
216
278
|
```
|
|
217
279
|
|
|
218
|
-
|
|
280
|
+
`status` can also be specified at the level of individual sources:
|
|
219
281
|
|
|
220
|
-
|
|
282
|
+
```yml
|
|
283
|
+
sources:
|
|
284
|
+
components:
|
|
285
|
+
root:
|
|
286
|
+
status: REVIEW
|
|
287
|
+
folders:
|
|
288
|
+
- id: folder-api-id-1
|
|
289
|
+
name: Folder 1
|
|
290
|
+
status: NONE
|
|
291
|
+
projects:
|
|
292
|
+
- id: project-1
|
|
293
|
+
name: Project 1
|
|
294
|
+
status: WIP
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
If both are specified, a source-level `status` overrides a top-level `status`.
|
|
298
|
+
|
|
299
|
+
More information about Ditto statuses can be found [here](https://www.dittowords.com/docs/tips-for-collaborating).
|
|
221
300
|
|
|
222
301
|
#### Rich Text
|
|
223
302
|
|
|
224
|
-
If defined
|
|
303
|
+
If defined with the `flat` format, output values will be HTML strings (rich text) for each piece of source data.
|
|
304
|
+
|
|
305
|
+
If defined with the `structured` format, output data will include a `rich_text` property that is an HTML string (rich text) for each piece of source data.
|
|
306
|
+
|
|
307
|
+
You can read more about Ditto's rich text feature [here](https://www.dittowords.com/docs/rich-text).
|
|
225
308
|
|
|
226
309
|
```yml
|
|
227
310
|
richText: true
|
|
@@ -232,17 +315,21 @@ richText: true
|
|
|
232
315
|
```yml
|
|
233
316
|
sources:
|
|
234
317
|
components:
|
|
235
|
-
|
|
318
|
+
root: true
|
|
236
319
|
folders:
|
|
237
320
|
- id: 61b8d26105f8f400e97fdd14
|
|
238
321
|
name: Onboarding
|
|
322
|
+
- id: 61b8d26105f8f400e97fdd15
|
|
323
|
+
name: Onboarding 2
|
|
324
|
+
status: WIP
|
|
239
325
|
projects:
|
|
240
326
|
- name: Landing Page Copy
|
|
241
327
|
id: 61b8d26105f8f400e97fdd14
|
|
242
328
|
- name: User Settings
|
|
243
329
|
id: 606cb89ac55041013d552f8b
|
|
330
|
+
status: WIP
|
|
244
331
|
variants: true
|
|
245
|
-
format:
|
|
332
|
+
format: structured
|
|
246
333
|
status: FINAL
|
|
247
334
|
richText: false
|
|
248
335
|
```
|
|
@@ -274,19 +361,21 @@ All files created will adhere to the following template:
|
|
|
274
361
|
{source_name}__{variant_name}.{extension}
|
|
275
362
|
```
|
|
276
363
|
|
|
277
|
-
- `source_name`: the name of
|
|
278
|
-
-
|
|
279
|
-
-
|
|
364
|
+
- `source_name`: the name of the source a given file holds data for
|
|
365
|
+
- for projects, this is `{project-name}`
|
|
366
|
+
- for components, this is `components__{folder_name}`
|
|
367
|
+
- `variant_name`: the API ID of a variant or `base` for files generated for non-variant text
|
|
368
|
+
- `extension`: the file extension that corresponds to the configured format(s)
|
|
280
369
|
|
|
281
|
-
To
|
|
370
|
+
To keep cross-platform behavior consistent, file names will be fully lowercase, have whitespace replaced with hyphens, and have non-word characters (with the exception of `-` and `_`) removed.
|
|
282
371
|
|
|
283
372
|
If the configured format(s) result(s) in JSON files being generated, an `index.js` "driver file" is also created to simplify the process of integrating Ditto into web apps:
|
|
284
373
|
|
|
285
374
|
```js
|
|
286
375
|
module.exports = {
|
|
287
376
|
ditto_component_library: {
|
|
288
|
-
base: require("./
|
|
289
|
-
spanish: require("./
|
|
377
|
+
base: require("./components__root__base.json"),
|
|
378
|
+
spanish: require("./components__root__spanish.json"),
|
|
290
379
|
},
|
|
291
380
|
project_xxx: {
|
|
292
381
|
base: require("./example-project__base.json"),
|
package/bin/add-project.js
CHANGED
|
@@ -1,36 +1,104 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="341fbe24-4d10-55cb-81ec-4b58e4cf2348")}catch(e){}}();
|
|
3
|
+
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
13
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const projects = (0, getSelectedProjects_1.getSelectedProjects)();
|
|
13
|
-
const usingComponents = (0, getSelectedProjects_1.getIsUsingComponents)();
|
|
14
|
-
try {
|
|
15
|
-
if (usingComponents) {
|
|
16
|
-
if (projects.length) {
|
|
17
|
-
console.log(`\nYou're currently syncing text from the ${output_1.default.info("Component Library")} and from the following projects: ${(0, projectsToText_1.default)(projects)}`);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
console.log(`\nYou're currently only syncing text from the ${output_1.default.info("Component Library")}`);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
else if (projects.length) {
|
|
24
|
-
console.log(`\nYou're currently set up to sync text from the following projects: ${(0, projectsToText_1.default)(projects)}`);
|
|
25
|
-
}
|
|
26
|
-
await (0, project_1.collectAndSaveSource)({
|
|
27
|
-
components: false,
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
console.log(`\nSorry, there was an error adding a project to your workspace: `, error);
|
|
32
|
-
(0, quit_1.quit)("Project selection was not updated.");
|
|
33
|
-
}
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
34
21
|
};
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
var __async = (__this, __arguments, generator) => {
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
var fulfilled = (value) => {
|
|
34
|
+
try {
|
|
35
|
+
step(generator.next(value));
|
|
36
|
+
} catch (e) {
|
|
37
|
+
reject(e);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var rejected = (value) => {
|
|
41
|
+
try {
|
|
42
|
+
step(generator.throw(value));
|
|
43
|
+
} catch (e) {
|
|
44
|
+
reject(e);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
48
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
var add_project_exports = {};
|
|
52
|
+
__export(add_project_exports, {
|
|
53
|
+
default: () => add_project_default
|
|
54
|
+
});
|
|
55
|
+
module.exports = __toCommonJS(add_project_exports);
|
|
56
|
+
var import_project = require("./init/project");
|
|
57
|
+
var import_projectsToText = __toESM(require("./utils/projectsToText"));
|
|
58
|
+
var import_getSelectedProjects = require("./utils/getSelectedProjects");
|
|
59
|
+
var import_output = __toESM(require("./output"));
|
|
60
|
+
var import_quit = require("./utils/quit");
|
|
61
|
+
const addProject = () => __async(void 0, null, function* () {
|
|
62
|
+
const projects = (0, import_getSelectedProjects.getSelectedProjects)();
|
|
63
|
+
const usingComponents = (0, import_getSelectedProjects.getIsUsingComponents)();
|
|
64
|
+
try {
|
|
65
|
+
if (usingComponents) {
|
|
66
|
+
if (projects.length) {
|
|
67
|
+
console.log(
|
|
68
|
+
`
|
|
69
|
+
You're currently syncing text from the ${import_output.default.info(
|
|
70
|
+
"Component Library"
|
|
71
|
+
)} and from the following projects: ${(0, import_projectsToText.default)(projects)}`
|
|
72
|
+
);
|
|
73
|
+
} else {
|
|
74
|
+
console.log(
|
|
75
|
+
`
|
|
76
|
+
You're currently only syncing text from the ${import_output.default.info(
|
|
77
|
+
"Component Library"
|
|
78
|
+
)}`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
} else if (projects.length) {
|
|
82
|
+
console.log(
|
|
83
|
+
`
|
|
84
|
+
You're currently set up to sync text from the following projects: ${(0, import_projectsToText.default)(
|
|
85
|
+
projects
|
|
86
|
+
)}`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
yield (0, import_project.collectAndSaveSource)({
|
|
90
|
+
components: false
|
|
91
|
+
});
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.log(
|
|
94
|
+
`
|
|
95
|
+
Sorry, there was an error adding a project to your workspace: `,
|
|
96
|
+
error
|
|
97
|
+
);
|
|
98
|
+
(0, import_quit.quit)("Project selection was not updated.");
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
var add_project_default = addProject;
|
|
102
|
+
//# sourceMappingURL=add-project.js.map
|
|
103
|
+
|
|
104
|
+
//# debugId=341fbe24-4d10-55cb-81ec-4b58e4cf2348
|
package/bin/add-project.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../lib/add-project.ts"],"sourcesContent":["import { collectAndSaveSource } from \"./init/project\";\nimport projectsToText from \"./utils/projectsToText\";\nimport {\n getSelectedProjects,\n getIsUsingComponents,\n} from \"./utils/getSelectedProjects\";\nimport output from \"./output\";\nimport { quit } from \"./utils/quit\";\n\nconst addProject = async () => {\n const projects = getSelectedProjects();\n const usingComponents = getIsUsingComponents();\n\n try {\n if (usingComponents) {\n if (projects.length) {\n console.log(\n `\\nYou're currently syncing text from the ${output.info(\n \"Component Library\"\n )} and from the following projects: ${projectsToText(projects)}`\n );\n } else {\n console.log(\n `\\nYou're currently only syncing text from the ${output.info(\n \"Component Library\"\n )}`\n );\n }\n } else if (projects.length) {\n console.log(\n `\\nYou're currently set up to sync text from the following projects: ${projectsToText(\n projects\n )}`\n );\n }\n await collectAndSaveSource({\n components: false,\n });\n } catch (error) {\n console.log(\n `\\nSorry, there was an error adding a project to your workspace: `,\n error\n );\n quit(\"Project selection was not updated.\");\n }\n};\n\nexport default addProject;\n"],"names":["output","projectsToText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAqC;AACrC,4BAA2B;AAC3B,iCAGO;AACP,oBAAmB;AACnB,kBAAqB;AAErB,MAAM,aAAa,MAAY;AAC7B,QAAM,eAAW,gDAAoB;AACrC,QAAM,sBAAkB,iDAAqB;AAE7C,MAAI;AACF,QAAI,iBAAiB;AACnB,UAAI,SAAS,QAAQ;AACnB,gBAAQ;AAAA,UACN;AAAA,yCAA4C,cAAAA,QAAO;AAAA,YACjD;AAAA,UACF,CAAC,yCAAqC,sBAAAC,SAAe,QAAQ,CAAC;AAAA,QAChE;AAAA,MACF,OAAO;AACL,gBAAQ;AAAA,UACN;AAAA,8CAAiD,cAAAD,QAAO;AAAA,YACtD;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF,WAAW,SAAS,QAAQ;AAC1B,cAAQ;AAAA,QACN;AAAA,wEAAuE,sBAAAC;AAAA,UACrE;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AACA,cAAM,qCAAqB;AAAA,MACzB,YAAY;AAAA,IACd,CAAC;AAAA,EACH,SAAS,OAAO;AACd,YAAQ;AAAA,MACN;AAAA;AAAA,MACA;AAAA,IACF;AACA,0BAAK,oCAAoC;AAAA,EAC3C;AACF;AAEA,IAAO,sBAAQ","debug_id":"341fbe24-4d10-55cb-81ec-4b58e4cf2348"}
|
package/bin/api.js
CHANGED
|
@@ -1,19 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="60c0c8b2-1610-5e22-a814-c819798eb831")}catch(e){}}();
|
|
3
|
+
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
13
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
var api_exports = {};
|
|
32
|
+
__export(api_exports, {
|
|
33
|
+
createApiClient: () => createApiClient
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(api_exports);
|
|
36
|
+
var import_axios = __toESM(require("axios"));
|
|
37
|
+
var import_config = __toESM(require("./config"));
|
|
38
|
+
var import_consts = __toESM(require("./consts"));
|
|
10
39
|
function createApiClient(token) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
40
|
+
return import_axios.default.create({
|
|
41
|
+
baseURL: import_consts.default.API_HOST,
|
|
42
|
+
headers: {
|
|
43
|
+
Authorization: `token ${token || import_config.default.getToken(import_consts.default.CONFIG_FILE, import_consts.default.API_HOST)}`
|
|
44
|
+
}
|
|
45
|
+
});
|
|
17
46
|
}
|
|
18
|
-
|
|
19
|
-
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
createApiClient
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=api.js.map
|
|
52
|
+
|
|
53
|
+
//# debugId=60c0c8b2-1610-5e22-a814-c819798eb831
|
package/bin/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../lib/api.ts"],"sourcesContent":["import axios from \"axios\";\n\nimport config from \"./config\";\nimport consts from \"./consts\";\n\nexport function createApiClient(token?: string) {\n return axios.create({\n baseURL: consts.API_HOST,\n headers: {\n Authorization: `token ${\n token || config.getToken(consts.CONFIG_FILE, consts.API_HOST)\n }`,\n },\n });\n}\n"],"names":["axios","consts","config"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,oBAAmB;AACnB,oBAAmB;AAEZ,SAAS,gBAAgB,OAAgB;AAC9C,SAAO,aAAAA,QAAM,OAAO;AAAA,IAClB,SAAS,cAAAC,QAAO;AAAA,IAChB,SAAS;AAAA,MACP,eAAe,SACb,SAAS,cAAAC,QAAO,SAAS,cAAAD,QAAO,aAAa,cAAAA,QAAO,QAAQ,CAC9D;AAAA,IACF;AAAA,EACF,CAAC;AACH","debug_id":"60c0c8b2-1610-5e22-a814-c819798eb831"}
|
package/bin/component-folders.js
CHANGED
|
@@ -1,10 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8df60202-713f-56b5-a6d5-8b65d7194665")}catch(e){}}();
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var __async = (__this, __arguments, generator) => {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
var fulfilled = (value) => {
|
|
24
|
+
try {
|
|
25
|
+
step(generator.next(value));
|
|
26
|
+
} catch (e) {
|
|
27
|
+
reject(e);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var rejected = (value) => {
|
|
31
|
+
try {
|
|
32
|
+
step(generator.throw(value));
|
|
33
|
+
} catch (e) {
|
|
34
|
+
reject(e);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
38
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
var component_folders_exports = {};
|
|
42
|
+
__export(component_folders_exports, {
|
|
43
|
+
showComponentFolders: () => showComponentFolders
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(component_folders_exports);
|
|
46
|
+
var import_fetchComponentFolders = require("./http/fetchComponentFolders");
|
|
47
|
+
function showComponentFolders() {
|
|
48
|
+
return __async(this, null, function* () {
|
|
49
|
+
const folders = yield (0, import_fetchComponentFolders.fetchComponentFolders)();
|
|
7
50
|
console.log(JSON.stringify(folders));
|
|
51
|
+
});
|
|
8
52
|
}
|
|
9
|
-
|
|
10
|
-
|
|
53
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
+
0 && (module.exports = {
|
|
55
|
+
showComponentFolders
|
|
56
|
+
});
|
|
57
|
+
//# sourceMappingURL=component-folders.js.map
|
|
58
|
+
|
|
59
|
+
//# debugId=8df60202-713f-56b5-a6d5-8b65d7194665
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../lib/component-folders.ts"],"sourcesContent":["import { fetchComponentFolders } from \"./http/fetchComponentFolders\";\n\nasync function showComponentFolders() {\n const folders = await fetchComponentFolders();\n\n console.log(JSON.stringify(folders));\n}\n\nexport { showComponentFolders };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mCAAsC;AAEtC,SAAe,uBAAuB;AAAA;AACpC,UAAM,UAAU,UAAM,oDAAsB;AAE5C,YAAQ,IAAI,KAAK,UAAU,OAAO,CAAC;AAAA,EACrC;AAAA","debug_id":"8df60202-713f-56b5-a6d5-8b65d7194665"}
|