Skip to content

Commit 92d2fd7

Browse files
Merge pull request #110 from mxenabled/wes/fixVulnerabilities
Wes/fix vulnerabilities
2 parents 7f31585 + cdaf8f8 commit 92d2fd7

26 files changed

+6735
-9015
lines changed

.eslintrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"plugins": ["@typescript-eslint"],
5+
"extends": [
6+
"eslint:recommended",
7+
"plugin:@typescript-eslint/recommended",
8+
"plugin:react-hooks/recommended"
9+
],
10+
"rules": {
11+
"semi": ["error", "never"],
12+
"quotes": ["error", "double"],
13+
"no-trailing-spaces": "error",
14+
"react-hooks/exhaustive-deps": "off",
15+
"@typescript-eslint/no-unused-vars": [
16+
"error",
17+
{
18+
"argsIgnorePattern": "^_",
19+
"varsIgnorePattern": "^_"
20+
}
21+
],
22+
"@typescript-eslint/no-var-requires": 0
23+
}
24+
}

.github/workflows/build-example-app.yml

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,42 @@ name: Build Example App
22

33
on:
44
pull_request:
5-
push:
6-
branches:
7-
- master
85

96
jobs:
107
Build:
118
runs-on: ubuntu-latest
129

1310
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v2
16-
with:
17-
node-version: 16
18-
cache: npm
19-
- uses: actions/cache@v3
20-
with:
21-
path: node_modules
22-
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
23-
restore-keys: |
24-
${{ runner.os }}-node-
25-
- uses: actions/cache@v3
26-
with:
27-
path: example/node_modules
28-
key: ${{ runner.os }}-node-${{ hashFiles('example/package-lock.json') }}
29-
restore-keys: |
30-
${{ runner.os }}-node-
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: 16
15+
- uses: actions/cache@v3
16+
with:
17+
path: node_modules
18+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
19+
restore-keys: |
20+
${{ runner.os }}-node-
21+
- uses: actions/cache@v3
22+
with:
23+
path: example/node_modules
24+
key: ${{ runner.os }}-node-${{ hashFiles('example/package-lock.json') }}
25+
restore-keys: |
26+
${{ runner.os }}-node-
3127
32-
- run: node --version
33-
- run: npm --version
34-
- name: Run npm install (sdk)
35-
run: npm install
28+
- run: node --version
29+
- run: npm --version
30+
- name: Run npm install (sdk)
31+
run: npm install
3632

37-
- name: Run npm install (app)
38-
run: npm install
39-
working-directory: example
33+
- name: Run npm install (app)
34+
run: npm install
35+
working-directory: example
4036

41-
- name: Create config file
42-
working-directory: example
43-
run: |
44-
echo '{ "proxy": "http://fakeserver.com" }' > config.json
37+
- name: Create config file
38+
working-directory: example
39+
run: |
40+
echo '{ "proxy": "http://fakeserver.com" }' > config.json
4541
46-
- run: npm run build
47-
working-directory: example
42+
- run: npm run build
43+
working-directory: example

.github/workflows/build-sdk.yml

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,22 @@ name: Build SDK
22

33
on:
44
pull_request:
5-
push:
6-
branches:
7-
- master
85

96
jobs:
107
Build:
118
runs-on: ubuntu-latest
129

1310
steps:
14-
- uses: actions/checkout@v2
15-
- uses: actions/setup-node@v2
16-
with:
17-
node-version: 16
18-
cache: npm
19-
- uses: actions/cache@v3
20-
with:
21-
path: node_modules
22-
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
23-
restore-keys: |
24-
${{ runner.os }}-node-
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: 16
15+
- uses: actions/cache@v3
16+
with:
17+
path: node_modules
18+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
19+
restore-keys: |
20+
${{ runner.os }}-node-
2521
26-
- run: npm install
27-
- run: npm run prettier -- --check
28-
- run: npm run lint
29-
- run: npm run build
30-
- run: npm run test
31-
- run: npm run spellcheck
22+
- run: npm install
23+
- run: npm run build
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Changelog updated
2+
3+
on: pull_request
4+
5+
jobs:
6+
check-changelog:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
13+
- name: Fetch master branch
14+
run: |
15+
git fetch origin master:master
16+
17+
- name: Check that changelog is updated
18+
run: |
19+
if ! git diff --name-only master | grep -q '^CHANGELOG.md$'; then
20+
echo "Error: CHANGELOG.md has not been updated."
21+
exit 1
22+
fi

.github/workflows/lint.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Lint
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
Lint-Prettier:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-node@v2
13+
with:
14+
node-version: 16
15+
- uses: actions/cache@v3
16+
with:
17+
path: node_modules
18+
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
19+
restore-keys: |
20+
${{ runner.os }}-node-
21+
22+
- run: npm install
23+
- run: npm run prettier -- --check
24+
- run: npm run lint
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: NPM Audit Example App
2+
3+
on:
4+
pull_request:
5+
schedule:
6+
- cron: "0 0 1 * *" # every month
7+
8+
jobs:
9+
NPM-Audit-Example-App:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: 16
17+
18+
- name: Run npm audit (app)
19+
run: npm audit --audit-level=high
20+
working-directory: example
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: NPM Audit SDK
2+
3+
on:
4+
pull_request:
5+
schedule:
6+
- cron: "0 0 1 * *" # every month
7+
8+
jobs:
9+
NPM-Audit-SDK:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- uses: actions/setup-node@v2
15+
with:
16+
node-version: 16
17+
18+
- name: Run npm audit
19+
run: npm audit --audit-level=high

.github/workflows/npm-publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Auto-publish NPM Package"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
push_to_registry:
10+
name: "Setup, and publish"
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: "Check out the repo"
15+
uses: actions/checkout@v4
16+
17+
- name: "Set up Node"
18+
uses: actions/setup-node@v4
19+
with:
20+
registry-url: "https://registry.npmjs.org"
21+
node-version: 20
22+
check-latest: true
23+
24+
- name: "Dependencies and tests"
25+
run: |
26+
npm ci
27+
npm run build
28+
- name: "Publish to NPM"
29+
uses: JS-DevTools/npm-publish@v3
30+
with:
31+
token: ${{ secrets.NPM_TOKEN }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: "NPM Version Check"
2+
3+
on: pull_request
4+
5+
jobs:
6+
push_to_registry:
7+
name: "NPM Version Check"
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: "Check out the repo"
12+
uses: actions/checkout@v4
13+
14+
- name: "Set up Node"
15+
uses: actions/setup-node@v4
16+
with:
17+
registry-url: "https://registry.npmjs.org"
18+
node-version: 20
19+
check-latest: true
20+
21+
- name: "Check if version is published"
22+
run: |
23+
PACKAGE_VERSION=$(npm pkg get version --workspaces=false | tr -d \")
24+
PACKAGE_NAME=$(npm pkg get name --workspaces=false | tr -d \")
25+
# Run npm view and capture the exit code (success or failure)
26+
npm view "$PACKAGE_NAME@$PACKAGE_VERSION" --json > result.json 2>&1 || true
27+
28+
cat result.json
29+
30+
# Check the exit code to determine if the version exists
31+
if grep -q "is not in this registry." result.json; then
32+
echo "Version $PACKAGE_VERSION does not exist for $PACKAGE_NAME on npmjs.com. 🎉"
33+
exit 0
34+
else
35+
echo "Version $PACKAGE_VERSION already exists for $PACKAGE_NAME on npmjs.com. 😬🫠"
36+
echo "Please update the 'version' property in package.json and try again."
37+
exit 1
38+
fi

.github/workflows/package-audit-example-app.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)