Skip to content

Commit

Permalink
chore: Ts/setup typescript for all (#21994)
Browse files Browse the repository at this point in the history
* chore(gatsby): Setup core packages with TS support

* fix check script
  • Loading branch information
blainekasten authored Mar 6, 2020
1 parent be46a2c commit 83ae63d
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/babel-plugin-remove-graphql-queries/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
3 changes: 3 additions & 0 deletions packages/babel-preset-gatsby-package/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
3 changes: 3 additions & 0 deletions packages/babel-preset-gatsby/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
3 changes: 3 additions & 0 deletions packages/gatsby-core-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
3 changes: 3 additions & 0 deletions packages/gatsby-image/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
3 changes: 3 additions & 0 deletions packages/gatsby-link/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
3 changes: 3 additions & 0 deletions packages/gatsby-page-utils/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
3 changes: 3 additions & 0 deletions packages/gatsby-react-router-scroll/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
3 changes: 3 additions & 0 deletions packages/gatsby-telemetry/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "../../tsconfig.json"
}
15 changes: 12 additions & 3 deletions scripts/check-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"use strict"

const fs = require(`fs`)
const glob = require(`glob`)
const path = require(`path`)
const chalk = require(`chalk`)
const yargs = require(`yargs`)
Expand All @@ -23,9 +24,17 @@ const packages = fs
.map(file => path.resolve(PACKAGES_DIR, file))
.filter(f => fs.lstatSync(path.resolve(f)).isDirectory())

let packagesWithTs = packages.filter(p =>
fs.existsSync(path.resolve(p, `tsconfig.json`))
)
// We only want to typecheck against packages that have a tsconfig.json
// AND have some ts files in it's source code.
let packagesWithTs = packages
.filter(p => fs.existsSync(path.resolve(p, `tsconfig.json`)))
.filter(
project =>
glob.sync(`/**/*.ts`, {
root: project,
ignore: `**/node_modules/**`,
}).length
)

if (filterPackage) {
packagesWithTs = packagesWithTs.filter(project =>
Expand Down

0 comments on commit 83ae63d

Please sign in to comment.