Skip to content

Latest commit

 

History

History

packages

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

Freshmint TypeScript Packages

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.

Development tools

  • 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.

Setup

After cloning this repository, install its dependencies from the root of this repository:

npm install

Building for development

This will launch tsup in watch mode and build all packages any time their files change:

npm run dev

Building for production

Run this command to create a production build of all packages:

npm run build

Tests

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

Updating snapshots

Some tests use Jest's snapshot testing feature. To update snaphots, run with the -u flag:

npm run test -- -u

Formatting & linting

# Format all packages using Prettier
npm run format 

# Lint all packages using ESLint
npm run lint

How to create a release

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.

Create one changeset per PR

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.

Prepare a release

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

Build a release

After updating the versions, build all packages from the root of this repository:

npm run build

Publish a release to NPM

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 and push the updated packages

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 git tags

Push the newly-created git tags to GitHub:

git push --tags

Publish a release on GitHub

Lastly, create a new release on GitHub from the tags you just pushed!