Skip to content

Commit 6ceadfa

Browse files
committed
* Improve descriptions for localSchemaFile flag
* Clean up logic for setting defaults on the config * Add Flags type in another spot
1 parent 5414a01 commit 6ceadfa

3 files changed

Lines changed: 21 additions & 10 deletions

File tree

packages/apollo/src/Command.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,21 @@ export abstract class ProjectCommand extends Command {
140140
}
141141

142142
if (flags.localSchemaFile) {
143-
config.setDefaults({
144-
client: {
143+
if (isClientConfig(config)) {
144+
config.setDefaults({
145+
client: {
146+
service: {
147+
localSchemaFile: flags.localSchemaFile
148+
}
149+
}
150+
});
151+
} else if (isServiceConfig(config)) {
152+
config.setDefaults({
145153
service: {
146154
localSchemaFile: flags.localSchemaFile
147155
}
148-
},
149-
service: {
150-
localSchemaFile: flags.localSchemaFile
151-
}
152-
});
156+
});
157+
}
153158
}
154159

155160
// load per command type defaults;
@@ -161,7 +166,11 @@ export abstract class ProjectCommand extends Command {
161166
return { config, filepath, isEmpty };
162167
}
163168

164-
protected createService(config: ApolloConfig, filepath: string, flags: any) {
169+
protected createService(
170+
config: ApolloConfig,
171+
filepath: string,
172+
flags: Flags
173+
) {
165174
const loadingHandler = new OclifLoadingHandler(this);
166175
const rootURI = `file://${parse(filepath).dir}`;
167176
const clientIdentity = {

packages/apollo/src/commands/client/codegen.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export default class Generate extends ClientCommand {
4545
required: true
4646
}),
4747
localSchemaFile: flags.string({
48-
description: "Path to your local GraphQL schema file"
48+
description:
49+
"Path to your local GraphQL schema file (introspection result or SDL)"
4950
}),
5051
addTypename: flags.boolean({
5152
description: "Automatically add __typename to your queries",

packages/apollo/src/commands/service/push.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export default class ServicePush extends ProjectCommand {
1616
default: "current"
1717
}),
1818
localSchemaFile: flags.string({
19-
description: "Path to your local GraphQL schema file"
19+
description:
20+
"Path to your local GraphQL schema file (introspection result or SDL)"
2021
})
2122
};
2223

0 commit comments

Comments
 (0)