-
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
1 parent
24d1cc4
commit 0e1138b
Showing
14 changed files
with
3,042 additions
and
1 deletion.
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,13 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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,2 @@ | ||
dist | ||
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,6 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint"], | ||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended"] | ||
} |
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,44 @@ | ||
name: Linting | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
linting: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node: [14] | ||
|
||
steps: | ||
- name: Checkout 🛎 | ||
uses: actions/checkout@master | ||
|
||
- name: Setup node env 🏗 | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ matrix.node }} | ||
check-latest: true | ||
|
||
- name: Get yarn cache directory path 🛠 | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- name: Cache node_modules 📦 | ||
uses: actions/[email protected] | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install dependencies 👨🏻💻 | ||
run: yarn | ||
|
||
- name: Run formatter 🎨 | ||
run: yarn format:ci | ||
|
||
- name: Run linter 👀 | ||
run: yarn lint:ci |
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,41 @@ | ||
name: Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
tests: | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node: [14] | ||
|
||
steps: | ||
- name: Checkout 🛎 | ||
uses: actions/checkout@master | ||
|
||
- name: Setup node env 🏗 | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ matrix.node }} | ||
check-latest: true | ||
|
||
- name: Get yarn cache directory path 🛠 | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
|
||
- name: Cache node_modules 📦 | ||
uses: actions/[email protected] | ||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
- name: Install dependencies 👨🏻💻 | ||
run: yarn | ||
|
||
- name: Run tests 🔌 | ||
run: yarn test |
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 @@ | ||
node_modules | ||
dist | ||
*.log | ||
.DS_Store |
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 @@ | ||
{ | ||
"tabWidth": 4, | ||
"printWidth": 140, | ||
"semi": true, | ||
"singleQuote": false | ||
} |
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 |
---|---|---|
@@ -1,2 +1,72 @@ | ||
# helloworld | ||
<div align="center"> | ||
|
||
# @blazingworks/helloworld | ||
|
||
![Lines of code](https://img.shields.io/tokei/lines/github/blazingworks/helloworld?style=for-the-badge) | ||
![npm Downloads](https://img.shields.io/npm/dy/@blazingworks/helloworld?style=for-the-badge) | ||
![GitHub issues](https://img.shields.io/github/issues/blazingworks/helloworld?style=for-the-badge) | ||
![GitHub pull requests](https://img.shields.io/github/issues-pr/blazingworks/helloworld?style=for-the-badge) | ||
![GitHub](https://img.shields.io/github/license/blazingworks/helloworld?style=for-the-badge) | ||
![GitHub Repo stars](https://img.shields.io/github/stars/blazingworks/helloworld?style=for-the-badge) | ||
![npm Version](https://img.shields.io/npm/v/@blazingworks/helloworld?style=for-the-badge) | ||
![GitHub contributors](https://img.shields.io/github/contributors/blazingworks/helloworld?style=for-the-badge) | ||
|
||
</div> | ||
|
||
🌍 Hello World NPM Library by BlazingWorks, acts as a boilerplate for future libraries | ||
|
||
## Tech Stack | ||
|
||
- [TypeScript](https://www.typescriptlang.org/) | ||
- [Jest](https://jestjs.io/) | ||
- [ESLint](https://eslint.org/) | ||
- [Prettier](https://prettier.io/) | ||
|
||
|
||
## Installation | ||
|
||
### NPM | ||
|
||
```bash | ||
npm install @blazingworks/helloworld | ||
``` | ||
|
||
### Yarn | ||
|
||
```bash | ||
yarn add @blazingworks/helloworld | ||
``` | ||
|
||
## Usage | ||
|
||
### TypeScript | ||
|
||
```typescript | ||
import { helloWorld } from '@blazingworks/helloworld'; | ||
|
||
console.log(helloWorld()); | ||
// or | ||
console.log(helloWorld("Nagi Aoe")); | ||
``` | ||
|
||
### JavaScript | ||
|
||
```javascript | ||
const { helloWorld } = require('@blazingworks/helloworld'); | ||
|
||
console.log(helloWorld()); | ||
// or | ||
console.log(helloWorld("Reiji Kurose")); | ||
``` | ||
|
||
## How to report issues/questions | ||
|
||
- For general issues/questions, [open an issue](https://github.com/blazingworks/helloworld/issues) | ||
- For security issues, please email [[email protected]](mailto:[email protected]) | ||
- For important questions, please email [[email protected]](mailto:[email protected]) | ||
|
||
## License | ||
|
||
As this is an open-source project, support is limited. Please use [GitHub Issues](https://github.com/blazingworks/helloworld/issues) for community support or contact [[email protected]](mailto:[email protected]) for very important matters. | ||
|
||
**ℹ️ All code in this repository is licensed under the [MIT License](LICENSE.md).** |
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 @@ | ||
/* eslint-disable no-undef */ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
}; |
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,33 @@ | ||
{ | ||
"name": "@blazingworks/helloworld", | ||
"version": "1.0.0", | ||
"description": "Hello World NPM Library by BlazingWorks, acts as a boilerplate for future libraries", | ||
"main": "dist/helloworld.js", | ||
"types": "dist/helloworld.d.ts", | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"repository": "https://github.com/blazingworks/helloworld.git", | ||
"author": "BlazingWorks", | ||
"license": "MIT", | ||
"private": false, | ||
"scripts": { | ||
"build": "rimraf dist && tsc", | ||
"prettier": "prettier --write \"src/**/*.ts\"", | ||
"lint": "eslint src/**/*.ts", | ||
"prettier:ci": "prettier --check \"src/**/*.ts\"", | ||
"lint:ci": "eslint src/**/*.ts --quiet", | ||
"test": "jest" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^29.1.1", | ||
"@typescript-eslint/eslint-plugin": "^5.38.1", | ||
"@typescript-eslint/parser": "^5.38.1", | ||
"eslint": "^8.24.0", | ||
"jest": "^29.1.2", | ||
"prettier": "^2.7.1", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^29.0.3", | ||
"typescript": "^4.8.4" | ||
} | ||
} |
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 @@ | ||
export function helloWorld(name?: string): string { | ||
if (name) { | ||
return `Hello ${name}`; | ||
} else { | ||
return "Hello World"; | ||
} | ||
} |
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,11 @@ | ||
import { helloWorld } from "../src/helloworld"; | ||
|
||
test(`No custom name`, () => { | ||
expect(helloWorld()).toBe("Hello World"); | ||
expect(helloWorld()).not.toBe("Hello undefined!"); | ||
}); | ||
|
||
test(`Custom name ("Nagi Aoe")`, () => { | ||
expect(helloWorld("Nagi Aoe")).toBe("Hello Nagi Aoe"); | ||
expect(helloWorld("Nagi Aoe")).not.toBe("Hello World"); | ||
}); |
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,14 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES2017", | ||
"module": "commonjs", | ||
"strict": true, | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true, | ||
"rootDir": "src", | ||
"outDir": "dist", | ||
"esModuleInterop": true, | ||
"declaration": true | ||
}, | ||
"exclude": ["tests/**/*"] | ||
} |
Oops, something went wrong.