Skip to content

Commit

Permalink
feat(app migration): tsconfig: skipLibCheck to true
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed Nov 5, 2019
1 parent 996df21 commit 3964b6d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/@nodepack/plugin-typescript/src/app-migrations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,38 @@ module.exports = api => {
})
},
})

api.register({
id: 'skipLibCheck',
title: 'Add `skipLibCheck: true` to tsconfig',
up: (api, options) => {
api.modifyFile('tsconfig.json', (content) => {
if (typeof content === 'string') {
const { removeTrailingComma } = require('@nodepack/utils')
const { parse, stringify } = require('comment-json')
const config = parse(removeTrailingComma(content))
if (!config.compilerOptions) {
config.compilerOptions = {}
}
config.compilerOptions.skipLibCheck = true
return stringify(config, null, 2)
}
return content
})
},
down: (api, options) => {
api.modifyFile('tsconfig.json', (content) => {
if (typeof content === 'string') {
const { removeTrailingComma } = require('@nodepack/utils')
const { parse, stringify } = require('comment-json')
const config = parse(removeTrailingComma(content))
if (config.compilerOptions) {
delete config.compilerOptions.skipLibCheck
return stringify(config, null, 2)
}
}
return content
})
},
})
}

0 comments on commit 3964b6d

Please sign in to comment.