-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(gatsby-core-utils): Convert package to TS (#22122)
* chore(gatsby-core-utils): get-config-store to TS (#22051) * chore(gatsby-core-utils): get-config-store to TS * chore(gatsby-core-utils): change getConfigStore to named export * chore(gatsby-core-utils): ci to TS (#22047) * chore(gatsby-core-utils): package.json added type * chore(gatsby-core-utils): mocks convert ci-info to TS * chore(gatsby-core-utils): ci to TS * chore(gatsby-core-utils): add @types/ci-info * chore(gatsby-core-utils): re-install dependencies to fix order * chore(gatsby-core-utils): cpu-core-count to TS (#22048) * chore(gatsby-core-utils): create-content-digest to TS (#22049) * chore(gatsby-core-utils): tests create-content-digest to TS * chore(gatsby-core-utils): create-content-digest to TS * chore(gatsby-core-utils): create-require-from-path to TS (#22050) * chore(gatsby-core-utils): get-gatsby-version to TS (#22052) * chore(gatsby-core-utils): index to TS (#22053) * chore(gatsby-core-utils): index to TS * chore(gatby-core-utils): changed getConfigStore to named export in #22051 * chore(gatsby-core-utils): path to ts (#22054) * chore(gatsby-core-utils): tests path to TS * chore(gatsby-core-utils): path to ts * chore(gatsby-core-utils): url to TS (#22056) * chore(gatsby-core-utils): tests url to TS * chore(gatsby-core-utils): url to TS * migrate more files * fix the rest * better exports * fix lints * fix building * fix test Co-authored-by: Daniel Emod Kovacs <[email protected]>
- Loading branch information
1 parent
e031fbe
commit cc5fb21
Showing
24 changed files
with
149 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
{ | ||
"presets": [ | ||
["babel-preset-gatsby-package"] | ||
"presets": [["babel-preset-gatsby-package"]], | ||
"overrides": [ | ||
{ | ||
"test": "**/*.ts", | ||
"plugins": [["@babel/plugin-transform-typescript", { "isTSX": true }]] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
packages/gatsby-core-utils/src/__tests__/cpu-core-count.js
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
packages/gatsby-core-utils/src/__tests__/cpu-core-count.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
jest.mock(`../physical-cpu-count`, () => { | ||
return { getPhysicalCpuCount: (): number => 1 } | ||
}) | ||
import { cpuCoreCount } from "../cpu-core-count" | ||
|
||
beforeEach(() => { | ||
delete process.env.GATSBY_CPU_COUNT | ||
}) | ||
|
||
test(`it defaults to physical CPU count, if override not detected`, () => { | ||
expect(cpuCoreCount(false)).toBe(1) | ||
}) | ||
|
||
test(`it does not use env far override, if ignoreEnvVar is true`, () => { | ||
process.env.GATSBY_CPU_COUNT = `9001` | ||
|
||
expect(cpuCoreCount(true)).not.toBe(Number(process.env.GATSBY_CPU_COUNT)) | ||
}) | ||
|
||
test(`uses env var override, if exists`, () => { | ||
process.env.GATSBY_CPU_COUNT = `9001` | ||
|
||
expect(cpuCoreCount(false)).toBe(Number(process.env.GATSBY_CPU_COUNT)) | ||
}) |
2 changes: 1 addition & 1 deletion
2
...ls/src/__tests__/create-content-digest.js → ...ls/src/__tests__/create-content-digest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...s/gatsby-core-utils/src/__tests__/path.js → ...s/gatsby-core-utils/src/__tests__/path.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...es/gatsby-core-utils/src/__tests__/url.js → ...es/gatsby-core-utils/src/__tests__/url.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
packages/gatsby-core-utils/src/create-require-from-path.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.