Skip to content

Commit

Permalink
chore(gatsby): Convert src/utils/app-data.js to typescript (#22076)
Browse files Browse the repository at this point in the history
* chore(gatsby): Convert src/utils/utils/app-data.js to typescript

* chore(gatsby): fix promise to void

* chore(gatsby): fix path
  • Loading branch information
kawamataryo authored Mar 9, 2020
1 parent fe04b8e commit 7c19e61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby/src/commands/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const signalExit = require(`signal-exit`)
const telemetry = require(`gatsby-telemetry`)
const { store, emitter, readState } = require(`../redux`)
const queryUtil = require(`../query`)
const appDataUtil = require(`../utils/app-data`)
import * as appDataUtil from "../utils/app-data"
const WorkerPool = require(`../utils/worker/pool`)
const { structureWebpackErrors } = require(`../utils/webpack-error-utils`)
const {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
const fs = require(`fs-extra`)
const path = require(`path`)
import fs from "fs-extra"
import path from "path"

const APP_DATA_JSON = `app-data.json`

const write = (publicDir, hash) => {
export const write = (publicDir: string, hash: string): void => {
fs.outputJson(path.join(publicDir, `page-data`, APP_DATA_JSON), {
webpackCompilationHash: hash,
})
}

const exists = publicDir =>
export const exists = (publicDir: string): boolean =>
fs.pathExistsSync(path.join(publicDir, `page-data`, APP_DATA_JSON))

module.exports = {
write,
exists,
}

0 comments on commit 7c19e61

Please sign in to comment.