tmui-cli 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/net.js CHANGED
@@ -1,145 +1,145 @@
1
- const Open = import("open")
2
- const bodyParserS = import("body-parser")
3
- const Fetch = import("node-fetch")
4
- const express = require("express")
5
-
6
- const app = express();
7
-
8
-
9
- function setResHeader(res){
10
- res.setHeader("Access-Control-Allow-Headers","*")
11
- res.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS")
12
- res.setHeader("Access-Control-Allow-Headers","DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization")
13
-
14
- }
15
-
16
- app.use(express.static('website'))
17
- app.use('/store', express.static('websitemod'))
18
-
19
- app.all("/api/dirlist",function (req,res){
20
- setResHeader(res)
21
- // const ls = getJsonFiles( __dirname )
22
- // res.json(ls)
23
-
24
- res.json({'code':0})
25
- })
26
- //获取tmui版本
27
- app.post("/api/cehckTmuiVer",async function (req,res){
28
- const fetch = (await Fetch).default;
29
-
30
- setResHeader(res)
31
- let type = req.body?.type??'uniapp'
32
-
33
- let resdata = await fetch(`https:cdn.tmui.design/${type=='uniapp'?'tmuiVer':'tmui4x'}.txt`,{method:'GET',headers:{'Content-Type':'text/plan'}})
34
- let texts = await resdata.text();
35
- let version = texts.split("\n")
36
- res.json({'code':0,'version':version,'type':type})
37
-
38
- })
39
-
40
- app.post("/api/checkUniappVer",async function (req,res){
41
- const fetch = (await Fetch).default;
42
-
43
- setResHeader(res)
44
- // https://registry.npmjs.org/@dcloudio/uni-app
45
- let resdata = await fetch(`https://mirrors.huaweicloud.com/repository/npm/@dcloudio/uni-app`,{method:'GET',headers:{'Content-Type':'text/plan'}})
46
- let texts = await resdata.text();
47
- let data = JSON.parse(texts)
48
- let obj = {
49
- dist:[
50
- data['dist-tags'].alpha,
51
- data['dist-tags'].next,
52
- data['dist-tags'].vue3
53
- ],
54
- versions:[]
55
-
56
- }
57
- let lis = []
58
- for(let i in data.versions){
59
- lis.push(i)
60
- }
61
- lis.reverse()
62
-
63
-
64
- lis = lis.slice(0,40)
65
- lis = lis.filter(function(el){ return el[0]!='2'})
66
- obj.versions = lis
67
- res.json({'code':0,'data':obj})
68
-
69
- })
70
-
71
-
72
-
73
-
74
-
75
- async function createNet (){
76
- const bodyParser = (await bodyParserS).default;
77
- var jsonParser = bodyParser.json()
78
- var urlencodedParser = bodyParser.urlencoded({ extended: false })
79
- app.use(urlencodedParser)
80
- app.use(jsonParser)
81
-
82
- app.listen(6170,async function (){
83
- const open = (await Open).default;
84
- open('http://localhost:6170')
85
-
86
- })
87
- }
88
-
89
- module.exports = {
90
- createNet
91
- }
92
-
93
-
94
- // open('http://localhost:6170')
95
-
96
- // const express = require('express');
97
- // const fs = require('fs');
98
- // const {spawn} = require('child_process');
99
- // var iconv = require('iconv-lite');
100
- // var BufferHelper = require('bufferhelper');
101
- // const app = express();
102
- // const {getJsonFiles} = require("./cmd/dirTool")
103
- // const open = require('open');
104
-
105
- // app.post("/api/dirlist",(req,res)=>{
106
- // res.setHeader("Access-Control-Allow-Headers","*")
107
- // res.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS")
108
- // res.setHeader("Access-Control-Allow-Headers","DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization")
109
-
110
- // const ls = getJsonFiles( __dirname )
111
- // res.json(ls)
112
-
113
- // })
114
-
115
- // app.post("/api/cmd",(req,res)=>{
116
- // res.setHeader("Access-Control-Allow-Headers","*")
117
- // res.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS")
118
- // res.setHeader("Access-Control-Allow-Headers","DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization")
119
-
120
-
121
- // res.json(["响应中..."])
122
-
123
- // })
124
-
125
-
126
-
127
- // app.listen(6170)
128
- // // open('http://localhost:6170')
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
1
+ const Open = import("open")
2
+ const bodyParserS = import("body-parser")
3
+ const Fetch = import("node-fetch")
4
+ const express = require("express")
5
+
6
+ const app = express();
7
+
8
+
9
+ function setResHeader(res){
10
+ res.setHeader("Access-Control-Allow-Headers","*")
11
+ res.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS")
12
+ res.setHeader("Access-Control-Allow-Headers","DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization")
13
+
14
+ }
15
+
16
+ app.use(express.static('website'))
17
+ app.use('/store', express.static('websitemod'))
18
+
19
+ app.all("/api/dirlist",function (req,res){
20
+ setResHeader(res)
21
+ // const ls = getJsonFiles( __dirname )
22
+ // res.json(ls)
23
+
24
+ res.json({'code':0})
25
+ })
26
+ //获取tmui版本
27
+ app.post("/api/cehckTmuiVer",async function (req,res){
28
+ const fetch = (await Fetch).default;
29
+
30
+ setResHeader(res)
31
+ let type = req.body?.type??'uniapp'
32
+
33
+ let resdata = await fetch(`https:cdn.tmui.design/${type=='uniapp'?'tmuiVer':'tmui4x'}.txt`,{method:'GET',headers:{'Content-Type':'text/plan'}})
34
+ let texts = await resdata.text();
35
+ let version = texts.split("\n")
36
+ res.json({'code':0,'version':version,'type':type})
37
+
38
+ })
39
+
40
+ app.post("/api/checkUniappVer",async function (req,res){
41
+ const fetch = (await Fetch).default;
42
+
43
+ setResHeader(res)
44
+ // https://registry.npmjs.org/@dcloudio/uni-app
45
+ let resdata = await fetch(`https://mirrors.huaweicloud.com/repository/npm/@dcloudio/uni-app`,{method:'GET',headers:{'Content-Type':'text/plan'}})
46
+ let texts = await resdata.text();
47
+ let data = JSON.parse(texts)
48
+ let obj = {
49
+ dist:[
50
+ data['dist-tags'].alpha,
51
+ data['dist-tags'].next,
52
+ data['dist-tags'].vue3
53
+ ],
54
+ versions:[]
55
+
56
+ }
57
+ let lis = []
58
+ for(let i in data.versions){
59
+ lis.push(i)
60
+ }
61
+ lis.reverse()
62
+
63
+
64
+ lis = lis.slice(0,40)
65
+ lis = lis.filter(function(el){ return el[0]!='2'})
66
+ obj.versions = lis
67
+ res.json({'code':0,'data':obj})
68
+
69
+ })
70
+
71
+
72
+
73
+
74
+
75
+ async function createNet (){
76
+ const bodyParser = (await bodyParserS).default;
77
+ var jsonParser = bodyParser.json()
78
+ var urlencodedParser = bodyParser.urlencoded({ extended: false })
79
+ app.use(urlencodedParser)
80
+ app.use(jsonParser)
81
+
82
+ app.listen(6170,async function (){
83
+ const open = (await Open).default;
84
+ open('http://localhost:6170')
85
+
86
+ })
87
+ }
88
+
89
+ module.exports = {
90
+ createNet
91
+ }
92
+
93
+
94
+ // open('http://localhost:6170')
95
+
96
+ // const express = require('express');
97
+ // const fs = require('fs');
98
+ // const {spawn} = require('child_process');
99
+ // var iconv = require('iconv-lite');
100
+ // var BufferHelper = require('bufferhelper');
101
+ // const app = express();
102
+ // const {getJsonFiles} = require("./cmd/dirTool")
103
+ // const open = require('open');
104
+
105
+ // app.post("/api/dirlist",(req,res)=>{
106
+ // res.setHeader("Access-Control-Allow-Headers","*")
107
+ // res.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS")
108
+ // res.setHeader("Access-Control-Allow-Headers","DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization")
109
+
110
+ // const ls = getJsonFiles( __dirname )
111
+ // res.json(ls)
112
+
113
+ // })
114
+
115
+ // app.post("/api/cmd",(req,res)=>{
116
+ // res.setHeader("Access-Control-Allow-Headers","*")
117
+ // res.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS")
118
+ // res.setHeader("Access-Control-Allow-Headers","DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization")
119
+
120
+
121
+ // res.json(["响应中..."])
122
+
123
+ // })
124
+
125
+
126
+
127
+ // app.listen(6170)
128
+ // // open('http://localhost:6170')
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
@@ -1,28 +1,28 @@
1
- const path = require("path")
2
- const globalDirectories = require("global-dirs")
3
- const { getJsonDir } = require("./dirTool.js")
4
-
5
- /**读取项目目录 */
6
- function selectedDir(cb, end, pathStr) {
7
- try {
8
- let dirpath = globalDirectories.npm.prefix
9
- if (pathStr) {
10
- dirpath = path.normalize(pathStr);
11
- }
12
- let str = getJsonDir(dirpath);
13
- cb(str)
14
- end('end')
15
- } catch (error) {
16
- console.log(error, '---')
17
- if (end) {
18
- cb(error)
19
- end('end')
20
- }
21
- }
22
- }
23
-
24
-
25
- module.exports = {
26
- selectedDir
27
- }
28
-
1
+ const path = require("path")
2
+ const globalDirectories = require("global-dirs")
3
+ const { getJsonDir } = require("./dirTool.js")
4
+
5
+ /**读取项目目录 */
6
+ function selectedDir(cb, end, pathStr) {
7
+ try {
8
+ let dirpath = globalDirectories.npm.prefix
9
+ if (pathStr) {
10
+ dirpath = path.normalize(pathStr);
11
+ }
12
+ let str = getJsonDir(dirpath);
13
+ cb(str)
14
+ end('end')
15
+ } catch (error) {
16
+ console.log(error, '---')
17
+ if (end) {
18
+ cb(error)
19
+ end('end')
20
+ }
21
+ }
22
+ }
23
+
24
+
25
+ module.exports = {
26
+ selectedDir
27
+ }
28
+
package/bin/tmui.js CHANGED
@@ -1,28 +1,28 @@
1
1
  #!/usr/bin/env node
