Packship Installation Guide

This guide will walk you through installing Packship's dependencies and configuring Webpack.

1. Getting Started

Start by installing the Packship global command:

Packship Global Installation

For MacOS & Linux

sudo npm i -g packship@latest

For Windows

npm i -g packship@latest

Setting Up Your Package with Packship

packship init

Follow the prompts, and your package will be ready!

2. Dependency Installation

Initialize `node modules` and `package-lock.json`

Install the necessary dependencies to ensure your package runs smoothly.

npm install

If you encounter dependency resolution issues, similar to this:

Dependency Resolution Issues

Run the following command to install dependencies:

npm install --legacy-peer-deps

If you see an EACCES error, run the following command to fix permissions:

EACCES Issue
sudo chown -R $(whoami) "$(npm config get cache)"

Then, try installing the dependencies again:

npm install

If you encounter deprecated package warnings, you can safely ignore them or update the packages as needed.

Install the necessary dependencies to avoid redundancy and ensure proper package setup.

Main Dependencies

For TypeScript

npm install --save typescript @types/react @types/react-dom

For JavaScript

npm install react react-dom

Make sure TypeScript and React typings are installed for development purposes. Install these commands only once to avoid duplication.

Babel for React & TypeScript

Install Babel presets to compile TypeScript and JSX/React syntax:

For TypeScript

npm install --save-dev @babel/preset-typescript @babel/preset-react

For JavaScript

npm install --save-dev @babel/preset-react

Babel & Webpack Loaders

Install the necessary loaders for Babel and Webpack:

npm install --save-dev babel-loader webpack

These loaders ensure that Webpack and Babel can work together to transpile and bundle your code.

3. Publishing Your Npm Package

To publish your package, ensure the build is successful:

npm run build

For new packages

Once the build succeeds, publish your package:

packship publish

For existing packages

If you're updating an existing package, update the version and then publish:

npm version patch/minor/major      # Depending on your release
packship publish