@dobot-plus/template 1.0.0 → 1.0.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.
@@ -0,0 +1,76 @@
1
+ const path = require('path')
2
+ const HtmlInlineScriptPlugin = require('html-inline-script-webpack-plugin')
3
+ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
4
+ const { entries, htmlPlugins } = require('./entry')
5
+ const { DefinePlugin, ProvidePlugin } = require('webpack')
6
+
7
+ module.exports = (opts) => {
8
+ return {
9
+ mode: 'production',
10
+ entry: entries,
11
+ output: {
12
+ publicPath: './',
13
+ filename: '[name].js',
14
+ path: path.resolve(opts.output || 'dist')
15
+ },
16
+ module: {
17
+ rules: [
18
+ {
19
+ test: /\.(sa|sc|c)ss$/,
20
+ use: [
21
+ 'style-loader',
22
+ 'css-loader',
23
+ 'postcss-loader',
24
+ {
25
+ loader: 'sass-loader',
26
+ options: {
27
+ // implementation: sass
28
+ }
29
+ }
30
+ ]
31
+ },
32
+ {
33
+ test: /\.tsx?$/,
34
+ use: {
35
+ loader: 'esbuild-loader',
36
+ options: {
37
+ loader: 'tsx',
38
+ target: 'es2015'
39
+ }
40
+ }
41
+ },
42
+ {
43
+ test: /\.(jpe?g|png|gif|webp|svg)$/,
44
+ use: [
45
+ {
46
+ loader: 'url-loader',
47
+ options: {
48
+ // limit: 10 * 1024,
49
+ esModule: false
50
+ }
51
+ }
52
+ ]
53
+ }
54
+ ]
55
+ },
56
+ optimization: {
57
+ minimizer: [new CssMinimizerPlugin({})]
58
+ },
59
+ plugins: [
60
+ ...htmlPlugins,
61
+ new HtmlInlineScriptPlugin({
62
+ htmlMatchPattern: [/.html$/]
63
+ }),
64
+ new ProvidePlugin({
65
+ process: 'process/browser.js',
66
+ Buffer: ['buffer', 'Buffer']
67
+ })
68
+ ],
69
+ resolve: {
70
+ extensions: ['.js', '.jsx', '.json', '.tsx', '.ts'],
71
+ alias: {
72
+ '@dobot': path.resolve(process.cwd(), './.dobot')
73
+ }
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,91 @@
1
+ const { DefinePlugin, ProvidePlugin } = require('webpack')
2
+ const { entries, htmlPlugins } = require('./entry')
3
+ const { resolve } = require('path')
4
+ const HtmlWebpackPlugin = require('html-webpack-plugin')
5
+
6
+ module.exports = {
7
+ mode: 'development',
8
+ devtool: 'eval-source-map',
9
+ target: 'web',
10
+ entry: {
11
+ index: resolve(process.cwd(), `./.dobot/template/entry.tsx`),
12
+ ...entries
13
+ },
14
+ module: {
15
+ rules: [
16
+ {
17
+ test: /\.(sa|sc|c)ss$/,
18
+ use: [
19
+ 'style-loader',
20
+ 'css-loader',
21
+ 'postcss-loader',
22
+ {
23
+ loader: 'sass-loader',
24
+ options: {
25
+ // implementation: sass
26
+ }
27
+ }
28
+ ]
29
+ },
30
+ {
31
+ test: /\.tsx?$/,
32
+ use: {
33
+ loader: 'esbuild-loader',
34
+ options: {
35
+ loader: 'tsx',
36
+ target: 'es2015'
37
+ }
38
+ }
39
+ },
40
+ {
41
+ test: /\.(jpe?g|png|gif|webp|svg)$/,
42
+ use: [
43
+ {
44
+ loader: 'url-loader',
45
+ options: {
46
+ limit: 10 * 1024,
47
+ esModule: false
48
+ }
49
+ }
50
+ ]
51
+ }
52
+ ]
53
+ },
54
+ plugins: [
55
+ new HtmlWebpackPlugin({
56
+ filename: `index.html`,
57
+ chunks: ['index'],
58
+ template: resolve(process.cwd(), `./.dobot/template/index.html`),
59
+ inject: 'body',
60
+ minify: {
61
+ // 压缩html
62
+ collapseWhitespace: true, // 折叠空白区域
63
+ keepClosingSlash: true, // 保持闭合间隙
64
+ removeComments: true, // 移除注释
65
+ removeRedundantAttributes: true, // 删除冗余属性
66
+ removeScriptTypeAttributes: true, // 删除Script脚本类型属性
67
+ removeStyleLinkTypeAttributes: true, // 删除样式链接类型属性
68
+ useShortDoctype: true, // 使用短文档类型
69
+ preserveLineBreaks: true, // 保留换行符
70
+ minifyCSS: true, // 压缩文内css
71
+ minifyJS: true // 压缩文内js
72
+ }
73
+ }),
74
+ ...htmlPlugins,
75
+ new ProvidePlugin({
76
+ process: 'process/browser.js',
77
+ Buffer: ['buffer', 'Buffer']
78
+ }),
79
+ new DefinePlugin({
80
+ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
81
+ })
82
+ ],
83
+ resolve: {
84
+ extensions: ['.js', '.jsx', '.json', '.tsx', '.ts'],
85
+ alias: {
86
+ snapsvg: 'snapsvg/dist/snap.svg.js',
87
+ reactMarkdown: 'react-markdown/index.js',
88
+ '@dobot': resolve(process.cwd(), './.dobot')
89
+ }
90
+ }
91
+ }
@@ -0,0 +1,56 @@
1
+ const { resolve } = require('path')
2
+ const fs = require('fs')
3
+ const HtmlWebpackPlugin = require('html-webpack-plugin')
4
+
5
+ const cmdPath = process.cwd()
6
+
7
+ const entries = {}
8
+
9
+ const pageFiles = fs.readdirSync(resolve(cmdPath, './ui'))
10
+ const pages = []
11
+ pageFiles.forEach((page) => {
12
+ const status = fs.statSync(resolve(cmdPath, `./ui/${page}`))
13
+ if (!status.isDirectory()) {
14
+ pages.push(page.split('.')[0])
15
+ }
16
+ })
17
+
18
+ pages.forEach((page) => {
19
+
20
+ if (!fs.existsSync(resolve(cmdPath, `./.dobot/template/${page}.tsx`))) {
21
+ const tplStr = fs.readFileSync(resolve(cmdPath, `./.dobot/template/default.tsx.mustache`), 'utf-8')
22
+ fs.writeFileSync(resolve(cmdPath, `./.dobot/template/${page}.tsx`), tplStr.replace('$APP_PATH$', `../../ui/${page}`))
23
+ }
24
+ entries[page] = resolve(cmdPath, `./.dobot/template/${page}.tsx`)
25
+ })
26
+
27
+ const htmlPlugins = pages.map(
28
+ (file) =>
29
+ new HtmlWebpackPlugin({
30
+ filename: `${file}/${/toolbar/i.test(file) ? 'toolbar' : 'index'}.html`,
31
+ chunks: [file],
32
+ template: fs.existsSync(resolve(cmdPath, `./.dobot/template/${file}.html`))
33
+ ? `./.dobot/template/${file}.html`
34
+ : `./.dobot/template/index.html`,
35
+ inject: 'body',
36
+ minify: {
37
+ // 压缩html
38
+ collapseWhitespace: true, // 折叠空白区域
39
+ keepClosingSlash: true, // 保持闭合间隙
40
+ removeComments: true, // 移除注释
41
+ removeRedundantAttributes: true, // 删除冗余属性
42
+ removeScriptTypeAttributes: true, // 删除Script脚本类型属性
43
+ removeStyleLinkTypeAttributes: true, // 删除样式链接类型属性
44
+ useShortDoctype: true, // 使用短文档类型
45
+ preserveLineBreaks: true, // 保留换行符
46
+ minifyCSS: true, // 压缩文内css
47
+ minifyJS: true // 压缩文内js
48
+ }
49
+ })
50
+ )
51
+
52
+
53
+ module.exports = {
54
+ entries,
55
+ htmlPlugins
56
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ### [1.0.5](https://192.168.0.11:20022/IndustrialProducts/TPGroup/FrontEndpluginCollection/dobotplus/dobotpluginsworktile/compare/v1.0.2...v1.0.5) (2025-09-15)
6
+
7
+ ### [1.0.4](https://192.168.0.11:20022/IndustrialProducts/TPGroup/FrontEndpluginCollection/dobotplus/dobotpluginsworktile/compare/v1.0.2...v1.0.4) (2025-09-15)
8
+
9
+ ### [1.0.3](https://192.168.0.11:20022/IndustrialProducts/TPGroup/FrontEndpluginCollection/dobotplus/dobotpluginsworktile/compare/v1.0.2...v1.0.3) (2025-09-15)
10
+
11
+ ### [1.0.1](https://192.168.0.11:20022/IndustrialProducts/TPGroup/FrontEndpluginCollection/dobotplus/dobotpluginsworktile/compare/v1.0.2...v1.0.1) (2025-09-15)
package/dpt.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "ip": "192.168.5.1",
3
- "pluginPort": 22100
3
+ "port": 22001
4
4
  }
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@dobot-plus/template",
3
- "version": "1.0.0",
3
+ "version": "1.0.5",
4
4
  "engines": {
5
5
  "node": "20"
6
6
  },
7
7
  "scripts": {
8
8
  "dev": "dpt dev",
9
- "build": "dpt build"
9
+ "build": "dpt build",
10
+ "release": "standard-version && npm publish --access public"
10
11
  },
11
- "dependencies": {
12
+ "dependencies": {},
13
+ "devDependencies": {
12
14
  "@dobot-plus/components": "latest",
13
15
  "antd": "^5.22.3",
14
16
  "axios": "^1.3.3",
@@ -20,9 +22,7 @@
20
22
  "react-dom": "^18.3.1",
21
23
  "react-i18next": "^15.0.0",
22
24
  "react-redux": "^9.1.2",
23
- "redux": "^5.0.1"
24
- },
25
- "devDependencies": {
25
+ "redux": "^5.0.1",
26
26
  "@types/node": "^20.14.12",
27
27
  "@types/pubsub-js": "^1.8.6",
28
28
  "@types/react": "^18.3.3",
@@ -39,7 +39,7 @@
39
39
  "sass": "^1.77.8",
40
40
  "sass-loader": "^16.0.0",
41
41
  "style-loader": "^4.0.0",
42
- "ts-loader": "^9.5.1",
42
+ "esbuild-loader": "2.21.0",
43
43
  "typescript": "^5.5.4",
44
44
  "url-loader": "^4.1.1",
45
45
  "webpack": "^5.93.0",
package/project.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "name": "@dobot-plus/template"
2
+ "name": "template"
3
3
  }