Release v1.0.6

This commit is contained in:
svartalf 2020-03-24 16:26:10 +03:00
parent 8e14415dec
commit b2417cde72
17 changed files with 1905 additions and 923 deletions

19
.eslintrc.json Normal file
View File

@ -0,0 +1,19 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier",
"prettier/@typescript-eslint"
],
"rules": {
"@typescript-eslint/ban-ts-ignore": "off"
}
}

3
.github/FUNDING.yml vendored
View File

@ -1,3 +0,0 @@
liberapay: svartalf
patreon: svartalf
custom: ["https://svartalf.info/donate/", "https://www.buymeacoffee.com/svartalf"]

View File

@ -13,6 +13,7 @@ jobs:
- uses: actions/checkout@v1 - uses: actions/checkout@v1
- run: npm ci - run: npm ci
- run: npm run lint
- run: npm run build - run: npm run build
- run: npm run test - run: npm run test

View File

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
- Pass `allow-downgrade` flag to `rustup` if `nightly` toolchain with components requested
## [1.0.5] - 2020-01-26 ## [1.0.5] - 2020-01-26
### Fixed ### Fixed

View File

@ -1,11 +1,27 @@
# `rust-toolchain` Action # `rust-toolchain` Action
[![Sponsoring](https://img.shields.io/badge/Support%20it-Say%20%22Thank%20you!%22-blue)](https://actions-rs.github.io/#sponsoring)
![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg) ![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)
[![Gitter](https://badges.gitter.im/actions-rs/community.svg)](https://gitter.im/actions-rs/community) [![Gitter](https://badges.gitter.im/actions-rs/community.svg)](https://gitter.im/actions-rs/community)
![Continuous integration](https://github.com/actions-rs/toolchain/workflows/Continuous%20integration/badge.svg)
![Dependabot enabled](https://api.dependabot.com/badges/status?host=github&repo=actions-rs/toolchain)
This GitHub Action installs [Rust toolchain](https://github.com/rust-lang/rustup.rs#toolchain-specification). This GitHub Action installs [Rust toolchain](https://github.com/rust-lang/rustup.rs#toolchain-specification)
with [rustup](https://github.com/rust-lang/rustup) help.
Optionally it can set installed toolchain as a default and as an override for current directory. It supports additional targets, components and profiles and handles all
these small papercuts from you.
**Table of Contents**
* [Example workflow](#example-workflow)
* [Inputs](#inputs)
* [Outputs](#outputs)
* [Profiles](#profiles)
* [Components](#components)
* [The toolchain file](#the-toolchain-file)
* [License](#license)
* [Contribute and support](#contribute-and-support)
## Example workflow ## Example workflow
@ -25,9 +41,10 @@ jobs:
with: with:
toolchain: nightly toolchain: nightly
override: true override: true
components: rustfmt, clippy
# `cargo check` command here will use installed `nightly` # `cargo check` command here will use installed `nightly`
# as it set as an "override" for current directory # as it is set as an "override" for current directory
- name: Run cargo check - name: Run cargo check
uses: actions-rs/cargo@v1 uses: actions-rs/cargo@v1
@ -115,7 +132,15 @@ to install the minimal set of `nightly` toolchain components with the `rustfmt`
components: rustfmt, clippy components: rustfmt, clippy
``` ```
Same to the `profile` input, if the installed `rustup` does not supports "components", In case if `nightly` toolchain is requested and one of the components is missing in
latest `nightly` release, this Action will attempt the downgrade till it find
the most recent `nightly` with all components needed.\
Note that this behavior will work only if the following two conditions apply:
1. `toolchain` input is `nightly` exactly.
2. At least one component is provided in `components` input.
Same to the `profile` input, if installed `rustup` does not supports "components",
it will be automatically upgraded by this Action. it will be automatically upgraded by this Action.
## The toolchain file ## The toolchain file
@ -123,11 +148,22 @@ it will be automatically upgraded by this Action.
This Action supports [toolchain files](https://github.com/rust-lang/rustup#the-toolchain-file), This Action supports [toolchain files](https://github.com/rust-lang/rustup#the-toolchain-file),
so it is not necessary to use `toolchain` input anymore. so it is not necessary to use `toolchain` input anymore.
Input has higher priority, so if you are want to use toolchain file, you need to remove the input from the workflow file. Input has higher priority, so if you are want to use toolchain file,
you need to remove the input from the workflow file.
If neither `toolchain` input or `rust-toolchain` file are provided, Action execution will fail. If neither `toolchain` input or `rust-toolchain` file are provided,
Action execution will fail.
## Notes ## License
As `rustup` is not installed by default for [macOS environments](https://help.github.com/en/articles/virtual-environments-for-github-actions) This Action is distributed under the terms of the MIT license, see [LICENSE](https://github.com/actions-rs/toolchain/blob/master/LICENSE) for details.
at the moment (2019-09-13), this Action will try its best to install it before any other operations.
## Contribute and support
Any contributions are welcomed!
If you want to report a bug or have a feature request,
check the [Contributing guide](https://github.com/actions-rs/.github/blob/master/CONTRIBUTING.md).
You can also support author by funding the ongoing project work,
see [Sponsoring](https://actions-rs.github.io/#sponsoring).

View File

@ -1,65 +1,74 @@
import {toolchain_args} from "../src/args"; import { getToolchainArgs } from "../src/args";
import {morph} from "mock-env" import { morph } from "mock-env";
import {sync as tempWriteSync} from "temp-write" import { sync as tempWriteSync } from "temp-write";
describe('actions-rs/toolchain', () => { describe("actions-rs/toolchain", () => {
it('Parses action input into toolchain options', async () => { it("Parses action input into toolchain options", () => {
let args = morph(() => { const args = morph(
return toolchain_args("./rust-toolchain"); () => {
}, { return getToolchainArgs("./rust-toolchain");
'INPUT_TOOLCHAIN': 'nightly-2019-04-20', },
'INPUT_DEFAULT': 'false', {
'INPUT_OVERRIDE': 'true' INPUT_TOOLCHAIN: "nightly-2019-04-20",
}); INPUT_DEFAULT: "false",
INPUT_OVERRIDE: "true",
}
);
expect(args.name).toBe('nightly-2019-04-20'); expect(args.name).toBe("nightly-2019-04-20");
expect(args.default).toBe(false); expect(args.default).toBe(false);
expect(args.override).toBe(true); expect(args.override).toBe(true);
}); });
it('uses input variable if rust-toolchain file does not exist', function () { it("uses input variable if rust-toolchain file does not exist", function () {
let args = morph(() => { const args = morph(
return toolchain_args("./rust-toolchain"); () => {
}, { return getToolchainArgs("./rust-toolchain");
'INPUT_TOOLCHAIN': 'nightly', },
}); {
INPUT_TOOLCHAIN: "nightly",
}
);
expect(args.name).toBe("nightly") expect(args.name).toBe("nightly");
}); });
it('toolchain input is required if rust-toolchain does not exist', function () { it("toolchain input is required if rust-toolchain does not exist", function () {
expect(() => toolchain_args("./rust-toolchain")).toThrowError() expect(() => getToolchainArgs("./rust-toolchain")).toThrowError();
}); });
it('prioritizes rust-toolchain file over input variable', function () { it("prioritizes rust-toolchain file over input variable", function () {
let rustToolchainFile = tempWriteSync("1.39.0"); const rustToolchainFile = tempWriteSync("1.39.0");
let args = morph(() => { const args = morph(
return toolchain_args(rustToolchainFile); () => {
}, { return getToolchainArgs(rustToolchainFile);
'INPUT_TOOLCHAIN': 'nightly', },
}); {
INPUT_TOOLCHAIN: "nightly",
}
);
expect(args.name).toBe("nightly") expect(args.name).toBe("nightly");
}); });
it('uses rust-toolchain file if input does not exist', function () { it("uses rust-toolchain file if input does not exist", function () {
let rustToolchainFile = tempWriteSync("1.39.0"); const rustToolchainFile = tempWriteSync("1.39.0");
let args = morph(() => { const args = morph(() => {
return toolchain_args(rustToolchainFile); return getToolchainArgs(rustToolchainFile);
}, {}); }, {});
expect(args.name).toBe("1.39.0") expect(args.name).toBe("1.39.0");
}); });
it('trims content of the override file', function () { it("trims content of the override file", function () {
let rustToolchainFile = tempWriteSync("\n 1.39.0\n\n\n\n"); const rustToolchainFile = tempWriteSync("\n 1.39.0\n\n\n\n");
let args = morph(() => { const args = morph(() => {
return toolchain_args(rustToolchainFile); return getToolchainArgs(rustToolchainFile);
}, {}); }, {});
expect(args.name).toBe("1.39.0") expect(args.name).toBe("1.39.0");
}); });
}); });

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,11 +0,0 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}

11
jest.config.json Normal file
View File

@ -0,0 +1,11 @@
{
"clearMocks": true,
"moduleFileExtensions": ["js", "ts"],
"testEnvironment": "node",
"testMatch": ["**/*.test.ts"],
"testRunner": "jest-circus/runner",
"transform": {
"^.+\\.ts$": "ts-jest"
},
"verbose": true
}

2240
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "rust-toolchain", "name": "rust-toolchain",
"version": "1.0.5", "version": "1.0.6",
"private": false, "private": false,
"description": "Install the Rust toolchain", "description": "Install the Rust toolchain",
"main": "lib/main.js", "main": "lib/main.js",
@ -9,10 +9,12 @@
"test": "__tests__" "test": "__tests__"
}, },
"scripts": { "scripts": {
"build": "ncc build src/main.ts --minify", "build": "rm -rf ./dist/* && ncc build src/main.ts --minify",
"watch": "ncc build src/main.ts --watch", "format": "prettier --write 'src/**/*.ts' '__tests__/**/*.ts'",
"pretest": "git config core.hooksPath .githooks", "lint": "tsc --noEmit && eslint 'src/**/*.ts' '__tests__/**/*.ts'",
"test": "jest" "watch": "rm -rf ./dist/* && ncc build src/main.ts --watch",
"test": "jest -c jest.config.json",
"pretest": "git config core.hooksPath .githooks"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -30,21 +32,27 @@
"url": "https://github.com/actions-rs/toolchain/issues" "url": "https://github.com/actions-rs/toolchain/issues"
}, },
"dependencies": { "dependencies": {
"@actions-rs/core": "^0.0.8", "@actions-rs/core": "^0.0.9",
"@actions/core": "^1.2.2", "@actions/core": "^1.2.3",
"@actions/exec": "^1.0.3", "@actions/exec": "^1.0.3",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2"
"npm-check-updates": "^4.0.1"
}, },
"devDependencies": { "devDependencies": {
"temp-write": "^4.0.0", "@types/jest": "^25.1.4",
"@types/jest": "^24.9.1", "@types/node": "^13.9.3",
"@types/node": "^13.5.0", "@typescript-eslint/eslint-plugin": "^2.25.0",
"@zeit/ncc": "^0.21.0", "@typescript-eslint/parser": "^2.25.0",
"@zeit/ncc": "^0.22.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"jest": "^25.1.0", "jest": "^25.1.0",
"jest-circus": "^25.1.0", "jest-circus": "^25.1.0",
"mock-env": "^0.2.0", "mock-env": "^0.2.0",
"ts-jest": "^25.0.0", "npm-check-updates": "^4.0.5",
"typescript": "^3.7.5" "prettier": "^2.0.2",
"temp-write": "^4.0.0",
"ts-jest": "^25.2.1",
"typescript": "^3.8.3"
} }
} }

View File

@ -1,51 +1,52 @@
import {input} from '@actions-rs/core'; import { input } from "@actions-rs/core";
import {info, debug} from "@actions/core"; import { debug } from "@actions/core";
import {existsSync, readFileSync} from 'fs'; import { existsSync, readFileSync } from "fs";
export interface ToolchainOptions { export interface ToolchainOptions {
name: string, name: string;
target: string | undefined, target: string | undefined;
default: boolean, default: boolean;
override: boolean, override: boolean;
profile: string | undefined, profile: string | undefined;
components: string[] | undefined, components: string[] | undefined;
}
export function toolchain_args(overrideFile: string): ToolchainOptions {
let components: string[] | undefined = input.getInputList('components');
if (components && components.length === 0) {
components = undefined;
}
return {
name: determineToolchain(overrideFile),
target: input.getInput('target') || undefined,
default: input.getInputBool('default'),
override: input.getInputBool('override'),
profile: input.getInput('profile') || undefined,
components: components,
};
} }
function determineToolchain(overrideFile: string): string { function determineToolchain(overrideFile: string): string {
const toolchainInput = input.getInput("toolchain", { required: false });
const toolchainInput = input.getInput('toolchain', {required: false});
if (toolchainInput) { if (toolchainInput) {
debug(`using toolchain from input: ${toolchainInput}`); debug(`using toolchain from input: ${toolchainInput}`);
return toolchainInput return toolchainInput;
} }
if (!existsSync(overrideFile)) { if (!existsSync(overrideFile)) {
throw new Error("toolchain input was not given and repository does not have a rust-toolchain file") throw new Error(
"toolchain input was not given and repository does not have a rust-toolchain file"
);
} }
const rustToolchainFile = readFileSync(overrideFile, { const rustToolchainFile = readFileSync(overrideFile, {
encoding: "utf-8", encoding: "utf-8",
flag: "r" flag: "r",
}).trim(); }).trim();
debug(`using toolchain from rust-toolchain file: ${rustToolchainFile}`); debug(`using toolchain from rust-toolchain file: ${rustToolchainFile}`);
return rustToolchainFile; return rustToolchainFile;
} }
export function getToolchainArgs(overrideFile: string): ToolchainOptions {
let components: string[] | undefined = input.getInputList("components");
if (components && components.length === 0) {
components = undefined;
}
return {
name: determineToolchain(overrideFile),
target: input.getInput("target") || undefined,
default: input.getInputBool("default"),
override: input.getInputBool("override"),
profile: input.getInput("profile") || undefined,
components: components,
};
}

View File

@ -1,29 +1,27 @@
import * as core from '@actions/core'; import * as core from "@actions/core";
import * as exec from '@actions/exec';
import * as io from '@actions/io';
import path from "path"; import path from "path";
import * as args from './args'; import * as args from "./args";
import * as versions from './versions'; import * as versions from "./versions";
import {RustUp, ToolchainOptions} from '@actions-rs/core'; import { RustUp, ToolchainOptions } from "@actions-rs/core";
async function run() { async function run(): Promise<void> {
// we use path.join to make sure this works on Windows, Linux and MacOS // we use path.join to make sure this works on Windows, Linux and MacOS
let toolchainOverrideFile = path.join(process.cwd(), "rust-toolchain"); const toolchainOverridePath = path.join(process.cwd(), "rust-toolchain");
const opts = args.toolchain_args(toolchainOverrideFile); const opts = args.getToolchainArgs(toolchainOverridePath);
const rustup = await RustUp.getOrInstall(); const rustup = await RustUp.getOrInstall();
await rustup.call(['show']); await rustup.call(["show"]);
let shouldSelfUpdate = false; let shouldSelfUpdate = false;
if (opts.profile && !await rustup.supportProfiles()) { if (opts.profile && !(await rustup.supportProfiles())) {
shouldSelfUpdate = true; shouldSelfUpdate = true;
} }
if (opts.components && !await rustup.supportComponents()) { if (opts.components && !(await rustup.supportComponents())) {
shouldSelfUpdate = true; shouldSelfUpdate = true;
} }
if (shouldSelfUpdate) { if (shouldSelfUpdate) {
core.startGroup('Updating rustup'); core.startGroup("Updating rustup");
try { try {
await rustup.selfUpdate(); await rustup.selfUpdate();
} finally { } finally {
@ -32,11 +30,11 @@ async function run() {
} }
if (opts.profile) { if (opts.profile) {
//@ts-ignore // @ts-ignore: TS2345
await rustup.setProfile(opts.profile); await rustup.setProfile(opts.profile);
} }
let installOptions: ToolchainOptions = { const installOptions: ToolchainOptions = {
default: opts.default, default: opts.default,
override: opts.override, override: opts.override,
}; };
@ -48,6 +46,37 @@ async function run() {
if (shouldSelfUpdate) { if (shouldSelfUpdate) {
installOptions.noSelfUpdate = true; installOptions.noSelfUpdate = true;
} }
// Extra funny case.
// Due to `rustup` issue (https://github.com/rust-lang/rustup/issues/2146)
// right now installing `nightly` toolchain with extra components might fail
// if that specific `nightly` version does not have this component
// available.
//
// See https://github.com/actions-rs/toolchain/issues/53 also.
//
// By default `rustup` does not downgrade, as it does when you are
// updating already installed `nightly`, so we need to pass the
// corresponding flag manually.
//
// We are doing it only if both following conditions apply:
//
// 1. Requested toolchain is `"nightly"` (exact string match).
// 2. At least one component is requested.
//
// All other cases are not triggering automatic downgrade,
// for example, installing specific nightly version
// as in `"nightly-2020-03-20"` or `"stable"`.
//
// Motivation is that users probably want the latest one nightly
// with rustfmt and clippy (miri, etc) and they don't really care
// about what exact nightly it is.
// In case if it's not the nightly at all or it is a some specific
// nightly version, they know what they are doing.
if (opts.name == "nightly" && opts.components) {
installOptions.allowDowngrade = true;
}
await rustup.installToolchain(opts.name, installOptions); await rustup.installToolchain(opts.name, installOptions);
if (opts.target) { if (opts.target) {
@ -57,7 +86,7 @@ async function run() {
await versions.gatherInstalledVersions(); await versions.gatherInstalledVersions();
} }
async function main() { async function main(): Promise<void> {
try { try {
await run(); await run();
} catch (error) { } catch (error) {

View File

@ -1,61 +1,9 @@
import * as exec from '@actions/exec'; import * as exec from "@actions/exec";
import * as core from '@actions/core'; import * as core from "@actions/core";
export async function gatherInstalledVersions(): Promise<void> {
try {
core.startGroup('Gathering installed versions');
await rustc();
await cargo();
await rustup();
} finally {
core.endGroup();
}
}
/**
* Fetch currently used `rustc` version
*/
async function rustc(): Promise<void> {
const stdout = await getStdout('rustc', ['-V']);
try {
const version = parseFull(stdout);
core.setOutput('rustc', version.long);
core.setOutput('rustc_hash', version.hash);
} catch(e) {
core.warning(e);
core.setOutput('rustc', parseShort(stdout));
}
}
/**
* Fetch currently used `cargo` version
*/
async function cargo(): Promise<void> {
const stdout = await getStdout('cargo', ['-V']);
try {
const version = parseFull(stdout);
core.setOutput('cargo', version.long);
} catch(e) {
core.setOutput('cargo', parseShort(stdout));
}
}
async function rustup(): Promise<void> {
const stdout = await getStdout('rustup', ['-V']);
try {
const version = parseFull(stdout);
core.setOutput('rustup', version.long);
} catch(e) {
core.setOutput('rustup', parseShort(stdout));
}
}
interface Version { interface Version {
long: string, long: string;
hash: string, hash: string;
} }
/** /**
@ -69,8 +17,9 @@ interface Version {
* As a fallback, `parseShort` function can be used. * As a fallback, `parseShort` function can be used.
*/ */
function parseFull(stdout: string): Version { function parseFull(stdout: string): Version {
const regex = /\S+\s((\S+)\s\((\S+)\s(\S+)\))/m;
stdout = stdout.trim(); stdout = stdout.trim();
const matches = stdout.match(/\S+\s((\S+)\s\((\S+)\s(\S+)\))/m); const matches = regex.exec(stdout);
if (matches == null) { if (matches == null) {
throw new Error(`Unable to parse version from the "${stdout}" string`); throw new Error(`Unable to parse version from the "${stdout}" string`);
} }
@ -78,25 +27,30 @@ function parseFull(stdout: string): Version {
return { return {
long: matches[1], long: matches[1],
hash: matches[3], hash: matches[3],
} };
} }
function parseShort(stdout: string): string { function parseShort(stdout: string): string {
const regex = /\S+\s(.+)/m;
stdout = stdout.trim(); stdout = stdout.trim();
const matches = stdout.match(/\S+\s(.+)/m); const matches = regex.exec(stdout);
if (matches == null) { if (matches == null) {
core.warning(`Unable to determine version from the "${stdout}" string`); core.warning(`Unable to determine version from the "${stdout}" string`);
return ''; return "";
} else { } else {
return matches[1]; return matches[1];
} }
} }
async function getStdout(exe: string, args: string[], options?: {}): Promise<string> { async function getStdout(
let stdout = ''; exe: string,
args: string[],
options?: {}
): Promise<string> {
let stdout = "";
const resOptions = Object.assign({}, options, { const resOptions = Object.assign({}, options, {
listeners: { listeners: {
stdout: (buffer: Buffer) => { stdout: (buffer: Buffer): void => {
stdout += buffer.toString(); stdout += buffer.toString();
}, },
}, },
@ -106,3 +60,55 @@ async function getStdout(exe: string, args: string[], options?: {}): Promise<str
return stdout; return stdout;
} }
/**
* Fetch currently used `rustc` version
*/
async function rustc(): Promise<void> {
const stdout = await getStdout("rustc", ["-V"]);
try {
const version = parseFull(stdout);
core.setOutput("rustc", version.long);
core.setOutput("rustc_hash", version.hash);
} catch (e) {
core.warning(e);
core.setOutput("rustc", parseShort(stdout));
}
}
/**
* Fetch currently used `cargo` version
*/
async function cargo(): Promise<void> {
const stdout = await getStdout("cargo", ["-V"]);
try {
const version = parseFull(stdout);
core.setOutput("cargo", version.long);
} catch (e) {
core.setOutput("cargo", parseShort(stdout));
}
}
async function rustup(): Promise<void> {
const stdout = await getStdout("rustup", ["-V"]);
try {
const version = parseFull(stdout);
core.setOutput("rustup", version.long);
} catch (e) {
core.setOutput("rustup", parseShort(stdout));
}
}
export async function gatherInstalledVersions(): Promise<void> {
try {
core.startGroup("Gathering installed versions");
await rustc();
await cargo();
await rustup();
} finally {
core.endGroup();
}
}

7
tsconfig.eslint.json Normal file
View File

@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"include": [
"src/**/*.ts",
"__tests__/**/*.ts"
]
}

View File

@ -1,63 +1,32 @@
{ {
"compilerOptions": { "compilerOptions": {
/* Basic Options */ "allowJs": false,
// "incremental": true, /* Enable incremental compilation */ "checkJs": false,
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "esModuleInterop": true,
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "forceConsistentCasingInFileNames": true,
// "allowJs": true, /* Allow javascript files to be compiled. */ "module": "commonjs",
// "checkJs": true, /* Report errors in .js files. */ "moduleResolution": "node",
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ "newLine": "LF",
// "declaration": true, /* Generates corresponding '.d.ts' file. */ "noEmitOnError": true,
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ "noErrorTruncation": true,
// "sourceMap": true, /* Generates corresponding '.map' file. */ "noFallthroughCasesInSwitch": true,
// "outFile": "./", /* Concatenate and emit output to single file. */ "noImplicitAny": true,
"outDir": "./lib", /* Redirect output structure to the directory. */ "noImplicitReturns": true,
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ "noImplicitThis": true,
// "composite": true, /* Enable project compilation */ "noUnusedLocals": true,
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ "noUnusedParameters": true,
// "removeComments": true, /* Do not emit comments to output. */ "outDir": "dist",
// "noEmit": true, /* Do not emit outputs. */ "pretty": true,
// "importHelpers": true, /* Import emit helpers from 'tslib'. */ "removeComments": true,
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ "resolveJsonModule": true,
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ "strict": true,
"suppressImplicitAnyIndexErrors": false,
/* Strict Type-Checking Options */ "target": "es2018",
"strict": true, /* Enable all strict type-checking options. */ "declaration": false,
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ "sourceMap": false,
// "strictNullChecks": true, /* Enable strict null checks. */ "typeRoots": ["./types", "./node_modules/@types"]
// "strictFunctionTypes": true, /* Enable strict checking of function types. */ },
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ "include": [
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ "src/**/*.ts"
// "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": [], /* 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. */
},
"exclude": ["node_modules", "**/*.test.ts"]
} }

View File

@ -3,5 +3,5 @@ declare module "mock-env" {
callback: () => T, callback: () => T,
vars: object, vars: object,
toRemove?: string[] toRemove?: string[]
) ): any;
} }