@gadgetinc/ggt 1.0.2 → 1.0.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 (99) hide show
  1. package/README.md +192 -128
  2. package/lib/__generated__/graphql.js.map +1 -1
  3. package/lib/commands/add.js +385 -0
  4. package/lib/commands/add.js.map +1 -0
  5. package/lib/commands/deploy.js +20 -102
  6. package/lib/commands/deploy.js.map +1 -1
  7. package/lib/commands/dev.js +43 -114
  8. package/lib/commands/dev.js.map +1 -1
  9. package/lib/commands/list.js +3 -6
  10. package/lib/commands/list.js.map +1 -1
  11. package/lib/commands/login.js +2 -5
  12. package/lib/commands/login.js.map +1 -1
  13. package/lib/commands/logout.js +2 -5
  14. package/lib/commands/logout.js.map +1 -1
  15. package/lib/commands/open.js +45 -86
  16. package/lib/commands/open.js.map +1 -1
  17. package/lib/commands/pull.js +19 -76
  18. package/lib/commands/pull.js.map +1 -1
  19. package/lib/commands/push.js +19 -76
  20. package/lib/commands/push.js.map +1 -1
  21. package/lib/commands/root.js +4 -3
  22. package/lib/commands/root.js.map +1 -1
  23. package/lib/commands/status.js +3 -8
  24. package/lib/commands/status.js.map +1 -1
  25. package/lib/commands/version.js +6 -5
  26. package/lib/commands/version.js.map +1 -1
  27. package/lib/commands/whoami.js +2 -5
  28. package/lib/commands/whoami.js.map +1 -1
  29. package/lib/ggt.js.map +1 -1
  30. package/lib/main.js.map +1 -1
  31. package/lib/services/app/api/api.js.map +1 -1
  32. package/lib/services/app/api/operation.js +11 -0
  33. package/lib/services/app/api/operation.js.map +1 -1
  34. package/lib/services/app/app.js +21 -2
  35. package/lib/services/app/app.js.map +1 -1
  36. package/lib/services/app/arg.js.map +1 -1
  37. package/lib/services/app/client.js.map +1 -1
  38. package/lib/services/app/edit/edit.js.map +1 -1
  39. package/lib/services/app/edit/operation.js +52 -0
  40. package/lib/services/app/edit/operation.js.map +1 -1
  41. package/lib/services/app/error.js.map +1 -1
  42. package/lib/services/command/arg.js +3 -1
  43. package/lib/services/command/arg.js.map +1 -1
  44. package/lib/services/command/command.js +1 -0
  45. package/lib/services/command/command.js.map +1 -1
  46. package/lib/services/command/context.js.map +1 -1
  47. package/lib/services/config/config.js.map +1 -1
  48. package/lib/services/config/env.js.map +1 -1
  49. package/lib/services/config/package-json.js.map +1 -1
  50. package/lib/services/filesync/changes.js.map +1 -1
  51. package/lib/services/filesync/conflicts.js.map +1 -1
  52. package/lib/services/filesync/directory.js.map +1 -1
  53. package/lib/services/filesync/error.js +1 -0
  54. package/lib/services/filesync/error.js.map +1 -1
  55. package/lib/services/filesync/file.js.map +1 -1
  56. package/lib/services/filesync/filesync.js +179 -174
  57. package/lib/services/filesync/filesync.js.map +1 -1
  58. package/lib/services/filesync/hashes.js.map +1 -1
  59. package/lib/services/filesync/strategy.js.map +1 -1
  60. package/lib/services/filesync/sync-json.js.map +1 -1
  61. package/lib/services/http/auth.js.map +1 -1
  62. package/lib/services/http/http.js.map +1 -1
  63. package/lib/services/output/confirm.js.map +1 -1
  64. package/lib/services/output/footer.js.map +1 -1
  65. package/lib/services/output/log/field.js.map +1 -1
  66. package/lib/services/output/log/format/format.js.map +1 -1
  67. package/lib/services/output/log/format/json.js.map +1 -1
  68. package/lib/services/output/log/format/pretty.js.map +1 -1
  69. package/lib/services/output/log/level.js.map +1 -1
  70. package/lib/services/output/log/logger.js.map +1 -1
  71. package/lib/services/output/log/structured.js.map +1 -1
  72. package/lib/services/output/notify.js.map +1 -1
  73. package/lib/services/output/output.js.map +1 -1
  74. package/lib/services/output/print.js.map +1 -1
  75. package/lib/services/output/problems.js.map +1 -1
  76. package/lib/services/output/prompt.js.map +1 -1
  77. package/lib/services/output/report.js.map +1 -1
  78. package/lib/services/output/select.js.map +1 -1
  79. package/lib/services/output/spinner.js.map +1 -1
  80. package/lib/services/output/sprint.js.map +1 -1
  81. package/lib/services/output/symbols.js.map +1 -1
  82. package/lib/services/output/table.js.map +1 -1
  83. package/lib/services/output/timestamp.js.map +1 -1
  84. package/lib/services/output/update.js.map +1 -1
  85. package/lib/services/user/session.js.map +1 -1
  86. package/lib/services/user/user.js.map +1 -1
  87. package/lib/services/util/assert.js.map +1 -1
  88. package/lib/services/util/boolean.js.map +1 -1
  89. package/lib/services/util/collection.js.map +1 -1
  90. package/lib/services/util/function.js.map +1 -1
  91. package/lib/services/util/is.js.map +1 -1
  92. package/lib/services/util/json.js.map +1 -1
  93. package/lib/services/util/number.js.map +1 -1
  94. package/lib/services/util/object.js.map +1 -1
  95. package/lib/services/util/paths.js.map +1 -1
  96. package/lib/services/util/promise.js.map +1 -1
  97. package/lib/services/util/types.js.map +1 -1
  98. package/npm-shrinkwrap.json +2071 -1684
  99. package/package.json +30 -30
package/README.md CHANGED
@@ -31,6 +31,7 @@
31
31
  - [`ggt status`](#ggt-status)
32
32
  - [`ggt push`](#ggt-push)
33
33
  - [`ggt pull`](#ggt-pull)
34
+ - [`ggt add`](#ggt-add)
34
35
  - [`ggt open`](#ggt-open)
35
36
  - [`ggt list`](#ggt-list)
36
37
  - [`ggt login`](#ggt-login)
@@ -59,15 +60,16 @@ $ npm install -g ggt
59
60
  $ ggt
60
61
  The command-line interface for Gadget.
61
62
 
62
- USAGE
63
+ Usage
63
64
  ggt [COMMAND]
64
65
 
65
- COMMANDS
66
+ Commands
66
67
  dev Start developing your application
67
68
  deploy Deploy your environment to production
68
69
  status Show your local and environment's file changes
69
70
  push Push your local files to your environment
70
71
  pull Pull your environment's files to your local computer
72
+ add Add models, fields, actions and routes to your app
71
73
  open Open a Gadget location in your browser
72
74
  list List your available applications
73
75
  login Log in to your account
@@ -75,7 +77,7 @@ COMMANDS
75
77
  whoami Print the currently logged in account
76
78
  version Print this version of ggt
77
79
 
78
- FLAGS
80
+ Flags
79
81
  -h, --help Print how to use a command
80
82
  -v, --verbose Print more verbose output
81
83
  --telemetry Enable telemetry
@@ -89,164 +91,234 @@ Run "ggt [COMMAND] -h" for more information about a specific command.
89
91
 
90
92
  ```sh-session
91
93
  $ ggt dev -h
92
- Develop your app by synchronizing your local files with your
93
- environment's files, in real-time. Changes are tracked from
94
- the last "ggt dev", "ggt push", or "ggt pull" run locally.
94
+ Clones your Gadget environment's files to your local machine and keeps it in sync, in order to
95
+ enable local development with your text editor and source code with Git.
95
96
 
96
- USAGE
97
- ggt dev [DIRECTORY]
97
+ If your app's local directory already exists, this command first performs a sync to ensure
98
+ that your local and environment directories match, changes are tracked since last sync. If any
99
+ conflicts are detected, they must be resolved before development starts.
98
100
 
99
- EXAMPLES
100
- $ ggt dev
101
- $ ggt dev ~/gadget/example
102
- $ ggt dev ~/gadget/example
103
- $ ggt dev ~/gadget/example --app=example
104
- $ ggt dev ~/gadget/example --app=example --env=development --prefer=local
101
+ Usage
102
+ $ ggt dev [DIRECTORY] [options]
105
103
 
106
- ARGUMENTS
107
- DIRECTORY The directory to synchronize files to (default: ".")
104
+ DIRECTORY: The directory to sync files to (default: the current directory)
108
105
 
109
- FLAGS
110
- -a, --app=<name> The application to synchronize files with
111
- -e, --env=<name> The environment to synchronize files with
112
- --prefer=<filesystem> Prefer "local" or "environment" conflicting changes
106
+ Options
107
+ -a, --app <app_name> Selects the app to sync files with. Default set on ".gadget/sync.json"
108
+ -e, --env <env_name> Selects the environment to sync files with. Default set on ".gadget/sync.json"
109
+ --prefer <source> Auto-select changes from 'local' or 'environment' source on conflict
110
+ --allow-unknown-directory Syncs to any local directory with existing files, even if the ".gadget/sync.json" file is missing
111
+ --allow-different-app Syncs with a different app using the --app command, instead of the one specified in the .gadget/sync.json file
113
112
 
114
- Run "ggt dev --help" for more information.
115
- ```
113
+ Ignoring files
114
+ ggt dev uses a .ignore file, similar to .gitignore, to exclude specific files and
115
+ folders from syncing. These files are always ignored:
116
116
 
117
- ### `ggt deploy`
117
+ .DS_Store
118
+ • .gadget
119
+ • .git
120
+ • node_modules
118
121
 
119
- ```sh-session
120
- $ ggt deploy -h
121
- Deploy an environment to production.
122
+ Notes
123
+ "ggt dev" only works with development environments
124
+ "ggt dev" only supports "yarn" v1 for installing dependencies
125
+ • Avoid deleting or moving all of your files while "ggt dev" is running
122
126
 
123
- Your local files must match your environment's files
124
- before you can deploy. Changes are tracked from
125
- the last "ggt dev", "ggt push", or "ggt pull" run locally.
127
+ Examples
128
+ sync an app in a custom path
129
+ $ ggt dev ~/myGadgetApps/myBlog --app myBlogApp
126
130
 
127
- USAGE
128
- ggt deploy
131
+ sync with a specific environment and preselect all local changes on conflicts
132
+ $ ggt dev --env main --prefer local
129
133
 
130
- EXAMPLES
131
- $ ggt deploy
132
- $ ggt deploy --from=staging
133
- $ ggt deploy --from=staging --force
134
- $ ggt deploy --from=staging --force --allow-problems
134
+ sync a custom path with a specific app, environment and preselect all changes from local on conflicts
135
+ $ ggt dev ~/gadget/example --app=example --env=development --prefer=local
136
+ ```
135
137
 
136
- FLAGS
137
- -a, --app=<name> The application to deploy
138
- -e, --from=<env> The environment to deploy from
139
- --force Discard changes to your environment's filesystem
140
- --allow-problems Deploy regardless of any problems the environment has
141
- --allow-charges Deploy even if doing so will add charges to your account
138
+ ### `ggt deploy`
142
139
 
143
- Run "ggt deploy --help" for more information.
140
+ ```sh-session
141
+ $ ggt deploy -h
142
+ Deploys your app to production.
143
+
144
+ This command first performs a sync to ensure that your local and environment directories
145
+ match, changes are tracked since last sync. If any conflicts are detected, they must be
146
+ resolved before deployment.
147
+
148
+ Usage
149
+ $ ggt deploy [options]
150
+
151
+ Options
152
+ -a, --app <app_name> Selects a specific app to deploy. Default set on ".gadget/sync.json"
153
+ --from, -e, --env <env_name> Selects a specific environment to sync and deploy from. Default set on ".gadget/sync.json"
154
+ --force Deploys by discarding any changes made to the environment directory since last sync
155
+ --allow-different-directory Deploys from any local directory with existing files, even if the ".gadget/sync.json" file is missing
156
+ --allow-different-app Deploys a different app using the --app command, instead of the one specified in the “.gadget/sync.json” file
157
+ --allow-problems Deploys despite any existing issues found in the app (gelly errors, typescript errors etc.)
158
+ --allow-charges Deploys even if it results in additional charges to your plan
159
+
160
+ Examples
161
+ Deploys code from the staging environment of a myBlog
162
+ $ ggt deploy -a myBlog -from staging
144
163
  ```
145
164
 
146
165
  ### `ggt status`
147
166
 
148
167
  ```sh-session
149
168
  $ ggt status -h
150
- Show file changes since your last dev, push, or pull.
151
-
152
- USAGE
153
-
154
- ggt status
155
-
156
- EXAMPLES
169
+ Shows file changes since last sync (e.g. $ggt dev, push, deploy etc.)
157
170
 
158
- $ ggt status
171
+ Usage
172
+ ggt status
159
173
  ```
160
174
 
161
175
  ### `ggt push`
162
176
 
163
177
  ```sh-session
164
178
  $ ggt push -h
165
- Push your local files to your environment's filesystem.
166
- Changes are tracked from the last "ggt dev", "ggt push", or
167
- "ggt pull" run locally.
179
+ Pushes your local files to your environment directory.
168
180
 
169
- USAGE
170
- ggt push
181
+ This command first tracks changes in your environment directory since the last sync.
182
+ If changes are detected, you will be prompted to discard them or abort the push.
171
183
 
172
- EXAMPLES
173
- $ ggt push
174
- $ ggt push --env=staging
175
- $ ggt push --env=staging --force
184
+ Usage
185
+ ggt push [options]
176
186
 
177
- FLAGS
178
- -a, --app=<name> The application to push files to
179
- -e, --env=<name> The environment to push files to
180
- --force Discard changes to your environment's filesystem
187
+ Options
188
+ -a, --app <app_name> Selects the app to push local changes to. Default set on ".gadget/sync.json"
189
+ --from, -e, --env <env_name> Selects the environment to push local changes to. Default set on ".gadget/sync.json"
190
+ --force Forces a push by discarding any changes made on your environment directory since last sync
191
+ --allow-different-directory Pushes changes from any local directory with existing files, even if the ".gadget/sync.json" file is missing
192
+ --allow-different-app Pushes changes to an app using --app command, instead of the one in the “.gadget/sync.json” file
181
193
 
182
- Run "ggt push --help" for more information.
194
+ Examples
195
+ Push all local changes to the main environment by discarding any changes made on main
196
+ $ ggt push --env main --force
183
197
  ```
184
198
 
185
199
  ### `ggt pull`
186
200
 
187
201
  ```sh-session
188
202
  $ ggt pull -h
189
- Pull your environment's files to your local filesystem.
190
- Changes are tracked from the last "ggt dev", "ggt push", or
191
- "ggt pull" run locally.
203
+ Pulls your environment files to your local directory.
192
204
 
193
- USAGE
194
- ggt pull
205
+ This command first tracks changes in your local directory since the last sync. If changes are
206
+ detected, you will be prompted to discard them or abort the pull.
195
207
 
196
- EXAMPLES
197
- $ ggt pull
198
- $ ggt pull --env=staging
199
- $ ggt pull --env=staging --force
208
+ Usage
209
+ ggt pull [options]
200
210
 
201
- FLAGS
202
- -a, --app=<name> The application to pull files from
203
- -e, --env=<name> The environment to pull files from
204
- --force Discard changes to your local filesystem
211
+ Options
212
+ -a, --app <app_name> Selects the app to pull your environment changes from. Default set on ".gadget/sync.json"
213
+ --from, -e, --env <env_name> Selects the environment to pull changes from. Default set on ".gadget/sync.json"
214
+ --force Forces a pull by discarding any changes made on your local directory since last sync
215
+ --allow-different-directory Pulls changes from any environment directory, even if the ".gadget/sync.json" file is missing
216
+ --allow-different-app Pulls changes to a different app using --app command, instead of the one in the “.gadget/sync.json” file
205
217
 
206
- Run "ggt pull --help" for more information.
218
+ Examples
219
+ Pull all development environment changes by discarding any changes made locally
220
+ $ ggt pull --env development --force
221
+ ```
222
+
223
+ ### `ggt add`
224
+
225
+ ```sh-session
226
+ $ ggt add -h
227
+ Adds models, fields, actions and routes to your app.
228
+
229
+ This command first performs a sync to ensure that your local and environment directories match, changes are tracked since last sync.
230
+ If any conflicts are detected, they must be resolved before adding models, fields, actions or routes.
231
+
232
+ Usage
233
+ ggt add model <model_name> [field_name:field_type ...]
234
+
235
+ ggt add action [CONTEXT]/<action_name>
236
+ CONTEXT:Specifies the kind of action. Use "model" for model actions otherwise use "action".
237
+
238
+ ggt add route <HTTP_METHOD> <route_path>
239
+
240
+ ggt add field <model_path>/<field_name>:<field_type>
241
+
242
+ Options
243
+ -e, --env <env_name> Selects the environment to add to. Default set on ".gadget/sync.json"
244
+
245
+ Examples
246
+ Add a new model 'post' with out fields:
247
+ $ ggt add model modelA
248
+
249
+ Add a new model 'post' with 2 new 'string' type fields 'title' and 'body':
250
+ $ ggt add model post title:string body:string
251
+
252
+ Add new action 'publish' to the 'post' model:
253
+ ggt add action model/post/publish
254
+
255
+ Add a new action 'audit'
256
+ ggt add action action/audit
257
+
258
+ Add a new route 'howdy'
259
+ ggt add route GET howdy
260
+
261
+ Add a new 'boolean' type field 'published' to an existing model
262
+ ggt add field post/published:boolean
207
263
  ```
208
264
 
209
265
  ### `ggt open`
210
266
 
211
267
  ```sh-session
212
268
  $ ggt open -h
213
- Open a Gadget location in your browser.
214
-
215
- USAGE
216
- ggt open [LOCATION] [MODEL]
217
-
218
- EXAMPLES
219
- $ ggt open
220
- $ ggt open logs
221
- $ ggt open permissions
222
- $ ggt open data modelA
223
- $ ggt open schema modelA
224
- $ ggt open data --show-all
225
- $ ggt open schema --show-all
226
-
227
- ARGUMENTS
228
- LOCATION The location to open
229
- MODEL The model to open
230
-
231
- FLAGS
232
- -a, --app=<name> The application to open
233
- -e, --env=<env> The environment to open
234
- --show-all Show all available models to open
235
-
236
- Run "ggt open --help" for more information.
269
+ This command opens a specific Gadget page in your browser, allowing you to directly access
270
+ various parts of your application's interface such as logs, permissions, data views, or
271
+ schemas.
272
+
273
+ Usage
274
+ ggt open [LOCATION] [model_name] [--show-all] [options]
275
+
276
+ LOCATION: specifies the part of Gadget to open, by default it'll open the apps home page:
277
+
278
+ + logs Opens logs
279
+ + permissions Opens permissions
280
+ + data Opens data editor for a specific model
281
+ + schema Opens schema editor for a specific model
282
+
283
+ Options
284
+ -a, --app <app_name> Selects the application to open in your browser. Default set on ".gadget/sync.json"
285
+ -e, --env <env_name> Selects the environment to open in your browser. Default set on ".gadget/sync.json"
286
+ --show-all Shows all schema, or data options by listing your available models
287
+
288
+ Examples
289
+ Opens editor home
290
+ $ ggt open
291
+
292
+ Opens logs
293
+ $ ggt open logs
294
+
295
+ Opens permissions
296
+ $ ggt open permissions
297
+
298
+ Opens data editor for the 'post' model
299
+ $ ggt open data post
300
+
301
+ Opens schema for 'post' model
302
+ $ ggt open schema post
303
+
304
+ Shows all models available in the data editor
305
+ $ ggt open data -show-all
306
+
307
+ Shows all models available in the schema viewer
308
+ $ ggt open schema --show-all
309
+
310
+ Opens data editor for 'post' model of app 'myBlog' in the 'staging' environment
311
+ $ ggt open data post --app myBlog --env staging
237
312
  ```
238
313
 
239
314
  ### `ggt list`
240
315
 
241
316
  ```sh-session
242
317
  $ ggt list -h
243
- List your available applications.
244
-
245
- USAGE
246
- ggt list
318
+ List the apps available to the currently logged-in user.
247
319
 
248
- EXAMPLES
249
- $ ggt list
320
+ Usage
321
+ ggt list
250
322
  ```
251
323
 
252
324
  ### `ggt login`
@@ -255,11 +327,8 @@ EXAMPLES
255
327
  $ ggt login -h
256
328
  Log in to your account.
257
329
 
258
- USAGE
259
- ggt login
260
-
261
- EXAMPLES
262
- $ ggt login
330
+ Usage
331
+ ggt login
263
332
  ```
264
333
 
265
334
  ### `ggt logout`
@@ -268,11 +337,8 @@ EXAMPLES
268
337
  $ ggt logout -h
269
338
  Log out of your account.
270
339
 
271
- USAGE
272
- ggt logout
273
-
274
- EXAMPLES
275
- $ ggt logout
340
+ Usage
341
+ ggt logout
276
342
  ```
277
343
 
278
344
  ### `ggt whoami`
@@ -281,11 +347,8 @@ EXAMPLES
281
347
  $ ggt whoami -h
282
348
  Show the name and email address of the currently logged in user.
283
349
 
284
- USAGE
285
- ggt whoami
286
-
287
- EXAMPLES
288
- $ ggt whoami
350
+ Usage
351
+ ggt whoami
289
352
  ```
290
353
 
291
354
  ### `ggt version`
@@ -294,9 +357,10 @@ EXAMPLES
294
357
  $ ggt version -h
295
358
  Print this version of ggt.
296
359
 
297
- USAGE
298
- ggt version
360
+ Usage
361
+ ggt version
299
362
 
300
- EXAMPLES
301
- $ ggt version
363
+ Updating ggt
364
+ When there is a new release of ggt, running ggt will show you a message letting you
365
+ know that an update is available.
302
366
  ```