@cloudbase/manager-node 5.2.0 → 5.4.0-beta.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.
@@ -1,70 +0,0 @@
1
- {
2
- "name": "@cloudbase/manager-node",
3
- "version": "5.2.0",
4
- "description": "The node manage service api for cloudbase.",
5
- "main": "lib/index.js",
6
- "scripts": {
7
- "build": "rimraf lib types && npx tsc",
8
- "test:coverage": "jest --runInBand --detectOpenHandles --coverage --testTimeout=100000",
9
- "test": "jest --runInBand --detectOpenHandles --testTimeout=100000",
10
- "lint": "eslint \"./**/*.ts\"",
11
- "lint:fix": "eslint --fix \"./**/*.ts\"",
12
- "prepublishOnly": "npm run build",
13
- "watch": "rimraf lib types && tsc -w",
14
- "link": "node scripts/link.js",
15
- "unlink": "node scripts/link.js -d"
16
- },
17
- "repository": {
18
- "type": "git",
19
- "url": "https://github.com/TencentCloudBase/cloudbase-manager-node.git"
20
- },
21
- "author": "Tencent CloudBase Team",
22
- "license": "ISC",
23
- "typings": "types/index.d.ts",
24
- "devDependencies": {
25
- "@lerna/create-symlink": "^6.4.1",
26
- "@types/fs-extra": "^11.0.4",
27
- "@types/jest": "^24.0.18",
28
- "@types/node": "^12.7.4",
29
- "@types/node-fetch": "^2.5.0",
30
- "@types/unzipper": "^0.10.11",
31
- "@typescript-eslint/eslint-plugin": "^3.7.1",
32
- "@typescript-eslint/parser": "^3.7.1",
33
- "eslint": "^7.6.0",
34
- "eslint-config-alloy": "^3.7.4",
35
- "husky": "^3.0.5",
36
- "jest": "^24.9.0",
37
- "lint-staged": "^9.2.5",
38
- "rimraf": "^3.0.0",
39
- "ts-jest": "^24.1.0",
40
- "typescript": "^5.8.3"
41
- },
42
- "dependencies": {
43
- "@cloudbase/database": "^0.6.2",
44
- "archiver": "^3.1.1",
45
- "cos-nodejs-sdk-v5": "^2.14.0",
46
- "del": "^5.1.0",
47
- "fs-extra": "^11.3.0",
48
- "https-proxy-agent": "^5.0.1",
49
- "lodash": "^4.17.21",
50
- "make-dir": "^3.0.0",
51
- "micromatch": "^4.0.2",
52
- "node-fetch": "^2.6.0",
53
- "query-string": "^6.8.3",
54
- "unzipper": "^0.12.3",
55
- "uuid": "^9.0.0",
56
- "walkdir": "^0.4.1"
57
- },
58
- "husky": {
59
- "hooks": {
60
- "pre-commit": "npm run build && git add . && lint-staged"
61
- }
62
- },
63
- "lint-staged": {
64
- "*.ts": [
65
- "eslint --fix",
66
- "git add"
67
- ]
68
- },
69
- "packageManager": "yarn@1.22.22"
70
- }
@@ -1,98 +0,0 @@
1
- /**
2
- * Tencent is pleased to support the open source community by making CloudBaseFramework - 云原生一体化部署工具 available.
3
- *
4
- * Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
5
- *
6
- * Please refer to license text included with this package for license details.
7
- */
8
-
9
- const os = require('os')
10
- const fs = require('fs')
11
- const fse = require('fs-extra')
12
- const del = require('del')
13
- const path = require('path')
14
- const mkdirp = require('mkdirp')
15
- const { execSync } = require('child_process')
16
- const { createSymlink } = require('@lerna/create-symlink')
17
-
18
- const globalNpmPath = execSync('npm root -g', {
19
- encoding: 'utf-8'
20
- }).trim()
21
- // 如果不支持workspace 可以用下面写死
22
- // const globalNpmPath = '/usr/local/lib/node_modules';
23
-
24
- async function main() {
25
- const unlink = process.argv?.[2] === '-d'
26
- await linkCore(unlink)
27
- }
28
-
29
- async function linkCore(unlink = false) {
30
- const jsonString = await fs.readFileSync(path.join(__dirname, '../package.json'))
31
- const { name } = JSON.parse(jsonString)
32
- await link(path.join(process.cwd()), path.join(globalNpmPath, '@cloudbase/cli'), name, unlink)
33
- }
34
-
35
- function isSymlink(path) {
36
- const stats = fs.lstatSync(path)
37
- return stats.isSymbolicLink()
38
- }
39
-
40
- // 将 global tcb cli 工具中的 framework-core link 到 packages/framework-core
41
- async function link(src, dest, packageName, unlink = false) {
42
- const prevCwd = process.cwd()
43
- const destPlugin = path.join(dest, 'node_modules', '@cloudbase')
44
- // 确保目录存在
45
- mkdirp.sync(destPlugin)
46
- // 切换 cwd
47
- process.chdir(destPlugin)
48
-
49
- const pathName = packageName.replace('@cloudbase/', '')
50
- const backupPathName = `${pathName}_backup`
51
-
52
- if (unlink) {
53
- if (fs.existsSync(pathName) && !isSymlink(pathName)) {
54
- console.log(`【失败】${pathName} 不是软链接`, process.cwd())
55
- return
56
- }
57
-
58
- if (fs.existsSync(pathName) && fs.existsSync(backupPathName)) {
59
- // 删除软链接
60
- del.sync([pathName])
61
-
62
- // 恢复备份
63
- fse.moveSync(backupPathName, pathName)
64
-
65
- // 删除软链接
66
- console.log('【成功】删除软链接:', process.cwd())
67
- } else {
68
- console.info(
69
- `不存在 ${pathName} 或 ${backupPathName},请重装安装 npm i @cloudbase/cli -g`,
70
- process.cwd()
71
- )
72
- }
73
- } else {
74
- // 创建软链接
75
-
76
- if (fs.existsSync(pathName)) {
77
- if (!fs.existsSync(backupPathName)) {
78
- // 不存在备份则进行备份
79
-
80
- if (!isSymlink(pathName)) {
81
- // 不是软链接才备份
82
- fse.moveSync(pathName, backupPathName)
83
- }
84
- } else {
85
- // 存在备份则直接删除
86
- del.sync([pathName])
87
- }
88
- }
89
-
90
- await createSymlink(src, pathName, 'junction')
91
- console.log('【成功】创建软链接:', process.cwd())
92
- }
93
-
94
- // 切回源目录
95
- process.chdir(prevCwd)
96
- }
97
-
98
- main()
@@ -1,19 +0,0 @@
1
- {
2
- "compileOnSave": true,
3
- "compilerOptions": {
4
- "module": "commonjs",
5
- "target": "ES2017",
6
- "moduleResolution": "node",
7
- "outDir": "lib",
8
- "removeComments": false,
9
- "types": ["node"],
10
- "esModuleInterop": true,
11
- "declaration": true,
12
- "declarationDir": "./types",
13
- "experimentalDecorators": true,
14
- "newLine": "LF",
15
- "skipLibCheck": true
16
- },
17
- "include": ["src/**/*"],
18
- "exclude": ["node_modules", "test"]
19
- }
@@ -1,14 +0,0 @@
1
- {
2
- "compileOnSave": true,
3
- "compilerOptions": {
4
- "experimentalDecorators": true,
5
- "module": "commonjs",
6
- "target": "ES2017",
7
- "moduleResolution": "node",
8
- "outDir": "lib",
9
- "types": ["node", "jest"],
10
- "esModuleInterop": true
11
- },
12
- "include": ["src/**/*", "test/**/*"],
13
- "exclude": ["node_modules"]
14
- }