Skip to content

Commit bf1ba69

Browse files
committed
ci: separate build & test stages
1 parent ce07285 commit bf1ba69

File tree

5 files changed

+61
-78
lines changed

5 files changed

+61
-78
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ npm-debug.log
88
.DS_Store
99
.esm-cache
1010

11+
# Bundle
12+
target
13+
1114
# Typescript
1215
*.tsbuildinfo
1316
.tsbuildinfo

.travis.yml

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,48 @@
11
language: node_js
2-
node_js:
3-
- "8"
4-
- "10"
5-
- "12"
6-
- "13"
72
sudo: false
3+
4+
install: skip
5+
before_install: skip
6+
before_script: skip
7+
script: skip
8+
9+
env:
10+
- CACHE_NAME=${TRAVIS_OS_NAME}-ALL_IN_ONE
11+
812
cache:
913
directories:
14+
- ./target
15+
- target
1016
- node_modules
17+
18+
stages:
19+
- build
20+
- test
21+
22+
jobs:
23+
include:
24+
- stage: build
25+
node_js:
26+
- "12"
27+
install:
28+
- echo "target dir content:"
29+
- ls -l target
30+
- yarn install
31+
- yarn build
32+
- echo "target dir content:"
33+
- ls -l target
34+
script: skip
35+
- stage: test
36+
node_js:
37+
- "6"
38+
- "8"
39+
- "10"
40+
- "12"
41+
- "13"
42+
install:
43+
- echo "target dir content:"
44+
- ls -l target
45+
before_install: skip
46+
before_script: skip
47+
script:
48+
- yarn test

example/jsonrpc.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
],
77
"license": "MIT",
88
"version": "2.1.0",
9-
"source": "src/main/ts/index.ts",
10-
"main": "jsonrpc.js",
11-
"module": "jsonrpc.mjs",
12-
"unpkg": "jsonrpc.umd.js",
13-
"browser": "jsonrpc.umd.js",
14-
"types": "jsonrpc.d.ts",
9+
"source": "target/jsonrpc.ts",
10+
"main": "target/jsonrpc.js",
11+
"module": "target/jsonrpc.mjs",
12+
"unpkg": "target/jsonrpc.umd.js",
13+
"browser": "target/jsonrpc.umd.js",
14+
"types": "target/jsonrpc.d.ts",
1515
"typescript": {
16-
"definition": "jsonrpc.d.ts"
16+
"definition": "target/jsonrpc.d.ts"
1717
},
1818
"repository": {
1919
"type": "git",
@@ -42,10 +42,11 @@
4242
},
4343
"scripts": {
4444
"build:tsc": "tsc -p tsconfig.build.json",
45-
"build:microbundle": "microbundle jsonrpc.ts --name jsonrpc --strict",
46-
"build": "yarn build:microbundle",
45+
"build:target": "rm -rf ./target && mkdir -p ./target && find . -name \"jsonrpc.*\" -exec cp '{}' ./target/ \\;",
46+
"build:microbundle": "microbundle build jsonrpc.ts --name jsonrpc --strict",
47+
"build": "yarn build:microbundle && yarn build:target",
4748
"lint": "tslint -p tsconfig.json -t stylish jsonrpc.ts",
48-
"test": "npm run lint && tman"
49+
"test": "yarn lint && tman"
4950
},
5051
"files": [
5152
"README.md",

test/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
const assert = require('assert')
44
const tman = require('tman')
55

6-
test(require('../jsonrpc.js'))
7-
test(require('../jsonrpc.umd'))
8-
test(require('esm')(module)('../jsonrpc.mjs'))
6+
test(require('../target/jsonrpc.js'))
7+
test(require('../target/jsonrpc.umd'))
8+
test(require('esm')(module)('../target/jsonrpc.mjs'))
99

1010
require('ts-node/register')
11-
test(require('../jsonrpc.ts').default)
11+
test(require('../target/jsonrpc.ts').default)
1212

1313
function test (jsonrpc) {
1414
tman.suite('jsonrpc', function () {

0 commit comments

Comments
 (0)