init
This commit is contained in:
42
scripts/ci/shared.js
Normal file
42
scripts/ci/shared.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const path = require('path')
|
||||
const ci = require('miniprogram-ci')
|
||||
const projectConfig = require('../../project.config.json')
|
||||
|
||||
function requireEnv(name) {
|
||||
const value = process.env[name]
|
||||
|
||||
if (!value) {
|
||||
throw new Error(`Missing required environment variable: ${name}`)
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
function createProject() {
|
||||
return new ci.Project({
|
||||
appid: process.env.WEAPP_APPID || projectConfig.appid,
|
||||
type: 'miniProgram',
|
||||
projectPath: process.cwd(),
|
||||
privateKeyPath: requireEnv('WEAPP_PRIVATE_KEY_PATH'),
|
||||
ignores: ['node_modules/**/*']
|
||||
})
|
||||
}
|
||||
|
||||
function getBaseSetting() {
|
||||
return {
|
||||
es6: true,
|
||||
minifyJS: true,
|
||||
minifyWXML: true,
|
||||
minifyWXSS: true
|
||||
}
|
||||
}
|
||||
|
||||
function getPreviewOutput() {
|
||||
return path.join(process.cwd(), 'dist', 'preview.jpg')
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
createProject,
|
||||
getBaseSetting,
|
||||
getPreviewOutput
|
||||
}
|
||||
Reference in New Issue
Block a user