Packship is a CLI tool designed to simplify the process of initializing new npm packages. It automates the creation of package directories, configuration files, and more, helping you set up packages faster and with less hassle.
This guide will walk you through installing Packship's dependencies and configuring Webpack.
sudo npm i -g packship@latest
npm i -g packship@latest
packship init
Follow the prompts, and your package will be ready!
Note: For the best experience, we recommend initializing your packages with
packship init
. While you can usepackship publish
with any npm package, packages initialized with Packship will have access to optimized workflows and features.
Install the necessary dependencies to ensure your package runs smoothly.
npm install
If you encounter dependency resolution issues, similar to this:
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:
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.
npm install --save typescript @types/react @types/react-dom
npm install react react-dom
Make sure TypeScript and React typings are installed for development purposes. Install these commands only once to avoid duplication.
Install Babel presets to compile TypeScript and JSX/React syntax:
npm install --save-dev @babel/preset-typescript @babel/preset-react
npm install --save-dev @babel/preset-react
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.
To publish your package, ensure the build is successful:
npm run build
Once the build succeeds, publish your package:
packship publish
If you're updating an existing package, update the version and then publish:
npm version patch/minor/major # Depending on your release
Then:
packship publish
If you encounter any issues with the Packship tool itself, you can report them directly from the terminal:
packship report
This command is specifically for reporting issues with the Packship CLI tool, not for issues with your npm package. For security and clarity, this command can only be run:
- Outside of any package directory, or
- Inside a package that was initialized with Packship
If you try to run this command in a package that wasn't initialized with Packship, you'll see an error message and the command will exit.
When you run this command in a valid context, you'll be given two options:
- Automatic Submission - Submit the issue directly to GitHub from the terminal (requires a GitHub token)
- Manual Submission - Get formatted issue content to copy and paste into GitHub's issue form
If you choose automatic submission and don't have a GitHub token set up, you'll be prompted to enter one. You can also set a GitHub token as an environment variable beforehand:
export GITHUB_TOKEN=your_github_token
The tool will guide you through collecting all necessary information about the issue, including optional system information to help with troubleshooting.
PackShip collects anonymous usage data to help improve the tool. This data includes command usage (such as how many times init
and publish
commands are run) and error rates, but never includes personal information or code.
You can manage telemetry settings with the following PackShip commands:
# Check current telemetry status
packship telemetry status
# Enable telemetry
packship telemetry enable
# Disable telemetry
packship telemetry disable
Telemetry is opt-in and can be disabled at any time.
We welcome contributions to PackShip! Please see CONTRIBUTING.md for details on how to contribute.
This project is licensed under the MIT License. See the LICENSE.md file for details.