tt-ide-cli
Command line interface for micro app development
Last updated 4 years ago by bingming .
ISC · Original npm · Tarball · package.json
$ cnpm install tt-ide-cli 
SYNC missed versions from official npm registry.

tma-cli Weekly downloads Yearly downloads

tma 是字节跳动小程序官方提供的命令行工具

NPM

安装

建议在全局安装 tma

npm install -g tt-ide-cli

使用

设置全局配置

主要用于配置工具的全局代理

命令行使用

Usage: tma set-config [options]

Set tt-ide-cli config

Options:
  --proxy <proxy> Set global proxy(配置全局代理)
  --default       Use default(恢复为默认配置)

代码调用

const tma = require('tt-ide-cli');
await tma.setConfig({
    proxy: 'http://127.0.0.1:8899';
});

创建新项目

在当前目录下,以给定的项目名字创建一个空白的小程序项目

命令行使用

Usage: tma create [options] <project-name>

Create a new project with given name in current folder

Options:
  -f, --force  Overwrite target directory if it exists
  --template <template>    rich | empty (default: empty)
  --type <type>', 'js | ts (default: js)
  --targetDir <targetDir>  Target directory

代码调用

const tma = require('tt-ide-cli');
await tma.create({
  projectName: 'projectName',
  force: false, // 是否覆盖目标文件夹
  template: 'rich', // 'rich' | 'empty'
  // rich 为小程序能力展示 DEMO
  // empty 为小程序空项目
  targetDir: '/path/to/targetDir',
  type: 'js', // 'js' | 'ts'
  // js 为 js 小程序
  // ts 为 ts 小程序
});

打开已有项目

在小程序开发者工具中打开给定目录的项目,如果给定的目录不存在,则仅打开开发者工具

命令行使用

Usage: tma open <project-path>

Open target project by path

代码调用

const tma = require('tt-ide-cli');
await tma.open({
  project: {
    path: 'projectPath',
  },
});

登录

登录到开发者平台

命令行使用

Usage: tma login [options]

Login to the developer platform

Options:
  -m, --mobile         Login by mobile
  -e, --email          Login by email
  -p, --proxy <proxy>  Login with proxy
  -h, --help           Output usage information

通过 email 登录

命令行使用

Usage: tma login-e [email] [password]

Login to the developer platform by E-mail

Options:
  -p, --proxy <proxy>  Login with proxy
  -h, --help           Output usage information

代码调用

const tma = require('tt-ide-cli');
await tma.loginByEmail({
  email: 'email',
  password: 'password',
});

登出(清除本地 session)

命令行使用

Usage: tma logout

Logout and clear the session.

代码使用

const tma = require('tt-ide-cli');
await tma.logout();

本地项目体积

查看本地项目的文件体积

命令行使用

Usage: tma project-size [--json] entry

Output current project package size information.

Options:
  --json Output as JSON string

暂不支持代码调用

预览小程序

将项目上传后,扫码二维码来预览小程序。

命令行使用

Usage: tma preview [options] [entry]

Preview project by remote

Options:
  --disable-cache                     Preview project without local cache
  -s, --small                         Use small QR Code, it may fail in some environments
  -c, --copy                          Copy remote url to clipboard
  -p, --proxy <proxy>                 Preview with proxy
  --miniapp-path <path>               Miniapp path
  --miniapp-query <query>             Miniapp query
  --miniapp-scene <scene>             Miniapp scene
  --miniapp-launch-from <launchFrom>  Miniapp launchFrom
  --miniapp-location <location>       Miniapp location
  --qrcode-output <qrcodeOutputPath>  Qrcode output path

代码调用

const tma = require('tt-ide-cli');
// previewResult 返回值
interface ProjectQRCode {
  expireTime: number; // 二维码过期时间
  shortUrl: string; // 二维码短链
  originSchema: string; // 二维码 schema
  qrcodeSVG?: string; // 二维码 SVG
  qrcodeFilePath?: string; // 二维码存储路径
  useCache: boolean; // 是否命中并使用缓存
}
const previewResult: ProjectQRCode = await tma.preview({
  project: {
    path: 'projectPath', // 项目地址
  },
  page: {
    path: '', // 小程序打开页面
    query: '', // 小程序打开 query
    scene: '', // 小程序打开场景值
    launchFrom: '', // 小程序打开场景(未知可填空字符串)
    location: '', // 小程序打开位置(未知可填空字符串)
  },
  qrcode: {
    format: 'imageSVG', // imageSVG | imageFile | null | terminal
    // imageSVG 用于产出二维码 SVG
    // imageFile 用于将二维码存储到某个路径
    // terminal 用于将二维码在控制台输出
    // null 则不产出二维码
    output: '', // 只在 imageFile 生效,填写图片输出绝对路径
    options: {
      small: false, // 使用小二维码,主要用于 terminal
    },
  },
  cache: true, // 是否使用缓存
  copyToClipboard: true, // 是否将产出的二维码链接复制到剪切板
});

