- npm account: Create one at https://www.npmjs.com if you don't have one
- npm login: Run
npm loginand enter your credentials
cd /Users/nyamathshaik/fast-json-patch
npm loginEnter your:
- Username
- Password
- One-time password (if 2FA is enabled)
npm run buildThis will:
- Clean the dist folders
- Compile TypeScript
- Generate CommonJS and ESM modules
- Run webpack
# Create a tarball
npm pack
# This creates @nyamathshaik-fast-json-patch-3.1.2-date-support.0.tgz
# Test in another project
cd /tmp
mkdir test-package
cd test-package
npm init -y
npm install /Users/nyamathshaik/fast-json-patch/@nyamathshaik-fast-json-patch-3.1.2-date-support.0.tgz
# Test it
node -e "const fjp = require('@nyamathshaik/fast-json-patch'); console.log(fjp)"cd /Users/nyamathshaik/fast-json-patch
# Dry run first (see what will be published)
npm publish --dry-run
# Actually publish
npm publish --access publicNote: The --access public flag is required for scoped packages (@nyamathshaik/*) to be publicly accessible.
# Check on npm
npm view @nyamathshaik/fast-json-patch
# Or visit
# https://www.npmjs.com/package/@nyamathshaik/fast-json-patchnpm notice
npm notice 📦 @nyamathshaik/fast-json-patch@3.1.2-date-support.0
npm notice === Tarball Contents ===
npm notice 1.1kB LICENSE.txt
npm notice 18.2kB README.md
npm notice 2.7kB package.json
npm notice 1.9kB index.d.ts
npm notice 407B index.js
npm notice 659B index.mjs
npm notice 611B index.ts
...
npm notice === Tarball Details ===
npm notice name: @nyamathshaik/fast-json-patch
npm notice version: 3.1.2-date-support.0
npm notice filename: @nyamathshaik/fast-json-patch-3.1.2-date-support.0.tgz
npm notice package size: XX.X kB
npm notice unpacked size: XXX.X kB
npm notice shasum: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
npm notice integrity: xxxxxxxxxxxxxxxxxxxxx[...]xxxxxxxxxxxxx
npm notice total files: XX
npm notice
npm notice Publishing to https://registry.npmjs.org/ with tag latest
+ @nyamathshaik/fast-json-patch@3.1.2-date-support.0
Cause: Not logged in or no permission Solution:
npm login
npm publish --access publicCause: npm thinks it's too similar to existing package Solution: The scoped package (@nyamathshaik/*) should avoid this
Cause: Version 3.1.2-date-support.0 already published Solution:
# Bump version
npm version 3.1.2-date-support.1
git push fork feature/date-object-support
npm publish --access publiccd /Users/nyamathshaik/uipath/API-Workflow/api-workflow-executor
# Update package.json
npm install @nyamathshaik/fast-json-patch@3.1.2-date-support.0
# Or manually edit package.json:
# "@nyamathshaik/fast-json-patch": "3.1.2-date-support.0"If you want to keep using fast-json-patch in your code:
{
"dependencies": {
"fast-json-patch": "npm:@nyamathshaik/fast-json-patch@3.1.2-date-support.0"
}
}This installs @nyamathshaik/fast-json-patch but allows you to require('fast-json-patch').
When PR #330 is merged:
cd /Users/nyamathshaik/uipath/API-Workflow/api-workflow-executor
# Uninstall fork
npm uninstall @nyamathshaik/fast-json-patch
# Install official version (assuming 3.2.0 includes Date support)
npm install fast-json-patch@^3.2.0
# No code changes needed!Once the official package merges Date support, deprecate your fork:
npm deprecate @nyamathshaik/fast-json-patch "This fork is no longer needed. Use official fast-json-patch@^3.2.0 instead"Ready to publish? Run the commands above!