oipage 1.5.0 → 1.6.0-alpha.0
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/CHANGELOG +10 -1
- package/bin/disk.js +6 -1
- package/bin/help.js +2 -1
- package/bin/run +2 -1
- package/nodejs/animation/index.js +1 -1
- package/nodejs/cmdlog/index.js +1 -1
- package/nodejs/disk/index.d.ts +10 -1
- package/nodejs/disk/index.js +14 -2
- package/nodejs/format/index.js +1 -1
- package/nodejs/json/index.js +1 -1
- package/nodejs/logform/index.js +1 -1
- package/nodejs/reader/index.js +1 -1
- package/nodejs/throttle/index.js +1 -1
- package/package.json +1 -1
- package/web/XMLHttpRequest/index.js +1 -1
- package/web/animation/index.js +1 -1
- package/web/format/index.js +1 -1
- package/web/json/index.js +1 -1
- package/web/onReady/index.js +1 -1
- package/web/performChunk/index.js +1 -1
- package/web/reader/index.js +1 -1
- package/web/style/index.js +1 -1
- package/web/throttle/index.js +1 -1
package/CHANGELOG
CHANGED
|
@@ -114,4 +114,13 @@ v1.5.0:
|
|
|
114
114
|
* 图片转PDF
|
|
115
115
|
2、API功能(Node.js)
|
|
116
116
|
* disk 磁盘相关操作
|
|
117
|
-
(包括:moveDisk、listDisk)
|
|
117
|
+
(包括:moveDisk、listDisk)
|
|
118
|
+
v1.6.0:
|
|
119
|
+
date:
|
|
120
|
+
changes:
|
|
121
|
+
- 新增功能
|
|
122
|
+
1、命令(oipage-cli)
|
|
123
|
+
* disk --link 创建磁盘链接
|
|
124
|
+
2、API功能(Node.js)
|
|
125
|
+
* disk 磁盘相关操作
|
|
126
|
+
(包括:linkDisk)
|
package/bin/disk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { deleteDisk, copyDisk, moveDisk } = require("../nodejs/disk");
|
|
1
|
+
const { deleteDisk, copyDisk, moveDisk, linkDisk } = require("../nodejs/disk");
|
|
2
2
|
|
|
3
3
|
module.exports = function (config) {
|
|
4
4
|
let isForce = false;
|
|
@@ -27,5 +27,10 @@ module.exports = function (config) {
|
|
|
27
27
|
else if (config.value[i].name === "--copy") {
|
|
28
28
|
copyDisk(config.value[i].value[0], config.value[i].value[1], isForce);
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
// 创建磁盘链接
|
|
32
|
+
else if (config.value[i].name === "--link") {
|
|
33
|
+
linkDisk(config.value[i].value[0], config.value[i].value[1], isForce);
|
|
34
|
+
}
|
|
30
35
|
}
|
|
31
36
|
};
|
package/bin/help.js
CHANGED
package/bin/run
CHANGED
package/nodejs/cmdlog/index.js
CHANGED
package/nodejs/disk/index.d.ts
CHANGED
|
@@ -36,4 +36,13 @@ export interface listDiskType {
|
|
|
36
36
|
}) => void): void
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
export let listDisk: listDiskType
|
|
39
|
+
export let listDisk: listDiskType
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 创建文件或文件夹的链接
|
|
43
|
+
*/
|
|
44
|
+
export interface linkDiskType {
|
|
45
|
+
(sourcePath: string, targetPath: string): void
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export let linkDisk: linkDiskType
|
package/nodejs/disk/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* disk of OIPage v1.
|
|
2
|
+
* disk of OIPage v1.6.0-alpha.0
|
|
3
3
|
* git+https://github.com/oi-contrib/OIPage.git
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const { join } = require("path");
|
|
7
|
-
const { existsSync, readdirSync, lstatSync, unlinkSync, rmdirSync, mkdirSync, copyFileSync } = require("fs");
|
|
7
|
+
const { existsSync, readdirSync, lstatSync, unlinkSync, rmdirSync, mkdirSync, copyFileSync, symlinkSync } = require("fs");
|
|
8
|
+
const { execSync } = require("child_process");
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* 删除文件或文件夹
|
|
@@ -156,8 +157,19 @@ function listDisk(sourcePath, callback) {
|
|
|
156
157
|
"folder": folder
|
|
157
158
|
});
|
|
158
159
|
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* 软链接文件或文件夹
|
|
164
|
+
* @param {*} sourcePath
|
|
165
|
+
* @param {*} targetPath
|
|
166
|
+
*/
|
|
167
|
+
function linkDisk(sourcePath, targetPath) {
|
|
168
|
+
const type = lstatSync(sourcePath).isDirectory() ? 'junction' : 'file';
|
|
169
|
+
symlinkSync(sourcePath, targetPath, type);
|
|
159
170
|
}
|
|
160
171
|
exports.deleteDisk = deleteDisk;
|
|
161
172
|
exports.copyDisk = copyDisk;
|
|
162
173
|
exports.moveDisk = moveDisk;
|
|
163
174
|
exports.listDisk = listDisk;
|
|
175
|
+
exports.linkDisk = linkDisk;
|
package/nodejs/format/index.js
CHANGED
package/nodejs/json/index.js
CHANGED
package/nodejs/logform/index.js
CHANGED
package/nodejs/reader/index.js
CHANGED
package/nodejs/throttle/index.js
CHANGED
package/package.json
CHANGED
package/web/animation/index.js
CHANGED
package/web/format/index.js
CHANGED
package/web/json/index.js
CHANGED
package/web/onReady/index.js
CHANGED
package/web/reader/index.js
CHANGED
package/web/style/index.js
CHANGED
package/web/throttle/index.js
CHANGED