feat: workflows

This commit is contained in:
Marton Lederer 2021-02-20 11:29:47 +01:00
parent 882ef0a8f1
commit 74798c6e61
No known key found for this signature in database
GPG Key ID: 9B7FD44832ADFE95
4 changed files with 52 additions and 8 deletions

21
.github/workflows/fmt.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: fmt
on: [push, pull_request]
jobs:
fmt:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- name: Install yarn
run: npm i -g yarn
- name: Install dependencies
run: yarn
- name: Check fmt
run: yarn fmt:check

21
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Test
on: [push, pull_request]
jobs:
fmt:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- name: Install yarn
run: npm i -g yarn
- name: Install dependencies
run: yarn
- name: Run tests
run: yarn test

View File

@ -8,10 +8,12 @@ build({
watch: !production,
format: "cjs",
outfile: `./dist/index.js`
}).catch(() => process.exit(1));
// copy module declarations
copyFile("./src/modules.d.ts", "./dist/modules.d.ts", (err) => {
if (err) throw err;
console.log("[modules.d.ts] copied");
});
})
.then(() => {
// copy module declarations
copyFile("./src/modules.d.ts", "./dist/modules.d.ts", (err) => {
if (err) throw err;
console.log("[modules.d.ts] copied");
});
})
.catch(() => process.exit(1));

View File

@ -12,7 +12,7 @@
"scripts": {
"build": "NODE_ENV=production node build.js && tsc --emitDeclarationOnly",
"dev": "NODE_ENV=development node build.js",
"test": "cd test && mocha 'index.js' --no-timeout --exit",
"test": "yarn build && cd test && mocha 'index.js' --no-timeout --exit",
"fmt": "prettier --write .",
"fmt:check": "prettier --check ."
},