Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/NazmusSayad/npmize
Make npm packages easily.
https://github.com/NazmusSayad/npmize
Last synced: 2 months ago
JSON representation
Make npm packages easily.
- Host: GitHub
- URL: https://github.com/NazmusSayad/npmize
- Owner: NazmusSayad
- License: gpl-3.0
- Created: 2022-11-07T17:23:05.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-09-29T12:25:00.000Z (5 months ago)
- Last Synced: 2024-11-09T08:49:51.585Z (3 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/jspac
- Size: 186 KB
- Stars: 25
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# npmize
This package simplifies creating npm packages that work seamlessly across browsers and Node.js environments by handling CommonJS (CJS) and ES modules (ESM) for you.
# Features
- **TypeScript Support:** Compile TypeScript code with ease.
- **Zero Configuration:** Get started without any complex setup.
- **Universal Compatibility:** Works across browsers and Node.js.
- **ESM and CJS Compilation:** Compiles code to both CJS and ESM formats.
- **Simple and Lightweight:** Easy to use and maintains a small footprint.
- **Multiple Threads** Can utilize multiple threads for extremely large projects.
- **Path Conversion:** Converts TypeScript config paths to relative paths for compatibility.
- **ESM `__dirname` and `__filename` Support:** Enables these variables for ESM compatibility.# Installation
**Locally:**
```bash
npm install -D npmize
```**Yarn:**
```bash
yarn add -D npmize
```**pnpm:**
```bash
pnpm add -D npmize
```# Usage
```bash
npmize [options]
```**Example:**
1. Initialize a new project:
```bash
npmize init project-name
```2. Get help information:
```bash
npmize --help
npmize --help-usage
```
## TypeScript Path Handling:
If you use TypeScript paths, ensure `baseUrl` is set in your `tsconfig.json`. For files within a `src` directory, set `baseUrl` to `./src`.
```json
{
"compilerOptions": {
"baseUrl": "./src",
"outDir": "./dist",
"paths": { "@/*": ["./*"] }
},
"include": ["./src"]
}
```# Notes
- **Variable Naming:** Avoid using `VGhpcyBuYW1lIGlzIGFscmVhZHkgdXNlZCB0byBlbmFibGUgX19kaXJuYW1lIGFuZCBfX2ZpbGVuYW1lIDop` (encoded using Base64) as a top-level variable name.
Made with ❤️ by [Nazmus Sayad](https://github.com/NazmusSayad).