@dittowords/cli 2.7.1 → 3.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.
Files changed (53) hide show
  1. package/README.md +150 -137
  2. package/bin/add-project.js +5 -7
  3. package/bin/add-project.js.map +1 -1
  4. package/bin/api.js +0 -5
  5. package/bin/api.js.map +1 -1
  6. package/bin/config.js +38 -11
  7. package/bin/config.js.map +1 -1
  8. package/bin/ditto.js +66 -57
  9. package/bin/ditto.js.map +1 -1
  10. package/bin/http/fetchVariants.js +26 -0
  11. package/bin/http/fetchVariants.js.map +1 -0
  12. package/bin/init/init.js +17 -6
  13. package/bin/init/init.js.map +1 -1
  14. package/bin/init/project.js +38 -45
  15. package/bin/init/project.js.map +1 -1
  16. package/bin/init/token.js +22 -20
  17. package/bin/init/token.js.map +1 -1
  18. package/bin/pull.js +142 -193
  19. package/bin/pull.js.map +1 -1
  20. package/bin/remove-project.js +2 -7
  21. package/bin/remove-project.js.map +1 -1
  22. package/bin/utils/cleanFileName.js +11 -0
  23. package/bin/utils/cleanFileName.js.map +1 -0
  24. package/bin/utils/generateJsDriver.js +56 -0
  25. package/bin/utils/generateJsDriver.js.map +1 -0
  26. package/bin/utils/getSelectedProjects.js +3 -18
  27. package/bin/utils/getSelectedProjects.js.map +1 -1
  28. package/bin/utils/projectsToText.js +10 -1
  29. package/bin/utils/projectsToText.js.map +1 -1
  30. package/bin/utils/promptForProject.js +2 -3
  31. package/bin/utils/promptForProject.js.map +1 -1
  32. package/bin/utils/quit.js +10 -0
  33. package/bin/utils/quit.js.map +1 -0
  34. package/lib/add-project.ts +6 -9
  35. package/lib/api.ts +0 -5
  36. package/lib/config.ts +57 -19
  37. package/lib/ditto.ts +74 -58
  38. package/lib/http/fetchVariants.ts +30 -0
  39. package/lib/init/init.ts +38 -6
  40. package/lib/init/project.test.ts +3 -3
  41. package/lib/init/project.ts +47 -58
  42. package/lib/init/token.ts +17 -16
  43. package/lib/pull.ts +205 -261
  44. package/lib/remove-project.ts +2 -8
  45. package/lib/types.ts +24 -3
  46. package/lib/utils/cleanFileName.ts +6 -0
  47. package/lib/utils/generateJsDriver.ts +68 -0
  48. package/lib/utils/getSelectedProjects.ts +5 -24
  49. package/lib/utils/projectsToText.ts +11 -1
  50. package/lib/utils/promptForProject.ts +2 -3
  51. package/lib/utils/quit.ts +5 -0
  52. package/package.json +1 -1
  53. package/tsconfig.json +2 -1
package/README.md CHANGED
@@ -35,20 +35,20 @@ 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 configure the CLI with an initial project from your workspace:
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
- Looks like there are no Ditto projects selected for your current directory.
41
+ Looks like there are no Ditto sources selected for your current directory: /Users/ditto
42
42
 
43
- ? Choose the project you'd like to sync text from:
44
- - Ditto Component Library https://app.dittowords.com/components/all
43
+ ? Choose the source you'd like to sync text from:
44
+ - Ditto Component Library https://app.dittowords.com/components
45
45
  - NUX Onboarding Flow https://app.dittowords.com/doc/609e9981c313f8018d0c346a
46
46
  ...
