Skip to content

Commit 74c68fb

Browse files
Add GitHub Actions workflow for Node.js package testing and security auditing
1 parent 9715815 commit 74c68fb

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

.github/workflows/node.js.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# 🚀 This workflow tests a Node.js (npm) package across different Node.js versions and on multiple operating systems 🌐
2+
# Additionally, it checks for any security risks in the dependencies 🔒
3+
# For more information, see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs 📚
4+
5+
name: Node.js Package Test 🎉
6+
7+
on:
8+
push:
9+
branches: ['main']
10+
pull_request:
11+
branches: ['main']
12+
13+
jobs:
14+
test:
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, windows-latest, macos-latest]
19+
node-version: [17.x, 18.x, 19.x, 20.x, 21.x]
20+
21+
steps:
22+
- name: 📁 Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: 📦 Use Node.js ${{ matrix.node-version }}
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
cache: 'npm'
30+
31+
- name: 📦 Install dependencies
32+
run: npm install
33+
34+
- name: 🚀 Run the application
35+
run: node .
36+
37+
- name: 🔒 Check for security risks
38+
run: npm audit --json > audit-result.json
39+
id: audit
40+
41+
- name: 📣 Display audit results
42+
run: cat audit-result.json

bin/index.js

Whitespace-only changes.

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,15 @@
22
"name": "ctf",
33
"version": "1.0.0",
44
"description": "A command-line shell utility for setting up and managing Capture The Flag (CTF)",
5-
"main": "index.js",
5+
"main": "bin/index.js",
66
"private": "true",
77
"bin": {
88
"ctf": "./bin/index.js"
99
},
1010
"scripts": {
1111
"lint": "eslint .",
1212
"format": "prettier --write .",
13-
"lint:fix": "eslint . --fix",
14-
"prepare": "npm run lint && npm run format"
13+
"lint:fix": "eslint . --fix"
1514
},
1615
"keywords": [
1716
"CTF",

0 commit comments

Comments
 (0)