-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Code is still plain js, but fully covered by typescript via jsdocs * Refactor code to be more programatic * Added utils function that can check if we need to build & publish new version * Added dummy circleci file * Some vscode configs
Showing
17 changed files
with
4,144 additions
and
136 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# this file still do nothing | ||
version: 2 | ||
|
||
aliases: | ||
- &docker | ||
- image: circleci/node:dubnium | ||
|
||
- &environment | ||
TZ: /usr/share/zoneinfo/America/Los_Angeles | ||
|
||
- &restore_yarn_cache | ||
restore_cache: | ||
name: Restore node_modules cache | ||
keys: | ||
- v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
- v1-node-{{ arch }}-{{ .Branch }}- | ||
- v1-node-{{ arch }}- | ||
- &run_yarn | ||
run: | ||
name: Install Packages | ||
command: yarn --frozen-lockfile | ||
|
||
orbs: | ||
node: circleci/node@1.0.1 | ||
|
||
jobs: | ||
setup: | ||
docker: *docker | ||
environment: *environment | ||
|
||
steps: | ||
- checkout | ||
- run: | ||
name: Nodejs Version | ||
command: node --version | ||
- *restore_yarn_cache | ||
- *run_yarn | ||
- save_cache: | ||
name: Save node_modules cache | ||
key: v1-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }} | ||
paths: | ||
- ~/.cache/yarn | ||
|
||
# workflows: | ||
# version: 2 | ||
# nightly: | ||
# triggers: | ||
# - schedule: | ||
# # every 10 minutes | ||
# cron: "*/10 * * * *" | ||
# filters: | ||
# branches: | ||
# only: | ||
# - master | ||
# jobs: | ||
# - should-publish |
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,11 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
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,3 +1,5 @@ | ||
node_modules | ||
target | ||
yarn-error.log | ||
yarn-error.log | ||
auto-publish/staging-area | ||
auto-publish/staging-area-for-test |
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 @@ | ||
lts/Dubnium |
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,3 @@ | ||
{ | ||
"recommendations": ["orta.vscode-jest", "editorconfig.editorconfig", "orta.vscode-jest"] | ||
} |
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,10 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib", | ||
"debug.node.autoAttach": "on", | ||
"jest.debugMode": false, | ||
"jest.autoEnable": false, | ||
"jest.enableCodeLens": true, | ||
"jest.enableInlineErrorMessages": true, | ||
"jest.runAllTestsFirst": true, | ||
"jest.debugCodeLens.showWhenTestStateIn": ["fail", "unknown", "pass", "skip"], | ||
} |
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,61 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Auto publish utils doesReactDOMHasNewerVersionThanUs - no! RC is ready: Correct params passed to execFile 1`] = ` | ||
[MockFunction] { | ||
"calls": Array [ | ||
Array [ | ||
"yarn", | ||
Array [ | ||
"info", | ||
"@hot-loader/react-dom", | ||
"--json", | ||
], | ||
Object { | ||
"cwd": undefined, | ||
"timeout": 2000, | ||
}, | ||
[Function], | ||
], | ||
Array [ | ||
"yarn", | ||
Array [ | ||
"info", | ||
"@hot-loader/react-dom", | ||
"--json", | ||
], | ||
Object { | ||
"cwd": undefined, | ||
"timeout": 2000, | ||
}, | ||
[Function], | ||
], | ||
Array [ | ||
"yarn", | ||
Array [ | ||
"info", | ||
"react-dom", | ||
"--json", | ||
], | ||
Object { | ||
"cwd": undefined, | ||
"timeout": 2000, | ||
}, | ||
[Function], | ||
], | ||
], | ||
"results": Array [ | ||
Object { | ||
"type": "return", | ||
"value": undefined, | ||
}, | ||
Object { | ||
"type": "return", | ||
"value": undefined, | ||
}, | ||
Object { | ||
"type": "return", | ||
"value": undefined, | ||
}, | ||
], | ||
} | ||
`; |
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,10 @@ | ||
const path = require("path"); | ||
const fs = require("fs-extra"); | ||
const { getAndPatchGivenReactDOMVersion } = require("./utils"); | ||
|
||
(async () => { | ||
const targetDir = await getAndPatchGivenReactDOMVersion(path.resolve(__dirname, "staging-area"), "16.8.6"); | ||
await fs.copy(targetDir, path.resolve(__dirname, "../target")) | ||
|
||
console.log("Done!"); | ||
})(); |
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,3 @@ | ||
const fs = require("fs-extra"); | ||
|
||
|
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,82 @@ | ||
export interface yarnInfoJsonResponse { | ||
type: "inspect"; | ||
data: { | ||
name: string; | ||
"dist-tags": Partial<{ | ||
[k: string]: string | ||
}>; | ||
versions: string[]; | ||
time: { [key: string]: string }; | ||
maintainers: Array<{ | ||
name: string; | ||
email: string; | ||
}>; | ||
description: string; | ||
homepage: string; | ||
repository: { | ||
type: string; | ||
url: string; | ||
}; | ||
bugs: { | ||
url: string; | ||
}; | ||
license: string; | ||
readmeFilename: string; | ||
keywords: string[]; | ||
version: string; | ||
}; | ||
/* | ||
example data: | ||
{ | ||
"type": "inspect", | ||
"data": { | ||
"name": "@hot-loader/react-dom", | ||
"dist-tags": { "latest": "16.8.6" }, | ||
"versions": [ | ||
"16.7.0-alpha.2", | ||
"16.7.0-alpha.2.1", | ||
"16.7.0-alpha.2.2", | ||
"16.7.0-alpha.2.3", | ||
"16.7.0-alpha.2.4", | ||
"16.7.0", | ||
"16.8.0-alpha.0", | ||
"16.8.1", | ||
"16.8.2", | ||
"16.8.3", | ||
"16.8.4", | ||
"16.8.5", | ||
"16.8.6" | ||
], | ||
"time": { | ||
"created": "2018-11-21T10:47:51.342Z", | ||
"16.7.0-alpha.2": "2018-11-21T10:47:51.742Z", | ||
"modified": "2019-03-28T09:32:10.123Z", | ||
"16.7.0-alpha.2.1": "2018-11-21T21:35:44.318Z", | ||
"16.7.0-alpha.2.2": "2018-12-07T12:21:53.582Z", | ||
"16.7.0-alpha.2.3": "2018-12-17T06:55:29.788Z", | ||
"16.7.0-alpha.2.4": "2018-12-19T09:23:40.548Z", | ||
"16.7.0": "2018-12-20T09:22:04.981Z", | ||
"16.8.0-alpha.0": "2019-01-10T04:39:04.893Z", | ||
"16.8.1": "2019-02-07T00:17:32.764Z", | ||
"16.8.2": "2019-02-18T21:58:30.554Z", | ||
"16.8.3": "2019-02-25T21:15:23.701Z", | ||
"16.8.4": "2019-03-07T09:04:23.315Z", | ||
"16.8.5": "2019-03-25T11:19:27.329Z", | ||
"16.8.6": "2019-03-28T09:32:06.816Z" | ||
}, | ||
"maintainers": [{ "name": "kashey", "email": "thekashey@gmail.com" }], | ||
"description": "The Hot version of React-DOM", | ||
"homepage": "https://github.com/hot-loader/react-dom#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/hot-loader/react-dom.git" | ||
}, | ||
"bugs": { "url": "https://github.com/hot-loader/react-dom/issues" }, | ||
"license": "MIT", | ||
"readmeFilename": "README.md", | ||
"keywords": ["HMR", "react", "hot-loader"], | ||
"version": "latest" | ||
} | ||
} | ||
*/ | ||
} |
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,231 @@ | ||
const child_process = require("child_process"); | ||
const semver = require("semver"); | ||
const path = require("path"); | ||
const fs = require("fs-extra"); | ||
const OUR_RC_DIST_TAG = "rc"; | ||
const basePackageJSON = require("../source/package.base.json"); | ||
const { | ||
default: { patch } | ||
// @ts-ignore | ||
} = require("react-hot-loader/webpack"); | ||
|
||
/** | ||
* Install the given react-dom version, patch it, and return the path to the patched package. | ||
* | ||
* @param {string} stagingArea | ||
* @param {string} version | ||
*/ | ||
async function getAndPatchGivenReactDOMVersion(stagingArea, version) { | ||
const wd = path.resolve(stagingArea, version); | ||
await fs.emptyDir(wd); | ||
const originalDir = path.resolve(wd, "source"); | ||
const targetDir = path.resolve(wd, "target"); | ||
|
||
await fs.mkdirp(originalDir); | ||
await fs.mkdirp(targetDir); | ||
|
||
// create new local package.json for isolation | ||
await execFile("yarn", ["init", "-y"], originalDir); | ||
// install react so avoid yarn peer warnings | ||
await execFile( | ||
"yarn", | ||
[ | ||
"add", | ||
"react", | ||
"--no-lockfile" | ||
], | ||
originalDir | ||
); | ||
await execFile( | ||
"yarn", | ||
[ | ||
"add", | ||
"react-dom", | ||
"--no-lockfile" | ||
// "--modules-folder", "lalal" | ||
], | ||
originalDir | ||
); | ||
|
||
const reactDOMPath = path.resolve(originalDir, "node_modules", "react-dom"); | ||
|
||
const patchedFiles = await patchWork(reactDOMPath, targetDir); | ||
|
||
if (patchedFiles.length < 2) { | ||
throw new Error("expected to patch at least 2 files"); | ||
} | ||
|
||
// console.debug(patchedFiles); | ||
return targetDir; | ||
} | ||
|
||
/** | ||
* Checks on npm registry if the latest published version of react-dom is newer than our latest published package, | ||
* In the latest or rc dist tags. | ||
*/ | ||
async function doesReactDOMHasNewerVersionThanUs() { | ||
const [ourRCVersion, ourLatestVersion, reactDOMVersion] = await Promise.all([ | ||
getVersionInDistTagOfPackage("@hot-loader/react-dom", OUR_RC_DIST_TAG), | ||
getVersionInDistTagOfPackage("@hot-loader/react-dom", "latest"), | ||
getVersionInDistTagOfPackage("react-dom", "latest") | ||
]); | ||
|
||
// seems like react-dom have new version! | ||
if (semver.gt(reactDOMVersion, ourLatestVersion)) { | ||
if (semver.gte(ourRCVersion, reactDOMVersion)) { | ||
// Ah no, we have a version waiting in our RC tag | ||
return false; | ||
} | ||
|
||
return reactDOMVersion; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** | ||
* (In npm) returns the version that the given dist tag points to, on the given package | ||
* @param {string} packageName | ||
* @param {string} distTag | ||
*/ | ||
async function getVersionInDistTagOfPackage(packageName, distTag) { | ||
// yarn info @hot-loader/react-dom@latest --json | ||
/** | ||
* @type {import("./interfaces").yarnInfoJsonResponse} | ||
*/ | ||
const json = JSON.parse( | ||
await execFile("yarn", ["info", packageName, "--json"]) | ||
); | ||
const distTagPointsTo = json.data["dist-tags"][distTag]; | ||
|
||
if (!distTagPointsTo) { | ||
throw new Error("Given dist tag not found"); | ||
} | ||
|
||
return distTagPointsTo; | ||
} | ||
|
||
/** | ||
* promisified version of child_process.execFile | ||
* | ||
* @param {string} file | ||
* @param {readonly string[] | null | undefined} args | ||
* @param {string} [cwd] | ||
* @returns {Promise<string>} | ||
*/ | ||
async function execFile(file, args, cwd) { | ||
return new Promise((res, rej) => { | ||
child_process.execFile( | ||
file, | ||
args, | ||
{ timeout: 2000, cwd }, | ||
(error, stdout, stderr) => { | ||
if (error) { | ||
rej(error); | ||
} else { | ||
res(stdout); | ||
} | ||
} | ||
); | ||
}); | ||
} | ||
|
||
/** | ||
* Apply the needed patches on the given react-dom installation, | ||
* And put the results to the given targetDir | ||
* returns the number of file changed | ||
* | ||
* @param {string} originalDirOrReactDOMPackage | ||
* @param {string} targetDir | ||
*/ | ||
async function patchWork(originalDirOrReactDOMPackage, targetDir) { | ||
const pkg = require(path.resolve(originalDirOrReactDOMPackage, "package.json")); | ||
|
||
await fs.mkdirp(targetDir); | ||
const patchedFiles = await copyAndPatchDirectory( | ||
originalDirOrReactDOMPackage, | ||
targetDir | ||
); | ||
|
||
// was doing nothing (?) | ||
// await copyAndPatchDirectory("../source", "../node_modules/react-dom/", "../target"); | ||
|
||
await fs.writeFile( | ||
path.resolve(targetDir, "package.json"), | ||
JSON.stringify( | ||
filterPackage(Object.assign(pkg, basePackageJSON)), | ||
null, | ||
" " | ||
) | ||
); | ||
|
||
return patchedFiles; | ||
|
||
} | ||
|
||
/** | ||
* @param {string} source | ||
* @param {string} dest | ||
*/ | ||
async function copyAndMaybePatchFile(source, dest) { | ||
const data = (await fs.readFile(source)).toString(); | ||
const patchedData = await patch(data); | ||
await fs.writeFile(dest, patchedData || data); | ||
|
||
return patchedData !== data; | ||
} | ||
|
||
/** | ||
* @param {string} source | ||
* @param {string} target | ||
*/ | ||
async function copyAndPatchDirectory(source, target) { | ||
/** @type {string[]} */ | ||
const patchedFiles = []; | ||
|
||
const list = await fs.readdir(source); | ||
|
||
for (const i of list) { | ||
const sourceFile = path.resolve(source, i); | ||
const targetFile = path.resolve(target, i); | ||
|
||
const stat = await fs.stat(sourceFile); | ||
if (stat.isDirectory()) { | ||
try { | ||
await fs.mkdir(path.resolve(target, i)); | ||
} catch (e) {} | ||
|
||
patchedFiles.push(...await copyAndPatchDirectory(sourceFile, targetFile)) | ||
} else { | ||
if (await copyAndMaybePatchFile(sourceFile, targetFile)) { | ||
patchedFiles.push(targetFile); | ||
} | ||
} | ||
} | ||
|
||
return patchedFiles; | ||
} | ||
|
||
/** | ||
* @param {{ [x: string]: any; }} pkg | ||
*/ | ||
function filterPackage(pkg) { | ||
return Object.keys(pkg).reduce( | ||
(acc, key) => | ||
key[0] === "_" | ||
? acc | ||
: { | ||
...acc, | ||
[key]: pkg[key] | ||
}, | ||
{} | ||
); | ||
} | ||
|
||
|
||
module.exports = { | ||
getAndPatchGivenReactDOMVersion, | ||
doesReactDOMHasNewerVersionThanUs, | ||
getVersionInDistTagOfPackage, | ||
execFile | ||
}; |
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,98 @@ | ||
const { | ||
getAndPatchGivenReactDOMVersion, | ||
doesReactDOMHasNewerVersionThanUs | ||
} = require("./utils"); | ||
const { resolve } = require("path"); | ||
const child_process = require("child_process"); | ||
|
||
/** | ||
* @type {typeof child_process} | ||
*/ | ||
const actualChildProcess = jest.requireActual("child_process"); | ||
|
||
jest.mock( | ||
"child_process", | ||
() => { | ||
return { | ||
execFile: jest.fn() | ||
}; | ||
}, | ||
{ | ||
virtual: true | ||
} | ||
); | ||
|
||
describe("Auto publish utils", () => { | ||
afterEach(() => { | ||
// @ts-ignore | ||
child_process.execFile.mockClear(); | ||
}); | ||
|
||
test("Run getAndPatchGivenVersion and don't crash", async () => { | ||
const stagingArea = resolve(__dirname, "staging-area-for-test"); | ||
|
||
// @ts-ignore | ||
child_process.execFile.mockImplementation((...args) => { | ||
// @ts-ignore | ||
return actualChildProcess.execFile(...args); | ||
}); | ||
|
||
await getAndPatchGivenReactDOMVersion(stagingArea, "16.8.6"); | ||
}); | ||
|
||
test("doesReactDOMHasNewerVersionThanUs - no! RC is ready", async () => { | ||
const returnValues = [ | ||
{ rc: "2.0.0" }, | ||
{ latest: "1.0.0" }, | ||
{ latest: "2.0.0" } | ||
]; | ||
|
||
// @ts-ignore | ||
child_process.execFile.mockImplementation((a, b, c, callback) => { | ||
callback( | ||
false, | ||
JSON.stringify({ data: { "dist-tags": returnValues.shift() } }) | ||
); | ||
}); | ||
|
||
expect(await doesReactDOMHasNewerVersionThanUs()).toEqual(false); | ||
|
||
expect(child_process.execFile).toMatchSnapshot("Correct params passed to execFile"); | ||
}); | ||
|
||
test("doesReactDOMHasNewerVersionThanUs - no! our latest is updated", async () => { | ||
const returnValues = [ | ||
{ rc: "1.0.0" }, | ||
{ latest: "2.0.0" }, | ||
{ latest: "2.0.0" } | ||
]; | ||
|
||
// @ts-ignore | ||
child_process.execFile.mockImplementation((a, b, c, callback) => { | ||
callback( | ||
false, | ||
JSON.stringify({ data: { "dist-tags": returnValues.shift() } }) | ||
); | ||
}); | ||
|
||
expect(await doesReactDOMHasNewerVersionThanUs()).toEqual(false); | ||
}); | ||
|
||
test("doesReactDOMHasNewerVersionThanUs - yes! 2.0.0", async () => { | ||
const returnValues = [ | ||
{ rc: "1.1.0" }, | ||
{ latest: "1.0.0" }, | ||
{ latest: "2.0.0" } | ||
]; | ||
|
||
// @ts-ignore | ||
child_process.execFile.mockImplementation((a, b, c, callback) => { | ||
callback( | ||
false, | ||
JSON.stringify({ data: { "dist-tags": returnValues.shift() } }) | ||
); | ||
}); | ||
|
||
expect(await doesReactDOMHasNewerVersionThanUs()).toEqual("2.0.0"); | ||
}); | ||
}); |
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,185 @@ | ||
// For a detailed explanation regarding each configuration property, visit: | ||
// https://jestjs.io/docs/en/configuration.html | ||
|
||
module.exports = { | ||
// All imported modules in your tests should be mocked automatically | ||
// automock: false, | ||
|
||
// Stop running tests after `n` failures | ||
// bail: 0, | ||
|
||
// Respect "browser" field in package.json when resolving modules | ||
// browser: false, | ||
|
||
// The directory where Jest should store its cached dependency information | ||
// cacheDirectory: "/private/var/folders/ps/3nk6jjbn7b75s2d29scw0j7c0000gn/T/jest_dx", | ||
|
||
// Automatically clear mock calls and instances between every test | ||
// clearMocks: false, | ||
|
||
// Indicates whether the coverage information should be collected while executing the test | ||
// collectCoverage: false, | ||
|
||
// An array of glob patterns indicating a set of files for which coverage information should be collected | ||
// collectCoverageFrom: null, | ||
|
||
// The directory where Jest should output its coverage files | ||
// coverageDirectory: null, | ||
|
||
// An array of regexp pattern strings used to skip coverage collection | ||
// coveragePathIgnorePatterns: [ | ||
// "/node_modules/" | ||
// ], | ||
|
||
// A list of reporter names that Jest uses when writing coverage reports | ||
// coverageReporters: [ | ||
// "json", | ||
// "text", | ||
// "lcov", | ||
// "clover" | ||
// ], | ||
|
||
// An object that configures minimum threshold enforcement for coverage results | ||
// coverageThreshold: null, | ||
|
||
// A path to a custom dependency extractor | ||
// dependencyExtractor: null, | ||
|
||
// Make calling deprecated APIs throw helpful error messages | ||
// errorOnDeprecated: false, | ||
|
||
// Force coverage collection from ignored files using an array of glob patterns | ||
// forceCoverageMatch: [], | ||
|
||
// A path to a module which exports an async function that is triggered once before all test suites | ||
// globalSetup: null, | ||
|
||
// A path to a module which exports an async function that is triggered once after all test suites | ||
// globalTeardown: null, | ||
|
||
// A set of global variables that need to be available in all test environments | ||
// globals: {}, | ||
|
||
// An array of directory names to be searched recursively up from the requiring module's location | ||
// moduleDirectories: [ | ||
// "node_modules" | ||
// ], | ||
|
||
// An array of file extensions your modules use | ||
// moduleFileExtensions: [ | ||
// "js", | ||
// "json", | ||
// "jsx", | ||
// "ts", | ||
// "tsx", | ||
// "node" | ||
// ], | ||
|
||
// A map from regular expressions to module names that allow to stub out resources with a single module | ||
// moduleNameMapper: {}, | ||
|
||
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader | ||
// modulePathIgnorePatterns: [], | ||
|
||
// Activates notifications for test results | ||
// notify: false, | ||
|
||
// An enum that specifies notification mode. Requires { notify: true } | ||
// notifyMode: "failure-change", | ||
|
||
// A preset that is used as a base for Jest's configuration | ||
// preset: null, | ||
|
||
// Run tests from one or more projects | ||
// projects: null, | ||
|
||
// Use this configuration option to add custom reporters to Jest | ||
// reporters: undefined, | ||
|
||
// Automatically reset mock state between every test | ||
// resetMocks: false, | ||
|
||
// Reset the module registry before running each individual test | ||
// resetModules: false, | ||
|
||
// A path to a custom resolver | ||
// resolver: null, | ||
|
||
// Automatically restore mock state between every test | ||
// restoreMocks: false, | ||
|
||
// The root directory that Jest should scan for tests and modules within | ||
// rootDir: null, | ||
|
||
// A list of paths to directories that Jest should use to search for files in | ||
// roots: [ | ||
// "<rootDir>" | ||
// ], | ||
|
||
// Allows you to use a custom runner instead of Jest's default test runner | ||
// runner: "jest-runner", | ||
|
||
// The paths to modules that run some code to configure or set up the testing environment before each test | ||
// setupFiles: [], | ||
|
||
// A list of paths to modules that run some code to configure or set up the testing framework before each test | ||
// setupFilesAfterEnv: [], | ||
|
||
// A list of paths to snapshot serializer modules Jest should use for snapshot testing | ||
// snapshotSerializers: [], | ||
|
||
// The test environment that will be used for testing | ||
testEnvironment: "node", | ||
|
||
// Options that will be passed to the testEnvironment | ||
// testEnvironmentOptions: {}, | ||
|
||
// Adds a location field to test results | ||
// testLocationInResults: false, | ||
|
||
// The glob patterns Jest uses to detect test files | ||
// testMatch: [ | ||
// "**/__tests__/**/*.[jt]s?(x)", | ||
// "**/?(*.)+(spec|test).[tj]s?(x)" | ||
// ], | ||
|
||
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped | ||
// testPathIgnorePatterns: [ | ||
// "/node_modules/" | ||
// ], | ||
|
||
// The regexp pattern or array of patterns that Jest uses to detect test files | ||
// testRegex: [], | ||
|
||
// This option allows the use of a custom results processor | ||
// testResultsProcessor: null, | ||
|
||
// This option allows use of a custom test runner | ||
// testRunner: "jasmine2", | ||
|
||
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href | ||
// testURL: "http://localhost", | ||
|
||
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout" | ||
// timers: "real", | ||
|
||
// A map from regular expressions to paths to transformers | ||
// transform: null, | ||
|
||
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation | ||
// transformIgnorePatterns: [ | ||
// "/node_modules/" | ||
// ], | ||
|
||
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them | ||
// unmockedModulePathPatterns: undefined, | ||
|
||
// Indicates whether each individual test should be reported during the run | ||
// verbose: null, | ||
|
||
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode | ||
// watchPathIgnorePatterns: [], | ||
|
||
// Whether to use watchman for file crawling | ||
// watchman: 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 was deleted.
Oops, something went wrong.
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,65 @@ | ||
{ | ||
"compilerOptions": { | ||
/* Basic Options */ | ||
// "incremental": true, /* Enable incremental compilation */ | ||
"target": "es2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ | ||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ | ||
"lib": ["es2018"], /* Specify library files to be included in the compilation. */ | ||
"allowJs": true, /* Allow javascript files to be compiled. */ | ||
"checkJs": true, /* Report errors in .js files. */ | ||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ | ||
// "declaration": true, /* Generates corresponding '.d.ts' file. */ | ||
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ | ||
// "sourceMap": true, /* Generates corresponding '.map' file. */ | ||
// "outFile": "./", /* Concatenate and emit output to single file. */ | ||
"outDir": "./dist", /* Redirect output structure to the directory. */ | ||
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ | ||
// "composite": true, /* Enable project compilation */ | ||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ | ||
// "removeComments": true, /* Do not emit comments to output. */ | ||
"noEmit": true, /* Do not emit outputs. */ | ||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */ | ||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ | ||
"isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ | ||
|
||
/* Strict Type-Checking Options */ | ||
"strict": true, /* Enable all strict type-checking options. */ | ||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ | ||
// "strictNullChecks": true, /* Enable strict null checks. */ | ||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */ | ||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ | ||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ | ||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ | ||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ | ||
|
||
/* Additional Checks */ | ||
// "noUnusedLocals": true, /* Report errors on unused locals. */ | ||
// "noUnusedParameters": true, /* Report errors on unused parameters. */ | ||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ | ||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ | ||
|
||
/* Module Resolution Options */ | ||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ | ||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ | ||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ | ||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ | ||
// "typeRoots": [], /* List of folders to include type definitions from. */ | ||
"types": ["@types/node", "@types/jest"], /* Type declaration files to be included in compilation. */ | ||
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ | ||
// "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ | ||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ | ||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ | ||
|
||
/* Source Map Options */ | ||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ | ||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ | ||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ | ||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ | ||
|
||
/* Experimental Options */ | ||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ | ||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ | ||
"resolveJsonModule": true | ||
}, | ||
"include": ["auto-publish"] | ||
} |