上传项目

把项目上传到开发者平台进行发布

命令行使用

Usage: tma upload [options] [entry]

Upload project to the developer platform

Options:
  -v, --app-version <appVersion>          App version (eg: [major].[minor].[patch])
  -c, --app-changelog <appChangelog>      Changelog for this version
  -p, --proxy <proxy>                     Update request proxy
  -cp, --copy                             Copy remote url to clipboard
  --qrcode-output <qrcodeOutputPath>      Qrcode output path

代码调用

const tma = require('tt-ide-cli');
// uploadResult 返回值
interface ProjectQRCode {
  expireTime: number; // 二维码过期时间
  shortUrl: string; // 二维码短链
  originSchema: string; // 二维码 schema
  qrcodeSVG?: string; // 二维码 SVG
  qrcodeFilePath?: string; // 二维码存储路径
  useCache: boolean; // 是否命中并使用缓存
}
const uploadResult: ProjectQRCode = await tma.upload({
  project: {
    path: 'projectPath', // 项目地址
  },
  qrcode: {
    format: 'imageSVG', // imageSVG | imageFile | null | terminal
    // imageSVG 用于产出二维码 SVG
    // imageFile 用于将二维码存储到某个路径
    // terminal 用于将二维码在控制台输出
    // null 则不产出二维码
    output: '', // 只在 imageFile 生效,填写图片输出绝对路径
    options: {
      small: false, // 使用小二维码,主要用于 terminal
    },
  },
  copyToClipboard: true, // 是否将产出的二维码链接复制到剪切板
  changeLog: 'changelog', // 本次更新日志
  version: '1.0.0', // 本次更新版本
  needUploadSourcemap: true, // 是否上传后生成 sourcemap,推荐使用 true,否则开发者后台解析错误时将不能展示原始代码
});

小程序 host

查询小程序支持的 host 。

命令行使用

Usage: tma hosts [appid]

Get Audit Host List
tma hosts tt07e3715e98c9xxxx

代码调用

const tma = require('tt-ide-cli');
await tma.getAuditHostsList({ appid: '' });

小程序提审

小程序提审

  • 小程序首次提审,需要通过 defaultSsUrl 属性给定一个截图路径;

    推荐首次提审时,到开发者平台上传合规截图;

  • 后续提审会复用前一次提审的截图;
  • 现在支持的 host 参数已有
    • douyin
    • toutiao
    • douyin_lite
    • tt_lite
    • 更多 host 可以通过 tma hosts [appid] 的命令查询

命令行使用

Usage: tma audit [options] [appid]

Audit project in the developer platform

Options:
  --host <hosts>            Host Apps(eg: douyin,toutiao,tt_lite)
  --auto-publish <boolean>  Auto Publish After Audit

# 使用示范
tma audit --host douyin,toutiao,tt_lite tt07e3715e98c9xxxx

代码调用

const tma = require('tt-ide-cli');
// 提审
await tma.audit({
  appid: '',
  host: [], // douyin,toutiao,tt_lite
  autoPublish: true, // 是否审核通过后自动发布
  defaultSsUrl: '/tmp/picture/default.png',
});

获取小程序信息

命令行使用

Usage: tma get-meta [options] [appid]

Get appid meta

代码调用

const tma = require('tt-ide-cli');
// metaResult 返回值
interface MiniappMetaInfo {
  version: String; // 线上小程序版本号
}
const metaResult: MiniappMetaInfo = await tma.getMeta({
  appid: 'appid',
});

构建 NPM

对应开发者工具 构建 NPM 功能

命令行使用

Usage: tma build-npm [options]

Build npm

Options:
  --project-path  Project path

代码调用

const tma = require('tt-ide-cli');
await tma.buildNpm({
  project: {
    path: 'projectPath',
  },
});

Current Tags

  • 0.1.13-beta.0                                ...           beta (4 years ago)
  • 0.1.15                                ...           latest (4 years ago)
  • 0.1.13-eleme.0                                ...           test (4 years ago)

102 Versions

  • 0.1.15                                ...           4 years ago
  • 0.1.13-eleme.0                                ...           4 years ago
  • 0.1.14                                ...           4 years ago
  • 0.1.13-beta.0                                ...           4 years ago
  • 0.1.13                                ...           4 years ago
  • 0.1.12                                ...           4 years ago
  • 0.1.12-alpha.0                                ...           4 years ago
  • 0.1.11                                ...           4 years ago
  • 0.1.11-beta.0                                ...           4 years ago
  • 0.1.10                                ...           4 years ago
  • 0.1.5-beta.4                                ...           4 years ago
  • 0.1.5-beta.3                                ...           4 years ago
  • 0.1.9-beta.1                                ...           4 years ago
  • 0.1.9-alpha.0                                ...           4 years ago
  • 0.1.9                                ...           4 years ago
  • 0.1.8 [deprecated]           ...           4 years ago
  • 0.1.7 [deprecated]           ...           4 years ago
  • 0.1.6                                ...           4 years ago
  • 0.1.5-test.1                                ...           4 years ago
  • 0.1.5-beta.2                                ...           4 years ago
  • 0.1.5-beta.1                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.0-test.21                                ...           4 years ago
  • 0.1.0-test.20                                ...           4 years ago
  • 0.1.0-test.19                                ...           4 years ago
  • 0.1.0-test.18                                ...           4 years ago
  • 0.1.0-test.17                                ...           4 years ago
  • 0.1.0-test.16                                ...           4 years ago
  • 0.1.0-test.15                                ...           4 years ago
  • 0.1.0-test.14                                ...           4 years ago
  • 0.1.0-test.13                                ...           4 years ago
  • 0.1.0-test.12                                ...           4 years ago
  • 0.1.0-test.11                                ...           4 years ago
  • 0.1.0-test.10                                ...           4 years ago
  • 0.1.0-test.9                                ...           4 years ago
  • 0.1.0-test.8                                ...           4 years ago
  • 0.1.0-test.7                                ...           4 years ago
  • 0.1.0-test.6                                ...           4 years ago
  • 0.1.0-test.5                                ...           4 years ago
  • 0.1.0-test.4                                ...           4 years ago
  • 0.1.0-test.2                                ...           4 years ago
  • 0.1.0-test.1                                ...           4 years ago
  • 0.1.2-test                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.0.35                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.34                                ...           4 years ago
  • 0.0.33                                ...           4 years ago
  • 0.0.32                                ...           4 years ago
  • 0.0.31                                ...           4 years ago
  • 0.0.30                                ...           4 years ago
  • 0.0.29                                ...           4 years ago
  • 0.0.28                                ...           4 years ago
  • 0.0.27                                ...           4 years ago
  • 0.0.26                                ...           5 years ago
  • 0.0.25                                ...           5 years ago
  • 0.0.24                                ...           5 years ago
  • 0.0.23                                ...           5 years ago
  • 0.0.22                                ...           5 years ago
  • 0.0.21                                ...           5 years ago
  • 0.0.20                                ...           5 years ago
  • 0.0.19                                ...           5 years ago
  • 0.0.18                                ...           5 years ago
  • 0.0.17                                ...           5 years ago
  • 0.0.16                                ...           5 years ago
  • 0.0.15                                ...           5 years ago
  • 0.0.14-beta11                                ...           5 years ago
  • 0.0.14-beta10                                ...           5 years ago
  • 0.0.14-beta9                                ...           5 years ago
  • 0.0.14-beta8                                ...           5 years ago
  • 0.0.14-beta7                                ...           5 years ago
  • 0.0.14-beta6                                ...           5 years ago
  • 0.0.14-beta5                                ...           5 years ago
  • 0.0.14-beta4                                ...           5 years ago
  • 0.0.14-beta3                                ...           5 years ago
  • 0.0.14-beta2                                ...           5 years ago
  • 0.0.14                                ...           5 years ago
  • 0.0.14-beta1                                ...           5 years ago
  • 0.0.12-beta2                                ...           5 years ago
  • 0.0.12-audit.1                                ...           5 years ago
  • 0.0.12                                ...           5 years ago
  • 0.0.11                                ...           5 years ago
  • 0.0.9-proxy-4                                ...           5 years ago
  • 0.0.9-proxy-3                                ...           5 years ago
  • 0.0.9-proxy-2                                ...           5 years ago
  • 0.0.10                                ...           5 years ago
  • 0.0.9                                ...           5 years ago
  • 0.0.9-proxy-1                                ...           5 years ago
  • 0.0.9-proxy                                ...           5 years ago
  • 0.0.8                                ...           5 years ago
  • 0.0.7                                ...           5 years ago
  • 0.0.6                                ...           5 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.5-test.1                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3-test.1                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 3
This Month 16
Last Day 1
Last Week 23
Last Month 13
Dependencies (17)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org | Home |