Skip to content

Commit

Permalink
🎉 Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
OfficialCRUGG committed Sep 30, 2022
1 parent 24d1cc4 commit 0e1138b
Show file tree
Hide file tree
Showing 14 changed files with 3,042 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .editorconfig
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
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
6 changes: 6 additions & 0 deletions .eslintrc
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"]
}
44 changes: 44 additions & 0 deletions .github/worksflows/linting.yml
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
41 changes: 41 additions & 0 deletions .github/worksflows/tests.yml
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
*.log
.DS_Store
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tabWidth": 4,
"printWidth": 140,
"semi": true,
"singleQuote": false
}
72 changes: 71 additions & 1 deletion README.md
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).**
6 changes: 6 additions & 0 deletions jest.config.js
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",
};
33 changes: 33 additions & 0 deletions package.json
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"
}
}
7 changes: 7 additions & 0 deletions src/helloworld.ts
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";
}
}
11 changes: 11 additions & 0 deletions tests/helloworld.test.ts
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");
});
14 changes: 14 additions & 0 deletions tsconfig.json
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/**/*"]
}
Loading

0 comments on commit 0e1138b

Please sign in to comment.