# tkit-scripts

> > TODO: description

Latest version **3.2.2** (published 2020-02-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install tkit-scripts
pnpm add tkit-scripts
yarn add tkit-scripts
bun add tkit-scripts
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.2.2 |
| Published | 2020-02-03 |
| First published | 2019-07-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 46 |
| Unpacked size | 67.3 KB |
| Known vulnerabilities | 0 (+12 in 3 direct dependencies) |
| Install scripts | no |
| GitHub stars | 7 |
| Author | "yangqianjun" |
| Maintainers | yangqianjun |

## Links

- npm: https://www.npmjs.com/package/tkit-scripts
- Repository: https://github.com/gogoyqj/tkit
- Homepage: https://github.com/gogoyqj/tkit#readme
- Issues: https://github.com/gogoyqj/tkit/issues
- npm.io page: https://npm.io/package/tkit-scripts

## Dependencies (46)

- [less](https://npm.io/package/less.md) ^3.9.0
- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [tslib](https://npm.io/package/tslib.md) ^1.9.3
- [dotenv](https://npm.io/package/dotenv.md) ^6.2.0
- [enzyme](https://npm.io/package/enzyme.md) ^3.9.0
- [nodemon](https://npm.io/package/nodemon.md) ^1.18.10
- [postcss](https://npm.io/package/postcss.md) ^7.0.14
- [webpack](https://npm.io/package/webpack.md) 4.28.4
- [ts-loader](https://npm.io/package/ts-loader.md) ^5.3.3
- [babel-core](https://npm.io/package/babel-core.md) ^6.26.3
- [babel-jest](https://npm.io/package/babel-jest.md) ^24.1.0
- [css-loader](https://npm.io/package/css-loader.md) ^3.4.0
- [tkit-utils](https://npm.io/package/tkit-utils.md) ^3.0.0
- [typescript](https://npm.io/package/typescript.md) ^3.3.3333
- [url-loader](https://npm.io/package/url-loader.md) ^1.1.2
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.3.4
- [file-loader](https://npm.io/package/file-loader.md) ^3.0.1
- [less-loader](https://npm.io/package/less-loader.md) ^4.1.0
- [autoprefixer](https://npm.io/package/autoprefixer.md) ^9.4.9
- [babel-loader](https://npm.io/package/babel-loader.md) ^8.0.6
- [style-loader](https://npm.io/package/style-loader.md) ^0.23.1
- [dotenv-expand](https://npm.io/package/dotenv-expand.md) ^4.2.0
- [redux-actions](https://npm.io/package/redux-actions.md) ^2.6.4
- [postcss-loader](https://npm.io/package/postcss-loader.md) ^3.0.0
- [react-loadable](https://npm.io/package/react-loadable.md) ^5.5.0
- [react-dev-utils](https://npm.io/package/react-dev-utils.md) ^9.0.1
- [react-hot-loader](https://npm.io/package/react-hot-loader.md) ^4.7.1
- [redux-mock-store](https://npm.io/package/redux-mock-store.md) ^1.5.3
- [ts-import-plugin](https://npm.io/package/ts-import-plugin.md) ^1.6.1
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.3.4
- [source-map-loader](https://npm.io/package/source-map-loader.md) ^0.2.4
- [webpack-dev-server](https://npm.io/package/webpack-dev-server.md) 3.2.1
- [babel-plugin-import](https://npm.io/package/babel-plugin-import.md) ^1.12.0
- [html-webpack-plugin](https://npm.io/package/html-webpack-plugin.md) ^3.2.0
- [terser-webpack-plugin](https://npm.io/package/terser-webpack-plugin.md) ^1.3.0
- [postcss-flexbugs-fixes](https://npm.io/package/postcss-flexbugs-fixes.md) ^4.1.0
- [enzyme-adapter-react-16](https://npm.io/package/enzyme-adapter-react-16.md) ^1.10.0
- [mini-css-extract-plugin](https://npm.io/package/mini-css-extract-plugin.md) ^0.5.0
- [webpack-bundle-analyzer](https://npm.io/package/webpack-bundle-analyzer.md) ^3.0.4
- [webpack-manifest-plugin](https://npm.io/package/webpack-manifest-plugin.md) 2.0.4
- [sw-precache-webpack-plugin](https://npm.io/package/sw-precache-webpack-plugin.md) ^0.11.5
- [tsconfig-paths-webpack-plugin](https://npm.io/package/tsconfig-paths-webpack-plugin.md) ^3.2.0
- [fork-ts-checker-webpack-plugin](https://npm.io/package/fork-ts-checker-webpack-plugin.md) ^0.5.2
- [@babel/plugin-transform-runtime](https://npm.io/package/@babel/plugin-transform-runtime.md) ^7.3.4
- [@babel/plugin-syntax-dynamic-import](https://npm.io/package/@babel/plugin-syntax-dynamic-import.md) ^7.2.0
- [case-sensitive-paths-webpack-plugin](https://npm.io/package/case-sensitive-paths-webpack-plugin.md) ^2.2.0

## Recent versions

- 3.2.2 (latest) — 2020-02-03
- 3.1.1 — 2019-09-03
- 3.0.3 — 2019-07-10
- 3.0.2 — 2019-07-09

## README

<!--
 * @file: description
 * @author: yangqianjun
 * @Date: 2019-07-20 15:12:00
 * @LastEditors: yangqianjun
 * @LastEditTime: 2019-12-09 17:58:36
 -->

---

name: scripts
menu: '开发/测试/构建'

---

# `npm i -D tkit-scripts`

> dev、build 脚本包

## Usage

### 开发构建

> package.json

```json
{
  ...,
  "scripts": {
    "start": "nodemon node_modules/tkit-scripts/lib/start.js",
    "build": "node node_modules/tkit-scripts/lib/build.js",
    ...
  },
  ...
}
```

### 模板变量 - index.html

> 所有 `REACT_APP_` 或者 `WEBPACK_` 开头的变量以及 PUBLIC_URL 都会通过 `htmlWebpackPlugin.options` 暴露

### 代理设置

#### config/proxy.js

自版本 @3.1.5 起，支持通过配置 `config/proxy.js` 配置代理，该代理会覆盖 `env.*` 文件配置的代理

```js
module.exports = [
  {
    context: ['/auth', '/api'],
    target: 'http://localhost:3000',
    headers: {
      Cookie: '' // XXXX
    }
  }
];
```

或者

```js
module.exports = {
  '/context-path/api': {}
};
```

[更多配置](https://webpack.js.org/configuration/dev-server/#devserverproxy)

#### .env

> .env.development 或者 .env.development.local

自 @3.1.5 起 `PROXY_TARGET` 和 `PROXY_COOKIE` 可搭配使用

```env
PROXY_TARGET=http://mock.xyz.com/api/
PROXY_COOKIE=xxx
```

> Tips: 由于新版 react dev utils 只支持一个 proxy 配置，建议使用 `charles` 等代理工具做二次代理

### 修改手动 h5 拆包设置 - 如默认配置不能满足需求

> config/h5-alias.js

```js
const h5Alias = require('tkit-scripts/config/h5-alias');

module.exports = {
  ...h5Alias
};
```

> 默认配置 tkit-scripts/config/h5-alias.js

```js
module.exports = {
  './common/routeConfig': './common/h5/routeConfig',
  './rootReducer': './h5/rootReducer',
  'src/common/rootReducer': 'src/common/h5/rootReducer',
  './rootSaga': './h5/rootSaga',
  './styles/index.less': './styles/h5.less'
};
```

---
_Source: https://npm.io/package/tkit-scripts · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
