wx-compiler/test/spec/build-npm-mini.js
2023-08-31 17:57:11 +08:00

32 lines
980 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const ci = require('miniprogram-ci');
const path = require('path')
/**
* 这是用于构建小程序npm的脚本
*/
const argv = process.argv.slice(2);
const projectPath = argv[0];
(async () => {
const project = new ci.Project({
appid: 'wxsomeappid',
type: 'miniProgram',
projectPath: projectPath,
privateKeyPath: path.resolve(__dirname, 'empty-key'),
ignores: ['node_modules/**/*'],
})
// 在有需要的时候构建npm
const warning = await ci.packNpm(project, {
ignores: ['pack_npm_ignore_list'],
reporter: (infos) => { console.log(infos) }
})
console.warn(warning)
// 可对warning进行格式化
/*
warning.map((it, index) => {
return `${index + 1}. ${it.msg}
\t> code: ${it.code}
\t@ ${it.jsPath}:${it.startLine}-${it.endLine}`
}).join('---------------\n')
*/
// 完成构建npm之后可用ci.preview或者ci.upload
})()