From 023f2270e720a2f773a0e46add2f0c4bfb90d750 Mon Sep 17 00:00:00 2001 From: cenfun Date: Sat, 21 Sep 2024 15:36:38 +0800 Subject: [PATCH] doc TS --- README.md | 25 +++++++++++++------------ README.zh-Hans.md | 24 +++++++++++++----------- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 8d334b8..f32d215 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,7 @@ - [TestCafe](#testcafe) - [Selenium Webdriver](#selenium-webdriver) - [Mocha](#mocha) - - [tsx](#tsx) - - [ts-node](#ts-node) + - [TypeScript](#typescript) - [AVA](#ava) - [Codecov](#codecov) - [Codacy](#codacy) @@ -776,8 +775,7 @@ mcr -c mcr.config.js -- sub-cli -c sub-cli.config.js - Examples - [Mocha](#mocha) - - [tsx](#tsx) - - [ts-node](#ts-node) + - [TypeScript](#typescript) - [AVA](#ava) ## Config File @@ -1034,19 +1032,22 @@ c8 --experimental-monocart --reporter=v8 --reporter=console-details node foo.js ```sh mcr mocha ./test/**/*.js ``` + +### [TypeScript](https://github.com/microsoft/typescript) + +- [tsx](https://github.com/privatenumber/tsx) ```sh +cross-env NODE_OPTIONS="--import tsx" npx mcr tsx ./src/example.ts +cross-env NODE_OPTIONS="--import tsx" npx mcr mocha ./test/**/*.ts +# Node.js v20.6.0 + +mcr --import tsx tsx ./src/example.ts mcr --import tsx mocha ./test/**/*.ts ``` -- see [mcr-tsx](https://github.com/cenfun/mcr-tsx) - -### [tsx](https://github.com/privatenumber/tsx) +- [ts-node](https://github.com/TypeStrong/ts-node) ```sh -mcr --import tsx tsx ./src/example.ts +cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr ts-node ./src/example.ts +cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr mocha ./test/**/*.ts ``` -- see [mcr-tsx](https://github.com/cenfun/mcr-tsx) - -### [ts-node](https://github.com/TypeStrong/ts-node) -- see [mcr-ts-node](https://github.com/cenfun/mcr-ts-node) ### [AVA](https://github.com/avajs/ava) ```sh diff --git a/README.zh-Hans.md b/README.zh-Hans.md index 3dbd799..b3ea8ee 100644 --- a/README.zh-Hans.md +++ b/README.zh-Hans.md @@ -53,8 +53,7 @@ - [TestCafe](#testcafe) - [Selenium Webdriver](#selenium-webdriver) - [Mocha](#mocha) - - [tsx](#tsx) - - [ts-node](#ts-node) + - [TypeScript](#typescript) - [AVA](#ava) - [Codecov](#codecov) - [Codacy](#codacy) @@ -779,8 +778,7 @@ mcr -c mcr.config.js -- sub-cli -c sub-cli.config.js - 参见例子 - [Mocha](#mocha) - - [tsx](#tsx) - - [ts-node](#ts-node) + - [TypeScript](#typescript) - [AVA](#ava) ## Config File @@ -1038,19 +1036,23 @@ c8 --experimental-monocart --reporter=v8 --reporter=console-details node foo.js ```sh mcr mocha ./test/**/*.js ``` + +### [TypeScript](https://github.com/microsoft/typescript) + +- [tsx](https://github.com/privatenumber/tsx) ```sh +cross-env NODE_OPTIONS="--import tsx" npx mcr tsx ./src/example.ts +cross-env NODE_OPTIONS="--import tsx" npx mcr mocha ./test/**/*.ts +# Node.js v20.6.0 + +mcr --import tsx tsx ./src/example.ts mcr --import tsx mocha ./test/**/*.ts ``` -- see [mcr-tsx](https://github.com/cenfun/mcr-tsx) - -### [tsx](https://github.com/privatenumber/tsx) +- [ts-node](https://github.com/TypeStrong/ts-node) ```sh -mcr --import tsx tsx ./src/example.ts +cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr ts-node ./src/example.ts +cross-env NODE_OPTIONS="--loader ts-node/esm --no-warnings" npx mcr mocha ./test/**/*.ts ``` -- see [mcr-tsx](https://github.com/cenfun/mcr-tsx) -### [ts-node](https://github.com/TypeStrong/ts-node) -- see [mcr-ts-node](https://github.com/cenfun/mcr-ts-node) ### [AVA](https://github.com/avajs/ava) ```sh