@gadgetinc/ggt 0.2.0 → 0.2.1
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 +6 -6
- package/lib/__generated__/graphql.js.map +1 -1
- package/lib/commands/help.js +1 -1
- package/lib/commands/help.js.map +1 -1
- package/lib/commands/list.js +1 -1
- package/lib/commands/list.js.map +1 -1
- package/lib/commands/login.js.map +1 -1
- package/lib/commands/logout.js.map +1 -1
- package/lib/commands/sync.js +50 -39
- package/lib/commands/sync.js.map +1 -1
- package/lib/commands/whoami.js.map +1 -1
- package/lib/utils/base-command.js +2 -2
- package/lib/utils/base-command.js.map +1 -1
- package/lib/utils/client.js.map +1 -1
- package/lib/utils/context.js.map +1 -1
- package/lib/utils/errors.js.map +1 -1
- package/lib/utils/flags.js.map +1 -1
- package/lib/utils/fs-utils.js +4 -0
- package/lib/utils/fs-utils.js.map +1 -1
- package/lib/utils/help.js.map +1 -1
- package/lib/utils/promise.js.map +1 -1
- package/lib/utils/sleep.js +1 -1
- package/lib/utils/sleep.js.map +1 -1
- package/npm-shrinkwrap.json +554 -438
- package/oclif.manifest.json +1 -21
- package/package.json +19 -19
package/README.md
CHANGED
|
@@ -129,7 +129,7 @@ EXAMPLES
|
|
|
129
129
|
Goodbye!
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
_See code: [src/commands/sync.ts](https://github.com/gadget-inc/ggt/blob/v0.2.
|
|
132
|
+
_See code: [src/commands/sync.ts](https://github.com/gadget-inc/ggt/blob/v0.2.1/src/commands/sync.ts)_
|
|
133
133
|
|
|
134
134
|
### `ggt help [COMMAND]`
|
|
135
135
|
|
|
@@ -143,7 +143,7 @@ ARGUMENTS
|
|
|
143
143
|
COMMAND The command to show help for.
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
_See code: [src/commands/help.ts](https://github.com/gadget-inc/ggt/blob/v0.2.
|
|
146
|
+
_See code: [src/commands/help.ts](https://github.com/gadget-inc/ggt/blob/v0.2.1/src/commands/help.ts)_
|
|
147
147
|
|
|
148
148
|
### `ggt list`
|
|
149
149
|
|
|
@@ -170,7 +170,7 @@ EXAMPLES
|
|
|
170
170
|
$ ggt list --sort=slug
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
_See code: [src/commands/list.ts](https://github.com/gadget-inc/ggt/blob/v0.2.
|
|
173
|
+
_See code: [src/commands/list.ts](https://github.com/gadget-inc/ggt/blob/v0.2.1/src/commands/list.ts)_
|
|
174
174
|
|
|
175
175
|
### `ggt login`
|
|
176
176
|
|
|
@@ -189,7 +189,7 @@ EXAMPLES
|
|
|
189
189
|
Hello, Jane Doe (jane@example.com)
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
_See code: [src/commands/login.ts](https://github.com/gadget-inc/ggt/blob/v0.2.
|
|
192
|
+
_See code: [src/commands/login.ts](https://github.com/gadget-inc/ggt/blob/v0.2.1/src/commands/login.ts)_
|
|
193
193
|
|
|
194
194
|
### `ggt logout`
|
|
195
195
|
|
|
@@ -204,7 +204,7 @@ EXAMPLES
|
|
|
204
204
|
Goodbye
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
_See code: [src/commands/logout.ts](https://github.com/gadget-inc/ggt/blob/v0.2.
|
|
207
|
+
_See code: [src/commands/logout.ts](https://github.com/gadget-inc/ggt/blob/v0.2.1/src/commands/logout.ts)_
|
|
208
208
|
|
|
209
209
|
### `ggt whoami`
|
|
210
210
|
|
|
@@ -219,7 +219,7 @@ EXAMPLES
|
|
|
219
219
|
You are logged in as Jane Doe (jane@example.com)
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
-
_See code: [src/commands/whoami.ts](https://github.com/gadget-inc/ggt/blob/v0.2.
|
|
222
|
+
_See code: [src/commands/whoami.ts](https://github.com/gadget-inc/ggt/blob/v0.2.1/src/commands/whoami.ts)_
|
|
223
223
|
|
|
224
224
|
<!-- commandsstop -->
|
|
225
225
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/__generated__/graphql.ts"],"sourcesContent":["/**\n * ======================================================\n * THIS IS A GENERATED FILE! DO NOT EDIT IT MANUALLY!\n *\n * You can regenerate it by running `npm run generate-graphql`.\n * ======================================================\n */\n\nexport type Maybe<T> = T | null;\nexport type InputMaybe<T> = Maybe<T>;\nexport type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };\nexport type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };\nexport type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };\n/** All built-in and custom scalars, mapped to their actual values */\nexport type Scalars = {\n ID: string;\n String: string;\n Boolean: boolean;\n Int: number;\n Float: number;\n /** A date string, such as 2007-12-03, compliant with the `full-date` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */\n Date: any;\n /** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */\n DateTime: any;\n JSON: { [key: string]: any };\n};\n\nexport type ChangeAppDomainResult = {\n __typename?: 'ChangeAppDomainResult';\n onlyValidate?: Maybe<Scalars['Boolean']>;\n reason?: Maybe<Scalars['String']>;\n success: Scalars['Boolean'];\n};\n\nexport type ContributorResult = {\n __typename?: 'ContributorResult';\n email: Scalars['String'];\n isOwner: Scalars['Boolean'];\n isPending: Scalars['Boolean'];\n};\n\nexport type DeleteAppStatusResult = {\n __typename?: 'DeleteAppStatusResult';\n isNotCreator?: Maybe<Scalars['Boolean']>;\n success: Scalars['Boolean'];\n};\n\nexport type EnvironmentPatchResult = {\n __typename?: 'EnvironmentPatchResult';\n success: Scalars['Boolean'];\n};\n\nexport type EnvironmentPublishResult = {\n __typename?: 'EnvironmentPublishResult';\n success: Scalars['Boolean'];\n};\n\nexport type EnvironmentSubscriptionResult = {\n __typename?: 'EnvironmentSubscriptionResult';\n patches: Array<Scalars['JSON']>;\n};\n\nexport type EnvironmentTreeClientId = {\n clientType: Scalars['String'];\n id: Scalars['String'];\n};\n\nexport type FileSyncChangedEvent = {\n __typename?: 'FileSyncChangedEvent';\n content: Scalars['String'];\n encoding: FileSyncEncoding;\n mode: Scalars['Float'];\n path: Scalars['String'];\n};\n\nexport type FileSyncChangedEventInput = {\n content: Scalars['String'];\n encoding?: InputMaybe<FileSyncEncoding>;\n mode: Scalars['Float'];\n path: Scalars['String'];\n};\n\nexport type FileSyncDeletedEvent = {\n __typename?: 'FileSyncDeletedEvent';\n path: Scalars['String'];\n};\n\nexport type FileSyncDeletedEventInput = {\n path: Scalars['String'];\n};\n\nexport enum FileSyncEncoding {\n Base64 = 'base64',\n Utf8 = 'utf8'\n}\n\nexport type GadgetRole = {\n __typename?: 'GadgetRole';\n key: Scalars['String'];\n name: Scalars['String'];\n order: Scalars['Int'];\n selectable: Scalars['Boolean'];\n};\n\nexport type LogSearchResult = {\n __typename?: 'LogSearchResult';\n data: Scalars['JSON'];\n status: Scalars['String'];\n};\n\nexport type MigrateEnvironmentsResult = {\n __typename?: 'MigrateEnvironmentsResult';\n success: Scalars['Boolean'];\n};\n\nexport type Mutation = {\n __typename?: 'Mutation';\n changeAppDomain?: Maybe<ChangeAppDomainResult>;\n deleteApp?: Maybe<DeleteAppStatusResult>;\n migrateEnvironments?: Maybe<MigrateEnvironmentsResult>;\n patchEnvironmentTree?: Maybe<EnvironmentPatchResult>;\n publish?: Maybe<EnvironmentPublishResult>;\n publishFileSyncEvents: PublishFileSyncEventsResult;\n refreshScopes?: Maybe<RefreshScopesResult>;\n registerWebhooks?: Maybe<RegisterWebhooksResult>;\n removeContributor?: Maybe<RemoveContributorResult>;\n sendAppInvitation?: Maybe<SendAppInvitationResult>;\n unregisterWebhooks?: Maybe<UnregisterWebhooksResult>;\n};\n\n\nexport type MutationChangeAppDomainArgs = {\n newSubdomain: Scalars['String'];\n onlyValidate?: InputMaybe<Scalars['Boolean']>;\n};\n\n\nexport type MutationMigrateEnvironmentsArgs = {\n existingToProduction: Scalars['Boolean'];\n};\n\n\nexport type MutationPatchEnvironmentTreeArgs = {\n clientID: EnvironmentTreeClientId;\n patches: Array<Scalars['JSON']>;\n};\n\n\nexport type MutationPublishFileSyncEventsArgs = {\n input: PublishFileSyncEventsInput;\n};\n\n\nexport type MutationRefreshScopesArgs = {\n appConfigKey: Scalars['String'];\n connectionKey: Scalars['String'];\n shopId: Scalars['String'];\n};\n\n\nexport type MutationRegisterWebhooksArgs = {\n connectionKey: Scalars['String'];\n keepExtraTopics?: InputMaybe<Scalars['Boolean']>;\n modelKeys?: InputMaybe<Array<Scalars['String']>>;\n shopIds: Array<Scalars['String']>;\n};\n\n\nexport type MutationRemoveContributorArgs = {\n email: Scalars['String'];\n isInvitation: Scalars['Boolean'];\n};\n\n\nexport type MutationSendAppInvitationArgs = {\n email: Scalars['String'];\n resend?: InputMaybe<Scalars['Boolean']>;\n};\n\n\nexport type MutationUnregisterWebhooksArgs = {\n connectionKey: Scalars['String'];\n modelKeys?: InputMaybe<Array<Scalars['String']>>;\n shopIds?: InputMaybe<Array<Scalars['String']>>;\n};\n\nexport type PublishFileSyncEventsInput = {\n changed: Array<FileSyncChangedEventInput>;\n deleted: Array<FileSyncDeletedEventInput>;\n expectedRemoteFilesVersion: Scalars['String'];\n};\n\nexport type PublishFileSyncEventsResult = {\n __typename?: 'PublishFileSyncEventsResult';\n remoteFilesVersion: Scalars['String'];\n};\n\nexport type Query = {\n __typename?: 'Query';\n currentUser: User;\n environmentTreePath?: Maybe<Scalars['JSON']>;\n listContributors: Array<ContributorResult>;\n logsSearch: LogSearchResult;\n remoteFilesVersion: Scalars['String'];\n roles: Array<GadgetRole>;\n runTestSupportFunction?: Maybe<Scalars['JSON']>;\n typesManifest: TypesManifest;\n};\n\n\nexport type QueryEnvironmentTreePathArgs = {\n path: Scalars['String'];\n};\n\n\nexport type QueryLogsSearchArgs = {\n direction?: InputMaybe<Scalars['String']>;\n end?: InputMaybe<Scalars['DateTime']>;\n limit?: InputMaybe<Scalars['Int']>;\n query: Scalars['String'];\n start?: InputMaybe<Scalars['DateTime']>;\n step?: InputMaybe<Scalars['Int']>;\n};\n\nexport type RefreshScopesResult = {\n __typename?: 'RefreshScopesResult';\n success: Scalars['Boolean'];\n};\n\nexport type RegisterWebhooksResult = {\n __typename?: 'RegisterWebhooksResult';\n success: Scalars['Boolean'];\n};\n\nexport type RemoteFileSyncEvents = {\n __typename?: 'RemoteFileSyncEvents';\n changed: Array<FileSyncChangedEvent>;\n deleted: Array<FileSyncDeletedEvent>;\n remoteFilesVersion: Scalars['String'];\n};\n\nexport type RemoveContributorResult = {\n __typename?: 'RemoveContributorResult';\n reason?: Maybe<Scalars['String']>;\n success: Scalars['Boolean'];\n};\n\nexport type SendAppInvitationResult = {\n __typename?: 'SendAppInvitationResult';\n reason?: Maybe<Scalars['String']>;\n success: Scalars['Boolean'];\n};\n\nexport type Subscription = {\n __typename?: 'Subscription';\n editorActive?: Maybe<Scalars['Boolean']>;\n environmentTreePathPatches?: Maybe<EnvironmentSubscriptionResult>;\n logsSearch: LogSearchResult;\n remoteFileSyncEvents: RemoteFileSyncEvents;\n typesManifestStream: TypesManifest;\n};\n\n\nexport type SubscriptionEnvironmentTreePathPatchesArgs = {\n clientID: EnvironmentTreeClientId;\n path: Scalars['String'];\n};\n\n\nexport type SubscriptionLogsSearchArgs = {\n limit?: InputMaybe<Scalars['Int']>;\n query: Scalars['String'];\n start?: InputMaybe<Scalars['DateTime']>;\n};\n\n\nexport type SubscriptionRemoteFileSyncEventsArgs = {\n encoding?: InputMaybe<FileSyncEncoding>;\n localFilesVersion: Scalars['String'];\n};\n\nexport type TypeManifestEntry = {\n __typename?: 'TypeManifestEntry';\n declaration: Scalars['String'];\n path: Scalars['String'];\n};\n\nexport type TypesManifest = {\n __typename?: 'TypesManifest';\n dependenciesHash: Scalars['String'];\n entries: Array<TypeManifestEntry>;\n environmentVersion: Scalars['Int'];\n};\n\nexport type UnregisterWebhooksResult = {\n __typename?: 'UnregisterWebhooksResult';\n success: Scalars['Boolean'];\n};\n\nexport type User = {\n __typename?: 'User';\n email: Scalars['String'];\n name?: Maybe<Scalars['String']>;\n};\n\nexport type RemoteFileSyncEventsSubscriptionVariables = Exact<{\n localFilesVersion: Scalars['String'];\n}>;\n\n\nexport type RemoteFileSyncEventsSubscription = { __typename?: 'Subscription', remoteFileSyncEvents: { __typename?: 'RemoteFileSyncEvents', remoteFilesVersion: string, changed: Array<{ __typename?: 'FileSyncChangedEvent', path: string, mode: number, content: string, encoding: FileSyncEncoding }>, deleted: Array<{ __typename?: 'FileSyncDeletedEvent', path: string }> } };\n\nexport type RemoteFilesVersionQueryVariables = Exact<{ [key: string]: never; }>;\n\n\nexport type RemoteFilesVersionQuery = { __typename?: 'Query', remoteFilesVersion: string };\n\nexport type PublishFileSyncEventsMutationVariables = Exact<{\n input: PublishFileSyncEventsInput;\n}>;\n\n\nexport type PublishFileSyncEventsMutation = { __typename?: 'Mutation', publishFileSyncEvents: { __typename?: 'PublishFileSyncEventsResult', remoteFilesVersion: string } };\n"],"names":["FileSyncEncoding","Base64","Utf8"],"mappings":"AAAA;;;;;;CAMC,cAqFM;UAAKA,gBAAgB;IAAhBA,iBACVC,YAAS;IADCD,iBAEVE,UAAO;GAFGF,qBAAAA"}
|
|
1
|
+
{"version":3,"sources":["../../src/__generated__/graphql.ts"],"sourcesContent":["/**\n * ======================================================\n * THIS IS A GENERATED FILE! DO NOT EDIT IT MANUALLY!\n *\n * You can regenerate it by running `npm run generate-graphql`.\n * ======================================================\n */\n\nexport type Maybe<T> = T | null;\nexport type InputMaybe<T> = Maybe<T>;\nexport type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };\nexport type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };\nexport type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };\nexport type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };\nexport type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };\n/** All built-in and custom scalars, mapped to their actual values */\nexport type Scalars = {\n ID: { input: string | number; output: string; }\n String: { input: string; output: string; }\n Boolean: { input: boolean; output: boolean; }\n Int: { input: number; output: number; }\n Float: { input: number; output: number; }\n /** A date string, such as 2007-12-03, compliant with the `full-date` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */\n Date: { input: any; output: any; }\n /** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */\n DateTime: { input: any; output: any; }\n JSON: { input: { [key: string]: any }; output: { [key: string]: any }; }\n /** The `Upload` scalar type represents a file upload. */\n Upload: { input: any; output: any; }\n};\n\nexport type ApiUpgradeConvergePlanResult = {\n __typename?: 'APIUpgradeConvergePlanResult';\n items: Array<Scalars['JSON']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type ChangeAppDomainResult = {\n __typename?: 'ChangeAppDomainResult';\n onlyValidate?: Maybe<Scalars['Boolean']['output']>;\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type ContributorResult = {\n __typename?: 'ContributorResult';\n email: Scalars['String']['output'];\n isOwner: Scalars['Boolean']['output'];\n isPending: Scalars['Boolean']['output'];\n};\n\nexport type DeleteAppStatusResult = {\n __typename?: 'DeleteAppStatusResult';\n isNotCreator?: Maybe<Scalars['Boolean']['output']>;\n isNotOwner?: Maybe<Scalars['Boolean']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnableFrontendResult = {\n __typename?: 'EnableFrontendResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnvironmentPatchResult = {\n __typename?: 'EnvironmentPatchResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnvironmentPublishResult = {\n __typename?: 'EnvironmentPublishResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type EnvironmentSubscriptionResult = {\n __typename?: 'EnvironmentSubscriptionResult';\n patches: Array<Scalars['JSON']['output']>;\n};\n\nexport type EnvironmentTreeClientId = {\n clientType: Scalars['String']['input'];\n id: Scalars['String']['input'];\n};\n\nexport type FileSyncChangedEvent = {\n __typename?: 'FileSyncChangedEvent';\n content: Scalars['String']['output'];\n encoding: FileSyncEncoding;\n mode: Scalars['Float']['output'];\n path: Scalars['String']['output'];\n};\n\nexport type FileSyncChangedEventInput = {\n content: Scalars['String']['input'];\n encoding?: InputMaybe<FileSyncEncoding>;\n mode: Scalars['Float']['input'];\n oldPath?: InputMaybe<Scalars['String']['input']>;\n path: Scalars['String']['input'];\n};\n\nexport type FileSyncDeletedEvent = {\n __typename?: 'FileSyncDeletedEvent';\n path: Scalars['String']['output'];\n};\n\nexport type FileSyncDeletedEventInput = {\n path: Scalars['String']['input'];\n};\n\nexport enum FileSyncEncoding {\n Base64 = 'base64',\n Utf8 = 'utf8'\n}\n\nexport type GadgetRole = {\n __typename?: 'GadgetRole';\n key: Scalars['String']['output'];\n name: Scalars['String']['output'];\n order: Scalars['Int']['output'];\n selectable: Scalars['Boolean']['output'];\n};\n\nexport type IdentifySupportConversationResult = {\n __typename?: 'IdentifySupportConversationResult';\n identificationEmail: Scalars['String']['output'];\n identificationToken: Scalars['String']['output'];\n};\n\nexport type LogSearchResult = {\n __typename?: 'LogSearchResult';\n data: Scalars['JSON']['output'];\n status: Scalars['String']['output'];\n};\n\nexport type MigrateEnvironmentsResult = {\n __typename?: 'MigrateEnvironmentsResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type Mutation = {\n __typename?: 'Mutation';\n changeAppDomain?: Maybe<ChangeAppDomainResult>;\n deleteApp?: Maybe<DeleteAppStatusResult>;\n enableFrontend?: Maybe<EnableFrontendResult>;\n migrateEnvironments?: Maybe<MigrateEnvironmentsResult>;\n patchEnvironmentTree?: Maybe<EnvironmentPatchResult>;\n publish?: Maybe<EnvironmentPublishResult>;\n publishFileSyncEvents: PublishFileSyncEventsResult;\n refreshScopes?: Maybe<RefreshScopesResult>;\n registerWebhooks?: Maybe<RegisterWebhooksResult>;\n removeContributor?: Maybe<RemoveContributorResult>;\n sendAppInvitation?: Maybe<SendAppInvitationResult>;\n unregisterWebhooks?: Maybe<UnregisterWebhooksResult>;\n uploadFiles: UploadFilesResult;\n};\n\n\nexport type MutationChangeAppDomainArgs = {\n newSubdomain: Scalars['String']['input'];\n onlyValidate?: InputMaybe<Scalars['Boolean']['input']>;\n};\n\n\nexport type MutationEnableFrontendArgs = {\n hasShopifyConnection: Scalars['Boolean']['input'];\n};\n\n\nexport type MutationMigrateEnvironmentsArgs = {\n existingToProduction: Scalars['Boolean']['input'];\n};\n\n\nexport type MutationPatchEnvironmentTreeArgs = {\n clientID: EnvironmentTreeClientId;\n patches: Array<Scalars['JSON']['input']>;\n};\n\n\nexport type MutationPublishFileSyncEventsArgs = {\n input: PublishFileSyncEventsInput;\n};\n\n\nexport type MutationRefreshScopesArgs = {\n appConfigKey: Scalars['String']['input'];\n connectionKey: Scalars['String']['input'];\n shopId: Scalars['String']['input'];\n};\n\n\nexport type MutationRegisterWebhooksArgs = {\n connectionKey: Scalars['String']['input'];\n keepExtraTopics?: InputMaybe<Scalars['Boolean']['input']>;\n modelKeys?: InputMaybe<Array<Scalars['String']['input']>>;\n shopIds: Array<Scalars['String']['input']>;\n};\n\n\nexport type MutationRemoveContributorArgs = {\n email: Scalars['String']['input'];\n isInvitation: Scalars['Boolean']['input'];\n};\n\n\nexport type MutationSendAppInvitationArgs = {\n email?: InputMaybe<Scalars['String']['input']>;\n emails?: InputMaybe<Array<Scalars['String']['input']>>;\n resend?: InputMaybe<Scalars['Boolean']['input']>;\n};\n\n\nexport type MutationUnregisterWebhooksArgs = {\n apiKeys?: InputMaybe<Array<Scalars['String']['input']>>;\n connectionKey: Scalars['String']['input'];\n modelKeys?: InputMaybe<Array<Scalars['String']['input']>>;\n};\n\n\nexport type MutationUploadFilesArgs = {\n files: Array<UploadFile>;\n};\n\nexport type PublishFileSyncEventsInput = {\n changed: Array<FileSyncChangedEventInput>;\n deleted: Array<FileSyncDeletedEventInput>;\n expectedRemoteFilesVersion: Scalars['String']['input'];\n};\n\nexport type PublishFileSyncEventsResult = {\n __typename?: 'PublishFileSyncEventsResult';\n remoteFilesVersion: Scalars['String']['output'];\n};\n\nexport type Query = {\n __typename?: 'Query';\n apiUpgradeConvergePlan?: Maybe<ApiUpgradeConvergePlanResult>;\n currentUser: User;\n environmentTreeChildKeys: Array<Scalars['String']['output']>;\n environmentTreePath?: Maybe<Scalars['JSON']['output']>;\n identifySupportConversation?: Maybe<IdentifySupportConversationResult>;\n listContributors: Array<ContributorResult>;\n logsSearch: LogSearchResult;\n remoteFilesVersion: Scalars['String']['output'];\n roles: Array<GadgetRole>;\n runTestSupportFunction?: Maybe<Scalars['JSON']['output']>;\n team: TeamResult;\n typesManifest: TypesManifest;\n};\n\n\nexport type QueryApiUpgradeConvergePlanArgs = {\n currentVersion: Scalars['String']['input'];\n targetVersion: Scalars['String']['input'];\n};\n\n\nexport type QueryEnvironmentTreeChildKeysArgs = {\n path: Scalars['String']['input'];\n};\n\n\nexport type QueryEnvironmentTreePathArgs = {\n hydrateChildrenGlobs?: InputMaybe<Array<Scalars['String']['input']>>;\n path: Scalars['String']['input'];\n};\n\n\nexport type QueryLogsSearchArgs = {\n direction?: InputMaybe<Scalars['String']['input']>;\n end?: InputMaybe<Scalars['DateTime']['input']>;\n limit?: InputMaybe<Scalars['Int']['input']>;\n query: Scalars['String']['input'];\n start?: InputMaybe<Scalars['DateTime']['input']>;\n step?: InputMaybe<Scalars['Int']['input']>;\n};\n\n\nexport type QueryTypesManifestArgs = {\n dependenciesHash: Scalars['String']['input'];\n};\n\nexport type RefreshScopesResult = {\n __typename?: 'RefreshScopesResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type RegisterWebhooksResult = {\n __typename?: 'RegisterWebhooksResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type RemoteFileSyncEvents = {\n __typename?: 'RemoteFileSyncEvents';\n changed: Array<FileSyncChangedEvent>;\n deleted: Array<FileSyncDeletedEvent>;\n remoteFilesVersion: Scalars['String']['output'];\n};\n\nexport type RemoveContributorResult = {\n __typename?: 'RemoveContributorResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type SendAppInvitationResult = {\n __typename?: 'SendAppInvitationResult';\n reason?: Maybe<Scalars['String']['output']>;\n success: Scalars['Boolean']['output'];\n};\n\nexport type Subscription = {\n __typename?: 'Subscription';\n editorActive?: Maybe<Scalars['Boolean']['output']>;\n environmentTreePathPatches?: Maybe<EnvironmentSubscriptionResult>;\n logsSearch: LogSearchResult;\n remoteFileSyncEvents: RemoteFileSyncEvents;\n typesManifestStream: TypesManifest;\n};\n\n\nexport type SubscriptionEnvironmentTreePathPatchesArgs = {\n clientID: EnvironmentTreeClientId;\n path: Scalars['String']['input'];\n};\n\n\nexport type SubscriptionLogsSearchArgs = {\n limit?: InputMaybe<Scalars['Int']['input']>;\n query: Scalars['String']['input'];\n start?: InputMaybe<Scalars['DateTime']['input']>;\n};\n\n\nexport type SubscriptionRemoteFileSyncEventsArgs = {\n encoding?: InputMaybe<FileSyncEncoding>;\n localFilesVersion: Scalars['String']['input'];\n};\n\nexport type TeamMember = {\n __typename?: 'TeamMember';\n contributesToApp: Scalars['Boolean']['output'];\n email: Scalars['String']['output'];\n};\n\nexport type TeamResult = {\n __typename?: 'TeamResult';\n availableSeats?: Maybe<Scalars['Int']['output']>;\n costPerSeat?: Maybe<Scalars['String']['output']>;\n teamMembers: Array<TeamMember>;\n};\n\nexport type TypeManifestEntry = {\n __typename?: 'TypeManifestEntry';\n declaration: Scalars['String']['output'];\n path: Scalars['String']['output'];\n};\n\nexport type TypesManifest = {\n __typename?: 'TypesManifest';\n cdn: Array<Scalars['String']['output']>;\n dependenciesHash: Scalars['String']['output'];\n entries: Array<TypeManifestEntry>;\n environmentVersion: Scalars['Int']['output'];\n};\n\nexport type UnregisterWebhooksResult = {\n __typename?: 'UnregisterWebhooksResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type UploadFile = {\n file: Scalars['Upload']['input'];\n path: Scalars['String']['input'];\n};\n\nexport type UploadFilesResult = {\n __typename?: 'UploadFilesResult';\n success: Scalars['Boolean']['output'];\n};\n\nexport type User = {\n __typename?: 'User';\n email: Scalars['String']['output'];\n name?: Maybe<Scalars['String']['output']>;\n};\n\nexport type RemoteFileSyncEventsSubscriptionVariables = Exact<{\n localFilesVersion: Scalars['String']['input'];\n}>;\n\n\nexport type RemoteFileSyncEventsSubscription = { __typename?: 'Subscription', remoteFileSyncEvents: { __typename?: 'RemoteFileSyncEvents', remoteFilesVersion: string, changed: Array<{ __typename?: 'FileSyncChangedEvent', path: string, mode: number, content: string, encoding: FileSyncEncoding }>, deleted: Array<{ __typename?: 'FileSyncDeletedEvent', path: string }> } };\n\nexport type RemoteFilesVersionQueryVariables = Exact<{ [key: string]: never; }>;\n\n\nexport type RemoteFilesVersionQuery = { __typename?: 'Query', remoteFilesVersion: string };\n\nexport type PublishFileSyncEventsMutationVariables = Exact<{\n input: PublishFileSyncEventsInput;\n}>;\n\n\nexport type PublishFileSyncEventsMutation = { __typename?: 'Mutation', publishFileSyncEvents: { __typename?: 'PublishFileSyncEventsResult', remoteFilesVersion: string } };\n"],"names":["FileSyncEncoding","Base64","Utf8"],"mappings":"AAAA;;;;;;CAMC,cAuGM;UAAKA,gBAAgB;IAAhBA,iBACVC,YAAS;IADCD,iBAEVE,UAAO;GAFGF,qBAAAA"}
|
package/lib/commands/help.js
CHANGED
|
@@ -4,7 +4,7 @@ import Help from "../utils/help.js";
|
|
|
4
4
|
import { BaseCommand } from "../utils/base-command.js";
|
|
5
5
|
class HelpCommand extends BaseCommand {
|
|
6
6
|
async run() {
|
|
7
|
-
const { argv
|
|
7
|
+
const { argv } = await this.parse();
|
|
8
8
|
const help = new Help(this.config, {
|
|
9
9
|
all: true
|
|
10
10
|
});
|
package/lib/commands/help.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/help.ts"],"sourcesContent":["import { Args } from \"@oclif/core\";\nimport Help from \"../utils/help.js\";\nimport { BaseCommand } from \"../utils/base-command.js\";\n\n/**\n * Copied from @oclif/plugin-help. Uses our own {@link Help} template class instead of the one from @oclif/core.\n *\n * @see https://github.com/oclif/plugin-help/blob/67b580570257b45e92d3a04d50bf2a432c59afe3/src/commands/help.ts\n */\nexport default class HelpCommand extends BaseCommand<typeof HelpCommand> {\n static override strict = false;\n\n static override summary = \"Display help for ggt.\";\n\n static override args = {\n command: Args.string({\n required: false,\n description: \"The command to show help for.\",\n }),\n };\n\n async run(): Promise<void> {\n const { argv } = await this.parse();\n const help = new Help(this.config, { all: true });\n await help.showHelp(argv as string[]);\n }\n}\n"],"names":["Args","Help","BaseCommand","HelpCommand","run","argv","parse","help","config","all","showHelp","strict","summary","args","command","string","required","description"],"mappings":";AAAA,SAASA,IAAI,QAAQ,cAAc;AACnC,OAAOC,UAAU,mBAAmB;AACpC,SAASC,WAAW,QAAQ,2BAA2B;AAOxC,MAAMC,oBAAoBD;IAYvC,MAAME,MAAqB;QACzB,MAAM,EAAEC,
|
|
1
|
+
{"version":3,"sources":["../../src/commands/help.ts"],"sourcesContent":["import { Args } from \"@oclif/core\";\nimport Help from \"../utils/help.js\";\nimport { BaseCommand } from \"../utils/base-command.js\";\n\n/**\n * Copied from @oclif/plugin-help. Uses our own {@link Help} template class instead of the one from @oclif/core.\n *\n * @see https://github.com/oclif/plugin-help/blob/67b580570257b45e92d3a04d50bf2a432c59afe3/src/commands/help.ts\n */\nexport default class HelpCommand extends BaseCommand<typeof HelpCommand> {\n static override strict = false;\n\n static override summary = \"Display help for ggt.\";\n\n static override args = {\n command: Args.string({\n required: false,\n description: \"The command to show help for.\",\n }),\n };\n\n async run(): Promise<void> {\n const { argv } = await this.parse();\n const help = new Help(this.config, { all: true });\n await help.showHelp(argv as string[]);\n }\n}\n"],"names":["Args","Help","BaseCommand","HelpCommand","run","argv","parse","help","config","all","showHelp","strict","summary","args","command","string","required","description"],"mappings":";AAAA,SAASA,IAAI,QAAQ,cAAc;AACnC,OAAOC,UAAU,mBAAmB;AACpC,SAASC,WAAW,QAAQ,2BAA2B;AAOxC,MAAMC,oBAAoBD;IAYvC,MAAME,MAAqB;QACzB,MAAM,EAAEC,IAAI,EAAE,GAAG,MAAM,IAAI,CAACC,KAAK;QACjC,MAAMC,OAAO,IAAIN,KAAK,IAAI,CAACO,MAAM,EAAE;YAAEC,KAAK;QAAK;QAC/C,MAAMF,KAAKG,QAAQ,CAACL;IACtB;AACF;AAhBE,iBADmBF,aACHQ,UAAS;AAEzB,iBAHmBR,aAGHS,WAAU;AAE1B,iBALmBT,aAKHU,QAAO;IACrBC,SAASd,KAAKe,MAAM,CAAC;QACnBC,UAAU;QACVC,aAAa;IACf;AACF;AAfF;;;;CAIC,GACD,SAAqBd,yBAiBpB"}
|
package/lib/commands/list.js
CHANGED
|
@@ -6,7 +6,7 @@ import { context } from "../utils/context.js";
|
|
|
6
6
|
import chalkTemplate from "chalk-template";
|
|
7
7
|
class List extends BaseCommand {
|
|
8
8
|
async run() {
|
|
9
|
-
const { flags
|
|
9
|
+
const { flags } = await this.parse(List);
|
|
10
10
|
const apps = await context.getAvailableApps();
|
|
11
11
|
if (!apps.length) {
|
|
12
12
|
this.log(dedent`
|
package/lib/commands/list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/list.ts"],"sourcesContent":["import { ux } from \"@oclif/core\";\nimport { dedent } from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command.js\";\nimport type { App } from \"../utils/context.js\";\nimport { context } from \"../utils/context.js\";\nimport chalkTemplate from \"chalk-template\";\n\nexport default class List extends BaseCommand<typeof List> {\n static override summary = \"List the apps available to the currently logged in user.\";\n\n static override usage = \"list\";\n\n static override examples = [\n dedent(chalkTemplate`\n {gray $ ggt list}\n {gray $ ggt list --extended}\n {gray $ ggt list --sort=slug}\n `),\n ];\n\n static override flags = {\n ...ux.table.flags(),\n };\n\n override requireUser = true;\n\n async run(): Promise<void> {\n const { flags } = await this.parse(List);\n\n const apps = await context.getAvailableApps();\n if (!apps.length) {\n this.log(dedent`\n It doesn't look like you have any applications.\n\n Visit https://gadget.new to create one!\n `);\n return;\n }\n\n ux.table<App & Record<string, never>>(\n apps as unknown as (App & Record<string, never>)[],\n {\n id: {\n header: \"ID\",\n extended: true,\n },\n slug: {\n header: \"Slug\",\n },\n primaryDomain: {\n header: \"Domain\",\n },\n },\n {\n printLine: this.log.bind(this),\n ...flags, // parsed flags\n }\n );\n }\n}\n"],"names":["ux","dedent","BaseCommand","context","chalkTemplate","List","run","flags","parse","apps","getAvailableApps","length","log","table","id","header","extended","slug","primaryDomain","printLine","bind","requireUser","summary","usage","examples"],"mappings":";AAAA,SAASA,EAAE,QAAQ,cAAc;AACjC,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,WAAW,QAAQ,2BAA2B;AAEvD,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,OAAOC,mBAAmB,iBAAiB;AAE5B,MAAMC,aAAaH;IAmBhC,MAAMI,MAAqB;QACzB,MAAM,EAAEC,
|
|
1
|
+
{"version":3,"sources":["../../src/commands/list.ts"],"sourcesContent":["import { ux } from \"@oclif/core\";\nimport { dedent } from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command.js\";\nimport type { App } from \"../utils/context.js\";\nimport { context } from \"../utils/context.js\";\nimport chalkTemplate from \"chalk-template\";\n\nexport default class List extends BaseCommand<typeof List> {\n static override summary = \"List the apps available to the currently logged in user.\";\n\n static override usage = \"list\";\n\n static override examples = [\n dedent(chalkTemplate`\n {gray $ ggt list}\n {gray $ ggt list --extended}\n {gray $ ggt list --sort=slug}\n `),\n ];\n\n static override flags = {\n ...ux.table.flags(),\n };\n\n override requireUser = true;\n\n async run(): Promise<void> {\n const { flags } = await this.parse(List);\n\n const apps = await context.getAvailableApps();\n if (!apps.length) {\n this.log(dedent`\n It doesn't look like you have any applications.\n\n Visit https://gadget.new to create one!\n `);\n return;\n }\n\n ux.table<App & Record<string, never>>(\n apps as unknown as (App & Record<string, never>)[],\n {\n id: {\n header: \"ID\",\n extended: true,\n },\n slug: {\n header: \"Slug\",\n },\n primaryDomain: {\n header: \"Domain\",\n },\n },\n {\n printLine: this.log.bind(this),\n ...flags, // parsed flags\n }\n );\n }\n}\n"],"names":["ux","dedent","BaseCommand","context","chalkTemplate","List","run","flags","parse","apps","getAvailableApps","length","log","table","id","header","extended","slug","primaryDomain","printLine","bind","requireUser","summary","usage","examples"],"mappings":";AAAA,SAASA,EAAE,QAAQ,cAAc;AACjC,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,WAAW,QAAQ,2BAA2B;AAEvD,SAASC,OAAO,QAAQ,sBAAsB;AAC9C,OAAOC,mBAAmB,iBAAiB;AAE5B,MAAMC,aAAaH;IAmBhC,MAAMI,MAAqB;QACzB,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAM,IAAI,CAACC,KAAK,CAACH;QAEnC,MAAMI,OAAO,MAAMN,QAAQO,gBAAgB;QAC3C,IAAI,CAACD,KAAKE,MAAM,EAAE;YAChB,IAAI,CAACC,GAAG,CAACX,MAAM,CAAC;;;;MAIhB,CAAC;YACD;QACF;QAEAD,GAAGa,KAAK,CACNJ,MACA;YACEK,IAAI;gBACFC,QAAQ;gBACRC,UAAU;YACZ;YACAC,MAAM;gBACJF,QAAQ;YACV;YACAG,eAAe;gBACbH,QAAQ;YACV;QACF,GACA;YACEI,WAAW,IAAI,CAACP,GAAG,CAACQ,IAAI,CAAC,IAAI;YAC7B,GAAGb,KAAK;QACV;IAEJ;;;QAlCA,uBAASc,eAAc;;AAmCzB;AAnDE,iBADmBhB,MACHiB,WAAU;AAE1B,iBAHmBjB,MAGHkB,SAAQ;AAExB,iBALmBlB,MAKHmB,YAAW;IACzBvB,OAAOG,aAAa,CAAC;;;;IAIrB,CAAC;CACF;AAED,iBAbmBC,MAaHE,SAAQ;IACtB,GAAGP,GAAGa,KAAK,CAACN,KAAK,EAAE;AACrB;AAfF,SAAqBF,kBAoDpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/login.ts"],"sourcesContent":["import { dedent } from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command.js\";\nimport chalkTemplate from \"chalk-template\";\n\nexport default class Login extends BaseCommand<typeof Login> {\n static override summary = \"Log in to your account.\";\n\n static override usage = \"login\";\n\n static override examples = [\n dedent(chalkTemplate`\n {gray $ ggt login}\n We've opened Gadget's login page using your default browser.\n\n Please log in and then return to this terminal.\n\n Hello, Jane Doe {gray (jane@example.com)}\n `),\n ];\n\n async run(): Promise<void> {\n await this.login();\n }\n}\n"],"names":["dedent","BaseCommand","chalkTemplate","Login","run","login","summary","usage","examples"],"mappings":";AAAA,SAASA,MAAM,QAAQ,YAAY;AACnC,SAASC,WAAW,QAAQ,2BAA2B;AACvD,OAAOC,mBAAmB,iBAAiB;AAE5B,MAAMC,cAAcF;IAgBjC,MAAMG,MAAqB;QACzB,MAAM,IAAI,CAACC;
|
|
1
|
+
{"version":3,"sources":["../../src/commands/login.ts"],"sourcesContent":["import { dedent } from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command.js\";\nimport chalkTemplate from \"chalk-template\";\n\nexport default class Login extends BaseCommand<typeof Login> {\n static override summary = \"Log in to your account.\";\n\n static override usage = \"login\";\n\n static override examples = [\n dedent(chalkTemplate`\n {gray $ ggt login}\n We've opened Gadget's login page using your default browser.\n\n Please log in and then return to this terminal.\n\n Hello, Jane Doe {gray (jane@example.com)}\n `),\n ];\n\n async run(): Promise<void> {\n await this.login();\n }\n}\n"],"names":["dedent","BaseCommand","chalkTemplate","Login","run","login","summary","usage","examples"],"mappings":";AAAA,SAASA,MAAM,QAAQ,YAAY;AACnC,SAASC,WAAW,QAAQ,2BAA2B;AACvD,OAAOC,mBAAmB,iBAAiB;AAE5B,MAAMC,cAAcF;IAgBjC,MAAMG,MAAqB;QACzB,MAAM,IAAI,CAACC,KAAK;IAClB;AACF;AAlBE,iBADmBF,OACHG,WAAU;AAE1B,iBAHmBH,OAGHI,SAAQ;AAExB,iBALmBJ,OAKHK,YAAW;IACzBR,OAAOE,aAAa,CAAC;;;;;;;IAOrB,CAAC;CACF;AAdH,SAAqBC,mBAmBpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/logout.ts"],"sourcesContent":["import chalkTemplate from \"chalk-template\";\nimport { dedent } from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command.js\";\nimport { context } from \"../utils/context.js\";\n\nexport default class Logout extends BaseCommand<typeof Logout> {\n static override summary = \"Log out of your account.\";\n\n static override usage = \"logout\";\n\n static override examples = [\n dedent(chalkTemplate`\n {gray $ ggt logout}\n Goodbye\n `),\n ];\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async run(): Promise<void> {\n if (context.session) {\n context.session = undefined;\n this.log(\"Goodbye\");\n } else {\n this.log(\"You are not logged in\");\n }\n }\n}\n"],"names":["chalkTemplate","dedent","BaseCommand","context","Logout","run","session","undefined","log","summary","usage","examples"],"mappings":";AAAA,OAAOA,mBAAmB,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,OAAO,QAAQ,sBAAsB;AAE/B,MAAMC,eAAeF;IAYlC,4DAA4D;IAC5D,MAAMG,MAAqB;QACzB,IAAIF,QAAQG,
|
|
1
|
+
{"version":3,"sources":["../../src/commands/logout.ts"],"sourcesContent":["import chalkTemplate from \"chalk-template\";\nimport { dedent } from \"ts-dedent\";\nimport { BaseCommand } from \"../utils/base-command.js\";\nimport { context } from \"../utils/context.js\";\n\nexport default class Logout extends BaseCommand<typeof Logout> {\n static override summary = \"Log out of your account.\";\n\n static override usage = \"logout\";\n\n static override examples = [\n dedent(chalkTemplate`\n {gray $ ggt logout}\n Goodbye\n `),\n ];\n\n // eslint-disable-next-line @typescript-eslint/require-await\n async run(): Promise<void> {\n if (context.session) {\n context.session = undefined;\n this.log(\"Goodbye\");\n } else {\n this.log(\"You are not logged in\");\n }\n }\n}\n"],"names":["chalkTemplate","dedent","BaseCommand","context","Logout","run","session","undefined","log","summary","usage","examples"],"mappings":";AAAA,OAAOA,mBAAmB,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,WAAW,QAAQ,2BAA2B;AACvD,SAASC,OAAO,QAAQ,sBAAsB;AAE/B,MAAMC,eAAeF;IAYlC,4DAA4D;IAC5D,MAAMG,MAAqB;QACzB,IAAIF,QAAQG,OAAO,EAAE;YACnBH,QAAQG,OAAO,GAAGC;YAClB,IAAI,CAACC,GAAG,CAAC;QACX,OAAO;YACL,IAAI,CAACA,GAAG,CAAC;QACX;IACF;AACF;AApBE,iBADmBJ,QACHK,WAAU;AAE1B,iBAHmBL,QAGHM,SAAQ;AAExB,iBALmBN,QAKHO,YAAW;IACzBV,OAAOD,aAAa,CAAC;;;IAGrB,CAAC;CACF;AAVH,SAAqBI,oBAqBpB"}
|
package/lib/commands/sync.js
CHANGED
|
@@ -5,7 +5,7 @@ import { _ as _define_property } from "@swc/helpers/_/_define_property";
|
|
|
5
5
|
import { Args, Flags } from "@oclif/core";
|
|
6
6
|
import assert from "assert";
|
|
7
7
|
import chalkTemplate from "chalk-template";
|
|
8
|
-
import { FSWatcher } from "
|
|
8
|
+
import { default as FSWatcher } from "watcher";
|
|
9
9
|
import { format } from "date-fns";
|
|
10
10
|
import { execa } from "execa";
|
|
11
11
|
import fs from "fs-extra";
|
|
@@ -27,6 +27,14 @@ import { app } from "../utils/flags.js";
|
|
|
27
27
|
import { FSIgnorer, ignoreEnoent, isEmptyDir, walkDir } from "../utils/fs-utils.js";
|
|
28
28
|
import { PromiseSignal } from "../utils/promise.js";
|
|
29
29
|
class Sync extends BaseCommand {
|
|
30
|
+
static fileStats(path) {
|
|
31
|
+
try {
|
|
32
|
+
return fs.statSync(path);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
ignoreEnoent(error);
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
30
38
|
/**
|
|
31
39
|
* Turns an absolute filepath into a relative one from {@linkcode dir}.
|
|
32
40
|
*/ relative(to) {
|
|
@@ -67,7 +75,7 @@ class Sync extends BaseCommand {
|
|
|
67
75
|
* @param changed The normalized paths that have changed.
|
|
68
76
|
* @param deleted The normalized paths that have been deleted.
|
|
69
77
|
* @param options.limit The maximum number of lines to print. Defaults to 10. If debug is enabled, this is ignored.
|
|
70
|
-
*/ logPaths(prefix, changed, deleted, { limit =10
|
|
78
|
+
*/ logPaths(prefix, changed, deleted, { limit = 10 } = {}) {
|
|
71
79
|
const lines = _.sortBy([
|
|
72
80
|
...changed.map((normalizedPath)=>chalkTemplate`{green ${prefix}} ${normalizedPath} {gray (changed)}`),
|
|
73
81
|
...deleted.map((normalizedPath)=>chalkTemplate`{red ${prefix}} ${normalizedPath} {gray (deleted)}`)
|
|
@@ -134,18 +142,6 @@ class Sync extends BaseCommand {
|
|
|
134
142
|
".gadget",
|
|
135
143
|
".git"
|
|
136
144
|
]);
|
|
137
|
-
this.watcher = new FSWatcher({
|
|
138
|
-
ignored: (filepath)=>this.ignorer.ignores(filepath),
|
|
139
|
-
// don't emit an event for every watched file on boot
|
|
140
|
-
ignoreInitial: true,
|
|
141
|
-
// make sure stats are always present on add/change events
|
|
142
|
-
alwaysStat: true,
|
|
143
|
-
// wait for the entire file to be written before emitting add/change events
|
|
144
|
-
awaitWriteFinish: {
|
|
145
|
-
pollInterval: this.flags["file-poll-interval"],
|
|
146
|
-
stabilityThreshold: this.flags["file-stability-threshold"]
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
145
|
this.debug("starting");
|
|
150
146
|
if (!which.sync("yarn", {
|
|
151
147
|
nothrow: true
|
|
@@ -153,7 +149,7 @@ class Sync extends BaseCommand {
|
|
|
153
149
|
throw new YarnNotFoundError();
|
|
154
150
|
}
|
|
155
151
|
await fs.ensureDir(this.dir);
|
|
156
|
-
const { remoteFilesVersion
|
|
152
|
+
const { remoteFilesVersion } = await this.client.queryUnwrap({
|
|
157
153
|
query: REMOTE_FILES_VERSION_QUERY
|
|
158
154
|
});
|
|
159
155
|
const hasRemoteChanges = BigInt(remoteFilesVersion) > BigInt(this.state.filesVersion);
|
|
@@ -188,7 +184,7 @@ class Sync extends BaseCommand {
|
|
|
188
184
|
});
|
|
189
185
|
let action;
|
|
190
186
|
if (hasLocalChanges) {
|
|
191
|
-
({ action
|
|
187
|
+
({ action } = await inquirer.prompt({
|
|
192
188
|
type: "list",
|
|
193
189
|
name: "action",
|
|
194
190
|
choices: [
|
|
@@ -249,6 +245,15 @@ class Sync extends BaseCommand {
|
|
|
249
245
|
*/ async run() {
|
|
250
246
|
let error;
|
|
251
247
|
const stopped = new PromiseSignal();
|
|
248
|
+
this.watcher = new FSWatcher(this.dir, {
|
|
249
|
+
ignore: (filepath)=>{
|
|
250
|
+
return this.ignorer.ignores(filepath);
|
|
251
|
+
},
|
|
252
|
+
// don't emit an event for every watched file on boot
|
|
253
|
+
ignoreInitial: true,
|
|
254
|
+
renameDetection: true,
|
|
255
|
+
recursive: true
|
|
256
|
+
});
|
|
252
257
|
this.stop = async (e)=>{
|
|
253
258
|
if (this.status != SyncStatus.RUNNING) return;
|
|
254
259
|
error = e;
|
|
@@ -295,7 +300,7 @@ class Sync extends BaseCommand {
|
|
|
295
300
|
})
|
|
296
301
|
}, {
|
|
297
302
|
error: (error)=>void this.stop(error),
|
|
298
|
-
next: ({ remoteFileSyncEvents
|
|
303
|
+
next: ({ remoteFileSyncEvents })=>{
|
|
299
304
|
const remoteFilesVersion = remoteFileSyncEvents.remoteFilesVersion;
|
|
300
305
|
// we always ignore .gadget/ files so that we don't publish them (they're managed by gadget), but we still want to receive them
|
|
301
306
|
const filter = (event)=>event.path.startsWith(".gadget/") || !this.ignorer.ignores(event.path);
|
|
@@ -376,12 +381,16 @@ class Sync extends BaseCommand {
|
|
|
376
381
|
});
|
|
377
382
|
return;
|
|
378
383
|
}
|
|
384
|
+
const isRename = "oldPath" in file;
|
|
379
385
|
try {
|
|
380
386
|
changed.push({
|
|
381
387
|
path: normalizedPath,
|
|
382
388
|
mode: file.mode,
|
|
383
389
|
content: file.isDirectory ? "" : await fs.readFile(this.absolute(normalizedPath), "base64"),
|
|
384
|
-
encoding: FileSyncEncoding.Base64
|
|
390
|
+
encoding: FileSyncEncoding.Base64,
|
|
391
|
+
...isRename ? {
|
|
392
|
+
oldPath: file.oldPath
|
|
393
|
+
} : undefined
|
|
385
394
|
});
|
|
386
395
|
} catch (error) {
|
|
387
396
|
// A file could have been changed and then deleted before we process the change event, so the readFile
|
|
@@ -404,7 +413,7 @@ class Sync extends BaseCommand {
|
|
|
404
413
|
});
|
|
405
414
|
this.log(chalkTemplate`Sent {gray ${format(new Date(), "pp")}}`);
|
|
406
415
|
this.logPaths("→", changed.map((x)=>x.path), deleted.map((x)=>x.path));
|
|
407
|
-
const { remoteFilesVersion
|
|
416
|
+
const { remoteFilesVersion } = data.publishFileSyncEvents;
|
|
408
417
|
this.debug("remote files version after publishing %s", remoteFilesVersion);
|
|
409
418
|
if (BigInt(remoteFilesVersion) > this.state.filesVersion) {
|
|
410
419
|
this.debug("updated local files version from %s to %s", this.state.filesVersion, remoteFilesVersion);
|
|
@@ -412,15 +421,19 @@ class Sync extends BaseCommand {
|
|
|
412
421
|
}
|
|
413
422
|
});
|
|
414
423
|
}, this.flags["file-push-delay"]);
|
|
415
|
-
this.
|
|
416
|
-
const
|
|
424
|
+
this.on("error", (error)=>void this.stop(error)).on("all", (event, absolutePath, renamedPath)=>{
|
|
425
|
+
const filePath = event === "rename" || event === "renameDir" ? renamedPath : absolutePath;
|
|
426
|
+
const isDirectory = event === "renameDir" || event === "addDir" || event === "unlinkDir";
|
|
427
|
+
const normalizedPath = this.normalize(filePath, isDirectory);
|
|
428
|
+
const stats = Sync.fileStats(filePath);
|
|
429
|
+
// this shouldn't ever be the case using watcher since it doesn't support symlinks but we'll keep it here just in case we ever switch to another lib that does support it
|
|
417
430
|
if (stats?.isSymbolicLink?.()) {
|
|
418
431
|
this.debug("skipping event caused by symlink %s", normalizedPath);
|
|
419
432
|
return;
|
|
420
433
|
}
|
|
421
|
-
if (
|
|
434
|
+
if (filePath == this.ignorer.filepath) {
|
|
422
435
|
this.ignorer.reload();
|
|
423
|
-
} else if (this.ignorer.ignores(
|
|
436
|
+
} else if (this.ignorer.ignores(filePath)) {
|
|
424
437
|
this.debug("skipping event caused by ignored file %s", normalizedPath);
|
|
425
438
|
return;
|
|
426
439
|
}
|
|
@@ -458,6 +471,16 @@ class Sync extends BaseCommand {
|
|
|
458
471
|
isDirectory: event === "unlinkDir"
|
|
459
472
|
});
|
|
460
473
|
break;
|
|
474
|
+
case "rename":
|
|
475
|
+
case "renameDir":
|
|
476
|
+
assert(stats, "missing stats on rename/renameDir event");
|
|
477
|
+
localFilesBuffer.set(normalizedPath, {
|
|
478
|
+
oldPath: this.normalize(absolutePath, isDirectory),
|
|
479
|
+
newPath: normalizedPath,
|
|
480
|
+
isDirectory: event === "renameDir",
|
|
481
|
+
mode: stats.mode
|
|
482
|
+
});
|
|
483
|
+
break;
|
|
461
484
|
}
|
|
462
485
|
this.publish();
|
|
463
486
|
});
|
|
@@ -492,6 +515,10 @@ class Sync extends BaseCommand {
|
|
|
492
515
|
this.log("Goodbye!");
|
|
493
516
|
}
|
|
494
517
|
}
|
|
518
|
+
on(eventName, listener) {
|
|
519
|
+
this.watcher.on(eventName, listener);
|
|
520
|
+
return this;
|
|
521
|
+
}
|
|
495
522
|
/**
|
|
496
523
|
* Enqueues a function that handles file-sync events onto the {@linkcode queue}.
|
|
497
524
|
*
|
|
@@ -585,22 +612,6 @@ _define_property(Sync, "flags", {
|
|
|
585
612
|
helpValue: "ms",
|
|
586
613
|
default: 100,
|
|
587
614
|
hidden: true
|
|
588
|
-
}),
|
|
589
|
-
"file-stability-threshold": Flags.integer({
|
|
590
|
-
name: "file-stability-threshold",
|
|
591
|
-
summary: "Time in milliseconds a file's size must remain the same.",
|
|
592
|
-
helpGroup: "file",
|
|
593
|
-
helpValue: "ms",
|
|
594
|
-
default: 500,
|
|
595
|
-
hidden: true
|
|
596
|
-
}),
|
|
597
|
-
"file-poll-interval": Flags.integer({
|
|
598
|
-
name: "file-poll-interval",
|
|
599
|
-
description: "Interval in milliseconds between polling a file's size.",
|
|
600
|
-
helpGroup: "file",
|
|
601
|
-
helpValue: "ms",
|
|
602
|
-
default: 100,
|
|
603
|
-
hidden: true
|
|
604
615
|
})
|
|
605
616
|
});
|
|
606
617
|
_define_property(Sync, "examples", [
|