Skip to content

Commit

Permalink
script renames and formatting changes (#751)
Browse files Browse the repository at this point in the history
* rename start:watch and build:watch scripts
* rename test:stolaf-college and test:carleton-college scripts
* add scripts to the prettier config and format watch.js
* formatting changes to node.js.yml
  • Loading branch information
drewvolz authored May 27, 2024
1 parent 234497d commit b1d8e4d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ name: Node.js CI

on:
push:
branches: [ "master" ]
branches: ['master']
pull_request:
branches: [ "master" ]
branches: ['master']

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [ 22.x ]
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -33,22 +33,22 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test

smoke-test-stolaf:
runs-on: ubuntu-latest
strategy:
matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [ 22.x ]
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -58,14 +58,14 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run test-stolaf-college
- run: npm run test:stolaf-college

smoke-test-carleton:
runs-on: ubuntu-latest
strategy:
matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [ 22.x ]
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand All @@ -75,7 +75,7 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run test-carleton-college
- run: npm run test:carleton-college

lint:
runs-on: ubuntu-latest
Expand All @@ -84,21 +84,21 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint

format:
runs-on: ubuntu-latest
strategy:
matrix:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [ 22.x ]
node-version: [22.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
},
"scripts": {
"build": "rm -rf ./dist ./.tsbuildinfo && tsc",
"build-watch": "tsc --watch",
"build:watch": "tsc --watch",
"p": "npm run pretty -- --no-write --check",
"pretty": "prettier --write source",
"pretty": "prettier --write source scripts",
"lint": "eslint --cache --max-warnings=0 .",
"start": "node dist/source/ccc-server/index.js",
"start-watch": "node --watch dist/source/ccc-server/index.js",
"start:watch": "node --watch dist/source/ccc-server/index.js",
"stolaf-college": "env INSTITUTION=stolaf-college npm start",
"carleton-college": "env INSTITUTION=carleton-college npm start",
"test-stolaf-college": "./scripts/smoke-test.sh stolaf-college",
"test-carleton-college": "./scripts/smoke-test.sh carleton-college",
"test:stolaf-college": "./scripts/smoke-test.sh stolaf-college",
"test:carleton-college": "./scripts/smoke-test.sh carleton-college",
"test": "ava",
"watch": "node ./scripts/watch.js"
},
Expand Down
10 changes: 5 additions & 5 deletions scripts/watch.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {spawn} from 'child_process'

const buildWatch = spawn('npm', ['run', 'build-watch'], {stdio: 'inherit'})
const startWatch = spawn('npm', ['run', 'start-watch'], {stdio: 'inherit'})
const buildWatch = spawn('npm', ['run', 'build:watch'], {stdio: 'inherit'})
const startWatch = spawn('npm', ['run', 'start:watch'], {stdio: 'inherit'})

const shutdown = () => {
buildWatch.kill()
startWatch.kill()
process.exit()
buildWatch.kill()
startWatch.kill()
process.exit()
}

process.on('SIGINT', shutdown)
Expand Down

0 comments on commit b1d8e4d

Please sign in to comment.