@youcan/cli 1.1.0-beta.0 → 1.1.0-beta.10
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/exec.cmd +3 -0
- package/bin/exec.js +8 -0
- package/dist/cli/commands/auth/login.d.ts +4 -2
- package/dist/cli/commands/auth/login.js +7 -85
- package/dist/cli/commands/auth/logout.d.ts +4 -2
- package/dist/cli/commands/auth/logout.js +9 -18
- package/dist/index.d.ts +2 -1
- package/dist/index.js +20 -2
- package/package.json +55 -40
- package/bin/index.js +0 -2
- package/dist/cli/commands/apps/create.d.ts +0 -2
- package/dist/cli/commands/apps/create.js +0 -65
- package/dist/cli/commands/apps/install.d.ts +0 -2
- package/dist/cli/commands/apps/install.js +0 -28
- package/dist/cli/commands/auth/types.d.ts +0 -6
- package/dist/cli/commands/index.d.ts +0 -12
- package/dist/cli/commands/index.js +0 -14
- package/dist/cli/commands/store/info.d.ts +0 -2
- package/dist/cli/commands/store/info.js +0 -29
- package/dist/cli/commands/store/switch.d.ts +0 -2
- package/dist/cli/commands/store/switch.js +0 -59
- package/dist/cli/commands/store/types.d.ts +0 -4
- package/dist/cli/commands/theme/delete.d.ts +0 -2
- package/dist/cli/commands/theme/delete.js +0 -46
- package/dist/cli/commands/theme/dev.d.ts +0 -2
- package/dist/cli/commands/theme/dev.js +0 -199
- package/dist/cli/commands/theme/init.d.ts +0 -2
- package/dist/cli/commands/theme/init.js +0 -86
- package/dist/cli/commands/theme/list.d.ts +0 -2
- package/dist/cli/commands/theme/list.js +0 -35
- package/dist/cli/commands/theme/pack.d.ts +0 -2
- package/dist/cli/commands/theme/pack.js +0 -31
- package/dist/cli/commands/theme/pull.d.ts +0 -2
- package/dist/cli/commands/theme/pull.js +0 -56
- package/dist/cli/commands/theme/types.d.ts +0 -17
- package/dist/cli/commands/types.d.ts +0 -22
- package/dist/cli/index.d.ts +0 -12
- package/dist/cli/index.js +0 -53
- package/dist/config/index.d.ts +0 -21
- package/dist/config/index.js +0 -25
- package/dist/config/messages.d.ts +0 -36
- package/dist/config/messages.js +0 -37
- package/dist/core/client/client.d.ts +0 -23
- package/dist/core/client/client.js +0 -83
- package/dist/core/client/types.d.ts +0 -80
- package/dist/core/themes/preview.d.ts +0 -1
- package/dist/core/themes/preview.js +0 -37
- package/dist/utils/common.d.ts +0 -22
- package/dist/utils/common.js +0 -67
- package/dist/utils/git/cloneRepository.d.ts +0 -6
- package/dist/utils/git/cloneRepository.js +0 -18
- package/dist/utils/helpers.d.ts +0 -3
- package/dist/utils/helpers.js +0 -35
- package/dist/utils/http.d.ts +0 -11
- package/dist/utils/http.js +0 -26
- package/dist/utils/network.d.ts +0 -2
- package/dist/utils/network.js +0 -81
- package/dist/utils/system/deleteFile.d.ts +0 -5
- package/dist/utils/system/deleteFile.js +0 -13
- package/dist/utils/system/ls.d.ts +0 -1
- package/dist/utils/system/ls.js +0 -9
- package/dist/utils/system/openLink.d.ts +0 -1
- package/dist/utils/system/saveFile.d.ts +0 -1
- package/dist/utils/system/saveFile.js +0 -9
- package/dist/utils/system/stdout.d.ts +0 -17
- package/dist/utils/system/stdout.js +0 -35
- package/dist/utils/system/writeToFile.d.ts +0 -1
- package/dist/utils/system/writeToFile.js +0 -7
- package/dist/utils/system/zipFolder.d.ts +0 -5
- package/dist/utils/system/zipFolder.js +0 -57
- package/dist/utils/system.d.ts +0 -1
- package/dist/utils/system.js +0 -18
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import archiver from 'archiver';
|
|
4
|
-
import { lsDir } from './ls.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Zip folder and save it to a given path and return zip folder path
|
|
8
|
-
*/
|
|
9
|
-
async function zipFolder(folderPath, folderName) {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
try {
|
|
12
|
-
const zipPath = path.resolve(folderPath, `${folderName}.zip`);
|
|
13
|
-
const output = fs.createWriteStream(zipPath);
|
|
14
|
-
const archive = archiver('zip', {
|
|
15
|
-
zlib: { level: 9 },
|
|
16
|
-
});
|
|
17
|
-
output.on('close', () => {
|
|
18
|
-
resolve(zipPath);
|
|
19
|
-
});
|
|
20
|
-
archive.on('error', (err) => {
|
|
21
|
-
reject(err);
|
|
22
|
-
});
|
|
23
|
-
archive.pipe(output);
|
|
24
|
-
archive.directory(path.resolve(folderPath, folderName), false);
|
|
25
|
-
archive.finalize();
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
reject(err);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
async function zipDirectory(dirPath, folderName, only) {
|
|
33
|
-
const ls = lsDir(dirPath).filter(folder => only?.includes(folder));
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
try {
|
|
36
|
-
const zip = path.resolve(dirPath, `${folderName}.zip`);
|
|
37
|
-
const output = fs.createWriteStream(zip);
|
|
38
|
-
const archive = archiver('zip', {
|
|
39
|
-
zlib: { level: 9 },
|
|
40
|
-
});
|
|
41
|
-
output.on('close', () => {
|
|
42
|
-
resolve(zip);
|
|
43
|
-
});
|
|
44
|
-
archive.on('error', (err) => {
|
|
45
|
-
reject(err);
|
|
46
|
-
});
|
|
47
|
-
archive.pipe(output);
|
|
48
|
-
ls.forEach(folder => archive.directory(path.resolve(dirPath, folder), folder));
|
|
49
|
-
archive.finalize();
|
|
50
|
-
}
|
|
51
|
-
catch (err) {
|
|
52
|
-
reject(err);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export { zipDirectory, zipFolder };
|
package/dist/utils/system.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const kill: (pid: number, signal?: string, timeout?: number) => Promise<void>;
|
package/dist/utils/system.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const kill = (pid, signal = 'SIGTERM', timeout = 1000) => new Promise((resolve, reject) => {
|
|
2
|
-
process.kill(pid, signal);
|
|
3
|
-
let count = 0;
|
|
4
|
-
setInterval(() => {
|
|
5
|
-
try {
|
|
6
|
-
process.kill(pid, 0);
|
|
7
|
-
}
|
|
8
|
-
catch (e) {
|
|
9
|
-
resolve();
|
|
10
|
-
}
|
|
11
|
-
count += 100;
|
|
12
|
-
if (count > timeout) {
|
|
13
|
-
reject(new Error('Timeout process kill'));
|
|
14
|
-
}
|
|
15
|
-
}, 100);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export { kill };
|