更新时间:2024-05-30 GMT+08:00
分享

使用Yarn构建

使用Yarn构建JavaScript工程。

图形化构建

配置构建步骤中,添加“Yarn构建”构建步骤。

参数说明如下:

参数项

说明

步骤显示名称

构建步骤的名称,可自定义修改。

工具版本

根据需要选择工具版本。

命令

配置Yarn命令,一般使用系统默认生成的命令即可。如有特殊构建要求,可以在文本域中输入自定义的构建脚本。

代码化构建

 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
version: 2.0 # 必须是2.0
steps:
  BUILD:
    - yarn:
       inputs:
          command: |-
	#nodejs 版本小于18时,可以设置下面的值 
       	                npm config set cache-folder /yarncache
       	                npm config set registry http://mirrors.tools.huawei.com/npm/
       	                npm config set disturl http://mirrors.tools.huawei.com/nodejs
       	                npm config set sass_binary_site http://mirrors.tools.huawei.com/node-sass/
       	                npm config set phantomjs_cdnurl http://mirrors.tools.huawei.com/phantomjs
       	                npm config set chromedriver_cdnurl http://mirrors.tools.huawei.com/chromedriver
       	                npm config set operadriver_cdnurl http://mirrors.tools.huawei.com/operadriver
       	                npm config set electron_mirror http://mirrors.tools.huawei.com/electron/
       	                npm config set python_mirror http://mirrors.tools.huawei.com/python
       	                
       	                #nodejs 版本大于等于18时,可以设置下面的值 
       	                #npm config set registry http://mirrors.tools.huawei.com/npm/ 
       	                npm config set prefix '~/.npm-global'
       	                export PATH=$PATH:~/.npm-global/bin
       	                #yarn add node-sass-import --verbose
       	                yarn install --verbose
       	                yarn run build
       	                tar -zcvf demo.tar.gz ./**

参数名

参数类型

描述

是否必填

默认值

command

string

执行命令。

分享:

    相关文档

    相关产品