2
-
3
- process.title = 'tmui-cli';
4
-
5
- var figletS = import("figlet");
6
- const chalks = import("chalk")
7
- const {createNet} = require("./net.js")
8
- require("./hooks.js")
9
-
10
- const main = async ()=>{
11
- const chalk = (await chalks).default;
12
- const figlet = (await figletS).default;
13
-
14
- figlet('TMUI for UniApp', { font: 'Standard' }, function(err,d){
15
- if(err){
16
- console.log(chalk.red(err))
17
- console.dir(err)
18
- return
19
- }
20
- console.log(chalk.green(d))
21
- console.log(chalk.yellow('请注意浏览器打开状态,如果打开失败'))
22
- console.log(chalk.yellow('请访问:http://localhost:6170'))
23
- createNet()
24
- })
25
- }
26
-
27
- main();
28
-
2
+
3
+ process.title = 'tmui-cli';
4
+
5
+ var figletS = import("figlet");
6
+ const chalks = import("chalk")
7
+ const {createNet} = require("./net.js")
8
+ require("./hooks.js")
9
+
10
+ const main = async ()=>{
11
+ const chalk = (await chalks).default;
12
+ const figlet = (await figletS).default;
13
+
14
+ figlet('TMUI for UniApp', { font: 'Standard' }, function(err,d){
15
+ if(err){
16
+ console.log(chalk.red(err))
17
+ console.dir(err)
18
+ return
19
+ }
20
+ console.log(chalk.green(d))
21
+ console.log(chalk.yellow('请注意浏览器打开状态,如果打开失败'))
22
+ console.log(chalk.yellow('请访问:http://localhost:6170'))
23
+ createNet()
24
+ })
25
+ }
26
+
27
+ main();
28
+
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
- {
2
- "name": "tmui-cli",
3
- "version": "1.2.4",
4
- "description": "tmui2.0,3.0,4.0x,3.2",
5
- "main": "./bin/tmui.js",
6
- "scripts": {
7
- "dev": "node ./bin/tmui.js",
8
- "test": "node ./dist/tmui.js",
9
- "build": "webpack --mode production"
10
- },
11
- "keywords": [
12
- "tmui"
13
- ],
14
- "author": {
15
- "name": "tmzdy"
16
- },
17
- "bin": {
18
- "tmui": "bin/tmui.js"
19
- },
20
- "license": "MIT",
21
- "dependencies": {
22
- "@babel/runtime": "^7.25.7",
23
- "babel-polyfill": "^6.26.0",
24
- "body-parser": "^1.20.3",
25
- "bufferhelper": "^0.2.1",
26
- "chalk": "^5.3.0",
27
- "codecs": "^3.1.0",
28
- "compressing": "^1.10.1",
29
- "express": "^4.21.1",
30
- "figlet": "^1.8.0",
31
- "global-dirs": "^4.0.0",
32
- "inquirer": "^12.0.0",
33
- "node-fetch": "^3.3.2",
34
- "node-os-utils": "^1.3.7",
35
- "open": "^10.1.0",
36
- "ps-tree": "^1.2.0",
37
- "ws": "^8.18.0"
38
- },
39
- "devDependencies": {
40
- "@babel/core": "^7.25.8",
41
- "@babel/plugin-transform-modules-commonjs": "^7.25.7",
42
- "@babel/plugin-transform-runtime": "^7.25.7",
43
- "@babel/preset-env": "^7.25.8",
44
- "babel-core": "^6.26.3",
45
- "babel-loader": "^9.2.1",
46
- "webpack": "^5.95.0",
47
- "webpack-cli": "^5.1.4",
48
- "webpack-node-externals": "^3.0.0"
49
- }
50
- }
1
+ {
2
+ "name": "tmui-cli",
3
+ "version": "1.2.5",
4
+ "description": "tmui2.0,3.0,4.0x,3.2",
5
+ "main": "./bin/tmui.js",
6
+ "scripts": {
7
+ "dev": "node ./bin/tmui.js",
8
+ "test": "node ./dist/tmui.js",
9
+ "build": "webpack --mode production"
10
+ },
11
+ "keywords": [
12
+ "tmui"
13
+ ],
14
+ "author": {
15
+ "name": "tmzdy"
16
+ },
17
+ "bin": {
18
+ "tmui": "bin/tmui.js"
19
+ },
20
+ "license": "MIT",
21
+ "dependencies": {
22
+ "@babel/runtime": "^7.25.7",
23
+ "babel-polyfill": "^6.26.0",
24
+ "body-parser": "^1.20.3",
25
+ "bufferhelper": "^0.2.1",
26
+ "chalk": "^5.3.0",
27
+ "codecs": "^3.1.0",
28
+ "compressing": "^1.10.1",
29
+ "express": "^4.21.1",
30
+ "figlet": "^1.8.0",
31
+ "global-dirs": "^4.0.0",
32
+ "inquirer": "^12.0.0",
33
+ "node-fetch": "^3.3.2",
34
+ "node-os-utils": "^1.3.7",
35
+ "open": "^10.1.0",
36
+ "ps-tree": "^1.2.0",
37
+ "ws": "^8.18.0"
38
+ },
39
+ "devDependencies": {
40
+ "@babel/core": "^7.25.8",
41
+ "@babel/plugin-transform-modules-commonjs": "^7.25.7",
42
+ "@babel/plugin-transform-runtime": "^7.25.7",
43
+ "@babel/preset-env": "^7.25.8",
44
+ "babel-core": "^6.26.3",
45
+ "babel-loader": "^9.2.1",
46
+ "webpack": "^5.95.0",
47
+ "webpack-cli": "^5.1.4",
48
+ "webpack-node-externals": "^3.0.0"
49
+ }
50
+ }
package/webpack.config.js CHANGED
@@ -1,17 +1,17 @@
1
- const path = require("path");
2
- const nodeExternals = require('webpack-node-externals');
3
- module.exports = {
4
- entry: './bin/tmui.js',
5
- output: {
6
- path: path.resolve(__dirname, 'dist'),
7
- filename: 'tmui.js',
8
- },
9
-
10
- resolve: {
11
- extensions: ['.js'], // 解析扩展名
12
- },
13
- target: 'node',
14
- externals: [
15
- nodeExternals()
16
- ],
1
+ const path = require("path");
2
+ const nodeExternals = require('webpack-node-externals');
3
+ module.exports = {
4
+ entry: './bin/tmui.js',
5
+ output: {
6
+ path: path.resolve(__dirname, 'dist'),
7
+ filename: 'tmui.js',
8
+ },
9
+
10
+ resolve: {
11
+ extensions: ['.js'], // 解析扩展名
12
+ },
13
+ target: 'node',
14
+ externals: [
15
+ nodeExternals()
16
+ ],
17
17
  }
@@ -1,20 +1,20 @@
1
- <!DOCTYPE html>
2
- <html lang="">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
- <link rel="icon" href="/favicon.ico" />
8
- <title>tmuistore</title>
9
- <script defer src="/js/chunk-vendors.js"></script><script defer src="/js/app.js"></script></head>
10
- <body>
11
- <noscript>
12
- <strong
13
- >We're sorry but tmuistore doesn't work properly without JavaScript enabled. Please enable it to
14
- continue.</strong
15
- >
16
- </noscript>
17
- <div id="app"></div>
18
- <!-- built files will be auto injected -->
19
- </body>
20
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
+ <link rel="icon" href="/favicon.ico" />
8
+ <title>tmuistore</title>
9
+ <script defer src="/js/chunk-vendors.js"></script><script defer src="/js/app.js"></script></head>
10
+ <body>
11
+ <noscript>
12
+ <strong
13
+ >We're sorry but tmuistore doesn't work properly without JavaScript enabled. Please enable it to
14
+ continue.</strong
15
+ >
16
+ </noscript>
17
+ <div id="app"></div>
18
+ <!-- built files will be auto injected -->
19
+ </body>
20
+ </html>