Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(gatsby): Convert src/utils/utils/app-data.js to typescript #22076

Merged
merged 3 commits into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
}