uview-ultra-plus 1.11.1 → 1.12.1
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/dist/package.json +13 -2
- package/dist/scripts/build.js +67 -36
- package/dist/scripts/sync-logic.js +56 -0
- package/dist/uview-ultra/package.json +1 -1
- package/package.json +13 -2
- package/dist/uview-ultra/package-lock.json +0 -65
package/dist/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uview-ultra-plus",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
4
|
+
"workspaces": [
|
|
5
|
+
"packages/*",
|
|
6
|
+
"examples/*"
|
|
7
|
+
],
|
|
4
8
|
"publishConfig": {
|
|
5
9
|
"registry": "https://registry.npmjs.org/"
|
|
6
10
|
},
|
|
@@ -14,6 +18,10 @@
|
|
|
14
18
|
"scripts": {
|
|
15
19
|
"release": "release-it",
|
|
16
20
|
"build": "node scripts/build.js",
|
|
21
|
+
"docs:dev": "vitepress dev docs",
|
|
22
|
+
"docs:build": "vitepress build docs",
|
|
23
|
+
"docs:preview": "vitepress preview docs",
|
|
24
|
+
"watch:examples": "node scripts/build.js --watch",
|
|
17
25
|
"rollup": "rollup -c rollup.config.mjs",
|
|
18
26
|
"test": "echo \"No test specified\""
|
|
19
27
|
},
|
|
@@ -50,8 +58,11 @@
|
|
|
50
58
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
51
59
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
52
60
|
"@rollup/plugin-terser": "^0.4.4",
|
|
61
|
+
"chokidar": "^5.0.0",
|
|
53
62
|
"release-it": "^19.2.4",
|
|
54
|
-
"rollup": "^4.59.0"
|
|
63
|
+
"rollup": "^4.59.0",
|
|
64
|
+
"vitepress": "^1.6.4",
|
|
65
|
+
"vue": "^3.5.29"
|
|
55
66
|
},
|
|
56
67
|
"engines": {
|
|
57
68
|
"node": ">=20.0.0"
|
package/dist/scripts/build.js
CHANGED
|
@@ -15,25 +15,23 @@ const distPath = path.join(projectRoot, 'dist');
|
|
|
15
15
|
|
|
16
16
|
function clean() {
|
|
17
17
|
console.log('[Build] Cleaning dist...');
|
|
18
|
-
|
|
19
|
-
fs.
|
|
18
|
+
try {
|
|
19
|
+
if (fs.existsSync(distPath)) {
|
|
20
|
+
execSync(`rm -rf "${distPath}"`);
|
|
21
|
+
}
|
|
22
|
+
fs.mkdirSync(distPath, { recursive: true });
|
|
23
|
+
} catch (e) {
|
|
24
|
+
console.warn(`[Build] Clean warning: ${e.message}. Retrying...`);
|
|
25
|
+
// Maybe try one more time or just continue if mkdirSync succeeds
|
|
26
|
+
if (!fs.existsSync(distPath)) fs.mkdirSync(distPath, { recursive: true });
|
|
20
27
|
}
|
|
21
|
-
fs.mkdirSync(distPath, { recursive: true });
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
function copySource() {
|
|
25
|
-
console.log('[Build] Copying
|
|
26
|
-
|
|
27
|
-
// Main components
|
|
28
|
-
const uviewSrc = path.join(projectRoot, 'src/uview-ultra');
|
|
29
|
-
const uviewDest = path.join(distPath, 'uview-ultra');
|
|
31
|
+
console.log('[Build] Copying other core files to dist...');
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// lime-dayuts (moved to src/uview-ultra/uts-libs/lime-dayuts)
|
|
36
|
-
const limeSrc = path.join(projectRoot, 'src/uview-ultra/uts-libs/lime-dayuts');
|
|
33
|
+
// lime-dayuts (moved to packages/uview-ultra/uts-libs/lime-dayuts)
|
|
34
|
+
const limeSrc = path.join(projectRoot, 'packages/uview-ultra/uts-libs/lime-dayuts');
|
|
37
35
|
const limeDest = path.join(distPath, 'lime-dayuts');
|
|
38
36
|
if (fs.existsSync(limeSrc)) {
|
|
39
37
|
if (!fs.existsSync(limeDest)) fs.mkdirSync(limeDest, { recursive: true });
|
|
@@ -60,35 +58,68 @@ function patchImports() {
|
|
|
60
58
|
require('./patch-imports.js');
|
|
61
59
|
}
|
|
62
60
|
|
|
61
|
+
const chokidar = require('chokidar');
|
|
62
|
+
const { syncSourceToDist, syncExamples } = require('./sync-logic.js');
|
|
63
|
+
|
|
64
|
+
function fullBuild() {
|
|
65
|
+
clean();
|
|
66
|
+
syncSourceToDist(); // Sync from packages/uview-ultra to dist/uview-ultra
|
|
67
|
+
|
|
68
|
+
// Copy other core files to dist
|
|
69
|
+
copySource();
|
|
70
|
+
|
|
71
|
+
runRollup();
|
|
72
|
+
patchImports();
|
|
73
|
+
syncExamples(); // Sync from dist/uview-ultra to examples
|
|
74
|
+
console.log('[Build] Successfully completed!');
|
|
75
|
+
}
|
|
76
|
+
|
|
63
77
|
/**
|
|
64
|
-
*
|
|
78
|
+
* Watch mode logic
|
|
65
79
|
*/
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const exampleTargets = [
|
|
70
|
-
path.join(projectRoot, 'examples/uniapp/src/uni_modules/uview-ultra'),
|
|
71
|
-
path.join(projectRoot, 'examples/uniapp-x/uni_modules/uview-ultra')
|
|
72
|
-
];
|
|
80
|
+
function watch() {
|
|
81
|
+
const watchPath = path.join(projectRoot, 'packages/uview-ultra');
|
|
82
|
+
console.log(`[Watch] Starting watcher on ${watchPath}...`);
|
|
73
83
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
fs.rmSync(target, { recursive: true, force: true });
|
|
79
|
-
}
|
|
80
|
-
execSync(`rsync -aq --exclude='node_modules' "${uviewSrc}/" "${target}/"`);
|
|
81
|
-
}
|
|
84
|
+
const watcher = chokidar.watch(watchPath, {
|
|
85
|
+
ignored: /(^|[\/\\])\../,
|
|
86
|
+
persistent: true,
|
|
87
|
+
ignoreInitial: true
|
|
82
88
|
});
|
|
89
|
+
|
|
90
|
+
let timer = null;
|
|
91
|
+
const debounceSync = () => {
|
|
92
|
+
if (timer) clearTimeout(timer);
|
|
93
|
+
timer = setTimeout(() => {
|
|
94
|
+
console.log('[Watch] Changes detected, rebuilding...');
|
|
95
|
+
try {
|
|
96
|
+
// For watch mode, we only need to sync source, patch, and sync examples
|
|
97
|
+
// Rollup (vendor) usually doesn't need to re-run unless dependencies change
|
|
98
|
+
syncSourceToDist();
|
|
99
|
+
patchImports();
|
|
100
|
+
syncExamples();
|
|
101
|
+
console.log('[Watch] Sync completed. Waiting for changes...');
|
|
102
|
+
} catch (e) {
|
|
103
|
+
console.error(`[Watch] Sync failed: ${e.message}`);
|
|
104
|
+
}
|
|
105
|
+
}, 300);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
watcher
|
|
109
|
+
.on('all', (event, path) => {
|
|
110
|
+
console.log(`[Watch] Event ${event} on ${path}`);
|
|
111
|
+
debounceSync();
|
|
112
|
+
})
|
|
113
|
+
.on('error', error => console.log(`[Watch] Watcher error: ${error}`));
|
|
83
114
|
}
|
|
84
115
|
|
|
116
|
+
const isWatchMode = process.argv.includes('--watch') || process.argv.includes('-w');
|
|
117
|
+
|
|
85
118
|
try {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
syncExamples();
|
|
91
|
-
console.log('[Build] Successfully completed!');
|
|
119
|
+
fullBuild();
|
|
120
|
+
if (isWatchMode) {
|
|
121
|
+
watch();
|
|
122
|
+
}
|
|
92
123
|
} catch (err) {
|
|
93
124
|
console.error('[Build] Failed:', err.message);
|
|
94
125
|
process.exit(1);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
const projectRoot = path.resolve(__dirname, '..');
|
|
6
|
+
const distPath = path.join(projectRoot, 'dist/uview-ultra');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Copy source code from packages to dist
|
|
10
|
+
*/
|
|
11
|
+
function syncSourceToDist() {
|
|
12
|
+
console.log('[Sync] Copying packages/uview-ultra to dist/uview-ultra...');
|
|
13
|
+
const uviewSrc = path.join(projectRoot, 'packages/uview-ultra');
|
|
14
|
+
|
|
15
|
+
if (!fs.existsSync(distPath)) {
|
|
16
|
+
fs.mkdirSync(distPath, { recursive: true });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
execSync(`rsync -aq --exclude='node_modules' --exclude='uts-libs' "${uviewSrc}/" "${distPath}/"`);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
console.error(`[Sync] Failed to sync source to dist: ${e.message}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Synchronize from dist to examples for local testing
|
|
28
|
+
*/
|
|
29
|
+
function syncExamples() {
|
|
30
|
+
console.log('[Sync] Syncing dist/uview-ultra to examples...');
|
|
31
|
+
const exampleTargets = [
|
|
32
|
+
path.join(projectRoot, 'examples/uniapp/src/uni_modules/uview-ultra'),
|
|
33
|
+
path.join(projectRoot, 'examples/uniapp-x/uni_modules/uview-ultra')
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
if (!fs.existsSync(distPath)) {
|
|
37
|
+
console.warn('[Sync] Dist directory not found. Please run build first.');
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
exampleTargets.forEach(target => {
|
|
42
|
+
if (fs.existsSync(path.dirname(target))) {
|
|
43
|
+
console.log(`[Sync] Syncing to ${path.relative(projectRoot, target)}...`);
|
|
44
|
+
try {
|
|
45
|
+
if (fs.existsSync(target)) {
|
|
46
|
+
execSync(`rm -rf "${target}"`);
|
|
47
|
+
}
|
|
48
|
+
execSync(`rsync -aq --exclude='node_modules' "${distPath}/" "${target}/"`);
|
|
49
|
+
} catch (e) {
|
|
50
|
+
console.error(`[Sync] Failed to sync to ${target}: ${e.message}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
module.exports = { syncSourceToDist, syncExamples };
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uview-ultra-plus",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.1",
|
|
4
|
+
"workspaces": [
|
|
5
|
+
"packages/*",
|
|
6
|
+
"examples/*"
|
|
7
|
+
],
|
|
4
8
|
"publishConfig": {
|
|
5
9
|
"registry": "https://registry.npmjs.org/"
|
|
6
10
|
},
|
|
@@ -14,6 +18,10 @@
|
|
|
14
18
|
"scripts": {
|
|
15
19
|
"release": "release-it",
|
|
16
20
|
"build": "node scripts/build.js",
|
|
21
|
+
"docs:dev": "vitepress dev docs",
|
|
22
|
+
"docs:build": "vitepress build docs",
|
|
23
|
+
"docs:preview": "vitepress preview docs",
|
|
24
|
+
"watch:examples": "node scripts/build.js --watch",
|
|
17
25
|
"rollup": "rollup -c rollup.config.mjs",
|
|
18
26
|
"test": "echo \"No test specified\""
|
|
19
27
|
},
|
|
@@ -50,8 +58,11 @@
|
|
|
50
58
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
51
59
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
52
60
|
"@rollup/plugin-terser": "^0.4.4",
|
|
61
|
+
"chokidar": "^5.0.0",
|
|
53
62
|
"release-it": "^19.2.4",
|
|
54
|
-
"rollup": "^4.59.0"
|
|
63
|
+
"rollup": "^4.59.0",
|
|
64
|
+
"vitepress": "^1.6.4",
|
|
65
|
+
"vue": "^3.5.29"
|
|
55
66
|
},
|
|
56
67
|
"engines": {
|
|
57
68
|
"node": ">=20.0.0"
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "uview-ultra",
|
|
3
|
-
"version": "1.11.1",
|
|
4
|
-
"lockfileVersion": 3,
|
|
5
|
-
"requires": true,
|
|
6
|
-
"packages": {
|
|
7
|
-
"": {
|
|
8
|
-
"name": "uview-ultra",
|
|
9
|
-
"version": "1.11.1",
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"clipboard": "^2.0.11",
|
|
12
|
-
"dayjs": "^1.11.3"
|
|
13
|
-
},
|
|
14
|
-
"engines": {
|
|
15
|
-
"HBuilderX": "^3.1.0",
|
|
16
|
-
"uni-app": "^4.87",
|
|
17
|
-
"uni-app-x": "^4.87"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"node_modules/clipboard": {
|
|
21
|
-
"version": "2.0.11",
|
|
22
|
-
"resolved": "https://registry.npmmirror.com/clipboard/-/clipboard-2.0.11.tgz",
|
|
23
|
-
"integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
|
|
24
|
-
"license": "MIT",
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"good-listener": "^1.2.2",
|
|
27
|
-
"select": "^1.1.2",
|
|
28
|
-
"tiny-emitter": "^2.0.0"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"node_modules/dayjs": {
|
|
32
|
-
"version": "1.11.19",
|
|
33
|
-
"resolved": "https://registry.npmmirror.com/dayjs/-/dayjs-1.11.19.tgz",
|
|
34
|
-
"integrity": "sha512-t5EcLVS6QPBNqM2z8fakk/NKel+Xzshgt8FFKAn+qwlD1pzZWxh0nVCrvFK7ZDb6XucZeF9z8C7CBWTRIVApAw==",
|
|
35
|
-
"license": "MIT"
|
|
36
|
-
},
|
|
37
|
-
"node_modules/delegate": {
|
|
38
|
-
"version": "3.2.0",
|
|
39
|
-
"resolved": "https://registry.npmmirror.com/delegate/-/delegate-3.2.0.tgz",
|
|
40
|
-
"integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==",
|
|
41
|
-
"license": "MIT"
|
|
42
|
-
},
|
|
43
|
-
"node_modules/good-listener": {
|
|
44
|
-
"version": "1.2.2",
|
|
45
|
-
"resolved": "https://registry.npmmirror.com/good-listener/-/good-listener-1.2.2.tgz",
|
|
46
|
-
"integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
|
|
47
|
-
"license": "MIT",
|
|
48
|
-
"dependencies": {
|
|
49
|
-
"delegate": "^3.1.2"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"node_modules/select": {
|
|
53
|
-
"version": "1.1.2",
|
|
54
|
-
"resolved": "https://registry.npmmirror.com/select/-/select-1.1.2.tgz",
|
|
55
|
-
"integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA==",
|
|
56
|
-
"license": "MIT"
|
|
57
|
-
},
|
|
58
|
-
"node_modules/tiny-emitter": {
|
|
59
|
-
"version": "2.1.0",
|
|
60
|
-
"resolved": "https://registry.npmmirror.com/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
|
|
61
|
-
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==",
|
|
62
|
-
"license": "MIT"
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|