feat: workflows
This commit is contained in:
parent
882ef0a8f1
commit
74798c6e61
21
.github/workflows/fmt.yml
vendored
Normal file
21
.github/workflows/fmt.yml
vendored
Normal 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
21
.github/workflows/test.yml
vendored
Normal 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
|
||||||
16
build.js
16
build.js
@ -8,10 +8,12 @@ build({
|
|||||||
watch: !production,
|
watch: !production,
|
||||||
format: "cjs",
|
format: "cjs",
|
||||||
outfile: `./dist/index.js`
|
outfile: `./dist/index.js`
|
||||||
}).catch(() => process.exit(1));
|
})
|
||||||
|
.then(() => {
|
||||||
// copy module declarations
|
// copy module declarations
|
||||||
copyFile("./src/modules.d.ts", "./dist/modules.d.ts", (err) => {
|
copyFile("./src/modules.d.ts", "./dist/modules.d.ts", (err) => {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
console.log("[modules.d.ts] copied");
|
console.log("[modules.d.ts] copied");
|
||||||
});
|
});
|
||||||
|
})
|
||||||
|
.catch(() => process.exit(1));
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "NODE_ENV=production node build.js && tsc --emitDeclarationOnly",
|
"build": "NODE_ENV=production node build.js && tsc --emitDeclarationOnly",
|
||||||
"dev": "NODE_ENV=development node build.js",
|
"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": "prettier --write .",
|
||||||
"fmt:check": "prettier --check ."
|
"fmt:check": "prettier --check ."
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user