47
47
  ```
48
48
 
49
- After selecting a project, 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 [documentation on config.yml](#files) further down in this README for a full reference of how the CLI can be configured.
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) further down in this README 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! You can set up the CLI in multiple directories by running `ditto-cli` and choosing an initial project to sync from.
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 run `ditto-cli` in multiple directories.
52
52
 
53
53
  ## API Keys
54
54
 
@@ -56,201 +56,214 @@ The CLI will not prompt for an API key if a value is provided in the environment
56
56
 
57
57
  If the `DITTO_API_KEY` environment variable is not set, the CLI will attempt to parse a token from [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
- We don't recommend editing the file manually; if you need to remove a saved API key and put another one in its place,
60
- it's better to fully delete the file and then re-run the CLI so that a new key is prompted for.
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.
61
60
 
62
61
  ## Commands
63
62
 
64
- ### `pull`
63
+ ### Pull
65
64
 
66
- **Usage:** `ditto-cli pull`
65
+ **Usage:** `ditto-cli` (no commands), `ditto-cli pull`
67
66
 
68
- **Action:** Pulls text data from projects linked in `config.yml` and stores it in the `ditto/` folder.
67
+ **Action:** Pulls data from Ditto according to configured sources.
69
68
 
70
- The data will be stored in JSON, XML, or .strings files according to the `format` property specified in `config.yml`. If no format is specified, the default structured format will be used. Every time text is pulled, the existing text data is removed before new data is generated and stored.
69
+ Files in your local `ditto/` folder will be generated (`.json`, `.xml`, or `.strings` format according to the `format` property specified in `config.yml`.
71
70
 
72
- For more details on files generated by the `pull` command, see [JSON Files](#json-files).
71
+ If no format is specified, the `flat` format will be used by default. Each time text is pulled from Ditto, the existing text files in the `ditto/` directory are removed before new files are created in their place.
73
72
 
74
- ### `project add`
73
+ For more details on files generated by this command, see [JSON Files](#json-files).
74
+
75
+ ### Add project
75
76
 
76
77
  **Usage:** `ditto-cli project add`
77
78
 
78
- **Action:** Adds a project to the list of Ditto projects stored in `config.yml`. Running this will allow you to select from a list of projects in your workspace that have developer mode enabled.
79
+ **Action:** Lists projects in your workspace that have developer mode enabled and permits selecting one to add to `config.yml` via an interactive prompt.
79
80
 
80
- ### `project remove`
81
+ ### Remove project
81
82
 
82
83
  **Usage:** `ditto-cli project remove`
83
84
 
84
- **Action:** Removes a project from the list of Ditto projects stored in `config.yml`.
85
-
86
- ## Options
85
+ **Action:** Lists projects in `config.yml` and permits selecting one to remove from `config.yml` via an interactive prompt.
87
86
 
88
- `-m, --meta <data...>` Optional metadata to send arbitrary data to the backend. Ex: `-m githubActionRequest:true trigger:manual`. Currently, this option should only be utilized when the CLI is ran within a GitHub action (see [Ditto GitHub Action](https://github.com/dittowords/ditto-github-action)) via `githubActionRequest:true`.
87
+ ## Configuration
89
88
 
90
- ## Files
89
+ The `config.yml` file is the source of truth for a given directory about how the CLI should fetch and store data from Ditto. It includes information about which Ditto projects the CLI should pull text from, whether or not the component library should be included, in what format the text should be stored, and more.
91
90
 
92
- ### `ditto/`
91
+ This file is edited by the `project add` / `project remove` commands, but most options are currently only supported through manual edits.
93
92
 
94
- This folder houses the configuration file (`ditto/config.yml`) used by the CLI and is also the default write destination for any files the CLI generates. See [Output Directory](#output-directory) for details about how to customize the location that files are written to.
93
+ This is the default configuration file that is generated the first time that the CLI is run in a given directory:
95
94
 
96
- If you run the CLI in a directory that does not contain a `ditto/` folder, the folder and a `config.yml` file will be automatically created.
95
+ ```yml
96
+ sources:
97
+ components:
98
+ enabled: true
99
+ format: flat
100
+ variants: true
101
+ ```
97
102
 
98
- - #### config.yml
103
+ ### Supported Properties
99
104
 
100
- This is the source of truth for a given directory about how the CLI should fetch and store data from Ditto. It includes information about which Ditto projects the CLI should pull text from and in what format the text should be stored.
105
+ #### Sources
101
106
 
102
- This file is managed by the `project add` / `project remove` commands, but can also be updated by manually editing it.
107
+ 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.
103
108
 
104
- **Supported properties**
109
+ #### `sources.projects`
105
110
 
106
- ##### `projects`
111
+ A list of projects to pull text from.
107
112
 
108
- A list of project names and ids to pull text from.
113
+ ```yml
114
+ sources:
115
+ projects:
116
+ - id: 61b8d26105f8f400e97fdd14
117
+ name: Landing Page Copy
118
+ - id: 606cb89ac55041013d552f8b
119
+ name: User Settings
120
+ ```
109
121
 
110
- Required if `components: true` is not specified.
122
+ 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.
123
+
124
+ #### `sources.components`
125
+
126
+ An object to configure pulling component data from your component library.
127
+
128
+ ```yml
129
+ sources:
130
+ components:
131
+ # type: boolean
132
+ # required: true
133
+ #
134
+ # if set to true, enables pulling data from the component
135
+ # library. if set to false, CLI behaves as if `sources.components`
136
+ # is not defined
137
+ enabled: true
138
+
139
+ # type: { id: string; name: string; }
140
+ # required: false
141
+ #
142
+ # if defined, restricts the CLI to only pulling data for components that are in the specified folders.
143
+ folders:
144
+ - id: 61b8d26105f8f400e97fdd14
145
+ name: Onboarding
146
+ ```
111
147
 
112
- **Note**: the `name` property is used for display purposes when referencing a project in the CLI, but does not have to be an
113
- exact match with the project name in Ditto.
148
+ #### Variants
114
149
 
115
- ```yml
116
- projects:
117
- - name: Landing Page Copy
118
- id: 61b8d26105f8f400e97fdd14
119
- - name: User Settings
120
- id: 606cb89ac55041013d552f8b
121
- ```
150
+ Enables including variant information when pulling text data for configured sources.
122
151
 
123
- ##### `components`
152
+ Defaults to `false` if not specified.
124
153
 
125
- If included with a value of `true`, data from the component library will be fetched and included in the CLI's output.
154
+ ```yml
155
+ variants: true
156
+ ```
126
157
 
127
- Required if `projects` is not specified with a valid list of projects.
158
+ ##### Format
128
159
 
129
- ```yml
130
- components: true
131
- ```
160
+ The format that text data should be generated in. Accepted values:
132
161
 
133
- ##### `variants`
162
+ - `structured`
163
+ - `flat`
164
+ - `android`
165
+ - `ios-strings`
134
166
 
135
- If included with a value of `true`, variant data will be pulled for the specified projects and/or the component library.
167
+ Defaults to `flat` if not specified.
136
168
 
137
- Defaults to `false`.
169
+ ```yml
170
+ format: flat
171
+ ```
138
172
 
139
- ```yml
140
- variants: true
141
- ```
173
+ #### Status
142
174
 
143
- ##### `format`
175
+ If defined, data pulled will be restricted to text items or components that have the specified status. Accepted values:
144
176
 
145
- The format the specified projects should be stored in. Acceptable values are `structured`, `flat`, `android`, and `ios-strings`.
177
+ - `NONE`
178
+ - `WIP`
179
+ - `REVIEW`
180
+ - `FINAL`
146
181
 
147
- If not specified, the default format containing block and frame data will be used.
182
+ ```yml
183
+ status: FINAL
184
+ ```
148
185
 
149
- ```yml
150
- format: flat
151
- ```
186
+ Defaults to no status restriction if not specified.
152
187
 
153
- ##### `status`
188
+ More information about statuses can be found [here](https://www.dittowords.com/docs/tips-for-collaborating).
154
189
 
155
- If included, results will only include data with the passed in status value. Excluding this value will result in no filtering. Acceptable values are `NONE`, `WIP`, `REVIEW`, `FINAL`, and `DEV`.
190
+ #### Rich Text
156
191
 
157
- More information about statuses can be found [here](https://www.dittowords.com/docs/tips-for-collaborating).
192
+ If defined in conjunction with the `structured` format, output data will include an HTML string (rich text) for each text item or component that is sourced. You can read more about Ditto's rich text feature [here](https://www.dittowords.com/docs/rich-text).
158
193
 
159
- ```yml
160
- status: FINAL
161
- ```
194
+ ```yml
195
+ richText: true
196
+ ```
162
197
 
163
- **Full Example**
198
+ ### Full Configuration Example
164
199
 
165
- ```yml
200
+ ```yml
201
+ sources:
202
+ components:
203
+ enabled: true
204
+ folders:
205
+ - id: 61b8d26105f8f400e97fdd14
206
+ name: Onboarding
166
207
  projects:
167
208
  - name: Landing Page Copy
168
209
  id: 61b8d26105f8f400e97fdd14
169
210
  - name: User Settings
170
211
  id: 606cb89ac55041013d552f8b
171
- components: true
172
- variants: true
173
- format: flat
174
- status: FINAL
175
- ```
176
-
177
- - #### JSON Files
178
-
179
- For `structured` and `flat` formats the copy pulled from your Ditto projects is saved to JSON files in the `ditto/` folder.
180
-
181
- The number of files present and the convention with which they're named will vary according to the options specified in `config.yml`:
182
-
183
- - If the `variants` and `format` options are unset, all data will be stored in a single file: `text.json`
184
- - If the `variants` option is `true` and the `format` option is unset, files will be written on a per-variant basis; `base.json` will contain all base (non-variant) text and all other files will follow the pattern `[variant-api-id].json`.
185
- - If the `variants` option is unset and the `format` open is `flat` or `structured`, files will be written on a per-project basis following the pattern `[project-id].json`.
186
- - If the `variants` option is `true` and the `format` option is `flat` or `structured`, files will be written on a per-project per-variant basis following the pattern `[project-id__variant-api-id].json`. These files will NOT contain the top-level `projects` and `project_xyz` keys.
187
-
188
- - #### Mobile files (XML and .strings)
189
-
190
- When `format` is set to `android`, the resulting files will be in XML format. More information about the contents of the XML files can be found [here](https://developer.dittowords.com/api-reference#android).
191
-
192
- When `format` is set to `ios-strings`, the resulting files will be in .strings format. More information about the contents of the .strings files can be found [here](https://developer.dittowords.com/api-reference#ios-strings).
193
-
194
- - #### `index.js`
195
-
196
- An automatically generated driver file that simplifies the process of passing text data to Ditto JavaScript SDKs. This file has a standardized format that is always the same independent of the CLI configuration used to generate it.
212
+ variants: true
213
+ format: flat
214
+ status: FINAL
215
+ richText: false
216
+ ```
197
217
 
198
- **Since this file is designed to be consumed by other internal Ditto libraries, it is not recommended that you depend on it - its format may change between major releases.**
218
+ ## CLI Files
199
219
 
200
- ```ts
201
- interface DriverFile {
202
- [projectId: string]: {
203
- // non-variant text is represented via an apiId of 'base'
204
- [variantApiId: string]: {
205
- [id: string]: Frame | { text: string } | string;
206
- };
207
- };
208
- }
220
+ ### `ditto/` Directory
209
221
 
210
- interface Frame {
211
- blocks: {
212
- [blockId: string]: {
213
- [textApiId: string]: StructuredText;
214
- };
215
- };
216
- otherText: {
217
- [textId: string]: StructuredText;
218
- };
219
- }
222
+ This directory houses the configuration file (`ditto/config.yml`) used by the CLI and is also the default write destination for any files the CLI generates. See [Output Directory](#output-directory) for details on how to customize the location that files are written to.
220
223
 
221
- interface StructuredText {
222
- text: string;
223
- }
224
- ```
224
+ If you run the CLI in a directory that does not contain a `ditto/` folder, the folder and a default `config.yml` file will be automatically created.
225
225
 
226
- ```js
227
- module.exports = {
228
- ditto_component_library: {
229
- base: require("./ditto_component_library__base.json"),
230
- spanish: require("./ditto_component_library__spanish.json"),
231
- },
232
- project_1234: {
233
- base: require("./example-project__base.json"),
234
- spanish: require("./example-project__spanish.json"),
235
- },
236
- };
237
- ```
226
+ #### Output Files
238
227
 
239
- Example usage:
228
+ The CLI outputs data from Ditto by writing files to disk in your `ditto/` directory. The format and extension of such files will correspond to the `format` property of your configuration.
240
229
 
241
- ```jsx
242
- import source from "./ditto";
230
+ | **Format** | **File Extension** | **Common Usage** |
231
+ | :---------: | :----------------: | :-----------------: |
232
+ | flat | JSON | Web apps |
233
+ | structured | JSON | Web apps |
234
+ | android | XML | Native Android apps |
235
+ | ios-strings | STRINGS | Native iOS apps |
243
236
 
244
- const App = () => <DittoProvider source={source}>...</DittoProvider>;
245
- ```
237
+ All files created will adhere to the following template:
246
238
 
247
- ## Files
239
+ ```
240
+ {source_name}__{variant_name}.{extension}
241
+ ```
248
242
 
249
- ### Output Directory
243
+ - `source_name`: the name of a project or `ditto_component_library` for files containing component data
244
+ - `variant_name`: the ID of a variant or `base` for files generated for non-variant text
245
+ - `extension`: the file extension that corresponds to your configured format
246
+
247
+ To help with keeping 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.
248
+
249
+ If the configured format results in JSON files being generated, an `index.js` "driver file" is also created to simplify the process of integrating Ditto into web apps:
250
+
251
+ ```js
252
+ module.exports = {
253
+ ditto_component_library: {
254
+ base: require("./ditto_component_library__base.json"),
255
+ spanish: require("./ditto_component_library__spanish.json"),
256
+ },
257
+ project_xxx: {
258
+ base: require("./example-project__base.json"),
259
+ spanish: require("./example-project__spanish.json"),
260
+ },
261
+ };
262
+ ```
250
263
 
251
- By default, the CLI writes it's output files to `./ditto` (relative to the current working directory of the running process). The default path can be overwritten by specifying a custom one via the environment variable `DITTO_TEXT_DIR`.
264
+ The driver file is currently generated as a CommonJS module, but it's possible that ESM will be supported in the future.
252
265
 
253
- ### Authentication
266
+ ## Authentication
254
267
 
255
268
  By default, your API key is saved to `$HOME/.config/ditto`; the default path can be overwritten by specifying a custom one via the environment variable `DITTO_CONFIG_FILE`.
256
269
 
@@ -7,11 +7,7 @@ const project_1 = require("./init/project");
7
7
  const projectsToText_1 = __importDefault(require("./utils/projectsToText"));
8
8
  const getSelectedProjects_1 = require("./utils/getSelectedProjects");
9
9
  const output_1 = __importDefault(require("./output"));
10
- function quit(exitCode = 2) {
11
- console.log("Project selection was not updated.");
12
- process.exitCode = exitCode;
13
- process.exit();
14
- }
10
+ const quit_1 = require("./utils/quit");
15
11
  const addProject = async () => {
16
12
  const projects = (0, getSelectedProjects_1.getSelectedProjects)();
17
13
  const usingComponents = (0, getSelectedProjects_1.getIsUsingComponents)();
@@ -27,11 +23,13 @@ const addProject = async () => {
27
23
  else if (projects.length) {
28
24
  console.log(`\nYou're currently set up to sync text from the following projects: ${(0, projectsToText_1.default)(projects)}`);
29
25
  }
30
- await (0, project_1.collectAndSaveProject)(false);
26
+ await (0, project_1.collectAndSaveSource)({
27
+ components: false,
28
+ });
31
29
  }
32
30
  catch (error) {
33
31
  console.log(`\nSorry, there was an error adding a project to your workspace: `, error);
34
- quit();
32
+ (0, quit_1.quit)("Project selection was not updated.");
35
33
  }
36
34
  };
