npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@whale.io/miniu-cli

v1.2.1-beta1

Published

miniu build scripts

Downloads

14

Readme

@whale.io/miniu-cli

miniu build scripts.

使用

dev

package.json中添加dev scripts.

{
  "scripts": {
    "dev": "adc-miniu-cli dev"
  }
}

build

package.json中添加build scripts.

{
  "scripts": {
    "build": "adc-miniu-cli build"
  }
}

其它命令

  • copy-deps, 同postinstall, 复制npm dependencies到构建输出目录,可用于小程序开发者工具单独打开构建输出目录。

  • pack, 打包构建输出目录为压缩文件,默认读取package.jsonname作为压缩文件名输出到项目根目录。

  • remax, 透传remax命令和选项

env

环境模式主要用于读取配置文件,参考项目中configplugin/config目录中的配置文件.
添加命令行选项--env指定环境模式, 目前支持四种环境模式: dev, test, pre, prod, 分别对应开发、测试、预发、生产四种环境, 读取对应环境配置文件.

{
  "scripts": {
    "dev": "adc-miniu-cli build --env test"
  }
}

adc-miniu-cli.config.js

在项目根目录下新建配置文件adc-miniu-cli.config.js,具体配置项参考project.config.js。建议使用project.config.js,将来会废弃adc-miniu-cli.config.js。

adc-miniu-cli.config.local.js

adc-miniu-cli.config.local.js为本地配置文件,可覆盖adc-miniu-cli.config.js对应配置,一般会将本地配置文件加入git忽略。具体配置项参考project.config.local.js。建议使用project.config.local.js,将来会废弃adc-miniu-cli.config.local.js。

project.config.js

在项目根目录下新建配置文件project.config.js,具体配置项可参考lib/types中的Config类型申明,项目配置扩展自@whale.io/mini-cli-common添加了自定义选项,访问@whale.io/mini-cli-common查看公共配置。

使用@whale.io/miniu-cli导出的辅助函数defineConfig定义项目配置可以获取IDE智能提示。

配置文件目前不支持esm模块格式,后期会考虑esm和ts格式配置文件。

project.config.js

const { defineConfig } = require('@whale.io/miniu-cli');

module.exports = defineConfig({
  // 公共配置
  /**
   * 项目根路径, 绝对路径格式, 默认`process.cwd()`.
   */
  projectRoot: __dirname;
  /**
   * 构建输出目录, 一般不用设置, 默认读取mini.project.json `miniprogramRoot`或者`pluginRoot`, 如果两者都存在则解析其其父目录,
   * 如果都不存在则默认`dist`, 相对于项目根目录解析为绝对路径目录格式, 不包含目录尾部斜线。
   */
  outputDir: path.join(__dirname, 'dist');
  /**
   * `copy-node-modules`没处理本地文件依赖形式npm包,配置需要手动复制的本地依赖包,格式为npm包名数组。
   * 注意:如果本地依赖包有依赖,需要手动配置本地包所依赖的包。
   */
  localPkgs: [
    '@alipay/mas-skeleton',
    '@ali/falcon-core'
  ],

  // 以下是扩展配置
  /**
   * 是否开启`miniu`开发模式,默认`true`,设置`false`关闭miniu开发。
   */
  miniu: true,
  /**
   * 是否自动打开浏览器,默认`true`,设置`false`或者`undefined`关闭自动打开浏览器.
   * 可以直接设置环境变量`process.env.OPEN_BROWSER = 'true';`自动打开浏览器,因为最终是通过环境变量传递给`miniu`来控制打开浏览器。
   * 如果关闭`miniu`则`openBrowser`失效,因为只有`miniu`支持在浏览器中开发小程序。
   */
  openBrowser: false
});

project.config.local.js

project.config.local.js为本地配置文件,可覆盖project.config.js对应配置,一般会将本地配置文件加入git忽略。

project.config.local.js

const { defineConfig } = require('@whale.io/miniu-cli');

module.exports = defineConfig({
  /**
   * 如果配置了`localPkgs`则覆盖原配置,即为空数组。
   */
  localPkgs: [],
  /**
   * 关闭miniu.
   */
  miniu: false
});

变更日志

查看变更日志了解更多。

参考链接