All Projects → NiGhTTraX → Ts Monorepo

NiGhTTraX / Ts Monorepo

Licence: mit
Template for setting up a TypeScript monorepo

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ts Monorepo

Alias Hq
The end-to-end solution for configuring, refactoring, maintaining and using path aliases
Stars: ✭ 77 (-83.22%)
Mutual labels:  webpack, rollup, vscode, webstorm, jest
Entria Fullstack
Monorepo Playground with GraphQL, React, React Native, Relay Modern, TypeScript and Jest
Stars: ✭ 434 (-5.45%)
Mutual labels:  lerna, babel, jest, monorepo
Lerna Yarn Workspaces Monorepo
🐉 A Monorepo with multiple packages and a shared build, test, and release process.
Stars: ✭ 201 (-56.21%)
Mutual labels:  lerna, babel, jest, monorepo
Public
Repository for wallaby.js questions and issues
Stars: ✭ 662 (+44.23%)
Mutual labels:  webpack, vscode, intellij, jest
Sketchmine
Tools to validate, generate and analyse sketch files from web pages
Stars: ✭ 114 (-75.16%)
Mutual labels:  rollup, lerna, jest, monorepo
Starter React Flux
Generate your React PWA project with TypeScript or JavaScript
Stars: ✭ 65 (-85.84%)
Mutual labels:  webpack, create-react-app, babel, jest
React
Extremely simple boilerplate, easiest you can find, for React application including all the necessary tools: Flow | React 16 | redux | babel 6 | webpack 3 | css-modules | jest | enzyme | express + optional: sass/scss
Stars: ✭ 244 (-46.84%)
Mutual labels:  webpack, babel, jest
cra-monorepo-demo
Monorepo example using create-react-app and common component library structure with yarn workspaces
Stars: ✭ 37 (-91.94%)
Mutual labels:  create-react-app, lerna, monorepo
medly-components
🧩 Medly components provides numerous themable react components, each with multiple varitaions of sizes, colors, position etc.
Stars: ✭ 66 (-85.62%)
Mutual labels:  babel, jest, lerna
React Modern Library Boilerplate
Boilerplate for publishing modern React modules with Rollup
Stars: ✭ 285 (-37.91%)
Mutual labels:  rollup, create-react-app, babel
Bolt
The Bolt Design System provides robust Twig and Web Component-powered UI components, reusable visual styles, and powerful tooling to help developers, designers, and content authors build, maintain, and scale best of class digital experiences.
Stars: ✭ 186 (-59.48%)
Mutual labels:  webpack, lerna, monorepo
monorepo-typescript-next-the-sane-way
A monorepo example using TypeScript and Next.js
Stars: ✭ 104 (-77.34%)
Mutual labels:  jest, nextjs, monorepo
Opensource
Delivering delightful digital solutions. Open Source packages with combined ~85M/month downloads, semantically versioned following @conventional-commits. Fully powered by Jest, @Babel TypeScript, @Airbnb @ESLint + @Prettier, @YarnPKG + @Lerna independent versioning, GH @Actions & automated dep updates with @RenovateBot.
Stars: ✭ 459 (+0%)
Mutual labels:  babel, jest, monorepo
Xdm
a modern MDX compiler. No runtime. With esbuild, Rollup, and webpack plugins
Stars: ✭ 206 (-55.12%)
Mutual labels:  webpack, rollup, babel
Front End Guide
📚 Study guide and introduction to the modern front end stack.
Stars: ✭ 14,073 (+2966.01%)
Mutual labels:  webpack, babel, jest
ng-mono-repo-starter
Angular Mono Repo Starter
Stars: ✭ 79 (-82.79%)
Mutual labels:  jest, lerna, monorepo
100 Days Of Code Frontend
Curriculum for learning front-end development during #100DaysOfCode.
Stars: ✭ 2,419 (+427.02%)
Mutual labels:  webpack, nextjs, jest
monoreact
📦 React workspaces implementation
Stars: ✭ 13 (-97.17%)
Mutual labels:  create-react-app, rollup, monorepo
Graphql Starter
💥 Monorepo template (seed project) pre-configured with GraphQL API, PostgreSQL, React, Relay, and Material UI.
Stars: ✭ 3,377 (+635.73%)
Mutual labels:  babel, vscode, monorepo
Electron React Boilerplate
A Foundation for Scalable Cross-Platform Apps
Stars: ✭ 18,727 (+3979.96%)
Mutual labels:  webpack, babel, jest

Template project for setting up a TypeScript monorepo

Build Status


Table of content

Features

The main focus of this repo is making the Go to definition feature in IDEs work without any surprises, meaning it will work after a fresh clone without needing to build the project.

find-usage

The secondary focus is to remove surprises when publishing packages. The repo is set up so that each package gets a clean build output without any artifacts from other packages.

build-output

Setup

This repo uses yarn workspaces and Lerna. I recommend yarn for monorepos due to its easier setup, but everything here works with npm and lerna bootstrap as well and you can check that out in the npm branch.

yarn install

Docs

See the following blog posts:

If you're looking for the project references solution checkout the project-references branch.

Examples

This repo contains full examples of integrating with other tools and frameworks that need to be made aware that they're working with a monorepo. You can find each example in the examples/ folder.

ts-node

Use tsconfig-paths to resolve the path aliases at runtime:

{
  "scripts": {
    "start": "ts-node -r tsconfig-paths/register src/index.ts"
  }
}

See the full example here.

Babel

Use babel-plugin-module-resolver to resolve the path aliases:

module.exports = {
  presets: [
    ["@babel/preset-env", { targets: { node: "current" } }],
    "@babel/preset-typescript",
  ],

  plugins: [
    [
      "module-resolver",
      {
        alias: {
          "^@nighttrax/(.+)": "../\\1/src",
        },
      },
    ],
  ],
};

See the full example here.

webpack

Use tsconfig-paths-webpack-plugin to resolve the path aliases:

const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");

module.exports = {
  resolve: {
    plugins: [new TsconfigPathsPlugin()]
  }
};

See the full example here.

jest

If you use Babel then see this example from the Babel section above.

If you use ts-jest then you can use its pathsToModuleNameMapper helper:

const { pathsToModuleNameMapper } = require("ts-jest/utils");
const { compilerOptions } = require("../../tsconfig.json");

module.exports = {
  preset: "ts-jest",

  moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
    // This has to match the baseUrl defined in tsconfig.json.
    prefix: "<rootDir>/../../",
  }),
};

See the full example here.

create-react-app

Use react-app-rewired to extend CRA's webpack config and apply the tsconfig-paths-webpack-plugin:

const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");

module.exports = (config) => {
  // Remove the ModuleScopePlugin which throws when we
  // try to import something outside of src/.
  config.resolve.plugins.pop();

  // Resolve the path aliases.
  config.resolve.plugins.push(new TsconfigPathsPlugin());

  // Let Babel compile outside of src/.
  const oneOfRule = config.module.rules.find((rule) => rule.oneOf);
    const tsRule = oneOfRule.oneOf.find((rule) =>
      rule.test.toString().includes("ts|tsx")
    );
  tsRule.include = undefined;
  tsRule.exclude = /node_modules/;

  return config;
};

See the full example here.

NextJS

Use next-transpile-modules to tell NextJS to compile your dependencies:

const path = require("path");

const withTM = require("next-transpile-modules")(
  // All of the packages will resolve to our monorepo so we can match that path.
  [path.resolve(__dirname, "..")]
);

module.exports = withTM();

See the full example here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].