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

Open
wants to merge 4 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.

@rexgarland rexgarland requested a review from gregdingle May 15, 2024 00:59
index.js Outdated Show resolved Hide resolved
src/utils.js Outdated Show resolved Hide resolved
@rexgarland rexgarland marked this pull request as draft May 15, 2024 01:26
@dominics dominics force-pushed the rex/restructure-as-npm-ts-module branch from 0e29eef to 4bc2b02 Compare September 29, 2024 07:55
@dominics
Copy link
Member

dominics commented Sep 29, 2024

Rebased on latest master, added tsx for running tests and watching files, removed compiled output from source and test directories

At the moment, when using a package that imports this one with webpack, this package needs to be excluded from any ts-loader or babel-loader rules, otherwise you'd receive errors like this:

image

I believe this PR will fix such errors. The one caveat is that if you need to import this package from Github, you'll need to point at a commit or release that has the dist/ directory included. Therefore, to prepare a release for such uses:

# Check out the commit you want to release, then:
git checkout -B release-prep  # Create a branch, could be anything, just to make sure we don't commit this to master
yarn build                    # Prepare dist/

git add -f dist/              # Add dist/ to git, despite .gitignore
git commit -m "Preparing release"

git tag 2.0.0-rc.1            # Push a release tag
git push origin tag 2.0.0-rc.1

You can then use this release in package.json:

{
  "dependencies": {
    "kicad-to-json": "buildwithflux/kicad-module-parser#2.0.0-rc.1"
  }
}

The current state of this branch is deployed to the above tag/release, so we can test it. (Better would be to do a proper NPM release, but the above works for loading from Github)

@dominics dominics marked this pull request as ready for review September 29, 2024 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants