@gadgetinc/ggt 1.0.1 → 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.
- package/README.md +192 -128
- package/lib/__generated__/graphql.js.map +1 -1
- package/lib/commands/add.js +385 -0
- package/lib/commands/add.js.map +1 -0
- package/lib/commands/deploy.js +20 -102
- package/lib/commands/deploy.js.map +1 -1
- package/lib/commands/dev.js +43 -114
- package/lib/commands/dev.js.map +1 -1
- package/lib/commands/list.js +3 -6
- package/lib/commands/list.js.map +1 -1
- package/lib/commands/login.js +2 -5
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/logout.js +2 -5
- package/lib/commands/logout.js.map +1 -1
- package/lib/commands/open.js +45 -86
- package/lib/commands/open.js.map +1 -1
- package/lib/commands/pull.js +19 -76
- package/lib/commands/pull.js.map +1 -1
- package/lib/commands/push.js +19 -76
- package/lib/commands/push.js.map +1 -1
- package/lib/commands/root.js +4 -3
- package/lib/commands/root.js.map +1 -1
- package/lib/commands/status.js +3 -8
- package/lib/commands/status.js.map +1 -1
- package/lib/commands/version.js +6 -5
- package/lib/commands/version.js.map +1 -1
- package/lib/commands/whoami.js +2 -5
- package/lib/commands/whoami.js.map +1 -1
- package/lib/ggt.js.map +1 -1
- package/lib/main.js.map +1 -1
- package/lib/services/app/api/api.js.map +1 -1
- package/lib/services/app/api/operation.js +11 -0
- package/lib/services/app/api/operation.js.map +1 -1
- package/lib/services/app/app.js +21 -2
- package/lib/services/app/app.js.map +1 -1
- package/lib/services/app/arg.js.map +1 -1
- package/lib/services/app/client.js +1 -5
- package/lib/services/app/client.js.map +1 -1
- package/lib/services/app/edit/edit.js.map +1 -1
- package/lib/services/app/edit/operation.js +52 -0
- package/lib/services/app/edit/operation.js.map +1 -1
- package/lib/services/app/error.js.map +1 -1
- package/lib/services/command/arg.js +3 -1
- package/lib/services/command/arg.js.map +1 -1
- package/lib/services/command/command.js +1 -0
- package/lib/services/command/command.js.map +1 -1
- package/lib/services/command/context.js.map +1 -1
- package/lib/services/config/config.js.map +1 -1
- package/lib/services/config/env.js.map +1 -1
- package/lib/services/config/package-json.js.map +1 -1
- package/lib/services/filesync/changes.js.map +1 -1
- package/lib/services/filesync/conflicts.js.map +1 -1
- package/lib/services/filesync/directory.js.map +1 -1
- package/lib/services/filesync/error.js +1 -0
- package/lib/services/filesync/error.js.map +1 -1
- package/lib/services/filesync/file.js.map +1 -1
- package/lib/services/filesync/filesync.js +179 -174
- package/lib/services/filesync/filesync.js.map +1 -1
- package/lib/services/filesync/hashes.js.map +1 -1
- package/lib/services/filesync/strategy.js.map +1 -1
- package/lib/services/filesync/sync-json.js.map +1 -1
- package/lib/services/http/auth.js.map +1 -1
- package/lib/services/http/http.js.map +1 -1
- package/lib/services/output/confirm.js.map +1 -1
- package/lib/services/output/footer.js.map +1 -1
- package/lib/services/output/log/field.js.map +1 -1
- package/lib/services/output/log/format/format.js.map +1 -1
- package/lib/services/output/log/format/json.js.map +1 -1
- package/lib/services/output/log/format/pretty.js.map +1 -1
- package/lib/services/output/log/level.js.map +1 -1
- package/lib/services/output/log/logger.js.map +1 -1
- package/lib/services/output/log/structured.js.map +1 -1
- package/lib/services/output/notify.js.map +1 -1
- package/lib/services/output/output.js.map +1 -1
- package/lib/services/output/print.js.map +1 -1
- package/lib/services/output/problems.js.map +1 -1
- package/lib/services/output/prompt.js.map +1 -1
- package/lib/services/output/report.js.map +1 -1
- package/lib/services/output/select.js.map +1 -1
- package/lib/services/output/spinner.js.map +1 -1
- package/lib/services/output/sprint.js.map +1 -1
- package/lib/services/output/symbols.js.map +1 -1
- package/lib/services/output/table.js.map +1 -1
- package/lib/services/output/timestamp.js.map +1 -1
- package/lib/services/output/update.js.map +1 -1
- package/lib/services/user/session.js.map +1 -1
- package/lib/services/user/user.js.map +1 -1
- package/lib/services/util/assert.js.map +1 -1
- package/lib/services/util/boolean.js.map +1 -1
- package/lib/services/util/collection.js.map +1 -1
- package/lib/services/util/function.js.map +1 -1
- package/lib/services/util/is.js.map +1 -1
- package/lib/services/util/json.js.map +1 -1
- package/lib/services/util/number.js.map +1 -1
- package/lib/services/util/object.js.map +1 -1
- package/lib/services/util/paths.js.map +1 -1
- package/lib/services/util/promise.js.map +1 -1
- package/lib/services/util/types.js.map +1 -1
- package/npm-shrinkwrap.json +2071 -1684
- package/package.json +30 -30
package/lib/commands/open.js
CHANGED
|
@@ -14,92 +14,51 @@ export const args = {
|
|
|
14
14
|
type: Boolean
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
export const usage = (
|
|
18
|
-
if (ctx.args["-h"]) {
|
|
19
|
-
return sprint`
|
|
20
|
-
Open a Gadget location in your browser.
|
|
21
|
-
|
|
22
|
-
{bold USAGE}
|
|
23
|
-
ggt open [LOCATION] [MODEL]
|
|
24
|
-
|
|
25
|
-
{bold EXAMPLES}
|
|
26
|
-
$ ggt open
|
|
27
|
-
$ ggt open logs
|
|
28
|
-
$ ggt open permissions
|
|
29
|
-
$ ggt open data modelA
|
|
30
|
-
$ ggt open schema modelA
|
|
31
|
-
$ ggt open data --show-all
|
|
32
|
-
$ ggt open schema --show-all
|
|
33
|
-
|
|
34
|
-
{bold ARGUMENTS}
|
|
35
|
-
LOCATION The location to open
|
|
36
|
-
MODEL The model to open
|
|
37
|
-
|
|
38
|
-
{bold FLAGS}
|
|
39
|
-
-a, --app=<name> The application to open
|
|
40
|
-
-e, --env=<env> The environment to open
|
|
41
|
-
--show-all Show all available models to open
|
|
42
|
-
|
|
43
|
-
Run "ggt open --help" for more information.
|
|
44
|
-
`;
|
|
45
|
-
}
|
|
17
|
+
export const usage = (_ctx)=>{
|
|
46
18
|
return sprint`
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-e, --env, --environment=<name>
|
|
91
|
-
The environment to open.
|
|
92
|
-
|
|
93
|
-
Defaults to the environment within the ".gadget/sync.json"
|
|
94
|
-
file in the current directory or any parent directories.
|
|
95
|
-
|
|
96
|
-
--show-all
|
|
97
|
-
Makes "ggt open" display available models to open rather than
|
|
98
|
-
exiting with an error if a model is not specified.
|
|
99
|
-
|
|
100
|
-
Defaults to false.
|
|
101
|
-
|
|
102
|
-
Run "ggt open -h" for less information.
|
|
19
|
+
This command opens a specific Gadget page in your browser, allowing you to directly access
|
|
20
|
+
various parts of your application's interface such as logs, permissions, data views, or
|
|
21
|
+
schemas.
|
|
22
|
+
|
|
23
|
+
{gray Usage}
|
|
24
|
+
ggt open [LOCATION] [model_name] [--show-all] [options]
|
|
25
|
+
|
|
26
|
+
LOCATION: specifies the part of Gadget to open, by default it'll open the apps home page:
|
|
27
|
+
|
|
28
|
+
+ logs Opens logs
|
|
29
|
+
+ permissions Opens permissions
|
|
30
|
+
+ data Opens data editor for a specific model
|
|
31
|
+
+ schema Opens schema editor for a specific model
|
|
32
|
+
|
|
33
|
+
{gray Options}
|
|
34
|
+
-a, --app <app_name> Selects the application to open in your browser. Default set on ".gadget/sync.json"
|
|
35
|
+
-e, --env <env_name> Selects the environment to open in your browser. Default set on ".gadget/sync.json"
|
|
36
|
+
--show-all Shows all schema, or data options by listing your available models
|
|
37
|
+
|
|
38
|
+
{gray Examples}
|
|
39
|
+
Opens editor home
|
|
40
|
+
{cyanBright $ ggt open}
|
|
41
|
+
|
|
42
|
+
Opens logs
|
|
43
|
+
{cyanBright $ ggt open logs}
|
|
44
|
+
|
|
45
|
+
Opens permissions
|
|
46
|
+
{cyanBright $ ggt open permissions}
|
|
47
|
+
|
|
48
|
+
Opens data editor for the 'post' model
|
|
49
|
+
{cyanBright $ ggt open data post}
|
|
50
|
+
|
|
51
|
+
Opens schema for 'post' model
|
|
52
|
+
{cyanBright $ ggt open schema post}
|
|
53
|
+
|
|
54
|
+
Shows all models available in the data editor
|
|
55
|
+
{cyanBright $ ggt open data -show-all}
|
|
56
|
+
|
|
57
|
+
Shows all models available in the schema viewer
|
|
58
|
+
{cyanBright $ ggt open schema --show-all}
|
|
59
|
+
|
|
60
|
+
Opens data editor for 'post' model of app 'myBlog' in the 'staging' environment
|
|
61
|
+
{cyanBright $ ggt open data post --app myBlog --env staging}
|
|
103
62
|
`;
|
|
104
63
|
};
|
|
105
64
|
export const command = async (ctx)=>{
|
|
@@ -127,7 +86,7 @@ export const command = async (ctx)=>{
|
|
|
127
86
|
|
|
128
87
|
Did you mean {blueBright ${closest}}?
|
|
129
88
|
|
|
130
|
-
Run "ggt open
|
|
89
|
+
Run "ggt open --help" for usage
|
|
131
90
|
`);
|
|
132
91
|
}
|
|
133
92
|
switch(location){
|
package/lib/commands/open.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/open.ts"],"sourcesContent":["import open from \"open\";\nimport { getModels } from \"../services/app/app.js\";\nimport { ArgError } from \"../services/command/arg.js\";\nimport type { Command, Usage } from \"../services/command/command.js\";\nimport { UnknownDirectoryError } from \"../services/filesync/error.js\";\nimport { SyncJson, SyncJsonArgs, loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { select } from \"../services/output/select.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { sortBySimilar } from \"../services/util/collection.js\";\nimport { isNever } from \"../services/util/is.js\";\n\nexport type OpenArgs = typeof args;\n\nexport const args = {\n ...SyncJsonArgs,\n \"--show-all\": { type: Boolean },\n};\n\nexport const usage: Usage = (
|
|
1
|
+
{"version":3,"sources":["../../src/commands/open.ts"],"sourcesContent":["import open from \"open\";\nimport { getModels } from \"../services/app/app.js\";\nimport { ArgError } from \"../services/command/arg.js\";\nimport type { Command, Usage } from \"../services/command/command.js\";\nimport { UnknownDirectoryError } from \"../services/filesync/error.js\";\nimport { SyncJson, SyncJsonArgs, loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { select } from \"../services/output/select.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { sortBySimilar } from \"../services/util/collection.js\";\nimport { isNever } from \"../services/util/is.js\";\n\nexport type OpenArgs = typeof args;\n\nexport const args = {\n ...SyncJsonArgs,\n \"--show-all\": { type: Boolean },\n};\n\nexport const usage: Usage = (_ctx) => {\n return sprint`\n This command opens a specific Gadget page in your browser, allowing you to directly access\n various parts of your application's interface such as logs, permissions, data views, or\n schemas.\n\n {gray Usage}\n ggt open [LOCATION] [model_name] [--show-all] [options]\n \n LOCATION: specifies the part of Gadget to open, by default it'll open the apps home page:\n\n + logs Opens logs\n + permissions Opens permissions\n + data Opens data editor for a specific model\n + schema Opens schema editor for a specific model\n\n {gray Options}\n -a, --app <app_name> Selects the application to open in your browser. Default set on \".gadget/sync.json\"\n -e, --env <env_name> Selects the environment to open in your browser. Default set on \".gadget/sync.json\"\n --show-all Shows all schema, or data options by listing your available models\n \n {gray Examples}\n Opens editor home\n {cyanBright $ ggt open}\n\n Opens logs \n {cyanBright $ ggt open logs} \n \n Opens permissions\n {cyanBright $ ggt open permissions}\n \n Opens data editor for the 'post' model\n {cyanBright $ ggt open data post}\n \n Opens schema for 'post' model\n {cyanBright $ ggt open schema post}\n \n Shows all models available in the data editor\n {cyanBright $ ggt open data -show-all}\n \n Shows all models available in the schema viewer\n {cyanBright $ ggt open schema --show-all}\n \n Opens data editor for 'post' model of app 'myBlog' in the 'staging' environment \n {cyanBright $ ggt open data post --app myBlog --env staging}\n `;\n};\n\nexport const command: Command<OpenArgs> = async (ctx) => {\n const directory = await loadSyncJsonDirectory(process.cwd());\n const syncJson = await SyncJson.load(ctx, { directory });\n if (!syncJson) {\n throw new UnknownDirectoryError(ctx, { directory });\n }\n\n const location = ctx.args._[0] as Location | undefined;\n if (!location) {\n await open(`https://${syncJson.app.primaryDomain}/edit/${syncJson.env.name}`);\n println`\n Opened editor for environment {cyanBright ${syncJson.env.name}}.\n `;\n return;\n }\n\n if (!Locations.includes(location)) {\n const [closest] = sortBySimilar(location, Locations);\n throw new ArgError(sprint`\n Unknown location {yellow ${location}}\n\n Did you mean {blueBright ${closest}}?\n\n Run \"ggt open --help\" for usage\n `);\n }\n\n switch (location) {\n case \"logs\": {\n await open(`https://${syncJson.app.primaryDomain}/edit/${syncJson.env.name}/logs`);\n println`\n Opened log viewer for environment {cyanBright ${syncJson.env.name}}.\n `;\n break;\n }\n case \"permissions\": {\n await open(`https://${syncJson.app.primaryDomain}/edit/${syncJson.env.name}/settings/permissions`);\n println`\n Opened permissions settings for environment {cyanBright ${syncJson.env.name}}.\n `;\n break;\n }\n case \"data\":\n case \"schema\": {\n const view = ctx.args._[0];\n const remoteModelApiIdentifiers = (await getModels(ctx)).map((e) => e.apiIdentifier);\n\n let modelApiIdentifier = ctx.args._[1];\n if (!modelApiIdentifier) {\n if (ctx.args[\"--show-all\"]) {\n modelApiIdentifier = await select({ choices: remoteModelApiIdentifiers })(\"Which model do you wish to open?\");\n } else {\n throw new ArgError(sprint`\n \"ggt open ${view}\" requires a model to be specified.\n\n Run with \"--show-all\" to choose from available models.\n\n ggt open ${view} --show-all\n `);\n }\n }\n\n if (!remoteModelApiIdentifiers.includes(modelApiIdentifier)) {\n const [closest] = sortBySimilar(modelApiIdentifier, remoteModelApiIdentifiers);\n throw new ArgError(sprint`\n Unknown model {yellow ${modelApiIdentifier}}\n\n Did you mean {blueBright ${closest}}?\n\n Run with \"--show-all\" to choose from available models.\n\n ggt open ${view} --show-all\n `);\n }\n\n await open(`https://${syncJson.app.primaryDomain}/edit/${syncJson.env.name}/model/${modelApiIdentifier}/${view}`);\n println`\n Opened ${view} viewer for environment {cyanBright ${syncJson.env.name}} for model {cyanBright ${modelApiIdentifier}}.\n `;\n break;\n }\n default:\n isNever(location);\n }\n};\n\nconst Locations = [\"logs\", \"permissions\", \"data\", \"schema\"] as const;\n\ntype Location = (typeof Locations)[number];\n"],"names":["open","getModels","ArgError","UnknownDirectoryError","SyncJson","SyncJsonArgs","loadSyncJsonDirectory","println","select","sprint","sortBySimilar","isNever","args","type","Boolean","usage","_ctx","command","ctx","directory","process","cwd","syncJson","load","location","_","app","primaryDomain","env","name","Locations","includes","closest","view","remoteModelApiIdentifiers","map","e","apiIdentifier","modelApiIdentifier","choices"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,UAAU,OAAO;AACxB,SAASC,SAAS,QAAQ,yBAAyB;AACnD,SAASC,QAAQ,QAAQ,6BAA6B;AAEtD,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,SAASC,QAAQ,EAAEC,YAAY,EAAEC,qBAAqB,QAAQ,oCAAoC;AAClG,SAASC,OAAO,QAAQ,8BAA8B;AACtD,SAASC,MAAM,QAAQ,+BAA+B;AACtD,SAASC,MAAM,QAAQ,+BAA+B;AACtD,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,OAAO,QAAQ,yBAAyB;AAIjD,OAAO,MAAMC,OAAO;IAClB,GAAGP,YAAY;IACf,cAAc;QAAEQ,MAAMC;IAAQ;AAChC,EAAE;AAEF,OAAO,MAAMC,QAAe,CAACC;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ED
|
@@ -10,83 +10,26 @@ export const args = {
|
|
|
10
10
|
alias: "-f"
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
export const usage = (
|
|
14
|
-
if (ctx.args["-h"]) {
|
|
15
|
-
return sprint`
|
|
16
|
-
Pull your environment's files to your local filesystem.
|
|
17
|
-
Changes are tracked from the last "ggt dev", "ggt push", or
|
|
18
|
-
"ggt pull" run locally.
|
|
19
|
-
|
|
20
|
-
{bold USAGE}
|
|
21
|
-
ggt pull
|
|
22
|
-
|
|
23
|
-
{bold EXAMPLES}
|
|
24
|
-
$ ggt pull
|
|
25
|
-
$ ggt pull --env=staging
|
|
26
|
-
$ ggt pull --env=staging --force
|
|
27
|
-
|
|
28
|
-
{bold FLAGS}
|
|
29
|
-
-a, --app=<name> The application to pull files from
|
|
30
|
-
-e, --env=<name> The environment to pull files from
|
|
31
|
-
--force Discard changes to your local filesystem
|
|
32
|
-
|
|
33
|
-
Run "ggt pull --help" for more information.
|
|
34
|
-
`;
|
|
35
|
-
}
|
|
13
|
+
export const usage = (_ctx)=>{
|
|
36
14
|
return sprint`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{bold FLAGS}
|
|
57
|
-
|
|
58
|
-
-a, --app, --application=<name>
|
|
59
|
-
The application to pull files from.
|
|
60
|
-
|
|
61
|
-
Defaults to the application within the ".gadget/sync.json"
|
|
62
|
-
file in the current directory or any parent directories.
|
|
63
|
-
|
|
64
|
-
-e, --env, --environment=<name>
|
|
65
|
-
The environment to pull files from.
|
|
66
|
-
|
|
67
|
-
Defaults to the environment within the ".gadget/sync.json"
|
|
68
|
-
file in the current directory or any parent directories.
|
|
69
|
-
|
|
70
|
-
-f, --force
|
|
71
|
-
Discard any changes made to your local filesystem
|
|
72
|
-
since the last "ggt dev", "ggt push", or "ggt pull".
|
|
73
|
-
|
|
74
|
-
Defaults to false.
|
|
75
|
-
|
|
76
|
-
--allow-unknown-directory
|
|
77
|
-
Allows "ggt pull" to continue when the current directory, nor
|
|
78
|
-
any parent directories, contain a ".gadget/sync.json" file
|
|
79
|
-
within it.
|
|
80
|
-
|
|
81
|
-
Defaults to false.
|
|
82
|
-
|
|
83
|
-
--allow-different-app
|
|
84
|
-
Allows "ggt pull" to continue with a different "--app" than the
|
|
85
|
-
one found within the ".gadget/sync.json" file.
|
|
86
|
-
|
|
87
|
-
Defaults to false.
|
|
88
|
-
|
|
89
|
-
Run "ggt pull -h" for less information.
|
|
15
|
+
Pulls your environment files to your local directory.
|
|
16
|
+
|
|
17
|
+
This command first tracks changes in your local directory since the last sync. If changes are
|
|
18
|
+
detected, you will be prompted to discard them or abort the pull.
|
|
19
|
+
|
|
20
|
+
{gray Usage}
|
|
21
|
+
ggt pull [options]
|
|
22
|
+
|
|
23
|
+
{gray Options}
|
|
24
|
+
-a, --app <app_name> Selects the app to pull your environment changes from. Default set on ".gadget/sync.json"
|
|
25
|
+
--from, -e, --env <env_name> Selects the environment to pull changes from. Default set on ".gadget/sync.json"
|
|
26
|
+
--force Forces a pull by discarding any changes made on your local directory since last sync
|
|
27
|
+
--allow-different-directory Pulls changes from any environment directory, even if the ".gadget/sync.json" file is missing
|
|
28
|
+
--allow-different-app Pulls changes to a different app using --app command, instead of the one in the “.gadget/sync.json” file
|
|
29
|
+
|
|
30
|
+
{gray Examples}
|
|
31
|
+
Pull all development environment changes by discarding any changes made locally
|
|
32
|
+
{cyanBright $ ggt pull --env development --force}
|
|
90
33
|
`;
|
|
91
34
|
};
|
|
92
35
|
export const command = async (ctx)=>{
|
package/lib/commands/pull.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/pull.ts"],"sourcesContent":["import { ArgError, type ArgsDefinition } from \"../services/command/arg.js\";\nimport type { Command, Usage } from \"../services/command/command.js\";\nimport { FileSync } from \"../services/filesync/filesync.js\";\nimport { SyncJson, SyncJsonArgs, loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport type PullArgs = typeof args;\n\nexport const args = {\n ...SyncJsonArgs,\n \"--force\": { type: Boolean, alias: \"-f\" },\n} satisfies ArgsDefinition;\n\nexport const usage: Usage = (
|
|
1
|
+
{"version":3,"sources":["../../src/commands/pull.ts"],"sourcesContent":["import { ArgError, type ArgsDefinition } from \"../services/command/arg.js\";\nimport type { Command, Usage } from \"../services/command/command.js\";\nimport { FileSync } from \"../services/filesync/filesync.js\";\nimport { SyncJson, SyncJsonArgs, loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport type PullArgs = typeof args;\n\nexport const args = {\n ...SyncJsonArgs,\n \"--force\": { type: Boolean, alias: \"-f\" },\n} satisfies ArgsDefinition;\n\nexport const usage: Usage = (_ctx) => {\n return sprint`\n Pulls your environment files to your local directory.\n\n This command first tracks changes in your local directory since the last sync. If changes are\n detected, you will be prompted to discard them or abort the pull.\n\n {gray Usage}\n ggt pull [options]\n \n {gray Options}\n -a, --app <app_name> Selects the app to pull your environment changes from. Default set on \".gadget/sync.json\"\n --from, -e, --env <env_name> Selects the environment to pull changes from. Default set on \".gadget/sync.json\"\n --force Forces a pull by discarding any changes made on your local directory since last sync\n --allow-different-directory Pulls changes from any environment directory, even if the \".gadget/sync.json\" file is missing\n --allow-different-app Pulls changes to a different app using --app command, instead of the one in the “.gadget/sync.json” file\n \n {gray Examples}\n Pull all development environment changes by discarding any changes made locally\n {cyanBright $ ggt pull --env development --force}\n `;\n};\n\nexport const command: Command<PullArgs> = async (ctx) => {\n if (ctx.args._.length > 0) {\n throw new ArgError(sprint`\n \"ggt pull\" does not take any positional arguments.\n\n If you are trying to pull changes to a specific directory,\n you must \"cd\" to that directory and then run \"ggt push\".\n\n Run \"ggt pull -h\" for more information.\n `);\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const syncJson = await SyncJson.loadOrInit(ctx, { directory });\n const filesync = new FileSync(syncJson);\n const hashes = await filesync.hashes(ctx);\n\n if (hashes.environmentChangesToPull.size === 0) {\n println({ ensureEmptyLineAbove: true })`\n Nothing to pull.\n `;\n return;\n }\n\n if (hashes.localChangesToPush.size > 0) {\n // show them the local changes they will discard\n await filesync.print(ctx, { hashes });\n }\n\n await filesync.pull(ctx, { hashes });\n};\n"],"names":["ArgError","FileSync","SyncJson","SyncJsonArgs","loadSyncJsonDirectory","println","sprint","args","type","Boolean","alias","usage","_ctx","command","ctx","_","length","directory","process","cwd","syncJson","loadOrInit","filesync","hashes","environmentChangesToPull","size","ensureEmptyLineAbove","localChangesToPush","print","pull"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,QAAQ,QAA6B,6BAA6B;AAE3E,SAASC,QAAQ,QAAQ,mCAAmC;AAC5D,SAASC,QAAQ,EAAEC,YAAY,EAAEC,qBAAqB,QAAQ,oCAAoC;AAClG,SAASC,OAAO,QAAQ,8BAA8B;AACtD,SAASC,MAAM,QAAQ,+BAA+B;AAItD,OAAO,MAAMC,OAAO;IAClB,GAAGJ,YAAY;IACf,WAAW;QAAEK,MAAMC;QAASC,OAAO;IAAK;AAC1C,EAA2B;AAE3B,OAAO,MAAMC,QAAe,CAACC;IAC3B,OAAON,MAAM,CAAC;;;;;;;;;;;;;;;;;;;EAmBd,CAAC;AACH,EAAE;AAEF,OAAO,MAAMO,UAA6B,OAAOC;IAC/C,IAAIA,IAAIP,IAAI,CAACQ,CAAC,CAACC,MAAM,GAAG,GAAG;QACzB,MAAM,IAAIhB,SAASM,MAAM,CAAC;;;;;;;IAO1B,CAAC;IACH;IAEA,MAAMW,YAAY,MAAMb,sBAAsBc,QAAQC,GAAG;IACzD,MAAMC,WAAW,MAAMlB,SAASmB,UAAU,CAACP,KAAK;QAAEG;IAAU;IAC5D,MAAMK,WAAW,IAAIrB,SAASmB;IAC9B,MAAMG,SAAS,MAAMD,SAASC,MAAM,CAACT;IAErC,IAAIS,OAAOC,wBAAwB,CAACC,IAAI,KAAK,GAAG;QAC9CpB,QAAQ;YAAEqB,sBAAsB;QAAK,EAAE,CAAC;;IAExC,CAAC;QACD;IACF;IAEA,IAAIH,OAAOI,kBAAkB,CAACF,IAAI,GAAG,GAAG;QACtC,gDAAgD;QAChD,MAAMH,SAASM,KAAK,CAACd,KAAK;YAAES;QAAO;IACrC;IAEA,MAAMD,SAASO,IAAI,CAACf,KAAK;QAAES;IAAO;AACpC,EAAE"}
|
package/lib/commands/push.js
CHANGED
|
@@ -10,83 +10,26 @@ export const args = {
|
|
|
10
10
|
alias: "-f"
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
export const usage = (
|
|
14
|
-
if (ctx.args["-h"]) {
|
|
15
|
-
return sprint`
|
|
16
|
-
Push your local files to your environment's filesystem.
|
|
17
|
-
Changes are tracked from the last "ggt dev", "ggt push", or
|
|
18
|
-
"ggt pull" run locally.
|
|
19
|
-
|
|
20
|
-
{bold USAGE}
|
|
21
|
-
ggt push
|
|
22
|
-
|
|
23
|
-
{bold EXAMPLES}
|
|
24
|
-
$ ggt push
|
|
25
|
-
$ ggt push --env=staging
|
|
26
|
-
$ ggt push --env=staging --force
|
|
27
|
-
|
|
28
|
-
{bold FLAGS}
|
|
29
|
-
-a, --app=<name> The application to push files to
|
|
30
|
-
-e, --env=<name> The environment to push files to
|
|
31
|
-
--force Discard changes to your environment's filesystem
|
|
32
|
-
|
|
33
|
-
Run "ggt push --help" for more information.
|
|
34
|
-
`;
|
|
35
|
-
}
|
|
13
|
+
export const usage = (_ctx)=>{
|
|
36
14
|
return sprint`
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{bold FLAGS}
|
|
57
|
-
|
|
58
|
-
-a, --app, --application=<name>
|
|
59
|
-
The application to push files to.
|
|
60
|
-
|
|
61
|
-
Defaults to the application within the ".gadget/sync.json"
|
|
62
|
-
file in the current directory or any parent directories.
|
|
63
|
-
|
|
64
|
-
-e, --env, --environment=<name>
|
|
65
|
-
The environment to push files to.
|
|
66
|
-
|
|
67
|
-
Defaults to the environment within the ".gadget/sync.json"
|
|
68
|
-
file in the current directory or any parent directories.
|
|
69
|
-
|
|
70
|
-
-f, --force
|
|
71
|
-
Discard any changes made to your environment's filesystem
|
|
72
|
-
since the last "ggt dev", "ggt push", or "ggt pull".
|
|
73
|
-
|
|
74
|
-
Defaults to false.
|
|
75
|
-
|
|
76
|
-
--allow-unknown-directory
|
|
77
|
-
Allows "ggt push" to continue when the current directory, nor
|
|
78
|
-
any parent directories, contain a ".gadget/sync.json" file
|
|
79
|
-
within it.
|
|
80
|
-
|
|
81
|
-
Defaults to false.
|
|
82
|
-
|
|
83
|
-
--allow-different-app
|
|
84
|
-
Allows "ggt push" to continue with a different "--app" than the
|
|
85
|
-
one found within the ".gadget/sync.json" file.
|
|
86
|
-
|
|
87
|
-
Defaults to false.
|
|
88
|
-
|
|
89
|
-
Run "ggt push -h" for less information.
|
|
15
|
+
Pushes your local files to your environment directory.
|
|
16
|
+
|
|
17
|
+
This command first tracks changes in your environment directory since the last sync.
|
|
18
|
+
If changes are detected, you will be prompted to discard them or abort the push.
|
|
19
|
+
|
|
20
|
+
{gray Usage}
|
|
21
|
+
ggt push [options]
|
|
22
|
+
|
|
23
|
+
{gray Options}
|
|
24
|
+
-a, --app <app_name> Selects the app to push local changes to. Default set on ".gadget/sync.json"
|
|
25
|
+
--from, -e, --env <env_name> Selects the environment to push local changes to. Default set on ".gadget/sync.json"
|
|
26
|
+
--force Forces a push by discarding any changes made on your environment directory since last sync
|
|
27
|
+
--allow-different-directory Pushes changes from any local directory with existing files, even if the ".gadget/sync.json" file is missing
|
|
28
|
+
--allow-different-app Pushes changes to an app using --app command, instead of the one in the “.gadget/sync.json” file
|
|
29
|
+
|
|
30
|
+
{gray Examples}
|
|
31
|
+
Push all local changes to the main environment by discarding any changes made on main
|
|
32
|
+
{cyanBright $ ggt push --env main --force}
|
|
90
33
|
`;
|
|
91
34
|
};
|
|
92
35
|
export const command = async (ctx)=>{
|
package/lib/commands/push.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/push.ts"],"sourcesContent":["import { ArgError, type ArgsDefinition } from \"../services/command/arg.js\";\nimport type { Command, Usage } from \"../services/command/command.js\";\nimport { FileSync } from \"../services/filesync/filesync.js\";\nimport { SyncJson, SyncJsonArgs, loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport type PushArgs = typeof args;\n\nexport const args = {\n ...SyncJsonArgs,\n \"--force\": { type: Boolean, alias: \"-f\" },\n} satisfies ArgsDefinition;\n\nexport const usage: Usage = (
|
|
1
|
+
{"version":3,"sources":["../../src/commands/push.ts"],"sourcesContent":["import { ArgError, type ArgsDefinition } from \"../services/command/arg.js\";\nimport type { Command, Usage } from \"../services/command/command.js\";\nimport { FileSync } from \"../services/filesync/filesync.js\";\nimport { SyncJson, SyncJsonArgs, loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport type PushArgs = typeof args;\n\nexport const args = {\n ...SyncJsonArgs,\n \"--force\": { type: Boolean, alias: \"-f\" },\n} satisfies ArgsDefinition;\n\nexport const usage: Usage = (_ctx) => {\n return sprint`\n Pushes your local files to your environment directory.\n\n This command first tracks changes in your environment directory since the last sync.\n If changes are detected, you will be prompted to discard them or abort the push.\n\n {gray Usage}\n ggt push [options]\n \n {gray Options}\n -a, --app <app_name> Selects the app to push local changes to. Default set on \".gadget/sync.json\"\n --from, -e, --env <env_name> Selects the environment to push local changes to. Default set on \".gadget/sync.json\"\n --force Forces a push by discarding any changes made on your environment directory since last sync\n --allow-different-directory Pushes changes from any local directory with existing files, even if the \".gadget/sync.json\" file is missing\n --allow-different-app Pushes changes to an app using --app command, instead of the one in the “.gadget/sync.json” file\n \n {gray Examples}\n Push all local changes to the main environment by discarding any changes made on main\n {cyanBright $ ggt push --env main --force}\n `;\n};\n\nexport const command: Command<typeof args> = async (ctx) => {\n if (ctx.args._.length > 0) {\n throw new ArgError(sprint`\n \"ggt push\" does not take any positional arguments.\n\n If you are trying to push changes from a specific directory,\n you must \"cd\" to that directory and then run \"ggt push\".\n `);\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const syncJson = await SyncJson.loadOrInit(ctx, { directory });\n const filesync = new FileSync(syncJson);\n const hashes = await filesync.hashes(ctx);\n\n if (hashes.localChangesToPush.size === 0) {\n println({ ensureEmptyLineAbove: true })`\n Nothing to push.\n `;\n return;\n }\n\n if (hashes.environmentChangesToPull.size > 0 && !hashes.onlyDotGadgetFilesChanged) {\n // show them the environment changes they will discard\n await filesync.print(ctx, { hashes });\n }\n\n await filesync.push(ctx, { hashes });\n};\n"],"names":["ArgError","FileSync","SyncJson","SyncJsonArgs","loadSyncJsonDirectory","println","sprint","args","type","Boolean","alias","usage","_ctx","command","ctx","_","length","directory","process","cwd","syncJson","loadOrInit","filesync","hashes","localChangesToPush","size","ensureEmptyLineAbove","environmentChangesToPull","onlyDotGadgetFilesChanged","print","push"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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`
|
|
33
33
|
The command-line interface for Gadget.
|
|
34
34
|
|
|
35
|
-
{
|
|
35
|
+
{gray Usage}
|
|
36
36
|
ggt [COMMAND]
|
|
37
37
|
|
|
38
|
-
{
|
|
38
|
+
{gray Commands}
|
|
39
39
|
dev Start developing your application
|
|
40
40
|
deploy Deploy your environment to production
|
|
41
41
|
status Show your local and environment's file changes
|
|
42
42
|
push Push your local files to your environment
|
|
43
43
|
pull Pull your environment's files to your local computer
|
|
44
|
+
add Add models, fields, actions and routes to your app
|
|
44
45
|
open Open a Gadget location in your browser
|
|
45
46
|
list List your available applications
|
|
46
47
|
login Log in to your account
|
|
@@ -48,7 +49,7 @@ export const usage = ()=>{
|
|
|
48
49
|
whoami Print the currently logged in account
|
|
49
50
|
version Print this version of ggt
|
|
50
51
|
|
|
51
|
-
{
|
|
52
|
+
{gray Flags}
|
|
52
53
|
-h, --help Print how to use a command
|
|
53
54
|
-v, --verbose Print more verbose output
|
|
54
55
|
--telemetry Enable telemetry
|
package/lib/commands/root.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/root.ts"],"sourcesContent":["import arg from \"arg\";\nimport type { EmptyObject } from \"type-fest\";\nimport type { ArgsDefinition } from \"../services/command/arg.js\";\nimport { Commands, importCommand, isAvailableCommand, type Command, type Usage } from \"../services/command/command.js\";\nimport { verbosityToLevel } from \"../services/output/log/level.js\";\nimport { println } from \"../services/output/print.js\";\nimport { reportErrorAndExit } from \"../services/output/report.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { warnIfUpdateAvailable } from \"../services/output/update.js\";\nimport { sortBySimilar } from \"../services/util/collection.js\";\nimport { isNil } from \"../services/util/is.js\";\n\nexport type RootArgs = typeof args;\n\nexport const args = {\n \"-h\": { type: Boolean },\n \"--help\": { type: Boolean },\n \"--verbose\": { type: arg.COUNT, alias: [\"-v\", \"--debug\"] },\n \"--telemetry\": { type: Boolean },\n \"--json\": { type: Boolean },\n} satisfies ArgsDefinition;\n\nexport const usage: Usage = () => {\n return sprint`\n The command-line interface for Gadget.\n\n {
|
|
1
|
+
{"version":3,"sources":["../../src/commands/root.ts"],"sourcesContent":["import arg from \"arg\";\nimport type { EmptyObject } from \"type-fest\";\nimport type { ArgsDefinition } from \"../services/command/arg.js\";\nimport { Commands, importCommand, isAvailableCommand, type Command, type Usage } from \"../services/command/command.js\";\nimport { verbosityToLevel } from \"../services/output/log/level.js\";\nimport { println } from \"../services/output/print.js\";\nimport { reportErrorAndExit } from \"../services/output/report.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { warnIfUpdateAvailable } from \"../services/output/update.js\";\nimport { sortBySimilar } from \"../services/util/collection.js\";\nimport { isNil } from \"../services/util/is.js\";\n\nexport type RootArgs = typeof args;\n\nexport const args = {\n \"-h\": { type: Boolean },\n \"--help\": { type: Boolean },\n \"--verbose\": { type: arg.COUNT, alias: [\"-v\", \"--debug\"] },\n \"--telemetry\": { type: Boolean },\n \"--json\": { type: Boolean },\n} satisfies ArgsDefinition;\n\nexport const usage: Usage = () => {\n return sprint`\n The command-line interface for Gadget.\n\n {gray Usage}\n ggt [COMMAND]\n\n {gray Commands}\n dev Start developing your application\n deploy Deploy your environment to production\n status Show your local and environment's file changes\n push Push your local files to your environment\n pull Pull your environment's files to your local computer\n add Add models, fields, actions and routes to your app \n open Open a Gadget location in your browser\n list List your available applications\n login Log in to your account\n logout Log out of your account\n whoami Print the currently logged in account\n version Print this version of ggt\n\n {gray Flags}\n -h, --help Print how to use a command\n -v, --verbose Print more verbose output\n --telemetry Enable telemetry\n\n Run \"ggt [COMMAND] -h\" for more information about a specific command.\n `;\n};\n\nexport const command: Command<EmptyObject, EmptyObject> = async (parent): Promise<void> => {\n const ctx = parent.child({\n name: \"root\",\n parse: args,\n argv: process.argv.slice(2),\n permissive: true,\n });\n\n if (ctx.args[\"--json\"]) {\n process.env[\"GGT_LOG_FORMAT\"] = \"json\";\n }\n\n if (ctx.args[\"--verbose\"]) {\n process.env[\"GGT_LOG_LEVEL\"] = verbosityToLevel(ctx.args[\"--verbose\"]).toString();\n }\n\n await warnIfUpdateAvailable(ctx);\n\n let cmd = ctx.args._.shift();\n if (isNil(cmd)) {\n println(usage(ctx));\n process.exit(0);\n }\n\n if (cmd === \"sync\") {\n ctx.log.debug('renaming \"sync\" to \"dev\" for backwards compatibility');\n cmd = \"dev\";\n }\n\n if (!isAvailableCommand(cmd)) {\n const [closest] = sortBySimilar(cmd, Commands);\n println`\n Unknown command {yellow ${cmd}}\n\n Did you mean {blueBright ${closest}}?\n\n Run {gray ggt --help} for usage\n `;\n process.exit(1);\n }\n\n const subcommand = await importCommand(cmd);\n\n if (ctx.args[\"-h\"] ?? ctx.args[\"--help\"]) {\n println(subcommand.usage(ctx));\n process.exit(0);\n }\n\n try {\n await subcommand.command(ctx.child({ command: cmd, name: cmd, parse: subcommand.args }));\n } catch (error) {\n await reportErrorAndExit(ctx, error);\n }\n};\n"],"names":["arg","Commands","importCommand","isAvailableCommand","verbosityToLevel","println","reportErrorAndExit","sprint","warnIfUpdateAvailable","sortBySimilar","isNil","args","type","Boolean","COUNT","alias","usage","command","parent","ctx","child","name","parse","argv","process","slice","permissive","env","toString","cmd","_","shift","exit","log","debug","closest","subcommand","error"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,SAAS,MAAM;AAGtB,SAASC,QAAQ,EAAEC,aAAa,EAAEC,kBAAkB,QAAkC,iCAAiC;AACvH,SAASC,gBAAgB,QAAQ,kCAAkC;AACnE,SAASC,OAAO,QAAQ,8BAA8B;AACtD,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,MAAM,QAAQ,+BAA+B;AACtD,SAASC,qBAAqB,QAAQ,+BAA+B;AACrE,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAAS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f;IAEA,MAAMI,aAAa,MAAMlC,cAAc2B;IAEvC,IAAIV,IAAIR,IAAI,CAAC,KAAK,IAAIQ,IAAIR,IAAI,CAAC,SAAS,EAAE;QACxCN,QAAQ+B,WAAWpB,KAAK,CAACG;QACzBK,QAAQQ,IAAI,CAAC;IACf;IAEA,IAAI;QACF,MAAMI,WAAWnB,OAAO,CAACE,IAAIC,KAAK,CAAC;YAAEH,SAASY;YAAKR,MAAMQ;YAAKP,OAAOc,WAAWzB,IAAI;QAAC;IACvF,EAAE,OAAO0B,OAAO;QACd,MAAM/B,mBAAmBa,KAAKkB;IAChC;AACF,EAAE"}
|
package/lib/commands/status.js
CHANGED
|
@@ -7,15 +7,10 @@ import { sprint } from "../services/output/sprint.js";
|
|
|
7
7
|
export const args = SyncJsonArgs;
|
|
8
8
|
export const usage = ()=>{
|
|
9
9
|
return sprint`
|
|
10
|
-
|
|
10
|
+
Shows file changes since last sync (e.g. $ggt dev, push, deploy etc.)
|
|
11
11
|
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
ggt status
|
|
15
|
-
|
|
16
|
-
{bold EXAMPLES}
|
|
17
|
-
|
|
18
|
-
$ ggt status
|
|
12
|
+
{gray Usage}
|
|
13
|
+
ggt status
|
|
19
14
|
`;
|
|
20
15
|
};
|
|
21
16
|
export const command = async (ctx)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/status.ts"],"sourcesContent":["import { ArgError } from \"../services/command/arg.js\";\nimport type { Command, Usage } from \"../services/command/command.js\";\nimport { getConflicts, printConflicts } from \"../services/filesync/conflicts.js\";\nimport { UnknownDirectoryError } from \"../services/filesync/error.js\";\nimport { FileSync } from \"../services/filesync/filesync.js\";\nimport { SyncJson, SyncJsonArgs, loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport type StatusArgs = typeof args;\n\nexport const args = SyncJsonArgs;\n\nexport const usage: Usage = () => {\n return sprint`\n
|
|
1
|
+
{"version":3,"sources":["../../src/commands/status.ts"],"sourcesContent":["import { ArgError } from \"../services/command/arg.js\";\nimport type { Command, Usage } from \"../services/command/command.js\";\nimport { getConflicts, printConflicts } from \"../services/filesync/conflicts.js\";\nimport { UnknownDirectoryError } from \"../services/filesync/error.js\";\nimport { FileSync } from \"../services/filesync/filesync.js\";\nimport { SyncJson, SyncJsonArgs, loadSyncJsonDirectory } from \"../services/filesync/sync-json.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport type StatusArgs = typeof args;\n\nexport const args = SyncJsonArgs;\n\nexport const usage: Usage = () => {\n return sprint`\n Shows file changes since last sync (e.g. $ggt dev, push, deploy etc.)\n\n {gray Usage}\n ggt status\n `;\n};\n\nexport const command: Command<StatusArgs> = async (ctx) => {\n if (ctx.args._.length > 0) {\n throw new ArgError(sprint`\n \"ggt status\" does not take any positional arguments.\n\n If you are trying to see the status of a specific directory,\n you must \"cd\" to that directory and then run \"ggt status\".\n\n Run \"ggt status -h\" for more information.\n `);\n }\n\n const directory = await loadSyncJsonDirectory(process.cwd());\n const syncJson = await SyncJson.load(ctx, { directory });\n if (!syncJson) {\n throw new UnknownDirectoryError(ctx, { directory });\n }\n\n syncJson.print();\n\n const filesync = new FileSync(syncJson);\n const hashes = await filesync.hashes(ctx);\n await filesync.print(ctx, { hashes });\n\n const conflicts = getConflicts({ localChanges: hashes.localChanges, environmentChanges: hashes.environmentChanges });\n if (conflicts.size > 0) {\n ctx.log.debug(\"conflicts detected\", { conflicts });\n printConflicts({ conflicts });\n }\n};\n"],"names":["ArgError","getConflicts","printConflicts","UnknownDirectoryError","FileSync","SyncJson","SyncJsonArgs","loadSyncJsonDirectory","sprint","args","usage","command","ctx","_","length","directory","process","cwd","syncJson","load","print","filesync","hashes","conflicts","localChanges","environmentChanges","size","log","debug"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,QAAQ,QAAQ,6BAA6B;AAEtD,SAASC,YAAY,EAAEC,cAAc,QAAQ,oCAAoC;AACjF,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE,SAASC,QAAQ,QAAQ,mCAAmC;AAC5D,SAASC,QAAQ,EAAEC,YAAY,EAAEC,qBAAqB,QAAQ,oCAAoC;AAClG,SAASC,MAAM,QAAQ,+BAA+B;AAItD,OAAO,MAAMC,OAAOH,aAAa;AAEjC,OAAO,MAAMI,QAAe;IAC1B,OAAOF,MAAM,CAAC;;;;;EAKd,CAAC;AACH,EAAE;AAEF,OAAO,MAAMG,UAA+B,OAAOC;IACjD,IAAIA,IAAIH,IAAI,CAACI,CAAC,CAACC,MAAM,GAAG,GAAG;QACzB,MAAM,IAAId,SAASQ,MAAM,CAAC;;;;;;;IAO1B,CAAC;IACH;IAEA,MAAMO,YAAY,MAAMR,sBAAsBS,QAAQC,GAAG;IACzD,MAAMC,WAAW,MAAMb,SAASc,IAAI,CAACP,KAAK;QAAEG;IAAU;IACtD,IAAI,CAACG,UAAU;QACb,MAAM,IAAIf,sBAAsBS,KAAK;YAAEG;QAAU;IACnD;IAEAG,SAASE,KAAK;IAEd,MAAMC,WAAW,IAAIjB,SAASc;IAC9B,MAAMI,SAAS,MAAMD,SAASC,MAAM,CAACV;IACrC,MAAMS,SAASD,KAAK,CAACR,KAAK;QAAEU;IAAO;IAEnC,MAAMC,YAAYtB,aAAa;QAAEuB,cAAcF,OAAOE,YAAY;QAAEC,oBAAoBH,OAAOG,kBAAkB;IAAC;IAClH,IAAIF,UAAUG,IAAI,GAAG,GAAG;QACtBd,IAAIe,GAAG,CAACC,KAAK,CAAC,sBAAsB;YAAEL;QAAU;QAChDrB,eAAe;YAAEqB;QAAU;IAC7B;AACF,EAAE"}
|
package/lib/commands/version.js
CHANGED
|
@@ -4,11 +4,12 @@ import { sprint } from "../services/output/sprint.js";
|
|
|
4
4
|
export const usage = ()=>sprint`
|
|
5
5
|
Print this version of ggt.
|
|
6
6
|
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
|
|
7
|
+
{gray Usage}
|
|
8
|
+
ggt version
|
|
9
|
+
|
|
10
|
+
{gray Updating ggt}
|
|
11
|
+
When there is a new release of ggt, running ggt will show you a message letting you
|
|
12
|
+
know that an update is available.
|
|
12
13
|
`;
|
|
13
14
|
export const command = (_ctx)=>{
|
|
14
15
|
println(packageJson.version);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/version.ts"],"sourcesContent":["import type { Command, Usage } from \"../services/command/command.js\";\nimport { packageJson } from \"../services/config/package-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport const usage: Usage = () => sprint`\n Print this version of ggt.\n\n {
|
|
1
|
+
{"version":3,"sources":["../../src/commands/version.ts"],"sourcesContent":["import type { Command, Usage } from \"../services/command/command.js\";\nimport { packageJson } from \"../services/config/package-json.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\n\nexport const usage: Usage = () => sprint`\n Print this version of ggt.\n\n {gray Usage}\n ggt version\n \n {gray Updating ggt}\n When there is a new release of ggt, running ggt will show you a message letting you\n know that an update is available.\n`;\n\nexport const command: Command = (_ctx) => {\n println(packageJson.version);\n};\n"],"names":["packageJson","println","sprint","usage","command","_ctx","version"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AACA,SAASA,WAAW,QAAQ,qCAAqC;AACjE,SAASC,OAAO,QAAQ,8BAA8B;AACtD,SAASC,MAAM,QAAQ,+BAA+B;AAEtD,OAAO,MAAMC,QAAe,IAAMD,MAAM,CAAC;;;;;;;;;AASzC,CAAC,CAAC;AAEF,OAAO,MAAME,UAAmB,CAACC;IAC/BJ,QAAQD,YAAYM,OAAO;AAC7B,EAAE"}
|
package/lib/commands/whoami.js
CHANGED
|
@@ -4,11 +4,8 @@ import { getUser } from "../services/user/user.js";
|
|
|
4
4
|
export const usage = ()=>sprint`
|
|
5
5
|
Show the name and email address of the currently logged in user.
|
|
6
6
|
|
|
7
|
-
{
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{bold EXAMPLES}
|
|
11
|
-
$ ggt whoami
|
|
7
|
+
{gray Usage}
|
|
8
|
+
ggt whoami
|
|
12
9
|
`;
|
|
13
10
|
export const command = async (ctx)=>{
|
|
14
11
|
const user = await getUser(ctx);
|