Skip to content

Commit

Permalink
feat: setup project
Browse files Browse the repository at this point in the history
tak-bro committed Nov 13, 2023
0 parents commit d73e701
Showing 21 changed files with 3,891 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package.json
package-lock.json
pnpm-lock.yaml
dist
e2e/**
karma.conf.js
commitlint.config.js
13 changes: 13 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "unused-imports"],
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"globals": { "BigInt": true, "console": true, "WebAssembly": true },
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"curly": "error",
"unused-imports/no-unused-imports": "error",
"sort-imports": ["error", { "ignoreDeclarationSort": true, "ignoreCase": true }]
}
}
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'CI'
on:
pull_request:
branches:
- '**'
- '!main'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
with:
version: 6.0.2
- run: pnpm i

install:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 6.0.2
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: pnpm i
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release
on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions: {}

jobs:
release:
# IMPORTANT: prevent this action from running on forks
if: github.repository == 'tak-bro/ts-package-template'
permissions:
contents: write
pull-requests: write
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: pnpm/action-setup@v2
with:
version: 6.0.2
- run: pnpm i
- name: Publish to pnpm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
68 changes: 68 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# macOS
.DS_Store

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Dependency directories
/node_modules/

# Output of 'npm pack'
*.tgz

# dotenv environment variables file
.env
.env.test

# Distribution
dist

# Eslint cache
.eslintcache

# compiled output
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# profiling files
chrome-profiler-events*.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings

# System Files
Thumbs.db


4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*": "prettier --ignore-unknown --write",
"*.ts": "eslint --fix"
}
103 changes: 103 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz

pids
logs
results

# node js
node_modules
npm-debug.log

# IntelliJ resources
*.iml
*.ipr
*.iws
.idea

### Serverless ###
# Ignore build directory
.serverless

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### VisualStudioCode Patch ###
# Ignore all local history of files
.history

#mac
.DS_Store

# appveyor
.appveyor.yml

# babel
.babelrc
babel.config.js

# codecov
.codecov.yml

# docker
dbuild
dexec
docker-compose.yml
Dockerfile

# editorconfig
.editorconfig

# eslint
.eslintcache
.eslintignore
.eslintrc.js

# github
.github
.gitignore

# jest
.jest.init.js
coverage
jest.config.js
__mocks__
__snapshots__
__tests__
tests
*.test.js

# lintstaged
.lintstagedrc.json

# prettier
.prettierrc
.prettierignore
prettier.config.js

# travis
.travis.yml

# development
CODE_OF_CONDUCT.md
CONTRIBUTING.md
DEVELOPMENT.md
RELEASE.md
docs
example
scripts
src

.nvmrc
.editorconfig
tsconfig.json
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Add files here to ignore them from prettier formatting

/dist
/coverage
package.json
package-lock.json
pnpm-lock.yaml
dist
e2e/**
karma.conf.js
commitlint.config.js
19 changes: 19 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"printWidth": 120,
"tabWidth": 4,
"trailingComma": "es5",
"singleQuote": true,
"useTabs": false,
"semi": true,
"bracketSpacing": true,
"arrowParens": "avoid",
"overrides": [
{
"files": "*.html",
"options": {
"printWidth": 140,
"htmlWhitespaceSensitivity": "ignore"
}
}
]
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @lemoncloud/lemon-front-lib

## 1.3.12

### Patch Changes

- build: update project configuration
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 tak-bro

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.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<h1 align="center">ts-package-template</h1>

<p align="center">
<a aria-label="last commit" href="https://github.com/tak-bro/ts-package-template/commits/main">
<img alt="" src="https://img.shields.io/github/last-commit/tak-bro/ts-package-template.svg">
</a>
<a aria-label="license" href="https://github.com/tak-bro/ts-package-template/blob/main/LICENSE">
<img src="https://img.shields.io/github/license/tak-bro/ts-package-template.svg" alt="">
</a>
</p>

> Typescript Npm package template
## Prerequisite

- [Node.js](https://nodejs.org/)
- [pnpm](https://pnpm.io/)

## Usage

### Installation

```bash
$ git clone git@github.com:tak-bro/ts-package-template.git
$ cd ts-package-template
$ pnpm install && pnpm prepare
```

## Running the app

```bash
$ pnpm start
```

## Troubleshooting

Please follow this guidelines when reporting bugs and feature requests:

1. Use [GitHub Issues](https://github.com/tak-bro/ts-package-template/issues) board to report bugs and feature requests (not our email address)
2. Please **always** write steps to reproduce the error. That way we can focus on fixing the bug, not scratching our heads trying to reproduce it.

Thanks for understanding!

## Stay in touch

- [Author](https://env-tak.github.io/)

### License

The MIT License (see the [LICENSE](https://github.com/tak-bro/ts-package-template/blob/main/LICENSE) file for the full text)
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "ts-package-template",
"version": "0.0.0",
"description": "Typescript npm package template",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"type": "module",
"files": [
"dist"
],
"scripts": {
"prepare": "husky install",
"clean": "rm -rf dist",
"start": "tsc -w",
"build": "pnpm clean && tsup src/index.ts",
"release": "pnpm run build && changeset publish",
"fix:prettier": "prettier \"src/**/*.ts\" --write",
"fix:lint": "eslint src --ext .ts --fix",
"changeset": "npx changeset",
"changeset:version": "npx changeset version"
},
"keywords": [
"typescript",
"npm",
"template",
"package"
],
"author": "Hyungtak Jin",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"@changesets/cli": "^2.26.2",
"@types/node": "^20.9.0",
"@typescript-eslint/eslint-plugin": "^6.2.0",
"@typescript-eslint/parser": "^6.2.0",
"eslint": "^8.45.0",
"eslint-plugin-unused-imports": "^3.0.0",
"husky": "^8.0.0",
"lint-staged": "^13.2.3",
"prettier": "^3.0.0",
"tsup": "^7.1.0",
"typescript": "^5.1.6"
}
}
3,397 changes: 3,397 additions & 0 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @description create delay using async/await
* @param {number} duration (millisecond)
* @returns {Promise}
* @example
* await createAsyncDelay(2000) // wait 2 seconds
* */
export const createAsyncDelay = (duration: number) => {
return new Promise<void>(resolve => setTimeout(() => resolve(), duration));
};
16 changes: 16 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"baseUrl": "./",
"target": "es2015",
"module": "commonjs",
"types": ["node"],
"esModuleInterop": true,
"noImplicitAny": false,
"forceConsistentCasingInFileNames": true,
"strict": false,
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"strictPropertyInitialization": false
},
"include": ["src"]
}
13 changes: 13 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from 'tsup';

export default defineConfig({
dts: true,
minify: true,
sourcemap: true,
treeshake: true,
splitting: true,
clean: true,
outDir: 'dist',
entry: ['src/index.ts'],
format: ['esm', 'cjs'],
});

0 comments on commit d73e701

Please sign in to comment.