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

Build as proper NPM module #7

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rexgarland
Copy link

@rexgarland rexgarland commented May 15, 2024

Impact

Description

  • Builds ts code according to this guide, and updates package.json accordingly to point to the right file for js distribution

Testing

  • local test in test/

TODO:

  • update the package.json references in flux-app to reference this code, then check if pnpm build:copilot works on in flux
  • Make sure the prettier formats are stable: check on someone else's machine (@gregdingle?)

Notes

  • This won't break anything in flux-app, since we're referencing this module by exact commits already, not pointing to HEAD here.

index.js Outdated
Copy link
Author

Choose a reason for hiding this comment

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

Moved to src/index

Copy link
Author

Choose a reason for hiding this comment

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

(With small changes due to the import ./types)

Copy link
Author

Choose a reason for hiding this comment

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

This whole file was reindented due to Prettier. I believe this is a more stable formatting going forward, but the diff will be ugly.

Comment on lines +4 to +9
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
Copy link
Author

Choose a reason for hiding this comment

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

Key changes

"build": "yarn build:module && yarn build:symbol && yarn build:package",
"build:module": "npx pegjs -o src/module-parser.js --allowed-start-rules module,board ./src/module.pegjs",
"build:symbol": "npx pegjs -o src/symbol-parser.js --allowed-start-rules kicad_symbol_lib ./src/symbol.pegjs",
"build:package": "tsup",
Copy link
Author

Choose a reason for hiding this comment

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

Key change

src/utils.js Outdated
Copy link
Author

Choose a reason for hiding this comment

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

No-op change due to reruning tsc. Next step would be to not check this file in at all.

@rexgarland rexgarland marked this pull request as draft May 15, 2024 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant