Skip to content
This repository was archived by the owner on Oct 10, 2022. It is now read-only.

Commit b0dfd3d

Browse files
authored
Merge pull request #97 from netlify/chore/reorganize-setup
Reorganize development setup
2 parents e74f1dd + bef3573 commit b0dfd3d

File tree

4 files changed

+38
-28
lines changed

4 files changed

+38
-28
lines changed

.github/workflows/workflow.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
name: Build
2-
on: [push]
2+
on:
3+
# Ensure GitHub actions are not run twice for same commits
4+
push:
5+
branches: [master]
6+
tags: ['*']
7+
pull_request:
8+
types: [opened, synchronize, reopened]
39
env:
410
CI: 'true'
511
jobs:
@@ -24,7 +30,11 @@ jobs:
2430
node-version: ${{ matrix.node }}
2531
- name: Install dependencies
2632
run: npm install
33+
- name: Linting
34+
run: npm run format
2735
- name: Tests
28-
run: npm run test-ci
36+
run: npm run test:ci
37+
- name: Build
38+
run: npm run build
2939
- name: Codecov test coverage
30-
run: bash scripts/coverage.sh "${{ secrets.CODECOV_TOKEN }}" "${{ matrix.os }}" "${{ matrix.node }}"
40+
run: bash scripts/coverage.sh "${{ matrix.os }}" "${{ matrix.node }}"

ava.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
files: ['src/**/*.test.js'],
3+
compileEnhancements: false,
4+
babel: false,
5+
verbose: true
6+
}

package.json

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,34 @@
22
"name": "netlify",
33
"description": "Netlify Node.js API client",
44
"version": "4.0.3",
5-
"ava": {
6-
"files": [
7-
"src/**/*.test.js"
8-
],
9-
"compileEnhancements": false,
10-
"babel": false
11-
},
125
"files": [
136
"src",
147
"dist",
158
"!*.test.js*",
169
"!*~"
1710
],
18-
"main": "src/index.js",
11+
"main": "./src/index.js",
1912
"unpkg": "./dist/main.js",
2013
"umd:main": "./dist/main.js",
2114
"browser": {
2215
"./src/deploy/index.js": "./src/deploy/index.browser.js"
2316
},
2417
"scripts": {
25-
"prepublishOnly": "run-s build && git push && git push --tags && gh-release",
26-
"ci": "run-s test build",
27-
"test": "run-s test:* test:dev:*",
28-
"test-ci": "run-s test:* test:ci:*",
29-
"test:lint": "eslint --ignore-path .gitignore --fix --cache --format=codeframe --max-warnings=0 \"src/**/*.js\" \"*.js\"",
30-
"test:prettier": "prettier --ignore-path .gitignore --write --loglevel warn \"src/**/*.js\" \"*.{js,md,yml,json}\"",
31-
"test:dev:ava": "ava",
32-
"test:ci:ava": "nyc -r lcovonly -r text -r json ava",
33-
"build": "run-s build:*",
34-
"build:webpack": "webpack",
35-
"clean": "rimraf dist coverage",
36-
"version": "auto-changelog -p --template keepachangelog --breaking-pattern breaking && npm run test:prettier && git add CHANGELOG.md"
18+
"prepublishOnly": "npm run build && git push && git push --tags && gh-release",
19+
"test": "npm run format && npm run test:dev",
20+
"format": "run-s format:*",
21+
"format:lint": "eslint --ignore-path .gitignore --fix --cache --format=codeframe --max-warnings=0 \"src/**/*.js\"",
22+
"format:prettier": "prettier --ignore-path .gitignore --write --loglevel warn \"src/**/*.js\" \"*.{js,md,yml,json}\"",
23+
"test:dev": "ava",
24+
"test:ci": "nyc -r lcovonly -r text -r json ava",
25+
"update-snapshots": "ava -u",
26+
"build": "webpack",
27+
"version": "auto-changelog -p --template keepachangelog --breaking-pattern breaking && npm run format:prettier && git add CHANGELOG.md"
28+
},
29+
"husky": {
30+
"hooks": {
31+
"pre-push": "npm run format"
32+
}
3733
},
3834
"license": "MIT",
3935
"author": "Netlify Inc.",

scripts/coverage.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
#!/bin/bash
22
# Upload test coverage to Codecov
33

4-
token="$1"
5-
6-
os="$2"
4+
os="$1"
75
os="${os/-latest/}"
86

9-
node="$3"
7+
node="$2"
108
node="node_${node//./_}"
119

1210
curl -s https://codecov.io/bash | \
13-
bash -s -- -Z -y codecov.yml -f coverage/coverage-final.json -t "$token" -F "$os" -F "$node"
11+
bash -s -- -Z -y codecov.yml -f coverage/coverage-final.json -F "$os" -F "$node"

0 commit comments

Comments
 (0)