Skip to content

Commit c7443b3

Browse files
committed
Add typescript support
1 parent 36e80dc commit c7443b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4843
-9387
lines changed

.babelrc

-3
This file was deleted.

.editorconfig

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.php]
12+
indent_style = tab
13+
indent_size = 4
14+
15+
[*.py]
16+
charset = utf-8
17+
indent_style = space
18+
indent_size = 4
19+
end_of_line = lf
20+
insert_final_newline = true
21+
trim_trailing_whitespace = true
22+
23+
[Makefile]
24+
indent_style = tab
25+
indent_size = 4
26+
27+
[*.sln]
28+
indent_style = tab
29+
30+
[*.{md,mdx}]
31+
trim_trailing_whitespace = false

.eslintignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.config.js
2+
*.config.ts
3+
*.test.js
4+
*.test.ts
5+
dist

.eslintrc.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
extends: ['plugin:@typescript-eslint/recommended', 'prettier'],
4+
parserOptions: {
5+
sourceType: 'module',
6+
},
7+
rules: {
8+
'prettier/prettier': 'error',
9+
},
10+
plugins: ['@typescript-eslint', 'prettier'],
11+
}

.github/workflows/publish.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release & Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
- name: Create Release
15+
id: create_release
16+
uses: actions/create-release@v1
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
with:
20+
tag_name: ${{ github.ref }}
21+
release_name: ${{ github.ref }}
22+
draft: false
23+
prerelease: false
24+
25+
publish:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: Setup .npmrc file to publish to npm
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: '14.x'
33+
registry-url: 'https://registry.npmjs.org'
34+
- name: Install modules
35+
run: npm install
36+
- name: Build
37+
run: npm run build
38+
- name: Publish to npm
39+
run: npm publish --access public
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
- name: Setup .npmrc file to publish to GitHub Packages
43+
uses: actions/setup-node@v1
44+
with:
45+
node-version: '14.x'
46+
registry-url: 'https://npm.pkg.github.com'
47+
scope: '@egoistdeveloper'
48+
- run: npm run addscope
49+
- name: Publish to GitHub Packages
50+
run: npm publish
51+
env:
52+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'docs/**'
7+
- 'README.md'
8+
- 'LICENSE'
9+
- '.editorconfig'
10+
branches:
11+
- main
12+
- master
13+
pull_request:
14+
paths-ignore:
15+
- 'docs/**'
16+
- 'README.md'
17+
- 'LICENSE'
18+
- '.editorconfig'
19+
branches:
20+
- main
21+
- master
22+
23+
jobs:
24+
test:
25+
runs-on: ${{ matrix.os }}
26+
strategy:
27+
matrix:
28+
os:
29+
- ubuntu-latest
30+
- windows-latest
31+
node: [12.x, 14.x, 16.x]
32+
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Set up Node.js
36+
uses: actions/setup-node@v1
37+
with:
38+
node-version: ${{ matrix.node }}
39+
- name: Install modules
40+
run: yarn
41+
- name: Run tests
42+
run: yarn test

.gitignore

+117-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,117 @@
1-
node_modules
1+
2+
# Logs
3+
logs
4+
*.log
5+
npm-debug.log*
6+
yarn-debug.log*
7+
yarn-error.log*
8+
lerna-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Microbundle cache
58+
.rpt2_cache/
59+
.rts2_cache_cjs/
60+
.rts2_cache_es/
61+
.rts2_cache_umd/
62+
63+
# Optional REPL history
64+
.node_repl_history
65+
66+
# Output of 'npm pack'
67+
*.tgz
68+
69+
# Yarn Integrity file
70+
.yarn-integrity
71+
72+
# dotenv environment variables file
73+
.env
74+
.env.test
75+
76+
# parcel-bundler cache (https://parceljs.org/)
77+
.cache
78+
.parcel-cache
79+
80+
# Next.js build output
81+
.next
82+
out
83+
84+
# Nuxt.js build / generate output
85+
.nuxt
86+
dist
87+
88+
# Gatsby files
89+
.cache/
90+
# Comment in the public line in if your project uses Gatsby and not Next.js
91+
# https://nextjs.org/blog/next-9-1#public-directory-support
92+
# public
93+
94+
# vuepress build output
95+
.vuepress/dist
96+
97+
# Serverless directories
98+
.serverless/
99+
100+
# FuseBox cache
101+
.fusebox/
102+
103+
# DynamoDB Local files
104+
.dynamodb/
105+
106+
# TernJS port file
107+
.tern-port
108+
109+
# Stores VSCode versions used for testing VSCode extensions
110+
.vscode-test
111+
112+
# yarn v2
113+
.yarn/cache
114+
.yarn/unplugged
115+
.yarn/build-state.yml
116+
.yarn/install-state.gz
117+
.pnp.*

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
. "$(dirname "$0")/common.sh"
4+
5+
npx --no-install commitlint --edit $1

.husky/common.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
command_exists () {
2+
command -v "$1" >/dev/null 2>&1
3+
}
4+
5+
# Windows 10, Git Bash and Yarn workaround
6+
if command_exists winpty && test -t 1; then
7+
exec < /dev/tty
8+
fi

.husky/pre-commit

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
. "$(dirname "$0")/common.sh"
4+
5+
npm run test

.prettierrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
semi: false,
3+
singleQuote: true,
4+
trailingComma: 'es5',
5+
arrowParens: 'always',
6+
printWidth: 80,
7+
}

.releaserc

-15
This file was deleted.

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Yıldıray Eyüp Erdoğan
3+
Copyright (c) 2022 EgoistDeveloper
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

commitlint.config.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
module.exports = {
2-
extends: [
3-
'@commitlint/config-conventional'
4-
]
5-
};
1+
module.exports = {extends: ['@commitlint/config-conventional']}

config/fileTransformer.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// source: https://jestjs.io/docs/code-transformation#examples
2+
3+
const path = require('path');
4+
5+
module.exports = {
6+
process(src, filename, config, options) {
7+
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
8+
},
9+
};

config/tsconfig.cjs.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../tsconfig",
3+
"compilerOptions": {
4+
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
5+
"outDir": "../dist/cjs" /* Redirect output structure to the directory. */
6+
}
7+
}

config/tsconfig.esm.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../tsconfig",
3+
"compilerOptions": {
4+
"module": "ESNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
5+
"outDir": "../dist/esm" /* Redirect output structure to the directory. */
6+
}
7+
}

config/tsconfig.types.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../tsconfig",
3+
"compilerOptions": {
4+
"declaration": true /* Generates corresponding '.d.ts' file. */,
5+
"emitDeclarationOnly": true,
6+
"outDir": "../dist/types" /* Redirect output structure to the directory. */
7+
}
8+
}

config/tsconfig.umd.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "../tsconfig",
3+
"compilerOptions": {
4+
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
5+
"declaration": false /* Generates corresponding '.d.ts' file. */
6+
}
7+
}

0 commit comments

Comments
 (0)