Skip to content

NiftyLeague/nifty-fe-monorepo

Nifty League Frontend Monorepo

Algolia Search CodeQL CI

Built with Turborepo!

What's inside?

This Turborepo includes the following apps/packages:

Apps

Packages

  • @nl/eslint-config: global eslint configurations (includes eslint-plugin-next and eslint-config-prettier) for code analysis/linting
  • @nl/imx-passport: an Immutable Passport instance to connect apps to the Immutable zkEVM blockchain
  • @nl/playfab: a PlayFab client API for our game services. Includes auth UI components for PlayFab login.
  • @nl/prettier-config: global Prettier config overrides for code formatting
  • @nl/theme: a common theme wrapper for Next.js apps using Material-UI
  • @nl/typescript-config: global TypeScript configs tsconfig.json
  • @nl/ui: a stub React component library shared by all applications. Includes global Tailwind CSS styles.

Note: Each package/app strictly uses TypeScript

Development Ports

Utilities

This Turborepo has several tools already setup for you:

Getting Started

Install turbo globally

To install turbo globally for ease of use:

pnpm install turbo --global

Set working directory to root

Note: All commands are run from the root directory!

cd nifty-fe-monorepo

Install dependencies

We use pnpm to manage dependencies.

pnpm install

Add dependencies

Please install dependencies only where they're used.

To add a dependency to a specific app directory use --filter

pnpm add PACKAGE_NAME --filter=DIRECTORY_NAME

Build

To build all apps and packages, run the following command:

turbo build

Develop

To develop all apps and packages, run the following command:

turbo dev

Testing

To lint all apps and packages, run the following command:

turbo lint

Note: you can also use turbo lint:fix to run linting with --fix

To format all apps and packages, run the following command:

turbo format

To check TypeScript in all apps and packages, run the following command:

turbo type-check

To run all of the above test commands together, run the following command:

turbo test

Managing dependencies

We use Syncpack to ensure consistent dependency versions.

syncpack lint

Lint all versions and ranges and exit with 0 or 1 based on whether all files match your Syncpack configuration file.

syncpack fix-mismatches

Fix all mismatches in your dependencies uncovered by syncpack lint.

syncpack format

Format all package.json files to match our Syncpack configuration file .syncpackrc.ts.

syncpack list

Query and inspect all dependencies in our project, both valid and invalid.

syncpack update

Update all dependencies to the latest versions on the npm registry.
This covers dev, prod, and peer dependencies and updates all apps/packages recursively.

Updating dependencies via pnpm instead

--recursive, -r

Concurrently runs update in all subdirectories with a package.json (excluding node_modules).

--latest, -L

Update the dependencies to their latest stable version as determined by their latest tags.

--workspace

Tries to link all packages from the workspace. Versions are updated to match the versions of packages inside the workspace.

--interactive, -i

Show outdated dependencies and select which ones to update


Recusively update all packages (does not pull latest major releases):

pnpm up -r --workspace

Recusively show latest dependencies and select which ones to update:

pnpm up -r -L -i

pnpm Filtering

Filtering allows you to restrict commands to specific subsets of packages.

Selectors may be specified via the --filter (or -F) flag:

pnpm --filter <app/package_selector> <command>

App Selectors:

  • app
  • docs
  • smashers
  • web

Package Selectors:

  • eslint-config
  • imx-passport
  • playfab
  • prettier-config
  • theme
  • typescript-config
  • ui

CI Tests

We have several GitHub Actions workflows pre-configured to run tests such as linting, formatting, and type checking on pull requests to main or staging. All tests must pass before a pull request can be merged.

If you want to run the CI tests locally, you can use act to run the workflows.

On MacOS, you can install act using Homebrew:

brew install act

On Windows, you can install act using Chocolatey:

choco install act

After you have act installed, you can run the following command to run the all CI tests locally via Docker:

pnpm act-ci

Note: GitHub automatically provides a GITHUB_TOKEN secret when running workflows inside GitHub. With act, you need to mannually provide yours each run. The above command will automatically prompt you to input your GitHub personal access token!

Remote Caching

Turborepo can use a technique known as Remote Caching to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.

By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can create one, then enter the following commands:

npx turbo login

This will authenticate the Turborepo CLI with your Vercel account.

Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:

npx turbo link

Useful Links

Learn more about the power of Turborepo:

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

Support

Email andy@niftyleague.com

OR

Join the Nifty League Discord Server and message an admin

About

Monorepo for Nifty League frontend applications

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages