Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n breaks usage outside of jsonschema2md repo #157

Closed
trieloff opened this issue Jul 30, 2019 · 7 comments · Fixed by #158
Closed

i18n breaks usage outside of jsonschema2md repo #157

trieloff opened this issue Jul 30, 2019 · 7 comments · Fixed by #158

Comments

@trieloff
Copy link
Collaborator

Hi @Claymore1337 it looks like the latest release is broken when used from node_modules of another project:

$ npx jsonschema2md -d src/schemas -o docs

07
info: output directory: /home/circleci/project/docs
info: finished reading all *.schema.json files in /home/circleci/project/src/schemas, beginning processing….
/home/circleci/project/src/schemas/action.schema.json
/home/circleci/project/src/schemas/content.schema.json
/home/circleci/project/src/schemas/context.schema.json
/home/circleci/project/src/schemas/mdast.schema.json
/home/circleci/project/src/schemas/meta.schema.json
/home/circleci/project/src/schemas/position.schema.json
/home/circleci/project/src/schemas/rawrequest.schema.json
/home/circleci/project/src/schemas/request.schema.json
/home/circleci/project/src/schemas/response.schema.json
/home/circleci/project/src/schemas/secrets.schema.json
/home/circleci/project/src/schemas/section.schema.json
unresolved reference: https://ns.adobe.com/helix/pipeline/position
unresolved reference: https://ns.adobe.com/helix/pipeline/mdast
unresolved reference: https://ns.adobe.com/helix/pipeline/meta#/definitions/meta
unresolved reference: https://ns.adobe.com/helix/pipeline/meta#/definitions/meta/properties/title
unresolved reference: https://ns.adobe.com/helix/pipeline/meta#/definitions/meta/properties/intro
unresolved reference: https://ns.adobe.com/helix/pipeline/meta#/definitions/meta/properties/image
unresolved reference: https://ns.adobe.com/helix/pipeline/mdast
unresolved reference: https://ns.adobe.com/helix/pipeline/meta#/definitions/meta/properties/image
unresolved reference: https://ns.adobe.com/helix/pipeline/meta#/definitions/meta/properties/intro
unresolved reference: https://ns.adobe.com/helix/pipeline/meta#/definitions/meta
unresolved reference: https://ns.adobe.com/helix/pipeline/position
unresolved reference: https://ns.adobe.com/helix/pipeline/meta#/definitions/meta/properties/title
/home/circleci/project/src/schemas/textcoordinates.schema.json
Output processed. Trying to make a README.md now
error: ENOENT: no such file or directory, mkdir '/home/circleci/project/lib/locales' {"errno":-2,"code":"ENOENT","syscall":"mkdir","path":"/home/circleci/project/lib/locales"}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @adobe/helix-pipeline@4.0.5 docs: `npx jsonschema2md -d src/schemas -o docs`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @adobe/helix-pipeline@4.0.5 docs script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2019-07-30T09_41_43_235Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @adobe/helix-pipeline@4.0.5 types: `npm run docs && node bin/schema2ts.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @adobe/helix-pipeline@4.0.5 types script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2019-07-30T09_41_43_247Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @adobe/helix-pipeline@4.0.5 lint: `npx eslint . && npm run types`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @adobe/helix-pipeline@4.0.5 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2019-07-30T09_41_43_257Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @adobe/helix-pipeline@4.0.5 test-ci: `npm run lint && npm run test && codecov`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @adobe/helix-pipeline@4.0.5 test-ci script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2019-07-30T09_41_43_267Z-debug.log
Exited with code 1

See also adobe/helix-pipeline#432

@trieloff trieloff added the bug label Jul 30, 2019
@Claymore1337
Copy link
Contributor

@trieloff
I could not reproduce this bug on my environment. I assume that has something to do with the operation system.

I was building the path myself and not over the path.resolve/join like in other code part. I will make a branch with the fix. Is there a way how I could run that test on a branch?

Claymore1337 pushed a commit to Claymore1337/jsonschema2md that referenced this issue Jul 30, 2019
the i18n path was build by strings. now it use path to resolve it

fix adobe#157
@trieloff
Copy link
Collaborator Author

Just reading the error message

error: ENOENT: no such file or directory, mkdir '/home/circleci/project/lib/locales' {"errno":-2,"code":"ENOENT","syscall":"mkdir","path":"/home/circleci/project/lib/locales"}

it looks like the problem is that lib does not exist, so creating lib/locales won't work.

The bigger question is: why do we have to create the directory anyway?

Claymore1337 pushed a commit to Claymore1337/jsonschema2md that referenced this issue Jul 30, 2019
there was an bug in the init part of the i18n setup. It was moved to the cli to handle it in the
same way

fix adobe#157
@Claymore1337
Copy link
Contributor

I found the error. I have setuped the i18n lib in the file readmeWriter.js in the wrong way. Then I saw if i would setup it into the cli.js i just would need to do it once and not twice. So i have moved the init part of the i18n to the cli.js.

Now to your question. The i18n lib will create a file in the provided directory if the file did not exists.

@trieloff
Copy link
Collaborator Author

When run without arguments, then it should just take the i18n file from the project's __dirname instead of creating another output file.

@Claymore1337
Copy link
Contributor

This was exactly the bug at one point I have forgot to use dirname.

image

@trieloff
Copy link
Collaborator Author

Thank you, @Claymore1337 – much appreciated!

trieloff pushed a commit that referenced this issue Jul 31, 2019
## [3.1.1](v3.1.0...v3.1.1) (2019-07-31)

### Bug Fixes

* **i18n init:** moved the i18n init part to the cli.js ([5e37d2d](5e37d2d)), closes [#157](#157)
* **markdownwriter.js:** use path function to resolve the path ([5fe7db2](5fe7db2)), closes [#157](#157)
@trieloff
Copy link
Collaborator Author

🎉 This issue has been resolved in version 3.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

koraa pushed a commit to koraa/jsonschema2md that referenced this issue Aug 9, 2019
## [3.1.1](adobe/jsonschema2md@v3.1.0...v3.1.1) (2019-07-31)

### Bug Fixes

* **i18n init:** moved the i18n init part to the cli.js ([5e37d2d](adobe@5e37d2d)), closes [adobe#157](adobe#157)
* **markdownwriter.js:** use path function to resolve the path ([5fe7db2](adobe@5fe7db2)), closes [adobe#157](adobe#157)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants