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

fix: update path for schema #259

Merged
merged 7 commits into from
Oct 27, 2023
Merged

fix: update path for schema #259

merged 7 commits into from
Oct 27, 2023

Conversation

zixiang2018
Copy link
Contributor

@zixiang2018 zixiang2018 commented Oct 27, 2023

Context

To resolve this error when npm i.

npm ERR! command failed
npm ERR! command sh -c node scripts/postInstall
npm ERR! node:internal/modules/cjs/loader:1078
npm ERR!   throw err;
npm ERR!   ^
npm ERR! 
npm ERR! Error: Cannot find module '../src/2.0/schema/schema.json'

What this PR does

  • follow the quicktype command in postInstall which uses process.cwd to check for current working directory
  • remove schema compilation logic from postInstall.js so that npm i wont trigger it. Furthermore, made use of prebuild script (preBuild.js) to compile schema
  • add prebuild script in test so that test files can retrieve the schema files

scripts/postBuild.js Outdated Show resolved Hide resolved
@@ -16,6 +16,7 @@ jobs:
with:
node-version: 18.x
- run: npm ci && npm run postinstall
- run: npm run prebuild
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, prebuild should automatically run when npm run build is triggered. But since we don't build before running our tests, I understand we have to manually call it here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! Didnt wanted to add a npm run build in here because its not needed by the test script

@zixiang2018 zixiang2018 merged commit 2878d47 into master Oct 27, 2023
8 checks passed
@github-actions
Copy link

🎉 This PR is included in version 6.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants