This guide will walk you through installing Packship's dependencies and configuring Webpack.
Start by installing the Packship global command:
sudo npm i -g packship@latest
npm i -g packship@latest
packship init
Follow the prompts, and your package will be ready!
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
packship publish