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: 3 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 (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-28T20:55:19.000Z (4 months ago)
- Last Synced: 2024-08-08T01:19:12.055Z (3 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/jspac
- Size: 142 KB
- Stars: 24
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# npmize
This package tries to help you to make npm package without thinking about cjs and mjs module.
## Features
- Zero Config.
- Very very simple.
- Very very lightweight.
- This supports `typescript`.
- Enables `__dirname` and `__filename` for `mjs`(EsModule).---
## Installation
- with npm (globally)
```shell
npm i -g npmize
```- with npm
```shell
npm i -D npmize
```- with yarn
```shell
yarn add -D npmize
```- with pnpm
```shell
pnpm add -D npmize
```
---
# Command Line Interface
The interface for command-line usage is fairly simplistic at this stage, as seen in the following usage section.
## Usage
```shell
npmize [options]
```### Example:
```shell
npmize dev
```_This starts typescript watch mode._
---
## Commands
| Command | Description |
| ------- | ----------------------------- |
| init | Initilize `package.json` |
| dev | Start `typescript` watch mode |
| build | Build for prod |
## Command Options
| Option | Description |
| ------------ | --------------------------------------------------------------- |
| --no-install | Not to install required dependencies automatically |
| --no-ignore | Not to add recommended ignore files to .gitignore \| .npmignore |
| --no-src | Not to create src/index.ts folder when not exists |### Command: `init`
| Option | Description |
| -------- | --------------------- |
| --bin | Also add `bin` field |
| --legacy | Uses `.js` for fields |### Command: `dev` & `build`
You can use almost any typescript cli command here by using `--tsc`.
eg: `--tsc--jsx=react` --> `--jsx react`Not allowed list: `--project` `--outDir` `--module` `--watch` and their aliases
| Option | Description |
| ------------ | --------------------------------------- |
| --module=cjs | This starts dev mode of commonjs module |
| --module=mjs | This starts dev mode of esmodule module |
### Command: `build`
| Option | Description |
| -------- | ----------------------------------------------------- |
| --node | This enables `__dirname` and `__filename` in esmodule |
| --legacy | Uses `.js` files and creates package.json with type |
---
## **Note:**
- You should use --module=cjs with dev mode when working with packages for node because `__dirname` and `__filename` isn't supported in esmodule in dev mode
- Do not use `VGhpcyBuYW1lIGlzIGFscmVhZHkgdXNlZCB0byBlbmFibGUgX19kaXJuYW1lIGFuZCBfX2ZpbGVuYW1lIDop` as a variable name in your top level code.- If you want to know why! [`Base64`](https://www.base64decode.org) ... Hope you know.
- If you don't star our github repo your wife will divorce you, Else if you don't have wife then you will never get her.
---
Made by [Nazmus Sayad](https://github.com/NazmusSayad) with ❤️.