1.0.0-next.0 • Published 3 years ago

@evos-tech/propak v1.0.0-next.0

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

propak

  • A command line tool to ease development of NPM packages with client, server and shared packages.
  • Objective is to bootstrap TypeScript/NodeJS based projects for:
    • CommonJS (CJS) packages for NestJS
    • EcmaScript Module (ESM) packages for Angular (application & library)
    • Dual package format (CJS+ESM) for packages that will be used in both server side & client side
  • Highly opinionated:
    • Uses NPM 7 workspaces to support multi-package projects
    • Predefined TypeScript, linting (ESLint), testing (Jest) configurations
    • Predefined tasks to clean, build, test, lint.
    • Development mode to watch for changes and recompile based on type of package
    • Bump source code versions, including support for Angular projects
    • Publish to NPM registry
  • Current status lacks documentation so is meant for internal use only

Getting Started

Generate default packages for the project:

# --- create NPM project
mkdir my-project
cd my-project
npm init -f

# --- add propak as a dependency
npm add -D @evos-tech/propak

# --- generate default projects
propak generate

# --- install dependencies for generated projects
npm install

# --- build and start packages
propak build
propak start

# Angular app
http://localhost:4200

# NestJS app
http://localhost:3000

The steps above will:

  • Generate a new project with default packages.
    • api as a package that can be used by NestJS and Angular
    • server-lib as a CommonJS package that can be used as a NestJS dependency
    • server as a NestJS application server
    • client-lib as an Angular library
    • client as an Angular application
  • Build and start the packages for development.
    • api will watch for changes and recompile via tsc
    • server-lib will watch for changes and recompile via tsc
    • server will start server and watch for changes and recompile via nest start --watch
    • client-lib will watch for changes and recompile via ng build --watch
    • client will start Angular application and watch for changes via ng serve

Configuration

Describe config.ts

Publishing Packages and Managing Versions

# set version for packages to the initial prerelease version  
propak version --newVersion=v1.0.0-next.0

# ...develop your app...
# ...develop your app...
# ...develop your app...

# publish packages to NPM registry
propak publishNpm

# set version for packages to the next prerelease version  
propak version --newVersion=true

# repeat from ...develop your app...

Pre-requisites

  • NPM 7
  • PM2