37
35
  exports.default = addProject;
@@ -1 +1 @@
1
- {"version":3,"file":"add-project.js","sourceRoot":"","sources":["../lib/add-project.ts"],"names":[],"mappings":";;;;;AAAA,4CAAuD;AACvD,4EAAoD;AACpD,qEAGqC;AACrC,sDAA8B;AAE9B,SAAS,IAAI,CAAC,QAAQ,GAAG,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;IAClD,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC5B,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,GAAG,KAAK,IAAI,EAAE;IAC5B,MAAM,QAAQ,GAAG,IAAA,yCAAmB,GAAE,CAAC;IACvC,MAAM,eAAe,GAAG,IAAA,0CAAoB,GAAE,CAAC;IAE/C,IAAI;QACF,IAAI,eAAe,EAAE;YACnB,IAAI,QAAQ,CAAC,MAAM,EAAE;gBACnB,OAAO,CAAC,GAAG,CACT,4CAA4C,gBAAM,CAAC,IAAI,CACrD,mBAAmB,CACpB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F,QAAQ,CACT,EAAE,CACJ,CAAC;SACH;QACD,MAAM,IAAA,8BAAoB,EAAC;YACzB,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;KACJ;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,CAAC,GAAG,CACT,kEAAkE,EAClE,KAAK,CACN,CAAC;QACF,IAAA,WAAI,EAAC,oCAAoC,CAAC,CAAC;KAC5C;AACH,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
package/bin/api.js CHANGED
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.create = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
- const https_1 = __importDefault(require("https"));
9
8
  const config_1 = __importDefault(require("./config"));
10
9
  const consts_1 = __importDefault(require("./consts"));
11
10
  const create = (token) => {
@@ -14,10 +13,6 @@ const create = (token) => {
14
13
  headers: {
15
14
  Authorization: `token ${token}`,
16
15
  },
17
- httpsAgent: new https_1.default.Agent({
18
- requestCert: true,
19
- rejectUnauthorized: false,
20
- }),
21
16
  });
22
17
  };
23
18
  exports.create = create;
package/bin/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../lib/api.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,kDAA0B;AAE1B,sDAA8B;AAC9B,sDAA8B;AAEvB,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EAAE;IACvC,OAAO,eAAK,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,gBAAM,CAAC,QAAQ;QACxB,OAAO,EAAE;YACP,aAAa,EAAE,SAAS,KAAK,EAAE;SAChC;QACD,UAAU,EAAE,IAAI,eAAK,CAAC,KAAK,CAAC;YAC1B,WAAW,EAAE,IAAI;YACjB,kBAAkB,EAAE,KAAK;SAC1B,CAAC;KACH,CAAC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,MAAM,UAWjB;AAEF,kBAAe,IAAA,cAAM,EAAC,gBAAM,CAAC,QAAQ,CAAC,gBAAM,CAAC,WAAW,EAAE,gBAAM,CAAC,QAAQ,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../lib/api.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,sDAA8B;AAC9B,sDAA8B;AAEvB,MAAM,MAAM,GAAG,CAAC,KAAc,EAAE,EAAE;IACvC,OAAO,eAAK,CAAC,MAAM,CAAC;QAClB,OAAO,EAAE,gBAAM,CAAC,QAAQ;QACxB,OAAO,EAAE;YACP,aAAa,EAAE,SAAS,KAAK,EAAE;SAChC;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAPW,QAAA,MAAM,UAOjB;AAEF,kBAAe,IAAA,cAAM,EAAC,gBAAM,CAAC,QAAQ,CAAC,gBAAM,CAAC,WAAW,EAAE,gBAAM,CAAC,QAAQ,CAAC,CAAC,CAAC"}
package/bin/config.js CHANGED
@@ -3,17 +3,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DEFAULT_CONFIG = exports.DEFAULT_CONFIG_JSON = void 0;
6
7
  const fs_1 = __importDefault(require("fs"));
7
8
  const path_1 = __importDefault(require("path"));
8
9
  const url_1 = __importDefault(require("url"));
9
10
  const js_yaml_1 = __importDefault(require("js-yaml"));
10
11
  const consts_1 = __importDefault(require("./consts"));
11
- function createFileIfMissing(filename) {
12
+ exports.DEFAULT_CONFIG_JSON = {
13
+ sources: {
14
+ components: { enabled: true },
15
+ },
16
+ variants: true,
17
+ format: "flat",
18
+ };
19
+ exports.DEFAULT_CONFIG = js_yaml_1.default.dump(exports.DEFAULT_CONFIG_JSON);
20
+ function createFileIfMissing(filename, defaultContents) {
12
21
  const dir = path_1.default.dirname(filename);
22
+ // create the directory if it doesn't already exist
13
23
  if (!fs_1.default.existsSync(dir))
14
24
  fs_1.default.mkdirSync(dir);
25
+ // create the file if it doesn't already exist
15
26
  if (!fs_1.default.existsSync(filename)) {
16
- fs_1.default.closeSync(fs_1.default.openSync(filename, "w"));
27
+ // create the file, writing the `defaultContents` if provided
28
+ fs_1.default.writeFileSync(filename, defaultContents || "", "utf-8");
17
29
  }
18
30
  }
19
31
  function jsonIsConfigYAML(json) {
@@ -22,7 +34,8 @@ function jsonIsConfigYAML(json) {
22
34
  function jsonIsGlobalYAML(json) {
23
35
  return (!!json &&
24
36
  typeof json === "object" &&
25
- Object.values(json).every((arr) => arr.every((val) => typeof val === "object" && Object.keys(val).includes("token"))));
37
+ Object.values(json).every((arr) => arr.every &&
38
+ arr.every((val) => typeof val === "object" && Object.keys(val).includes("token"))));
26
39
  }
27
40
  /**
28
41
  * Read data from a project config file
@@ -31,7 +44,7 @@ function jsonIsGlobalYAML(json) {
31
44
  * @returns { ConfigYAML }
32
45
  */
33
46
  function readProjectConfigData(file = consts_1.default.PROJECT_CONFIG_FILE, defaultData = {}) {
34
- createFileIfMissing(file);
47
+ createFileIfMissing(file, exports.DEFAULT_CONFIG);
35
48
  const fileContents = fs_1.default.readFileSync(file, "utf8");
36
49
  const yamlData = js_yaml_1.default.load(fileContents);
37
50
  if (jsonIsConfigYAML(yamlData)) {
@@ -55,9 +68,17 @@ function readGlobalConfigData(file = consts_1.default.CONFIG_FILE, defaultData =
55
68
  return defaultData;
56
69
  }
57
70
  function writeProjectConfigData(file, data) {
58
- createFileIfMissing(file);
71
+ createFileIfMissing(file, exports.DEFAULT_CONFIG);
59
72
  const existingData = readProjectConfigData(file);
60
- const yamlStr = js_yaml_1.default.dump({ ...existingData, ...data });
73
+ const configData = {
74
+ ...existingData,
75
+ ...data,
76
+ sources: {
77
+ ...existingData.sources,
78
+ ...data.sources,
79
+ },
80
+ };
81
+ const yamlStr = js_yaml_1.default.dump(configData);
61
82
  fs_1.default.writeFileSync(file, yamlStr, "utf8");
62
83
  }
63
84
  function writeGlobalConfigData(file, data) {
@@ -130,25 +151,26 @@ function dedupeProjectName(projectNames, projectName) {
130
151
  * - an array of valid, deduped projects
131
152
  * - the `variants` and `format` config options
132
153
  */
133
- function parseSourceInformation() {
134
- const { projects, components, variants, format, status } = readProjectConfigData();
154
+ function parseSourceInformation(file) {
155
+ const { sources, variants, format, status, richText, projects: projectsRoot, components: componentsRoot, } = readProjectConfigData(file);
156
+ const projects = sources?.projects || [];
135
157
  const projectNames = new Set();
136
158
  const validProjects = [];
137
- let componentLibraryInProjects = false;
159
+ let hasComponentLibraryInProjects = false;
138
160
  (projects || []).forEach((project) => {
139
161
  const isValid = project.id && project.name;
140
162
  if (!isValid) {
141
163
  return;
142
164
  }
143
165
  if (project.id === "ditto_component_library") {
144
- componentLibraryInProjects = true;
166
+ hasComponentLibraryInProjects = true;
145
167
  return;
146
168
  }
147
169
  project.fileName = dedupeProjectName(projectNames, project.name);
148
170
  projectNames.add(project.fileName);
149
171
  validProjects.push(project);
150
172
  });
151
- const shouldFetchComponentLibrary = !!components || componentLibraryInProjects;
173
+ const shouldFetchComponentLibrary = Boolean(sources?.components?.enabled);
152
174
  const hasSourceData = !!validProjects.length || shouldFetchComponentLibrary;
153
175
  return {
154
176
  hasSourceData,
@@ -157,6 +179,11 @@ function parseSourceInformation() {
157
179
  variants: variants || false,
158
180
  format,
159
181
  status,
182
+ richText,
183
+ hasTopLevelProjectsField: !!projectsRoot,
184
+ hasTopLevelComponentsField: !!componentsRoot,
185
+ hasComponentLibraryInProjects,
186
+ componentFolders: sources?.components?.folders || null,
160
187
  };
161
188
  }
162
189
  exports.default = {
package/bin/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../lib/config.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,8CAAsB;AACtB,sDAA2B;AAE3B,sDAA8B;AAG9B,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,MAA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