Skip to content

himajin-dev/sample-monorepo-npm-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sample-monorepo-npm-package

This is a sample npm packages in monorepo hosted at GitHub Packages.

Use Lerna to run commands and publish packages.

Features

  • Use Yarn Workspaces to install development packages.
  • Use Lerna to build and publish packages.
  • Import without including dist in the path. Copy package.json to dist directory when publish packages.
  • Use tsc-alias to replace alias paths with relative paths.

Use in project

Sample project is here.

Create .npmrc:

@himajin-dev:registry=https://npm.pkg.github.com

Install npm packages:

npm install @himajin-dev/sample-monorepo-npm-package-foo
npm install @himajin-dev/sample-monorepo-npm-package-bar
npm install @himajin-dev/sample-monorepo-npm-package-baz

Import packages:

import { bar } from "@himajin-dev/sample-monorepo-npm-package-baz/foo/bar";

bar("hello")

Development

Setup

Install dependencies:

yarn install

Build

Transpile to JavaScript:

yarn build

Publish

Publish to GitHub Packages:

Note that this is not yarn publish command.

yarn run publish

If you are not logged in, log in to GitHub Packages:

npm login --registry=https://npm.pkg.github.com

About

Sample npm packages in monorepo hosted at GitHub Packages.

Resources

License

Stars

Watchers

Forks

Packages