Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# FUNDING.yml

github: abhishek-nexgen-dev
buymeacoffee: abhishek96z
open_collective: NexGenStudioDev
17 changes: 5 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,22 @@ on:
branches:
- master
tags:
- 'v*' # Optional: run on version tags like v1.0.0
- 'v*' # optional: publish on version tags like v1.0.0

jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js 18
- name: Setup Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org/'
registry-url: https://registry.npmjs.org/

- name: Setup pnpm
uses: pnpm/action-setup@v2
Expand All @@ -37,16 +36,10 @@ jobs:
# - name: Run tests (optional)
# run: pnpm test

- name: Authenticate with npm
- name: Authenticate to npm
run: npm config set //registry.npmjs.org/:_authToken=${NPM_TOKEN}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# Optional: Authenticate with GitHub Packages
# - name: Authenticate with GitHub Packages
# run: npm config set //npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to npm
run: pnpm publish --access public
run: pnpm publish --access public --no-git-checks
5 changes: 1 addition & 4 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ tsconfig*.json
jest.config.*
*.test.*
*.spec.*
__tests__/
test/
tests/


# Documentation (except README)
docs/
Expand All @@ -22,7 +20,6 @@ CHANGELOG.md
# Git files
.git/
.gitignore
.env
Environment/

# CI/CD
Expand Down
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
registry=https://registry.npmjs.org/
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
save-prefix=^
18 changes: 18 additions & 0 deletions .pnpmfile.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// pnpmfile.mjs
export const hooks = {
updateConfig(config) {
return {
...config,
shamefullyHoist: false,
strictPeerDependencies: false,
autoInstallPeers: true,
saveExact: false,
savePrefix: '^',
nodeLinker: 'isolated',
preferWorkspacePackages: true,
sharedWorkspaceLockfile: true,
publishBranch: 'master',
gitChecks: true,
}
},
}
24 changes: 0 additions & 24 deletions .pnpmrc

This file was deleted.

212 changes: 98 additions & 114 deletions PACKAGE_MANAGERS.md
Original file line number Diff line number Diff line change
@@ -1,166 +1,150 @@
# FastKit - Package Manager Usage Guide

This document explains how to use FastKit with both npm and pnpm package managers.
**FastKit** is a development toolkit that supports both `npm` and `pnpm` for installation, development, and publishing workflows.

