@mytmpvpn/mytmpvpn-cli 1.9.0 → 2.0.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/.eslintrc.js +30 -0
- package/dist/mytmpvpn.js +3 -1
- package/package.json +11 -4
- package/src/mytmpvpn.ts +3 -1
- package/#package-lock.json# +0 -6527
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
env: {
|
|
3
|
+
browser: true,
|
|
4
|
+
es2021: true
|
|
5
|
+
},
|
|
6
|
+
extends: ['standard-with-typescript', 'eslint:recommended', 'plugin:@typescript-eslint/recommended'],
|
|
7
|
+
parser: '@typescript-eslint/parser',
|
|
8
|
+
plugins: ['@typescript-eslint'],
|
|
9
|
+
root: true,
|
|
10
|
+
overrides: [
|
|
11
|
+
{
|
|
12
|
+
env: {
|
|
13
|
+
node: true
|
|
14
|
+
},
|
|
15
|
+
files: [
|
|
16
|
+
'.eslintrc.{js,cjs}'
|
|
17
|
+
],
|
|
18
|
+
parserOptions: {
|
|
19
|
+
sourceType: 'script'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
parserOptions: {
|
|
24
|
+
ecmaVersion: 'latest',
|
|
25
|
+
project: './tsconfig.json',
|
|
26
|
+
sourceType: 'module'
|
|
27
|
+
},
|
|
28
|
+
rules: {
|
|
29
|
+
}
|
|
30
|
+
}
|
package/dist/mytmpvpn.js
CHANGED
|
@@ -114,16 +114,18 @@ program.command('create')
|
|
|
114
114
|
.choices(vpnlib.getVpnConfigTypes())
|
|
115
115
|
.default(vpnlib.VpnType.WireGuard))
|
|
116
116
|
.option('--peanuts <nb>', 'Max number of peanuts to use (specify -1 for maximum)', '-1')
|
|
117
|
+
.option('--deleteAfter seconds', 'Number of seconds after which the vpn will be terminated')
|
|
117
118
|
.action((region, _, command) => {
|
|
118
119
|
const options = command.optsWithGlobals();
|
|
119
120
|
const syncStr = options.sync ? "synchronously" : "asynchronously";
|
|
121
|
+
const deleteAfter = options.deleteAfter ? options.deleteAfter : undefined;
|
|
120
122
|
log.debug(`Creating new ${options.type} vpn into ${region} ${syncStr}`);
|
|
121
123
|
auth.getLoggedInClientFromFiles({ appConfigFile: options.appConfig, userConfigFile: options.userConfig, profileName: options.profile }, (err, client) => {
|
|
122
124
|
if (err) {
|
|
123
125
|
handleError(err, options.verbose);
|
|
124
126
|
return;
|
|
125
127
|
}
|
|
126
|
-
client.createVpn(region, { type: options.type, maxPeanuts: options.peanuts }).then(vpn => {
|
|
128
|
+
client.createVpn(region, { type: options.type, maxPeanuts: options.peanuts, deleteAfter }).then(vpn => {
|
|
127
129
|
if (!options.sync) {
|
|
128
130
|
log.info(vpn);
|
|
129
131
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mytmpvpn/mytmpvpn-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "MyTmpVpn CLI",
|
|
5
5
|
"main": "./dist/mytmpvpn.js",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc --build && chmod +x dist/mytmpvpn.js",
|
|
12
|
+
"lint": "eslint",
|
|
12
13
|
"watch": "tsc -w",
|
|
13
14
|
"test": "jest",
|
|
14
15
|
"clean": "rm -rf dist/",
|
|
@@ -25,10 +26,16 @@
|
|
|
25
26
|
},
|
|
26
27
|
"license": "GNU GPL",
|
|
27
28
|
"dependencies": {
|
|
29
|
+
"@mytmpvpn/mytmpvpn-client": "^2.4.0",
|
|
30
|
+
"@mytmpvpn/mytmpvpn-common": "^3.0.0",
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
|
28
32
|
"commander": "^9.4.1",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
33
|
+
"eslint": "^8.53.0",
|
|
34
|
+
"eslint-config-standard-with-typescript": "^39.1.1",
|
|
35
|
+
"eslint-plugin-import": "^2.29.0",
|
|
36
|
+
"eslint-plugin-n": "^16.2.0",
|
|
37
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
38
|
+
"loglevel": "^1.8.1"
|
|
32
39
|
},
|
|
33
40
|
"devDependencies": {
|
|
34
41
|
"@types/jest": "^29.2.2",
|
package/src/mytmpvpn.ts
CHANGED
|
@@ -120,16 +120,18 @@ program.command('create')
|
|
|
120
120
|
.choices(vpnlib.getVpnConfigTypes())
|
|
121
121
|
.default(vpnlib.VpnType.WireGuard))
|
|
122
122
|
.option('--peanuts <nb>', 'Max number of peanuts to use (specify -1 for maximum)', '-1')
|
|
123
|
+
.option('--deleteAfter seconds', 'Number of seconds after which the vpn will be terminated')
|
|
123
124
|
.action((region: string, _, command) => {
|
|
124
125
|
const options = command.optsWithGlobals()
|
|
125
126
|
const syncStr = options.sync ? "synchronously" : "asynchronously"
|
|
127
|
+
const deleteAfter = options.deleteAfter ? options.deleteAfter : undefined
|
|
126
128
|
log.debug(`Creating new ${options.type} vpn into ${region} ${syncStr}`)
|
|
127
129
|
auth.getLoggedInClientFromFiles({ appConfigFile: options.appConfig, userConfigFile: options.userConfig, profileName: options.profile }, (err, client) => {
|
|
128
130
|
if (err) {
|
|
129
131
|
handleError(err, options.verbose)
|
|
130
132
|
return
|
|
131
133
|
}
|
|
132
|
-
client.createVpn(region, { type: options.type, maxPeanuts: options.peanuts }).then(vpn => {
|
|
134
|
+
client.createVpn(region, { type: options.type, maxPeanuts: options.peanuts, deleteAfter }).then(vpn => {
|
|
133
135
|
if (!options.sync) {
|
|
134
136
|
log.info(vpn)
|
|
135
137
|
return
|