-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1c7415c
Showing
26 changed files
with
6,018 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.cjs | ||
*.js | ||
dist/ | ||
demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
module.exports = { | ||
extends: ['airbnb', 'airbnb-typescript'], | ||
ignorePatterns: [ | ||
"**/generated/**", | ||
], | ||
rules: { | ||
"max-len": ["error", { | ||
code: 140, | ||
tabWidth: 2, | ||
// ignoreComments: true, | ||
ignoreTrailingComments: true, | ||
// ignoreStrings: true, | ||
ignoreTemplateLiterals: true, | ||
ignoreRegExpLiterals: true, | ||
}], | ||
"react/react-in-jsx-scope": "off", | ||
"import/prefer-default-export": "off", | ||
"@typescript-eslint/no-use-before-define": "off", | ||
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], | ||
"react/jsx-props-no-spreading": "off", | ||
"react/prop-types": "off", | ||
"jsx-a11y/click-events-have-key-events": "off", | ||
"jsx-a11y/no-static-element-interactions": "off", | ||
"jsx-a11y/label-has-associated-control": "off", | ||
"no-console": ["error", { allow: ["warn", "error", "info"] }], | ||
"no-plusplus": "off", | ||
"arrow-body-style": "off", | ||
"react/no-array-index-key": "off", | ||
"react/button-has-type": "off", | ||
"max-classes-per-file": "off", | ||
"global-require": "off", | ||
"jsx-a11y/anchor-is-valid": "off", | ||
"no-await-in-loop": "off", | ||
"no-restricted-syntax": "off", | ||
"import/no-cycle": "off", | ||
"class-methods-use-this": "off", | ||
"linebreak-style": "off", | ||
"quote-props": "off", | ||
"no-lonely-if": "off", | ||
"object-curly-newline": "warn", | ||
"import/order": [ | ||
"error", | ||
{ | ||
"groups": ["builtin", "external", "internal"], | ||
"pathGroups": [ | ||
{ | ||
"pattern": "@(react|react-native)", | ||
"group": "external", | ||
"position": "before" | ||
} | ||
], | ||
"pathGroupsExcludedImportTypes": ["react"], | ||
"newlines-between": "always", | ||
"alphabetize": { | ||
"order": "asc", | ||
"caseInsensitive": true | ||
} | ||
} | ||
], | ||
}, | ||
parserOptions: { | ||
project: './tsconfig.json', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
node_modules/ | ||
/build/ | ||
/lib/ | ||
/docs/ | ||
.idea/* | ||
|
||
.DS_Store | ||
coverage | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/.github/ | ||
/.vscode/ | ||
/node_modules/ | ||
/build/ | ||
/tmp/ | ||
.idea/* | ||
/docs/ | ||
|
||
coverage | ||
*.log | ||
.gitlab-ci.yml | ||
|
||
package-lock.json | ||
/*.tgz | ||
/tmp* | ||
/mnt/ | ||
/package/ | ||
/demos/ | ||
/demo/ | ||
/src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Chris Hager | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Monoid TypeScript NPM Boilerplate | ||
|
||
A TypeScript NPM boilerplate that suits how we usually write TypeScript. | ||
|
||
## Features | ||
|
||
1. Outputs modern style typescript package in `dist/{cjs,esm,types}/` using `tsc` and `esbuild`. | ||
|
||
1. Respects modern package.json | ||
1. `type` set to `"module"` | ||
1. `main` pointed to `./dist/cjs/index.cjs` for legacy NodeJS in commonjs format. | ||
1. `module` pointed to `./dist/esm/index.mjs` for bundlers in esmodule format. | ||
1. `types` for typescript declarations. | ||
1. `exports` following [Conditional Exports](https://nodejs.org/api/packages.html#conditional-exports) for newer NodeJS to find esmodule format when using `import` and commonjs format when using `require`. | ||
|
||
1. Test or demonstrate your package under `demo/{node,browser}/`. | ||
|
||
1. Only files under `dist/` will be published to npm. | ||
|
||
1. `dist/` will NOT be gitignored by default. | ||
|
||
1. `.eslintrc.js` based on [airbnb](https://www.npmjs.com/package/eslint-config-airbnb-typescript). | ||
|
||
1. [esmo](https://github.com/antfu/esno) installed to load typescript for node. | ||
|
||
## Commands | ||
|
||
```bash | ||
yarn build | ||
``` | ||
|
||
Build the output directory. | ||
|
||
```bash | ||
yarn lint | ||
``` | ||
|
||
Lint the project. | ||
|
||
```bash | ||
yarn cli | ||
``` | ||
|
||
Execute the cli with node. | ||
|
||
```bash | ||
yarn ts <file-name> | ||
``` | ||
|
||
Execute arbitrary typescript file with [esmo](https://github.com/antfu/esno). | ||
|
||
## Customization | ||
|
||
1. Find `stripe-currency-format`, replace that with your package name. | ||
|
||
2. Find `your-cli-name`, replace that with your cli name. | ||
|
||
## Usage | ||
|
||
1. Degit this repository | ||
|
||
``` | ||
npx degit https://github.com/MonoidDev/stripe-currency-format | ||
``` | ||
|
||
2. Use this template | ||
|
||
Click the green button `Use this template` on the top-right side of this GitHub repository (https://github.com/MonoidDev/stripe-currency-format). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<html> | ||
<head> | ||
<title> | ||
Test | ||
</title> | ||
</head> | ||
<body> | ||
<script type="module" src="./test.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { hello } from '../../dist/esm/index.mjs'; | ||
|
||
console.log(hello); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"scripts": { | ||
"postinstall": "ln -sf ../../../../dist/cjs/cli.cjs node_modules/.bin/your-cli-name", | ||
"ts": "esno" | ||
}, | ||
"dependencies": { | ||
"stripe-currency-format": "link:../../" | ||
}, | ||
"devDependencies": { | ||
"esno": "^0.14.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { stripeCurrencyFormat } from 'stripe-currency-format'; | ||
|
||
console.log(stripeCurrencyFormat(10000, 'USD')); | ||
|
||
console.log(stripeCurrencyFormat(10000, 'JPY')); | ||
|
||
console.log(stripeCurrencyFormat(114514, 'CNY')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"include": [ | ||
"**/*.ts" | ||
], | ||
"extends": "../../tsconfig.json" | ||
} |
Oops, something went wrong.