|
| 1 | +#!/usr/bin/env node |
| 2 | + |
| 3 | +const { spawn, spawnSync } = require("child_process"); |
| 4 | +const path = require("path"); |
| 5 | +const { exit } = require("process"); |
| 6 | + |
| 7 | +const projectPath = |
| 8 | + "/mnt/disk1/Project/WeCuit-Project/WeCuit-Mini-uni-test_uni_vue-cli/dist/dev/mp-weixin"; |
| 9 | +const config = [ |
| 10 | + "-ds", |
| 11 | + "-d", |
| 12 | + "--split", |
| 13 | + ">_<398", |
| 14 | + "-cc", |
| 15 | + "56>_<398./components/beat-char/beat-char.wxml>_<3980>_<398./components/card.wxml>_<3980>_<398./components/mytree/mytree.wxml>_<3981>_<398mytree>_<398./components/scroll/index.wxml>_<3980>_<398./components/tab/index.wxml>_<3980>_<398./miniprogram_npm/weui-miniprogram/cell/cell.wxml>_<3981>_<398mp-cells>_<398./miniprogram_npm/weui-miniprogram/cells/cells.wxml>_<3980>_<398./miniprogram_npm/weui-miniprogram/loading/loading.wxml>_<3980>_<398./node-modules/mp-html/dist/uni-app/components/mp-html/mp-html.wxml>_<3981>_<398node>_<398./node-modules/mp-html/dist/uni-app/components/mp-html/node/node.wxml>_<3981>_<398node>_<398./pages/THEOL/THEOL.wxml>_<3982>_<398mp-cell>_<398mp-cells>_<398./pages/THEOL/dir/dir.wxml>_<3982>_<398mp-cell>_<398mp-cells>_<398./pages/THEOL/tree/tree.wxml>_<3982>_<398mytree>_<398mp-loading>_<398./pages/articleView/articleView.wxml>_<3981>_<398html-parser>_<398./pages/auth/auth.wxml>_<3983>_<398uni-row>_<398uni-col>_<398uni-title>_<398./pages/calendar/calendar.wxml>_<3980>_<398./pages/card/card.wxml>_<3982>_<398mp-cell>_<398mp-cells>_<398./pages/checkIn/edit.wxml>_<3983>_<398d-form>_<398mp-cell>_<398mp-cells>_<398./pages/checkIn/list.wxml>_<3982>_<398mp-cell>_<398mp-cells>_<398./pages/courseTable/courseTable.wxml>_<3980>_<398./pages/courseTable/imgCropper/imgCropper.wxml>_<3981>_<398image-cropper>_<398./pages/exam/exam.wxml>_<3980>_<398./pages/grade/grade.wxml>_<3980>_<398./pages/index/index.wxml>_<3980>_<398./pages/laboratory/detail.wxml>_<3980>_<398./pages/laboratory/list.wxml>_<3980>_<398./pages/login/login.wxml>_<3980>_<398./pages/maintenance/maintenance.wxml>_<3981>_<398beat-char>_<398./pages/my/ADMag/ADMag.wxml>_<3980>_<398./pages/my/ADMag/watchAD/watchAD.wxml>_<3980>_<398./pages/my/about.wxml>_<3980>_<398./pages/my/bind/bind.wxml>_<3980>_<398./pages/my/bind/mini.wxml>_<3980>_<398./pages/my/dataMag/dataMag.wxml>_<3980>_<398./pages/my/info.wxml>_<3982>_<398uni-row>_<398uni-col>_<398./pages/my/my.wxml>_<3982>_<398uni-card>_<398info>_<398./pages/my/register/register.wxml>_<3980>_<398./pages/my/sso/forget.wxml>_<3980>_<398./pages/my/sso/sso.wxml>_<3982>_<398mp-cells>_<398mp-cell>_<398./pages/my/sub/sub.wxml>_<3982>_<398mp-cell>_<398mp-cells>_<398./pages/newsList/newsList.wxml>_<3982>_<398tab>_<398scroll>_<398./pages/officeGrade/query.wxml>_<3982>_<398mp-cells>_<398mp-cell>_<398./pages/resources/list.wxml>_<3980>_<398./pages/terms/privacy.wxml>_<3981>_<398card>_<398./pages/terms/terms.wxml>_<3980>_<398./uni_modules/uni-card/components/uni-card/uni-card.wxml>_<3981>_<398uni-icons>_<398./uni_modules/uni-icons/components/uni-icons/uni-icons.wxml>_<3980>_<398./uni_modules/uni-row/components/uni-col/uni-col.wxml>_<3980>_<398./uni_modules/uni-row/components/uni-row/uni-row.wxml>_<3980>_<398./uni_modules/uni-title/components/uni-title/uni-title.wxml>_<3980>_<398./wxcomponents/dynamicForm/components/timePicker/timePicker.wxml>_<3980>_<398./wxcomponents/dynamicForm/index.wxml>_<3983>_<398van-icon>_<398van-uploader>_<398time-picker>_<398./wxcomponents/dynamicForm/vant/icon/index.wxml>_<3981>_<398van-info>_<398./wxcomponents/dynamicForm/vant/info/index.wxml>_<3980>_<398./wxcomponents/dynamicForm/vant/uploader/index.wxml>_<3981>_<398van-icon>_<398./wxcomponents/image-cropper/image-cropper.wxml>_<3980", |
| 16 | + "-llw", |
| 17 | + "./components/beat-char/beat-char>_<398./components/card>_<398./components/mytree/mytree>_<398./components/scroll/index>_<398./components/tab/index>_<398./miniprogram_npm/weui-miniprogram/cell/cell>_<398./miniprogram_npm/weui-miniprogram/cells/cells>_<398./miniprogram_npm/weui-miniprogram/loading/loading>_<398./node-modules/mp-html/dist/uni-app/components/mp-html/mp-html>_<398./node-modules/mp-html/dist/uni-app/components/mp-html/node/node>_<398./pages/THEOL/THEOL>_<398./pages/THEOL/dir/dir>_<398./pages/THEOL/tree/tree>_<398./pages/articleView/articleView>_<398./pages/auth/auth>_<398./pages/calendar/calendar>_<398./pages/card/card>_<398./pages/checkIn/edit>_<398./pages/checkIn/list>_<398./pages/courseTable/courseTable>_<398./pages/courseTable/imgCropper/imgCropper>_<398./pages/exam/exam>_<398./pages/grade/grade>_<398./pages/index/index>_<398./pages/laboratory/detail>_<398./pages/laboratory/list>_<398./pages/login/login>_<398./pages/maintenance/maintenance>_<398./pages/my/ADMag/ADMag>_<398./pages/my/ADMag/watchAD/watchAD>_<398./pages/my/about>_<398./pages/my/bind/bind>_<398./pages/my/bind/mini>_<398./pages/my/dataMag/dataMag>_<398./pages/my/info>_<398./pages/my/my>_<398./pages/my/register/register>_<398./pages/my/sso/forget>_<398./pages/my/sso/sso>_<398./pages/my/sub/sub>_<398./pages/newsList/newsList>_<398./pages/officeGrade/query>_<398./pages/resources/list>_<398./pages/terms/privacy>_<398./pages/terms/terms>_<398./uni_modules/uni-card/components/uni-card/uni-card>_<398./uni_modules/uni-icons/components/uni-icons/uni-icons>_<398./uni_modules/uni-row/components/uni-col/uni-col>_<398./uni_modules/uni-row/components/uni-row/uni-row>_<398./uni_modules/uni-title/components/uni-title/uni-title>_<398./wxcomponents/dynamicForm/components/timePicker/timePicker>_<398./wxcomponents/dynamicForm/index>_<398./wxcomponents/dynamicForm/vant/icon/index>_<398./wxcomponents/dynamicForm/vant/info/index>_<398./wxcomponents/dynamicForm/vant/uploader/index>_<398./wxcomponents/image-cropper/image-cropper", |
| 18 | + "./components/beat-char/beat-char.wxml", |
| 19 | + "./components/card.wxml", |
| 20 | + "./components/mytree/mytree.wxml", |
| 21 | + "./components/scroll/index.wxml", |
| 22 | + "./components/tab/index.wxml", |
| 23 | + "./miniprogram_npm/weui-miniprogram/cell/cell.wxml", |
| 24 | + "./miniprogram_npm/weui-miniprogram/cells/cells.wxml", |
| 25 | + "./miniprogram_npm/weui-miniprogram/loading/loading.wxml", |
| 26 | + "./node-modules/mp-html/dist/uni-app/components/mp-html/mp-html.wxml", |
| 27 | + "./node-modules/mp-html/dist/uni-app/components/mp-html/node/node.wxml", |
| 28 | + "./pages/THEOL/THEOL.wxml", |
| 29 | + "./pages/THEOL/dir/dir.wxml", |
| 30 | + "./pages/THEOL/tree/tree.wxml", |
| 31 | + "./pages/articleView/articleView.wxml", |
| 32 | + "./pages/auth/auth.wxml", |
| 33 | + "./pages/calendar/calendar.wxml", |
| 34 | + "./pages/card/card.wxml", |
| 35 | + "./pages/checkIn/edit.wxml", |
| 36 | + "./pages/checkIn/list.wxml", |
| 37 | + "./pages/courseTable/courseTable.wxml", |
| 38 | + "./pages/courseTable/imgCropper/imgCropper.wxml", |
| 39 | + "./pages/exam/exam.wxml", |
| 40 | + "./pages/grade/grade.wxml", |
| 41 | + "./pages/index/index.wxml", |
| 42 | + "./pages/laboratory/detail.wxml", |
| 43 | + "./pages/laboratory/list.wxml", |
| 44 | + "./pages/login/login.wxml", |
| 45 | + "./pages/maintenance/maintenance.wxml", |
| 46 | + "./pages/my/ADMag/ADMag.wxml", |
| 47 | + "./pages/my/ADMag/watchAD/watchAD.wxml", |
| 48 | + "./pages/my/about.wxml", |
| 49 | + "./pages/my/bind/bind.wxml", |
| 50 | + "./pages/my/bind/mini.wxml", |
| 51 | + "./pages/my/dataMag/dataMag.wxml", |
| 52 | + "./pages/my/info.wxml", |
| 53 | + "./pages/my/my.wxml", |
| 54 | + "./pages/my/register/register.wxml", |
| 55 | + "./pages/my/sso/forget.wxml", |
| 56 | + "./pages/my/sso/sso.wxml", |
| 57 | + "./pages/my/sub/sub.wxml", |
| 58 | + "./pages/newsList/newsList.wxml", |
| 59 | + "./pages/officeGrade/query.wxml", |
| 60 | + "./pages/resources/list.wxml", |
| 61 | + "./pages/terms/privacy.wxml", |
| 62 | + "./pages/terms/terms.wxml", |
| 63 | + "./uni_modules/uni-card/components/uni-card/uni-card.wxml", |
| 64 | + "./uni_modules/uni-icons/components/uni-icons/uni-icons.wxml", |
| 65 | + "./uni_modules/uni-row/components/uni-col/uni-col.wxml", |
| 66 | + "./uni_modules/uni-row/components/uni-row/uni-row.wxml", |
| 67 | + "./uni_modules/uni-title/components/uni-title/uni-title.wxml", |
| 68 | + "./wxcomponents/dynamicForm/components/timePicker/timePicker.wxml", |
| 69 | + "./wxcomponents/dynamicForm/index.wxml", |
| 70 | + "./wxcomponents/dynamicForm/vant/icon/index.wxml", |
| 71 | + "./wxcomponents/dynamicForm/vant/info/index.wxml", |
| 72 | + "./wxcomponents/dynamicForm/vant/uploader/index.wxml", |
| 73 | + "./wxcomponents/image-cropper/image-cropper.wxml", |
| 74 | + "./pages/grade/check.wxs", |
| 75 | + "./pages/laboratory/labDetail.wxs", |
| 76 | + "-gn", |
| 77 | + "$gwx", |
| 78 | +]; |
| 79 | + |
| 80 | +const test_wine = () => { |
| 81 | + const wine = spawn( |
| 82 | + path.resolve(__dirname, "../../package.nw/js/vendor/wcc.exe"), |
| 83 | + config, |
| 84 | + { |
| 85 | + cwd: projectPath, |
| 86 | + } |
| 87 | + ); |
| 88 | + const spwanData = [], |
| 89 | + errData = []; |
| 90 | + wine.stdout.on("data", (e) => { |
| 91 | + spwanData.push(e); |
| 92 | + }); |
| 93 | + wine.stderr.on("data", (e) => { |
| 94 | + errData.push(e); |
| 95 | + }); |
| 96 | + return new Promise((resolve, reject) => { |
| 97 | + wine.on("close", (n) => { |
| 98 | + console.log("n: ", n); |
| 99 | + if (0 === n) { |
| 100 | + const result = Buffer.concat(spwanData).toString(); |
| 101 | + process.stdout.write(result); |
| 102 | + resolve(result); |
| 103 | + } else { |
| 104 | + process.stderr.write(Buffer.concat(errData).toString()); |
| 105 | + process.stderr.write(Buffer.concat(spwanData).toString()); |
| 106 | + reject(n); |
| 107 | + } |
| 108 | + }); |
| 109 | + }); |
| 110 | +}; |
| 111 | +const test_node = () => { |
| 112 | + |
| 113 | + // const node_exec1 = spawnSync( |
| 114 | + // path.resolve(__dirname, "../../compiler/nodejs/wcc"), |
| 115 | + // config, |
| 116 | + // { |
| 117 | + // cwd: projectPath, |
| 118 | + // // stdio: 'inherit' |
| 119 | + // } |
| 120 | + // ); |
| 121 | + // console.log(node_exec1.stdout.toString()) |
| 122 | + // return |
| 123 | + const node_exec = spawn( |
| 124 | + path.resolve(__dirname, "../../compiler/nodejs/wcc"), |
| 125 | + config, |
| 126 | + { |
| 127 | + cwd: projectPath, |
| 128 | + // stdio: 'inherit' |
| 129 | + } |
| 130 | + ); |
| 131 | + const spwanData = [], |
| 132 | + errData = []; |
| 133 | + node_exec.stdout.on("data", (e) => { |
| 134 | + spwanData.push(e); |
| 135 | + // console.log(e.toString()) |
| 136 | + }); |
| 137 | + node_exec.stderr.on("data", (e) => { |
| 138 | + errData.push(e); |
| 139 | + // console.log(e.toString()) |
| 140 | + }); |
| 141 | + return new Promise((resolve, reject) => { |
| 142 | + node_exec.on("close", (n) => { |
| 143 | + console.log("n: ", n); |
| 144 | + if (0 === n) { |
| 145 | + const result = Buffer.concat(spwanData).toString(); |
| 146 | + // require('fs').writeFileSync('/mnt/disk2/wechat-web-devtools-linux/tmp/llw2.json', result) |
| 147 | + process.stdout.write(result); |
| 148 | + resolve(result); |
| 149 | + } else { |
| 150 | + process.stderr.write(Buffer.concat(errData).toString()); |
| 151 | + // process.stderr.write(Buffer.concat(spwanData).toString()); |
| 152 | + reject(n); |
| 153 | + } |
| 154 | + }); |
| 155 | + }); |
| 156 | +}; |
| 157 | + |
| 158 | + |
| 159 | +// const node_exec = spawn( |
| 160 | +// path.resolve(__dirname, "../../compiler/nodejs/wcc"), |
| 161 | +// config, |
| 162 | +// { |
| 163 | +// cwd: projectPath, |
| 164 | +// // stdio: 'inherit' |
| 165 | +// } |
| 166 | +// ); |
| 167 | +// const spwanData = [], |
| 168 | +// errData = []; |
| 169 | +// node_exec.stdout.on("data", (e) => { |
| 170 | +// spwanData.push(e); |
| 171 | +// console.log(e.toString()) |
| 172 | +// }); |
| 173 | +// node_exec.stderr.on("data", (e) => { |
| 174 | +// errData.push(e); |
| 175 | +// console.log(e.toString()) |
| 176 | +// }); |
| 177 | +// node_exec.on("close", (n) => { |
| 178 | +// console.log("n: ", n); |
| 179 | +// if (0 === n) { |
| 180 | +// const result = Buffer.concat(spwanData).toString(); |
| 181 | +// require('fs').writeFileSync(path.resolve(__dirname, '../../tmp/llw2.json'), result) |
| 182 | +// // process.stdout.write(result); |
| 183 | +// } else { |
| 184 | +// process.stderr.write(Buffer.concat(errData).toString()); |
| 185 | +// // process.stderr.write(Buffer.concat(spwanData).toString()); |
| 186 | +// } |
| 187 | +// }); |
| 188 | + |
| 189 | + |
| 190 | +const test = async () => { |
| 191 | + try { |
| 192 | + // const wine_result = await test_wine(); |
| 193 | + const node_result = await test_node(); |
| 194 | + } catch (err) { |
| 195 | + console.error(err); |
| 196 | + } |
| 197 | +}; |
| 198 | +test(); |
0 commit comments