question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom template does not work with output directory (--out) in node module template

See original GitHub issue

In my node module template does not work the output directory.

gql-gen --export ./dist/generator/schema.js -t graphql-codegen-sequelize-typescript --out ./src/models/types/

config file


const config = {
  inputType: 'MULTIPLE_FILES',
  templates: {
    type,
    inputType,
    interface: interfaceTemplate,
    enum: enumTemplate,
    scalar,
    union,
    'loaders.ts.schema.handlebars': loaders,
    'loaders-export.ts.schema.handlebars': loadersExport
  },
  flattenTypes: true,
  filesExtension: 'ts',
....

The files ‘loaders.ts’ and ‘loaders-export.ts’ are writing in the root path, but output directory is ‘./src/models/types/’.

Is it a bug? In gql-gen.json file is working with loaders.ts.schema.handlebars file.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
GD-Aichicommented, May 16, 2018

I think you can close the ticket. Version 0.9.1 fixes my problem.

0reactions
GD-Aichicommented, May 8, 2018

I looked in the code for a minute and if the line 293 in to

prefix // or prefix: prefix 

then the files will writing in out directory. I don’t know, what do the master version do. https://github.com/dotansimha/graphql-code-generator/blob/da33ee50a7fa82a17ad4595be124cd1639deb6db/packages/graphql-codegen-compiler/src/generate-multiple-files.ts#L293-L299 I will checking the master build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The custom node template file is not working - Drupal Answers
I've created template file named node--product-display.tpl.php as suggested by the Theme developer module, but the changes I made to this file ...
Read more >
hbs files are not copied to dist folder · Issue #42 - GitHub
Created a folder "templates" in the "src" folder and put my .hbs in there. Install npm module: cpx. Create a npm run command...
Read more >
node.js - Jade - Loading templates from different directories
The setup used in the app is to have a /views/layout.jade file that loads for all sub-apps. The sub-apps' views are located in...
Read more >
How to build your own project templates using Node CLI and ...
How to build your own project templates using Node CLI and typescript. This is a journey of having my own cli to create...
Read more >
Template a file out to a target host - Ansible Documentation
In most cases, you can use the short module name template even without ... template_destpath is the path of the template on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found