ddy-process-pc-vue3 1.0.1-beta.32

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/README.md ADDED
@@ -0,0 +1 @@
1
+ > pc端 流程组件
package/assets/doc.png ADDED
Binary file
package/assets/pdf.png ADDED
Binary file
package/assets/qt.png ADDED
Binary file
Binary file
package/assets/xls.png ADDED
Binary file
Binary file
package/assets/zip.png ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "ddy-process-pc-vue3",
3
+ "version": "1.0.1-beta.32",
4
+ "description": "> pc端流程组件",
5
+ "main": "./ddy-process-pc-vue3.umd.cjs",
6
+ "style": "./style.css",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./ddy-process-pc-vue3.js",
11
+ "require": "./ddy-process-pc-vue3.umd.cjs"
12
+ },
13
+ "./style.css": {
14
+ "import": "./style.css",
15
+ "require": "./style.css"
16
+ }
17
+ },
18
+ "scripts": {
19
+ "test": "echo \"Error: no test specified\" && exit 1",
20
+ "postinstall": "node scripts/postinstall.mjs"
21
+ },
22
+ "author": "",
23
+ "license": "ISC"
24
+ }
@@ -0,0 +1,14 @@
1
+ import { isNull, switchVersion } from './utils.mjs'
2
+ try {
3
+ import('vue').then(res => {
4
+ const version = isNull(res.version) ? res.default.version : res.version
5
+ if (isNull(version))
6
+ console.warn('[vue-demi-sfc-component-template] Vue is not found. Please run "npm install vue" to install.')
7
+ else
8
+ switchVersion(version)
9
+ })
10
+ } catch (error) {
11
+ console.log('error', error)
12
+ }
13
+
14
+
@@ -0,0 +1,4 @@
1
+ import { switchVersion } from './utils.mjs'
2
+
3
+ const version = process.argv[2]
4
+ switchVersion(version)
@@ -0,0 +1,60 @@
1
+ import path from 'path'
2
+ import fs from 'fs'
3
+ import { fileURLToPath } from 'url'
4
+ const __filename = fileURLToPath(import.meta.url)
5
+ const __dirname = path.dirname(__filename)
6
+
7
+ function switchVersion(version) {
8
+ const src = getLibDir(version)
9
+ const dest = path.join(src, '..')
10
+ console.log(`[frontend-shared] switch ddy-process-pc-vue3 to vue version ${version}`)
11
+ copyDir(src, dest)
12
+ }
13
+
14
+ function getLibDir(version) {
15
+ const dirname = getDirName(version)
16
+ return path.join(__dirname, `../../ddy-process-pc-vue3/${dirname}`)
17
+ }
18
+
19
+ function getDirName(version) {
20
+ return String(version).startsWith('2.7.') ? 'v2.7' : String(version).startsWith('2') ? 'v2' : 'v3'
21
+ }
22
+
23
+ function copyDir(src, dest) {
24
+ console.log(`copying from ${src} to ${dest}`)
25
+ // unlink for pnpm, #92
26
+ try {
27
+ fs.unlinkSync(dest)
28
+ } catch (error) { }
29
+ try {
30
+ copyRecursiveSync(src, dest)
31
+ } catch (error) {
32
+ console.error(error)
33
+ }
34
+ }
35
+
36
+ function copyRecursiveSync(src, dest) {
37
+ const exists = fs.existsSync(src)
38
+ const stats = exists && fs.statSync(src)
39
+ const isDirectory = stats && stats.isDirectory()
40
+ if (isDirectory) {
41
+ !fs.existsSync(dest) && fs.mkdirSync(dest)
42
+ fs.readdirSync(src).forEach((childItemName) => {
43
+ copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName))
44
+ })
45
+ } else {
46
+ fs.copyFileSync(src, dest)
47
+ }
48
+ }
49
+ // 判断是否为空
50
+ function isNull(str) {
51
+ if (str === null) return true;
52
+ if (str === undefined) return true;
53
+ if (str === "null") return true;
54
+ if (str === "NaN") return true;
55
+ if (str === "undefined") return true;
56
+ if (str.length === 0) return true;
57
+ // if (/^\s*$/i.test(str)) return true;
58
+ return false;
59
+ }
60
+ export { getLibDir, copyDir, switchVersion, isNull }