0.2.1 • Published 3 years ago
npm-package-example-2 v0.2.1
npm-package-example
Um exemplo de como criar um bom pacote para o NPM.
Transform a string between camelCase, PascalCase, Capital Case, snake_case, kebab-case and CONSTANT_CASE.
Objetivos
- Permitir tree-shaking
- Usar TypeScript
- Usar o eslint e o prettier
- Testar o pacote usando o Jest
- Publicar no NPM
- Automatização
- Executar os testes em pull-requests
- Gerar uma release no github automaticamente com o changelog
- Publicar uma nova versão da documentação quando modificar a pasta "docs"
- Escrever um bom README
- Criar um site de documentação
Installation
npm install npm-package-example-2 --save
yarn add npm-package-example-2
Usage
import kebabCase from 'npm-package-example-2/kebabCase'
kebabCase('Hello world') // => hello-world
It's also possible to use this package directly in the browser without any build tools.
<script type="module">
import { constantCase } from 'https://unpkg.com/npm-package-example-2?module'
constantCase('hello-world') // => HELLO_WORLD
</script>
Core
camelCase('hello world') // => 'helloWorld'
pascalCase('hello world') // => 'HelloWorld'
kebabCase('hello world') // => 'hello-world'
snakeCase('hello world') // => 'hello_world'
dotCase('hello world') // => 'hello.world'
capitalCase('hello world') // => 'Hello World'
constantCase('hello world') // => 'HELLO_WORLD'
Documentation
See https://link-da-documentação.com
Development
Clone locally:
git clone https://github.com/iagobruno/npm-package-example
cd npm-package-example
yarn install
code .
Running Tests
To run tests, run the command below.
yarn run test --watch
Building
Create an optimized and minified version of the package in CJS, ESM and UMD ready to be distributed.
yarn run build
Release a new version
yarn run release
This script uses release-it to:
- Prevent new releases if any tests fail.
- Bump package.json version.
- Create git tag.
- Push to remote.
- Post new release in GitHub with changelog.
- Publish a new version in npm registry.
Contributing
Contributions are always welcome!
- ⭐ Star this project on GitHub.
- 🐞 Submit bugs and feature requests. (Please first search for existing and closed issues)
- ❔ Engage and help each other in the Discussions tab.
- 🔍 Review the source code changes.
- 👨💻 You can submit any ideas as pull requests.
License
MIT
0.2.1
3 years ago