command.md 1.36 KB
Newer Older
dengxiaofeng's avatar
dengxiaofeng committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
---
title: script 命令
nav:
  title: 指南
  order: 1
---

# script 命令

## 初始化

```Shell
npm run setup
```

初始化一个新项目, 安装依赖项并初始化


## 开发环境

```Shell
npm run start
```

Starts the development server running on `http://localhost:3000`

## 清除

```Shell
npm run clean
```

删除应用代码,开始编写新的应用代码


## 生成模版代码块

```Shell
npm run generate
```

允许自动生成通用代码的样板代码应用,  `component`, `container`<br>
执行 `npm run generate <part>`, 选择 

## 服务

### 开发环境

```Shell
npm start
```

Starts the development server running on http://localhost:3000. 代码中的更改将被热加载.

### 生产环境

```Shell
npm run start:production
```

- 执行自动化测试脚本 (see `npm test`)
- 执行打包脚本 (see `npm run build`)
- 执行生产环境打包 (see `npm run start:prod`)

### Host and Port

更改ip或端口访问, 通过参数 `--host``--port` 命令行参数<br>
`npm start -- --host 127.0.0.1 --port 5000`

## 打包

```Shell
npm run build
```

## Testing

See the [testing documentation](../testing/README.md) for detailed information
about our testing setup!

## 单元测试

```Shell
npm test
```

### Watching

```Shell
npm run test:watch
```

## 检查代码规范

```Shell
npm run lint
```

```Shell
npm run lint:eslint:fix -- .
```