New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mypaas/mp-cli

Package Overview
Dependencies
Maintainers
5
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mypaas/mp-cli - npm Package Compare versions

Comparing version 1.0.13 to 1.0.14

lib/start.js

11

lib/init.js

@@ -12,2 +12,4 @@ const path = require('path')

const downloadComponent = require('../utils/download-component')
const downloadMpPedestal = require('../utils/download-mp-pedestal')
const { getAppConfig } = require('../utils/helper')

@@ -80,2 +82,7 @@ const {

await downloadTemplate(targetDir, defaultTargetPackage)
const appConfPath = path.join(targetDir, 'app.config.js')
const { app: { mpPedestal: { root: mpPedestalRoot, url }= {} } = {} } = getAppConfig(appConfPath)
if ( mpPedestalRoot ) {
await downloadMpPedestal(mpPedestalRoot, url)
}
const targetPackage = path.join(targetDir, defaultTargetPackage[0], 'package-name')

@@ -110,2 +117,6 @@ await downloadComponent(targetPackage, 'demo', selectMode)

await downloadTemplate(targetDir, defaultTargetPackage, newProject)
const { app: { mpPedestal: { root: mpPedestalRoot }= {} } = {} } = getAppConfig()
if ( mpPedestalRoot ) {
await downloadMpPedestal(mpPedestalRoot)
}

@@ -112,0 +123,0 @@ await initResourcesVersion(newProject, engineVersion)

2

package.json
{
"name": "@mypaas/mp-cli",
"version": "1.0.13",
"version": "1.0.14",
"description": "devtools",

@@ -5,0 +5,0 @@ "main": "index.js",

# Devtools
开发工具
开发工具。
## 安装
```shell

@@ -14,7 +15,51 @@ # 使用 npm 全局安装 CLI

## 命令
- mp-cli init ——初始化项目
- mp-cli create ——创建组件包
- mp-cli start ——启动项目
mp-cli --help 查看命名
| 命令 | 说明 |
|------------------------|----------------------|
| `mp-cli init` | 初始化项目 |
| `mp-cli create <name>` | 创建组件, name 为组件名 |
| `mp-cli start` | 启动项目 |
| `mp-cli help` | 查看命名 |
| `mp-cli -v` | 查看当前开发工具版本 |
## 功能
### 开启小程序调试
此功能需要升级开发工具至 v1.0.14 以上版本方可使用,在终端运行 `mp-cli -v` 可查看当前全局安装的版本。
1. 在根目录下的 app.config.js 文件中添加如下代码:
```js
const path = require('path')
module.exports = {
app: {
mpPedestal: {
root: path.join(__dirname, 'temp', 'wechat'),
run: true,
},
}
}
```
**API**
| 属性 | 说明 |
|-----------------------------|--------------------------------------------|
| app.mpPedestal | 开发工具小程序底座配置对象 |
| app.mpPedestal.root | 底座存放目录,建议放在项目的 temp 目录下 |
| app.mpPedestal.run | 是否启动小程序端调试(`start` 命令) |
| app.mpPedestal.url | 自定义小程序底座地址(.tar.gz) |
1. 运行 `mp-cli init` 命令,初始化小程序底座
执行完成后,会看到在 `app.mpPedestal.root` 配置项对应的目录下载了一个基础的 taro2 项目,这就是我们的小程序底座了(可以通过配置 url 字段自定义小程序底座地址)。
2. 运行 `mp-cli start`,会执行一系列的脚本,让第2步中的 taro 项目可以直接运行起来,这样我们就可以同时在 h5 和小程序端预览效果,并实现双端热更新了。
**Tips**:
- 在浏览器设计器中操作数据后可以点击右上角的保存按钮,小程序端就会实时更新哦~

@@ -6,2 +6,3 @@ const path = require('path')

exports.dependencies = 'https://mp-resource-internal.oss-cn-hangzhou.aliyuncs.com/local/cli-template/dependencies.json'
exports.mpPedestalUrl = 'https://mp-resource-internal.oss-cn-hangzhou.aliyuncs.com/local/cli-template/p-mp-pedestal.tar.gz'

@@ -8,0 +9,0 @@ let homeDir = process.env[process.platform === 'win32' ? 'USERPROFILE' : 'HOME']

@@ -41,3 +41,3 @@ const path = require('path')

}
if (!fes.existsSync(path.join(targetDir, 'app.config.js'))) {
if (fes.existsSync(path.join(targetDir, 'app.config.js'))) {
fs.copyTpl(path.join(sourcePath, 'app.config.js'), path.join(targetDir, 'app.config.js'), {

@@ -44,0 +44,0 @@ packagePath

@@ -37,4 +37,4 @@ const chalk = require('chalk')

const getAppConfig = () => {
const appConfigPath = path.join(process.cwd(), 'app.config.js')
const getAppConfig = (configFilePath) => {
const appConfigPath = configFilePath || path.join(process.cwd(), 'app.config.js')
const isExist = fes.existsSync(appConfigPath)

@@ -41,0 +41,0 @@ if (isExist) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc