Skip to content

Commit

Permalink
feat: adds basic typescript setup
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-zakharchenko committed Oct 2, 2019
1 parent d91f1ad commit 0d12b50
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 18 deletions.
12 changes: 5 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
version: 2.1


commands:
npm-install:
steps:
Expand All @@ -18,30 +17,28 @@ commands:
- run: echo $(python --version) > .python-version
- restore_cache:
key: py-deps-{{ checksum ".python-version" }}-{{ checksum "docs/requirements.txt" }}
- run: "if [ ! -d ./venv ]; then python -m venv ./venv; fi"
- run: 'if [ ! -d ./venv ]; then python -m venv ./venv; fi'
- run: echo "source $(pwd)/venv/bin/activate" >> $BASH_ENV
- run: pip install -r ./docs/requirements.txt
- save_cache:
key: py-deps-{{ checksum "docs/requirements.txt" }}
paths:
- ./venv


aliases:
- &node12
image: circleci/node:12

- &python-docs
# using Python 3.6 as that's the version ReadTheDocs is running
- &python-docs # using Python 3.6 as that's the version ReadTheDocs is running
image: circleci/python:3.6-node

- &test-steps
steps:
- checkout
- npm-install
- run: npm run build
- run: npm run ci:test


jobs:
test-node12:
docker: [<<: *node12]
Expand All @@ -60,13 +57,15 @@ jobs:
steps:
- checkout
- npm-install
- run: npm run build
- run: npm run e2e:apib

test-e2e-openapi2:
docker: [<<: *node12]
steps:
- checkout
- npm-install
- run: npm run build
- run: npm run e2e:openapi2

quality-checks:
Expand Down Expand Up @@ -112,7 +111,6 @@ jobs:
- npm-install
- run: npm run ci:release


workflows:
version: 2
test-and-release:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package-lock.json
npm-shrinkwrap.json

/build
/coverage
/docs/_build
node_modules
Expand Down
15 changes: 8 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
environment:
nodejs_version: "12"
nodejs_version: '12'
install:
- ps: Install-Product node 12
- "npm -g install npm@6"
- 'npm -g install npm@6'
- "set PATH=%APPDATA%\\npm;%PATH%"
- "npm install"
- 'npm install'
cache:
- "node_modules -> package.json"
- 'node_modules -> package.json'
- "%APPDATA%\\npm-cache -> package.json"
build: off
test_script:
- "node --version"
- "npm --version"
- "npm test"
- 'node --version'
- 'npm --version'
- 'npm run build'
- 'npm test'
2 changes: 1 addition & 1 deletion bin/dredd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
});

const CLI = require('../lib/CLI');
const CLI = require('../build/CLI');

const dreddCli = new CLI({
custom: {
Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
"name": "dredd",
"version": "0.0.0-semantically-released",
"description": "HTTP API Testing Framework",
"main": "lib/Dredd.js",
"main": "build/Dredd.js",
"bin": {
"dredd": "bin/dredd"
},
"engines": {
"node": ">=8"
},
"scripts": {
"start": "npm run build -- --watch",
"build": "tsc --build tsconfig.json",
"docs:lint": "sphinx-build -nW -b linkcheck ./docs ./docs/_build",
"docs:test-extensions": "python -m unittest docs/_extensions/*.py --verbose",
"docs:build": "sphinx-build -nW -b html ./docs ./docs/_build",
Expand All @@ -26,15 +28,16 @@
"ci:docs": "npm run docs:build",
"ci:test": "npm test",
"ci:smoke": "bash ./scripts/smoke.sh",
"ci:release": "semantic-release && npm dist-tag add \"dredd@$(npm view dredd version)\" stable"
"ci:release": "semantic-release && npm dist-tag add \"dredd@$(npm view dredd version)\" stable",
"prepack": "npm run build"
},
"repository": {
"type": "git",
"url": "https://github.com/apiaryio/dredd"
},
"files": [
"bin",
"lib",
"build",
"options.json",
"README.md"
],
Expand Down
17 changes: 17 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compileOnSave": true,
"compilerOptions": {
"module": "commonjs",
"target": "es2017",
"lib": ["es2017"],
"typeRoots": ["node_modules/@types"],
"rootDir": "./lib",
"outDir": "./build",
"moduleResolution": "node",
"esModuleInterop": true,
"allowJs": true,
"allowSyntheticDefaultImports": true
},
"include": ["./lib/**/*.ts", "./lib/**/*.js"],
"exclude": ["node_modules", "build"]
}

0 comments on commit 0d12b50

Please sign in to comment.