Shared business logic package for Swipecast React Native and Web applications.
npm install @swipecast/shared
# or
yarn add @swipecast/sharedimport { StripeHelpers } from '@swipecast/shared';
const card = {
brand: 'American Express',
last4: '1234',
exp_month: 12,
exp_year: 2025,
};
const label = StripeHelpers.getCardBrandLabel(card); // "Amex"npm installnpm run buildThis will compile TypeScript to JavaScript in the dist directory.
The package is automatically published to npm when code is pushed to the main branch. The workflow will:
- Build the package
- Publish to npm using the
NPM_TOKENsecret
Setup:
-
Add your npm token as a GitHub secret named
NPM_TOKEN:- Go to your repository settings → Secrets and variables → Actions
- Add a new secret with your npm token (get it from npmjs.com → Access Tokens)
-
Update the version in
package.jsonbefore pushing:npm version patch # for bug fixes npm version minor # for new features npm version major # for breaking changes
-
Push to main:
git push origin main
Skip publishing: Add [skip publish] to your commit message to skip automatic publishing.
If you need to publish manually:
-
Make sure you're logged into npm:
npm login
-
Update the version in
package.json:npm version patch # for bug fixes npm version minor # for new features npm version major # for breaking changes
-
Publish:
npm publish
The prepublishOnly script will automatically build the package before publishing.
If you're using a private npm registry, update the publishConfig in package.json:
{
"publishConfig": {
"registry": "https://your-private-registry.com"
}
}shared/
├── src/
│ ├── stripe_helpers.ts # Stripe-related business logic
│ └── index.ts # Main entry point
├── dist/ # Compiled output (generated)
├── package.json
├── tsconfig.json
└── README.md
UNLICENSED