26 lines
644 B
JavaScript
26 lines
644 B
JavaScript
const run = require('tools/scripts');
|
|
|
|
const PATH_CRM_GRAPHQL_SCHEMA = './graphql/crm.schema.graphql';
|
|
const { URL_CRM_GRAPHQL_DIRECT, DEV_AUTH_TOKEN } = process.env;
|
|
|
|
function downloadSchema() {
|
|
const command1 = [
|
|
'gql-sdl',
|
|
URL_CRM_GRAPHQL_DIRECT,
|
|
`-H "Authorization: Bearer ${DEV_AUTH_TOKEN}"`,
|
|
'-o',
|
|
PATH_CRM_GRAPHQL_SCHEMA,
|
|
].join(' ');
|
|
run(command1, 'Download GraphQL Schema...');
|
|
}
|
|
|
|
function generateTypescript() {
|
|
const command2 = ['graphql-codegen,', '--config', '.graphqlrc.yml'].join(' ');
|
|
run(command2, 'Generating TypeScript code...');
|
|
}
|
|
|
|
module.exports = {
|
|
downloadSchema,
|
|
generateTypescript,
|
|
};
|