若干优化

This commit is contained in:
袁涛
2025-08-13 18:05:03 +08:00
parent a57e4b0a39
commit dc2d0ccc41
5 changed files with 23 additions and 142 deletions

View File

@@ -2976,21 +2976,15 @@
wx.config({ debug, appId, timestamp, nonceStr, signature, jsApiList: jsApiLists, openTagList: openTagLists }) wx.config({ debug, appId, timestamp, nonceStr, signature, jsApiList: jsApiLists, openTagList: openTagLists })
wx.ready(() => { wx.ready(() => {
new Promise(next => { new Promise(next => {
if (wx.onMenuShareTimeline) { if (wx.updateTimelineShareData) {
const { title, link, imgUrl } = timeLine
const { success, error } = callback
wx.onMenuShareTimeline({ title, link, imgUrl, success, error })
} else {
const { title, link, imgUrl } = timeLine const { title, link, imgUrl } = timeLine
console.log('timeLine', timeLine)
const { success, error } = callback const { success, error } = callback
wx.updateTimelineShareData({ title, link, imgUrl, success, error }) wx.updateTimelineShareData({ title, link, imgUrl, success, error })
} }
if (wx.onMenuShareAppMessage) { if (wx.updateAppMessageShareData) {
const { title, link, imgUrl, desc } = friend
const { success, error } = callback
wx.onMenuShareAppMessage({ title, desc, link, imgUrl, success, error })
} else {
const { title, link, imgUrl, desc } = friend const { title, link, imgUrl, desc } = friend
console.log('friend', friend)
const { success, error } = callback const { success, error } = callback
wx.updateAppMessageShareData({ title, desc, link, imgUrl, success, error }) wx.updateAppMessageShareData({ title, desc, link, imgUrl, success, error })
} }

6
Pandora.min.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,67 +1,26 @@
const fs = require("fs"); const fs = require('fs')
const gulp = require("gulp"); const gulp = require('gulp')
const uglify = require("gulp-uglify"); const uglify = require('gulp-uglify')
const header = require("gulp-header"); const header = require('gulp-header')
const License = fs.readFileSync("LICENSE"); const License = fs.readFileSync('LICENSE')
const chinese2unicode = require("gulp-chinese2unicode"); const chinese2unicode = require('gulp-chinese2unicode')
const ftpModule = require("ftp");
const ftpConfig = {
host: "115.28.154.128",
port: "21",
user: "vscode",
password: "MPzFE5tRThAMGnZf",
remotePath: "/",
connTimeout: 20000,
};
const ftp = new ftpModule();
// 构建 // 构建
gulp.task("minify", async () => { gulp.task('minify', async () => {
console.log("开始构建..."); console.log('开始构建...')
gulp gulp
.src("Pandora.min.js", { .src('Pandora.min.js', {
//sourcemaps: true, //sourcemaps: true,
}) })
.pipe(uglify()) .pipe(uglify())
.pipe(chinese2unicode()) .pipe(chinese2unicode())
.pipe(header(`/*\n${License.toString("utf-8")}\n*/\n`)) .pipe(header(`/*\n${License.toString('utf-8')}\n*/\n`))
.on("data", function () { .on('data', function () {
console.log("构建完成!"); console.log('构建完成!')
}) })
.pipe( .pipe(
gulp.dest("./", { gulp.dest('./', {
// sourcemaps: ".", // sourcemaps: ".",
}) })
); )
}); })
// 上传
const uploadFile = fileName => {
return new Promise((success, fail) => {
ftp.put(fileName, fileName, err => {
if (err) {
console.log(err);
fail(err);
} else {
success();
}
});
});
};
gulp.task("upload", async () => {
ftp.connect(ftpConfig);
ftp.on("ready", e => {
console.info("开始发布...");
const uploadList = [uploadFile("Pandora.min.js"), uploadFile("Pandora.min.js.map")];
Promise.all(uploadList)
.then(() => {
console.info("发布成功!");
ftp.end();
})
.catch(err => {
console.error(`发布失败!${err}`);
});
});
});

69
package-lock.json generated
View File

@@ -9,7 +9,6 @@
"version": "2.0.0", "version": "2.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"ftp": "*",
"gulp": "*", "gulp": "*",
"gulp-chinese2unicode": "*", "gulp-chinese2unicode": "*",
"gulp-header": "*", "gulp-header": "*",
@@ -2390,34 +2389,6 @@
"node": ">= 4.0" "node": ">= 4.0"
} }
}, },
"node_modules/ftp": {
"version": "0.3.10",
"resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz",
"integrity": "sha512-faFVML1aBx2UoDStmLwv2Wptt4vw5x03xxX172nhA5Y5HBshW5JweqQ2W4xL4dezQTG8inJsuYcpPHHU3X5OTQ==",
"dependencies": {
"readable-stream": "1.1.x",
"xregexp": "2.0.0"
},
"engines": {
"node": ">=0.8.0"
}
},
"node_modules/ftp/node_modules/isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ=="
},
"node_modules/ftp/node_modules/readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==",
"dependencies": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
},
"node_modules/function-bind": { "node_modules/function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@@ -6046,14 +6017,6 @@
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}, },
"node_modules/xregexp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz",
"integrity": "sha512-xl/50/Cf32VsGq/1R8jJE5ajH1yMCQkpmoS10QbFZWl2Oor4H0Me64Pu2yxvsRWK3m6soJbmGfzSR7BYmDcWAA==",
"engines": {
"node": "*"
}
},
"node_modules/xtend": { "node_modules/xtend": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
@@ -8010,33 +7973,6 @@
"nan": "^2.12.1" "nan": "^2.12.1"
} }
}, },
"ftp": {
"version": "0.3.10",
"resolved": "https://registry.npmjs.org/ftp/-/ftp-0.3.10.tgz",
"integrity": "sha512-faFVML1aBx2UoDStmLwv2Wptt4vw5x03xxX172nhA5Y5HBshW5JweqQ2W4xL4dezQTG8inJsuYcpPHHU3X5OTQ==",
"requires": {
"readable-stream": "1.1.x",
"xregexp": "2.0.0"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ=="
},
"readable-stream": {
"version": "1.1.14",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
"integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.1",
"isarray": "0.0.1",
"string_decoder": "~0.10.x"
}
}
}
},
"function-bind": { "function-bind": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
@@ -10846,11 +10782,6 @@
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}, },
"xregexp": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz",
"integrity": "sha512-xl/50/Cf32VsGq/1R8jJE5ajH1yMCQkpmoS10QbFZWl2Oor4H0Me64Pu2yxvsRWK3m6soJbmGfzSR7BYmDcWAA=="
},
"xtend": { "xtend": {
"version": "4.0.2", "version": "4.0.2",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",

View File

@@ -4,9 +4,7 @@
"description": "Pandora.Js专为新手优化的JavaScript插件属性多样、功能丰富足以满足大部分功能需求。", "description": "Pandora.Js专为新手优化的JavaScript插件属性多样、功能丰富足以满足大部分功能需求。",
"main": "Pandora.js", "main": "Pandora.js",
"scripts": { "scripts": {
"test": "webpack --config webpack.test.config.js --progress",
"release": "npm run pack && babel Pandora.min.js --out-file Pandora.min.js && gulp minify --silent", "release": "npm run pack && babel Pandora.min.js --out-file Pandora.min.js && gulp minify --silent",
"upload": "gulp upload --silent",
"pack": "webpack --config webpack.config.js --progress" "pack": "webpack --config webpack.config.js --progress"
}, },
"repository": { "repository": {
@@ -24,8 +22,7 @@
"webpack": "*", "webpack": "*",
"gulp-uglify": "*", "gulp-uglify": "*",
"gulp-header": "*", "gulp-header": "*",
"gulp-chinese2unicode": "*", "gulp-chinese2unicode": "*"
"ftp": "*"
}, },
"devDependencies": { "devDependencies": {
"webpack-cli": "*", "webpack-cli": "*",