Skip to content
Permalink
Browse files

fix(cli): fixes new command (#266)

  • Loading branch information
goldcaddy77 committed Nov 29, 2019
1 parent 80d0233 commit 6b1054eba5fd812b582543a3563c8c53d1efbb44
@@ -88,10 +88,15 @@ WARTHOG_AUTO_OPEN_PLAYGROUND=true yarn start:dev
### Create new project with the CLI
```bash
yarn global add warthog@beta
# Add warthog so that we can use the CLI
yarn add warthog
# Bootstrap a new application using Warthog CLI
yarn warthog new
# Install dependencies from generated package.json
yarn
# Generate a resource (model, resolver and service)
yarn warthog generate user name! nickname age:int! verified:bool!
@@ -31,13 +31,14 @@ export default {

const newFolder = toolbox.filesystem.path(__dirname, '../templates/new');
const files = await getFileRecursive(newFolder);

files.forEach(async file => {
const relativePath = path.relative(newFolder, file);
await generateFile(
toolbox,
props,
`new/${relativePath}`,
path.join(process.cwd(), 'new_app'),
process.cwd(),
relativePath.slice(0, -4) // remove .ejs
);
});
@@ -53,6 +54,9 @@ async function generateFile(
destFolder: string,
filename: string
) {
if (filename.startsWith('_')) {
filename = filename.replace(/^_/, '.');
}
const target = path.join(destFolder, '/', filename);

const generated = await toolbox.template.generate({
File renamed without changes.
@@ -13,15 +13,12 @@ export async function getSchemaInfo(options: BuildSchemaOptions) {

// get builded schema info from retrospection
const result = await graphql(schema, getIntrospectionQuery());
expect(result.errors).toBeUndefined();

if (!result || !result.data) {
throw new Error('Unable to introspect schema');
}

const schemaIntrospection = result.data.__schema as IntrospectionSchema;
expect(schemaIntrospection).toBeDefined();

const queryType = schemaIntrospection.types.find(
type => type.name === schemaIntrospection.queryType.name
) as IntrospectionObjectType;

0 comments on commit 6b1054e

Please sign in to comment.
You can’t perform that action at this time.