## Installation
📦 Available on npm:
[@nexgenstudiodev/fastkit](https://www.npmjs.com/package/@nexgenstudiodev/fastkit)

---

## 📥 Installation

### Using npm
```bash
npm install @abhishek-nexgen-dev/fastkit
npm install @nexgenstudiodev/fastkit
```

### Using pnpm
```bash
pnpm add @abhishek-nexgen-dev/fastkit
```

### Using yarn
### Using npm

```bash
yarn add @abhishek-nexgen-dev/fastkit
pnpm add @nexgenstudiodev/fastkit
```

## Development Scripts
### Using yarn

### For npm users
```bash
# Install dependencies
npm install

# Build the project
npm run build

# Clean build artifacts
npm run clean

# Rebuild (clean + build)
npm run rebuild

# Start development server
npm run start:dev
yarn add @nexgenstudiodev/fastkit
```

# Format code
npm run format

# Lint code
npm run lint
# 🔧 Development Scripts

# Fix linting issues
npm run lint:fix
The following scripts are available via `npm run <script>` or `pnpm run <script>`:

# Publish to npm
npm run publish:npm
| Script | Description |
|-----------------|--------------------------------------------------------|
| `build` | Compile TypeScript to JavaScript using `tsc` |
| `clean` | Delete the `dist` directory using `rimraf` |
| `rebuild` | Clean and then build (npm version) |
| `rebuild:pnpm` | Clean and then build (pnpm version) |
| `lint` | Run ESLint on all `.ts` and `.tsx` files in `src/` |
| `lint:fix` | Automatically fix linting issues |
| `test` | Run tests with Jest |
| `test:watch` | Watch files and re-run tests on change |
| `test:coverage` | Run tests and generate coverage report |
| `start:dev` | Start development mode using `ts-node-dev` |
| `format` | Format all supported files in `src/` using Prettier |
| `prepublishOnly`| Format, lint, and build before publishing (npm lifecycle hook) |
| `publish:npm` | Publish the package to npm (with public access) |
| `publish:pnpm` | Publish the package using pnpm (skip git checks) |
| `version:patch` | Bump patch version using npm |
| `version:minor` | Bump minor version using npm |
| `version:major` | Bump major version using npm |

# Version bumping
npm run version:patch
npm run version:minor
npm run version:major
```
---

### For pnpm users
```bash
# Install dependencies
pnpm install
# 🚀 Publishing Workflow

# Build the project
pnpm run build
### Using npm
1. Make your changes
2. Run tests: `npm test`
3. Build the project: `npm run build`
4. Bump version:
- `npm run version:patch` (or use `version:minor` / `version:major`)
5. Publish: `npm run publish:npm`

# Clean build artifacts
pnpm run clean
### Using pnpm
1. Make your changes
2. Run tests: `pnpm test`
3. Build the project: `pnpm run build`
4. Bump version:
- `npm run version:patch` (or use `version:minor` / `version:major`)
5. Publish: `pnpm run publish:pnpm`

# Rebuild (clean + build) - pnpm optimized
pnpm run rebuild:pnpm
---

# Start development server
pnpm run start:dev
# ⚙️ Configuration Files

# Format code
pnpm run format
| File | Description |
|------------------|---------------------------------|
| `package.json` | Project configuration (shared) |
| `.pnpmrc` | pnpm-specific config |
| `.npmignore` | Exclude files from npm package |
| `pnpm-lock.yaml` | pnpm lockfile (auto-generated) |
| `package-lock.json` | npm lockfile (auto-generated) |

# Lint code
pnpm run lint
---

# Fix linting issues
pnpm run lint:fix
# ✅ Best Practices

# Publish to npm
pnpm run publish:pnpm
- Use a single package manager throughout your project
- Commit lockfiles to ensure consistent builds
- Use correct CLI scripts based on your manager
- Use npm for version management
- Use either npm or pnpm to publish, **not both**

# Version bumping (still uses npm for version management)
npm run version:patch
npm run version:minor
npm run version:major
```
---

## Publishing Workflow
# 📊 Package Manager Comparison

### Using npm
1. Make your changes
2. Run tests: `npm test`
3. Build: `npm run build`
4. Bump version: `npm run version:patch` (or minor/major)
5. Publish: `npm run publish:npm`
| Feature | npm | pnpm |
|-----------------|------------|--------------|
| Speed | Moderate | Fast |
| Disk Usage | High | Low |
| Node Modules | Full copy | Symlinked |
| Lockfile | package-lock.json | pnpm-lock.yaml |
| Workspace Support | ✅ | ✅ |
| Compatibility | Universal | Growing |

### Using pnpm
1. Make your changes
2. Run tests: `pnpm test`
3. Build: `pnpm run build`
4. Bump version: `npm run version:patch` (or minor/major)
5. Publish: `pnpm run publish:pnpm`

## Configuration Files
# 🛠️ Troubleshooting

- **package.json**: Main package configuration (works with both)
- **.pnpmrc**: pnpm-specific configuration
- **.npmignore**: Files to exclude from npm package
- **pnpm-lock.yaml**: pnpm lockfile (auto-generated)
- **package-lock.json**: npm lockfile (auto-generated)
## Common Issues

## Best Practices
### Mixed lockfiles
Delete both `pnpm-lock.yaml` and `package-lock.json`, then reinstall dependencies.

1. **Choose one package manager** for your project and stick with it
2. **Commit lockfiles** to ensure reproducible builds
3. **Use the correct scripts** for your chosen package manager
4. **Version management** should use npm commands regardless of package manager
5. **Publishing** can use either npm or pnpm commands
### Permission errors
Use `npm login` or configure your npm registry properly.

## Package Manager Comparison
### Version conflicts
Bump the version before attempting to publish.

| Feature | npm | pnpm |
|---------|-----|------|
| Speed | Moderate | Fast |
| Disk Usage | High | Low (symlinks) |
| Node Modules | Full copy | Symlinked |
| Lockfile | package-lock.json | pnpm-lock.yaml |
| Workspace Support | ✅ | ✅ |
| Compatibility | Universal | Growing |
### Build errors
Try:
- Checking for syntax errors or missing dependencies
- Deleting `node_modules` and reinstalling packages
- Ensuring your TypeScript configuration is correct
- Running `npm run clean` before building again

## Troubleshooting

### Common Issues
```bash
npm run clean
npm run build
```

1. **Mixed lockfiles**: Delete both lockfiles and reinstall with your chosen package manager
2. **Permission errors**: Use `npm login` or configure registry authentication
3. **Version conflicts**: Ensure version is bumped before publishing
4. **Build errors**: Run `npm run clean` then `npm run build`

### Environment Setup


```bash
# Check versions
node --version
npm --version
pnpm --version

# Configure npm registry (if needed)
# Configure registries
npm config set registry https://registry.npmjs.org/

# Configure pnpm registry (if needed)
pnpm config set registry https://registry.npmjs.org/
```

## Links

- [npm Documentation](https://docs.npmjs.com/)
- [pnpm Documentation](https://pnpm.io/)
- [Package on npm](https://www.npmjs.com/package/@abhishek-nexgen-dev/fastkit)
- [GitHub Repository](https://github.com/NexGenStudioDev/FastKit)
```
Loading