This guide explains how to publish the Ethio-Intl SDK to npm for public consumption.
Before publishing, ensure you have:
- npm Account: Create one at npmjs.com
- GitHub Repository: Code should be in BeamSol/Ethio-Intl
- Build Verification: All tests pass and build succeeds
- Version Bumped: Update version in
package.jsonfor each release
- Run
npm test- All tests pass - Run
npm run build- Build succeeds without errors - Run
npm run type-check- TypeScript compilation succeeds - Update version in
package.json - Update
CHANGELOG.mdwith release notes - Verify all GitHub URLs are correct in
package.json - Test local installation:
npm pack && npm install -g ./ethio-intl-*.tgz
# Ensure you're on main branch and up to date
git checkout main
git pull origin main
# Run all checks
npm run type-check
npm test
npm run build
# Update version (patch, minor, or major)
npm version patch # 1.0.0 → 1.0.1
# npm version minor # 1.0.0 → 1.1.0
# npm version major # 1.0.0 → 2.0.0# Login to npm (if not already logged in)
npm login
# Dry run first (recommended)
npm publish --dry-run
# If dry run looks good, publish for real
npm publish
# Or publish with specific tag
npm publish --tag beta # for beta releases
npm publish --tag latest # for stable releases- Go to GitHub Releases
- Click "Create a new release"
- Use the version tag (e.g.,
v1.0.1) - Copy release notes from
CHANGELOG.md - Publish the release
# Push the version bump commit
git push origin main --tags
# Update GitHub Pages (if using)
npm run docs:deploy # if you have this script{
"name": "ethio-intl",
"version": "1.0.0",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js"
}
},
"files": ["dist", "README.md", "LICENSE"],
"repository": {
"type": "git",
"url": "https://github.com/BeamSol/Ethio-Intl.git"
}
}dist/
├── index.js # CommonJS build
├── index.mjs # ES modules build
├── index.d.ts # TypeScript definitions
└── types/ # Additional type definitions
# Create a test directory
mkdir test-ethio-intl
cd test-ethio-intl
# Install from local build
npm install ../path/to/ethio-intl/ethio-intl-1.0.0.tgz
# Create test file
echo "import { toEthDate, toEthNumber } from 'ethio-intl';
console.log('Ethiopian date:', toEthDate(new Date()));
console.log('Geez number:', toEthNumber(2025));" > test.js
# Run test
node test.js# Install from npm
npm install ethio-intl
# Test the installation
node -e "import { toEthDate } from 'ethio-intl'; console.log(toEthDate(new Date()));"- Patch (
1.0.0→1.0.1): Bug fixes, no breaking changes - Minor (
1.0.0→1.1.0): New features, backward compatible - Major (
1.0.0→2.0.0): Breaking changes
# Beta release
npm version prerelease --preid=beta
# Result: 1.0.1-beta.0
# Release candidate
npm version prerelease --preid=rc
# Result: 1.0.1-rc.0-
"You cannot publish over the previously published versions"
- Solution: Bump version number in
package.json
- Solution: Bump version number in
-
"Cannot read property 'length' of undefined"
- Solution: Ensure all required fields are present in
package.json
- Solution: Ensure all required fields are present in
-
"no such file or directory"
- Solution: Run
npm run buildbefore publishing
- Solution: Run
-
Permission denied
- Solution: Use
npm loginor check npm token permissions
- Solution: Use
# Clean and rebuild
npm run clean
npm install
npm run build
npm test- Package appears on npmjs.com/package/ethio-intl
- GitHub release created with proper tags
- Documentation updated with new version
- Demo site updated (if applicable)
- Social media announcement posted
- Changelog updated
- npm: Main distribution channel
- GitHub: Source code and issues
- Demo Site: Live examples
- Social Media: Twitter, LinkedIn, Instagram
- Dev Communities: Reddit (r/javascript, r/reactjs, r/Ethiopian)
- Blogs: Tech blogs and Ethiopian developer blogs
For publishing issues:
- Check npm logs:
npm publish --verbose - Verify package.json:
npm pack && tar -tf ethio-intl-*.tgz - Test locally first:
npm install ./ethio-intl-*.tgz
# One-liner for patch releases
npm version patch && npm run build && npm test && npm publishRemember: Always test locally before publishing to npm!