CODDDE / ember-cli-apiblueprint

ember-cli blueprints to generate JSONAPI compliant apiblueprints documents
MIT License
0 stars 0 forks source link

no such file or directory break pipeline #7

Open fsanvido opened 6 years ago

fsanvido commented 6 years ago

If a file imported from other .apib file is not present in the directory tree, the underline build crashes causing ember-cli to crash also, exiting the build pipeline and forcing to re-start ember-cli serve after fixing the error.

This is highly impracticaly for common operations such file renaming, performed outside the add blueprints.

An example of the error:

file deleted api-groups/alumn/relationships/classes.apib
file added api-groups/alumn/relationships/a-classes.apib
fs.js:646
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/Users/fabio/projects/test/test-addon/api-blueprints/api-groups/alumn/relationships/classes.apib'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.readFileSync (fs.js:551:33)
    at includeReplace (/Users/fabio/projects/ember-cli-apiblueprint/node_modules/aglio/lib/main.js:38:16)
    at String.replace (<anonymous>)
    at includeDirective (/Users/fabio/projects/ember-cli-apiblueprint/node_modules/aglio/lib/main.js:44:18)
    at includeReplace (/Users/fabio/projects/ember-cli-apiblueprint/node_modules/aglio/lib/main.js:40:12)
    at String.replace (<anonymous>)
    at includeDirective (/Users/fabio/projects/ember-cli-apiblueprint/node_modules/aglio/lib/main.js:44:18)
    at Object.exports.render (/Users/fabio/projects/ember-cli-apiblueprint/node_modules/aglio/lib/main.js:96:13)
    at render (/Users/fabio/projects/ember-cli-apiblueprint/node_modules/aglio/lib/main.js:147:22)
Agiledevers commented 5 years ago

Happens something similar when destroying a relationship via CLI. The line where the relationship is included in the group file needs to be deleted to avoid this error.

ember d api-hasmany company --to=user

Error: ENOENT: no such file or directory, open 'ws-docs/api-blueprints/api-groups/user/relationships/companies.apib'

content of api-blueprints/api-groups/user/user.apib

...

<!-- include(./relationships/companies.apib) -->
<!-- include(./relationships/permissions.apib) -->