This repository contains several TypeScript packages:
freshmint
is the main offering; a CLI tool for creating and managing NFT apps.@freshmint/core
is a library containing the contract templates and core logic that powers the Freshmint CLI.@freshmint/react
is a library that provides React hooks to make it easier to interact with Freshmint contracts from React.@freshmint/cadence-loader
is a Webpack loader for importing Cadence files into a web app.
- The TypeScript packages are organized in a monorepo layout managed by the Turborepo build system.
- We use tsup (and, by extension, esbuild) to bundle each TypeScript package as a JavaScript library.
- We use Prettier for code formatting and ESLint for linting.
- We use changesets to manage versioning and changelogs.
- We use GitHub Actions to run tests on each PR.
After cloning this repository, install its dependencies from the root of this repository:
npm install
This will launch tsup
in watch mode and build all packages any time their files change:
npm run dev
Run this command to create a production build of all packages:
npm run build
Run tests for all packages at once (note: currently core
is the only package that defines tests):
npm run tests
Run the tests for a specific package:
cd packages/core
# Run all tests for this package
npm run test
# Run the tests in a specific file
npm run test -- ./contracts/StandardNFTContract.test.ts
Some tests use Jest's snapshot testing feature.
To update snaphots, run with the -u
flag:
npm run test -- -u
# Format all packages using Prettier
npm run format
# Lint all packages using ESLint
npm run lint
All Freshmint packages are published to NPM. Instead of manually setting version tags, we use changesets to manage release versions.
We recommend reading the Introduction to Using Changesets.
Every PR should have an accompanying changeset. Before opening a PR, create a changeset:
npx changeset add
Then commit the changeset to your PR branch.
After accumulating one or more changesets in the main
branch, you can create a release.
This command automatically updates the versions on all packages. It also deletes the changeset files -- that is expected!
npx changeset version
After updating the versions, build all packages from the root of this repository:
npm run build
Run this command to publish all new package versions to NPM.
This also creates a new git tag for each updated package.
npx changeset publish
Commit the following changes:
- Updated
CHANGELOG.md
files - Updated
package.json
files - Deleted changeset files (these are no longer needed)
git add .
git commit -m "Prepare releases"
git push
Push the newly-created git tags to GitHub:
git push --tags
Lastly, create a new release on GitHub from the tags you just pushed!