Skip to content

Commit

Permalink
Adds a production build tsconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Sep 19, 2017
1 parent dbfc14a commit 971b1f0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@
},
"scripts": {
"precommit": "lint-staged",
"prepush": "npm run build",
"prepush": "yarn run build",
"test": "jest",
"test:watch": "jest --watch",
"lint": "tslint \"source/**/*.ts\"",
"lint:fix": "tslint \"source/**/*.ts\" --fix",
"prepublishOnly": "npm run build && yarn declarations",
"build": "shx rm -rf ./distribution && tsc && madge ./distribution --circular",
"prepublishOnly": "yarn run build && yarn declarations",
"build": "shx rm -rf ./distribution && tsc -p tsconfig.production.json && madge ./distribution --circular",
"build:watch": "tsc -w",
"link": "npm run build && chmod +x distribution/commands/danger.js && npm link",
"link": "yarn run build && chmod +x distribution/commands/danger.js && npm link",
"declarations": "ts-node ./scripts/create-danger-dts.ts",
"docs:cp_defs":
"mkdir docs/docs_generate; cp source/danger.d.ts docs/docs_generate; cp node_modules/github/lib/index.d.ts docs/docs_generate/github.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion source/runner/DangerfileRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ export function cleanDangerfile(contents: string): string {

const typescriptify = (content: string): string => {
const ts = require("typescript") // tslint:disable-line
let result = ts.transpileModule(content, {})
const compilerOptions = JSON.parse(fs.readFileSync("tsconfig.json", "utf8"))
let result = ts.transpileModule(content, compilerOptions)
return result.outputText
}

Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"module": "commonjs",
"moduleResolution": "node",
"pretty": true,
"target": "es2015",
"target": "es5",
"outDir": "distribution",
"lib": ["es5", "es2017"]
"lib": ["es2017"]
},
"formatCodeOptions": {
"indentSize": 2,
Expand Down
12 changes: 12 additions & 0 deletions tsconfig.production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"exclude": [
"dangerfile.ts",
"scripts",
"node_modules",
"source/**/fixtures/*",
"source/**/_tests/*",
"distribution",
"types"
]
}

0 comments on commit 971b1f0

Please sign in to comment.