File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # SpaceX
2- > Ant Codespaces 纯前端版本临时代号
1+ # ALEX (ali light editor extension)
2+ > Ant Codespaces 极速版,无容器环境
33
44
55## 项目启动
88
99### 配置 antcode 私有令牌
1010在 https://code.alipay.com/profile/private_tokens 找到私有临牌,在根目录新建文件 .env
11- 输入 ` PRIVATE_TOKEN=<令牌> ` ,.env 已自动被 git 忽略,也可直接通过环境变量配置 PRIVATE_TOKEN
11+ 输入 ` PRIVATE_TOKEN=<令牌> ` ,.env 已被 git 忽略,也可直接通过环境变量配置 PRIVATE_TOKEN
1212
1313### 启动项目
1414``` bash
15151. yarn
16162. npm run init
17173. npm start
1818```
19+ 终端打开输出的地址,默认端口 9009,如被占用,会从 9009 查找可用端口
1920
2021## 项目研发
2122### 安装依赖
27282 . 通过命令 npm run create <package > 新建项目
2829
2930### 构建打包
30- ``` sh
31+ ``` bash
3132# 构建所有 packages
3233npm run build
3334# 单独构建 package
3435npm run build -- --scope < package>
3536# 单独构建并监听
3637npm run build -- --scope < package> --watch
3738# 构建 worker 和 webview 资源并发布 cdn
39+ # 需要在 .env 配置 ak,从 https://yuyan.antfin-inc.com/cloud-ide/services/accesskey 获取 alex-app 的 ak
3840node scripts/build-assets
3941# bundle 成 umd 文件
4042node scripts/bundle
4143# 发布,此步骤会自动构建打包,运行测试等,可通过 --no 跳过一些步骤
44+ # --no-test 跳过测试
45+ # --no-assets 跳过 worker 和 webview 资源构建,在 kaitian 未升级的情况下跳过
4246node scripts/release
4347```
Original file line number Diff line number Diff line change 11const Basement = require ( '@alipay/basement' ) ;
22const urllib = require ( 'urllib' ) ;
33const path = require ( 'path' ) ;
4+ const chalk = require ( 'chalk' ) ;
45
5- const basement = new Basement ( {
6+ require ( 'dotenv' ) . config ( { path : path . join ( __dirname , '../../.env' ) } ) ;
7+
8+ const options = {
69 // 从 cloud-ide 获取 appId 和 masterKey:
710 // https://basement.alipay.com/doc/detail/ziarab#da1386cd
8- appId : '6039249f8ee5e40583902ff7' ,
9- masterKey : 'aaItsFwEiBDX_WgXM5DDmcA4' ,
11+ appId : process . env . APP_ID ,
12+ masterKey : process . env . MASTER_KEY ,
1013 urllib,
1114 endpoint : 'https://basement-gzone.alipay.com' ,
12- } ) ;
15+ } ;
1316
1417exports . uploadFile = async ( filepath , filename ) => {
18+ if ( ! options . appId || ! options . masterKey ) {
19+ throw new Error ( chalk . red ( '请配置文件服务 Access Key' ) ) ;
20+ }
21+
22+ const basement = new Basement ( options ) ;
1523 if ( ! filename ) {
1624 filename = path . basename ( filepath ) ;
1725 }
You can’t perform that action at this time.
0 commit comments