Skip to content

Commit 564b1e0

Browse files
committed
initial commit
0 parents  commit 564b1e0

23 files changed

+9909
-0
lines changed

.eslintignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
**/*.d.ts
2+
__tests__/
3+
dist/
4+
lib/
5+
node_modules/

.eslintrc

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"plugins": ["@typescript-eslint"],
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"ecmaVersion": 7,
6+
"sourceType": "module",
7+
"project": "./tsconfig.json"
8+
},
9+
"rules": {
10+
"no-shadow": "off",
11+
"@typescript-eslint/no-shadow": ["error", {"ignoreTypeValueShadow": true}],
12+
"i18n-text/no-en": "off",
13+
"eslint-comments/no-use": "off",
14+
"import/no-namespace": "off",
15+
"no-unused-vars": "off",
16+
"@typescript-eslint/no-unused-vars": "warn",
17+
"@typescript-eslint/explicit-member-accessibility": [
18+
"error",
19+
{"accessibility": "no-public"}
20+
],
21+
"@typescript-eslint/no-require-imports": "error",
22+
"@typescript-eslint/array-type": "error",
23+
"@typescript-eslint/await-thenable": "error",
24+
"@typescript-eslint/ban-ts-comment": "error",
25+
"camelcase": "warn",
26+
"@typescript-eslint/consistent-type-assertions": "error",
27+
"@typescript-eslint/explicit-function-return-type": [
28+
"error",
29+
{"allowExpressions": true}
30+
],
31+
"@typescript-eslint/func-call-spacing": ["error", "never"],
32+
"@typescript-eslint/no-array-constructor": "error",
33+
"@typescript-eslint/no-empty-interface": "error",
34+
"@typescript-eslint/no-explicit-any": "warn",
35+
"@typescript-eslint/no-extraneous-class": "error",
36+
"@typescript-eslint/no-for-in-array": "error",
37+
"@typescript-eslint/no-inferrable-types": "error",
38+
"@typescript-eslint/no-misused-new": "error",
39+
"@typescript-eslint/no-namespace": "error",
40+
"@typescript-eslint/no-non-null-assertion": "warn",
41+
"@typescript-eslint/no-unnecessary-qualifier": "error",
42+
"@typescript-eslint/no-unnecessary-type-assertion": "error",
43+
"@typescript-eslint/no-useless-constructor": "error",
44+
"@typescript-eslint/no-var-requires": "error",
45+
"@typescript-eslint/prefer-for-of": "warn",
46+
"@typescript-eslint/prefer-function-type": "warn",
47+
"@typescript-eslint/prefer-includes": "error",
48+
"@typescript-eslint/prefer-string-starts-ends-with": "error",
49+
"@typescript-eslint/promise-function-async": "error",
50+
"@typescript-eslint/require-array-sort-compare": "error",
51+
"@typescript-eslint/restrict-plus-operands": "error",
52+
"@typescript-eslint/type-annotation-spacing": "error",
53+
"@typescript-eslint/unbound-method": "error"
54+
},
55+
"env": {
56+
"node": true,
57+
"es6": true
58+
}
59+
}

.github/workflows/cicd.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
name: cicd
2+
3+
# NEEDS:
4+
# - secrets.SSH_ID
5+
# - secrets.SSH_ID_PUB
6+
# - secrets.SSH_ALLOWED_SIGNERS
7+
# - secrets.NPM_TOKEN
8+
9+
on:
10+
push:
11+
branches-ignore: main
12+
# test > update manifests
13+
pull_request:
14+
branches: main
15+
# test > update manifests > tag > release > npm package registry
16+
workflow_dispatch:
17+
# test > update manifests > tag > pre-release > npm package registry
18+
19+
concurrency: ${{ github.workflow }}
20+
21+
defaults:
22+
run:
23+
shell: bash
24+
25+
jobs:
26+
ci:
27+
runs-on: ubuntu-latest
28+
permissions:
29+
contents: write
30+
steps:
31+
32+
- run: curl -o 'GitVersion.yml' 'https://gist.githubusercontent.com/KamaranL/9e5c6d02123d4ef984a676e57602a4ef/raw/ContinuousDeployment.yml'
33+
working-directory: ${{ runner.temp }}
34+
35+
- uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
persist-credentials: true
39+
40+
- run: npm ci
41+
42+
- run: npm run test
43+
44+
- run: |
45+
SSH="${{ runner.temp }}/ssh"
46+
mkdir -p $SSH
47+
echo -e "${{ secrets.SSH_ID }}" >"$SSH/id"
48+
echo -e "${{ secrets.SSH_ID_PUB }}" >"$SSH/id.pub"
49+
echo -e "${{ secrets.SSH_ALLOWED_SIGNERS }}" >"$SSH/allowed_signers"
50+
chmod 0600 "$SSH/id"
51+
52+
git config --global user.name "GitHub Actions"
53+
git config --global user.email "lossy.typist.0i@icloud.com"
54+
git config --global user.signingkey "$SSH/id.pub"
55+
git config --global gpg.format "ssh"
56+
git config --global gpg.ssh.allowedsignersfile "$SSH/allowed_signers"
57+
git config --global commit.gpgsign true
58+
git config --global tag.gpgsign true
59+
git config --global push.followtags true
60+
name: Set up Git
61+
62+
- uses: gittools/actions/gitversion/setup@v0
63+
with:
64+
versionSpec: '5.x'
65+
66+
- uses: gittools/actions/gitversion/execute@v0
67+
with:
68+
useConfigFile: true
69+
configFilePath: '${{ runner.temp }}/GitVersion.yml'
70+
71+
- run: |
72+
[ "${{ github.event_name }}" == workflow_dispatch -a "${{ github.ref_name }}" != main ] && echo "CI_CREATE_TAG=true" >>"$GITHUB_ENV"
73+
74+
echo "CI_VERSION=${{ env.GITVERSION_FULLSEMVER }}" >>"$GITHUB_ENV"
75+
echo "CI_BRANCH=${{ github.ref_name }}" >>"$GITHUB_ENV"
76+
77+
if [ "${{ github.event_name }}" == pull_request -a "${{ github.base_ref }}" == main -a "${{ github.head_ref }}" == dev ]; then
78+
echo "CI_VERSION=${{ env.GITVERSION_MAJORMINORPATCH }}" >>"$GITHUB_ENV"
79+
echo "CI_BRANCH=${{ github.head_ref }}" >>"$GITHUB_ENV"
80+
echo "CI_CREATE_TAG=true" >>"$GITHUB_ENV"
81+
82+
gh release view v1.0.0 >/dev/null 2>&1 || echo "CI_VERSION=1.0.0" >>"$GITHUB_ENV"
83+
fi
84+
env:
85+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
name: Set CI_ vars
87+
88+
- run: |
89+
echo ${{ env.CI_VERSION }} >VERSION.txt
90+
npm version --quiet --allow-same-version --no-commit-hooks --no-git-tag-version ${{ env.CI_VERSION }}
91+
name: Update manifests
92+
93+
- run: |
94+
git commit -a --amend --no-edit --date=now --trailer "skip-checks: true"
95+
96+
[ ${{ env.CI_CREATE_TAG }} ] && git tag -a v${{ env.CI_VERSION }} -m v${{ env.CI_VERSION }} $(git rev-parse HEAD) && echo "CI_CREATE_RELEASE=true" >>"$GITHUB_ENV"
97+
98+
git push origin $(git rev-parse HEAD):${{ env.CI_BRANCH }} --force-with-lease
99+
name: Commit back to source
100+
101+
- run: gh release create v${{ env.CI_VERSION }} --generate-notes --verify-tag && echo "CI_CD=true" >>"$GITHUB_OUTPUT" && echo "CI_TAG=v${{ env.CI_VERSION }}" >>"$GITHUB_OUTPUT"
102+
id: release
103+
if: env.CI_CREATE_RELEASE
104+
env:
105+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106+
107+
outputs:
108+
cd: ${{ steps.release.outputs.CI_CD }}
109+
tag: ${{ steps.release.outputs.CI_TAG }}
110+
111+
cd:
112+
needs: ci
113+
if: needs.ci.outputs.cd
114+
runs-on: ubuntu-latest
115+
permissions:
116+
packages: write
117+
steps:
118+
119+
- uses: actions/checkout@v4
120+
with:
121+
fetch-tags: true
122+
persist-credentials: true
123+
ref: ${{ needs.ci.outputs.tag }}
124+
125+
- run: npm ci
126+
127+
- run: npm run compile
128+
129+
- uses: actions/setup-node@v4
130+
with:
131+
node-version: 'latest'
132+
registry-url: 'https://registry.npmjs.org'
133+
134+
- run: npm publish
135+
env:
136+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
!.env.project
2+
!.env.vault
3+
$RECYCLE.BIN/
4+
*.appconfig
5+
*.cab
6+
*.icloud
7+
*.ignore
8+
*.ignore.*
9+
*.lcov
10+
*.lnk
11+
*.log
12+
*.msi
13+
*.msix
14+
*.msm
15+
*.msp
16+
*.pid
17+
*.pid.lock
18+
*.seed
19+
*.stackdump
20+
*.tgz
21+
*.tsbuildinfo
22+
*~
23+
.AppleDB
24+
.AppleDesktop
25+
.AppleDouble
26+
.DS_Store
27+
.DocumentRevisions-V100
28+
.LSOverride
29+
.Spotlight-V100
30+
.TemporaryItems
31+
.Trash-*
32+
.Trashes
33+
.VolumeIcon.icns
34+
._*
35+
.apdisk
36+
.cache
37+
.cache/
38+
.com.apple.timemachine.donotpresent
39+
.directory
40+
.docusaurus
41+
.dynamodb/
42+
.env
43+
.env*
44+
.env.development.local
45+
.env.local
46+
.env.production.local
47+
.env.test
48+
.env.test.local
49+
.eslintcache
50+
.flaskenv*
51+
.fseventsd
52+
.fuse_hidden*
53+
.fusebox/
54+
.gitignore.d
55+
.grunt
56+
.lock-wscript
57+
.next
58+
.nfs*
59+
.node_repl_history
60+
.npm
61+
.nuxt
62+
.nyc_output
63+
.parcel-cache
64+
.pnp.*
65+
.pnpm-debug.log*
66+
.rpt2_cache/
67+
.rts2_cache_cjs/
68+
.rts2_cache_es/
69+
.rts2_cache_umd/
70+
.serverless/
71+
.stylelintcache
72+
.svelte-kit
73+
.temp
74+
.tern-port
75+
.vscode-test
76+
.vuepress/dist
77+
.webpack/
78+
.yarn-integrity
79+
.yarn/build-state.yml
80+
.yarn/cache
81+
.yarn/install-state.gz
82+
.yarn/unplugged
83+
@types/
84+
Icon
85+
Network Trash Folder
86+
Temporary Items
87+
Thumbs.db
88+
Thumbs.db:encryptable
89+
[Dd]esktop.ini
90+
__tests__/runner/*
91+
bower_components
92+
build/Release
93+
coverage
94+
dist/
95+
dist/**/*
96+
docs/
97+
ehthumbs.db
98+
ehthumbs_vista.db
99+
jspm_packages/
100+
lerna-debug.log*
101+
lib-cov
102+
lib/
103+
lib/**/*
104+
logs
105+
node_modules
106+
node_modules/
107+
npm-debug.log*
108+
out
109+
pids
110+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
111+
typings/
112+
web_modules/
113+
yarn-debug.log*
114+
yarn-error.log*

.npmignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.eslint*
2+
.github/
3+
.prettier*
4+
.vscode/
5+
__tests__/
6+
jest.config.js
7+
lib/
8+
node_modules/
9+
src/
10+
tsconfig.json

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/*.d.ts
2+
dist/
3+
lib/
4+
node_modules/

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"printWidth": 79,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": false,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": false,
9+
"arrowParens": "avoid"
10+
}

.vscode/tasks.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "test",
7+
"group": {
8+
"kind": "test",
9+
"isDefault": true
10+
},
11+
"problemMatcher": [],
12+
"label": "npm: test",
13+
"detail": "jest"
14+
}
15+
]
16+
}

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Kamaran Layne
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)