@hexonet/semantic-release-whmcs 3.1.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +13 -12
- package/.github/workflows/pull-request.yml +12 -10
- package/.github/workflows/push.yml +23 -15
- package/HISTORY.md +31 -0
- package/{base.css → coverage/base.css} +0 -0
- package/{block-navigation.js → coverage/block-navigation.js} +8 -0
- package/{coverage-final.json → coverage/coverage-final.json} +8 -8
- package/{favicon.png → coverage/favicon.png} +0 -0
- package/{index.html → coverage/index.html} +8 -3
- package/{lib → coverage/lib}/definitions/errors.js.html +8 -3
- package/{lib → coverage/lib}/definitions/index.html +8 -3
- package/{lib → coverage/lib}/delete-marketplace-version.js.html +8 -3
- package/{lib → coverage/lib}/get-error.js.html +8 -3
- package/{lib → coverage/lib}/get-github-releases.js.html +8 -3
- package/{lib → coverage/lib}/index.html +8 -3
- package/{lib → coverage/lib}/publish.js.html +82 -20
- package/{lib → coverage/lib}/puppet.js.html +11 -6
- package/{lib → coverage/lib}/resolve-config.js.html +8 -3
- package/{lib → coverage/lib}/scrape-marketplace-versions.js.html +8 -3
- package/{lib → coverage/lib}/set-compatible-versions.js.html +8 -3
- package/{lib → coverage/lib}/verify.js.html +8 -3
- package/{prettify.css → coverage/prettify.css} +0 -0
- package/{prettify.js → coverage/prettify.js} +0 -0
- package/{sort-arrow-sprite.png → coverage/sort-arrow-sprite.png} +0 -0
- package/{sorter.js → coverage/sorter.js} +26 -0
- package/lib/publish.js +35 -16
- package/package.json +11 -12
- package/whmcs.js +0 -1
- package/test/publish.test.js +0 -83
- package/test/verify.test.js +0 -93
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hexonet/semantic-release-whmcs",
|
3
3
|
"description": "`semantic-release` plugin for auto-publishing on WHMCS marketplace",
|
4
|
-
"version": "
|
4
|
+
"version": "4.0.0",
|
5
5
|
"private": false,
|
6
6
|
"publishConfig": {
|
7
7
|
"access": "public"
|
@@ -13,8 +13,8 @@
|
|
13
13
|
"main": "index.js",
|
14
14
|
"license": "MIT",
|
15
15
|
"engines": {
|
16
|
-
"node": ">=
|
17
|
-
"npm": ">=
|
16
|
+
"node": ">=16.15.1",
|
17
|
+
"npm": ">=8.11.1"
|
18
18
|
},
|
19
19
|
"homepage": "https://github.com/hexonet/semantic-release-whmcs#readme",
|
20
20
|
"repository": "github:hexonet/semantic-release-whmcs",
|
@@ -60,26 +60,25 @@
|
|
60
60
|
"@semantic-release/changelog": "^6.0.1",
|
61
61
|
"@semantic-release/exec": "^6.0.2",
|
62
62
|
"@semantic-release/git": "^10.0.1",
|
63
|
-
"ava": "^
|
64
|
-
"
|
65
|
-
"eslint": "^
|
66
|
-
"eslint-config-standard": "^16.0.3",
|
63
|
+
"ava": "^4.0.0",
|
64
|
+
"eslint": "^8.0.1",
|
65
|
+
"eslint-config-standard": "^17.0.0",
|
67
66
|
"eslint-plugin-import": "^2.25.2",
|
68
67
|
"eslint-plugin-json": "^3.0.0",
|
69
68
|
"eslint-plugin-markdown": "^2.1.0",
|
70
|
-
"eslint-plugin-
|
71
|
-
"eslint-plugin-promise": "^
|
69
|
+
"eslint-plugin-n": "^15.2.0",
|
70
|
+
"eslint-plugin-promise": "^6.0.0",
|
72
71
|
"esm": "^3.2.25",
|
73
72
|
"nyc": "^15.1.0",
|
74
|
-
"semantic-release": "^
|
73
|
+
"semantic-release": "^19.0.2",
|
75
74
|
"stream-buffers": "^3.0.2"
|
76
75
|
},
|
77
76
|
"dependencies": {
|
78
77
|
"@semantic-release/error": "^3.0.0",
|
79
78
|
"aggregate-error": "^3.1.0",
|
79
|
+
"debug": "^4.3.4",
|
80
80
|
"github-api": "^3.4.0",
|
81
|
-
"puppeteer": "^
|
82
|
-
"sinon": "^12.0.0",
|
81
|
+
"puppeteer": "^14.0.0",
|
83
82
|
"yargs": "^17.0.1"
|
84
83
|
}
|
85
84
|
}
|
package/whmcs.js
CHANGED
package/test/publish.test.js
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
import test from 'ava'
|
2
|
-
const publish = require('../lib/publish')
|
3
|
-
const deleteVersion = require('../lib/delete-marketplace-version')
|
4
|
-
|
5
|
-
test.beforeEach((t) => {
|
6
|
-
// Mock logger
|
7
|
-
t.context.logger = new class {
|
8
|
-
log (msg) {
|
9
|
-
if (process.env.DEBUG && /^semantic-release:(\*|whmcs)$/.test(process.env.DEBUG)) {
|
10
|
-
console.log(msg)
|
11
|
-
}
|
12
|
-
}
|
13
|
-
|
14
|
-
error (msg, details) { console.error(msg + ' ' + details) }
|
15
|
-
}()
|
16
|
-
})
|
17
|
-
|
18
|
-
test.serial('Verify publishing [login fails]', async (t) => {
|
19
|
-
const context = {
|
20
|
-
env: {
|
21
|
-
WHMCSMP_LOGIN: 'anonymous@hexonet.net',
|
22
|
-
WHMCSMP_PASSWORD: '1234567890',
|
23
|
-
WHMCSMP_PRODUCTID: '0'
|
24
|
-
},
|
25
|
-
logger: t.context.logger,
|
26
|
-
nextRelease: {
|
27
|
-
version: 'v6.6.6',
|
28
|
-
notes: '# something changed\n\ntwice.'
|
29
|
-
}
|
30
|
-
}
|
31
|
-
const result = await publish({}, context)
|
32
|
-
t.is(result, false)
|
33
|
-
})
|
34
|
-
|
35
|
-
test.serial('Verify publishing [no product id]', async (t) => {
|
36
|
-
const env = {
|
37
|
-
WHMCSMP_LOGIN: process.env.WHMCSMP_LOGIN,
|
38
|
-
WHMCSMP_PASSWORD: process.env.WHMCSMP_PASSWORD
|
39
|
-
}
|
40
|
-
t.truthy(env.WHMCSMP_LOGIN)
|
41
|
-
t.truthy(env.WHMCSMP_PASSWORD)
|
42
|
-
const context = {
|
43
|
-
env,
|
44
|
-
logger: t.context.logger,
|
45
|
-
nextRelease: {
|
46
|
-
version: 'v6.6.6',
|
47
|
-
notes: '# something changed\n\ntwice.'
|
48
|
-
}
|
49
|
-
}
|
50
|
-
const result = await publish({}, context)
|
51
|
-
t.is(result, false)
|
52
|
-
})
|
53
|
-
|
54
|
-
test.serial('Verify publishing [all fine]', async (t) => {
|
55
|
-
const env = process.env
|
56
|
-
t.truthy(env.WHMCSMP_LOGIN)
|
57
|
-
t.truthy(env.WHMCSMP_PASSWORD)
|
58
|
-
t.truthy(env.WHMCSMP_PRODUCTID)
|
59
|
-
const context = {
|
60
|
-
env,
|
61
|
-
logger: t.context.logger,
|
62
|
-
nextRelease: {
|
63
|
-
version: '0.0.1',
|
64
|
-
notes:
|
65
|
-
'# something changed\n\ntwice\n\n[link test](https://github.com/papakai) [link test2](https://github.com/papakai)\n\ndone.'
|
66
|
-
}
|
67
|
-
}
|
68
|
-
const result = await publish({}, context)
|
69
|
-
t.assert(result !== false)
|
70
|
-
|
71
|
-
// wait 20s between adding and deleting
|
72
|
-
await new Promise((resolve) => {
|
73
|
-
setTimeout(resolve, 20000)
|
74
|
-
})
|
75
|
-
|
76
|
-
const delContext = {
|
77
|
-
env,
|
78
|
-
logger: t.context.logger,
|
79
|
-
version: context.nextRelease.version
|
80
|
-
}
|
81
|
-
const del = await deleteVersion({}, delContext)
|
82
|
-
t.assert(del !== false)
|
83
|
-
})
|
package/test/verify.test.js
DELETED
@@ -1,93 +0,0 @@
|
|
1
|
-
const test = require('ava')
|
2
|
-
const { WritableStreamBuffer } = require('stream-buffers')
|
3
|
-
const verify = require('../lib/verify')
|
4
|
-
/* eslint camelcase: ["error", {properties: "never"}] */
|
5
|
-
|
6
|
-
test.beforeEach((t) => {
|
7
|
-
t.context.stdout = new WritableStreamBuffer()
|
8
|
-
t.context.stderr = new WritableStreamBuffer()
|
9
|
-
// Mock logger
|
10
|
-
t.context.log = function (msg) {
|
11
|
-
if (
|
12
|
-
process.env.DEBUG &&
|
13
|
-
/^semantic-release:(\*|whmcs)$/.test(process.env.DEBUG)
|
14
|
-
) {
|
15
|
-
console.log(msg)
|
16
|
-
}
|
17
|
-
}
|
18
|
-
t.context.error = function (msg, details) {
|
19
|
-
console.error(msg + ' ' + details)
|
20
|
-
}
|
21
|
-
t.context.logger = { log: t.context.log, error: t.context.error }
|
22
|
-
})
|
23
|
-
|
24
|
-
test.serial('Verify credentials [no login]', async (t) => {
|
25
|
-
const context = {
|
26
|
-
env: {},
|
27
|
-
stdout: t.context.stdout,
|
28
|
-
stderr: t.context.stderr,
|
29
|
-
logger: t.context.logger,
|
30
|
-
options: {}
|
31
|
-
}
|
32
|
-
const [error] = await t.throwsAsync(verify({}, context))
|
33
|
-
t.is(error.name, 'SemanticReleaseError')
|
34
|
-
t.is(error.code, 'EWHMCSNOCREDENTIALS')
|
35
|
-
})
|
36
|
-
|
37
|
-
test.serial('Verify credentials [no password]', async (t) => {
|
38
|
-
const context = {
|
39
|
-
env: { WHMCSMP_LOGIN: 'mylogin' },
|
40
|
-
stdout: t.context.stdout,
|
41
|
-
stderr: t.context.stderr,
|
42
|
-
logger: t.context.logger,
|
43
|
-
options: {}
|
44
|
-
}
|
45
|
-
const [error] = await t.throwsAsync(verify({}, context))
|
46
|
-
t.is(error.name, 'SemanticReleaseError')
|
47
|
-
t.is(error.code, 'EWHMCSNOCREDENTIALS')
|
48
|
-
})
|
49
|
-
|
50
|
-
test.serial('Verify product id [no product id]', async (t) => {
|
51
|
-
const context = {
|
52
|
-
env: { WHMCSMP_LOGIN: 'mylogin', WHMCSMP_PASSWORD: 'mypassword' },
|
53
|
-
stdout: t.context.stdout,
|
54
|
-
stderr: t.context.stderr,
|
55
|
-
logger: t.context.logger,
|
56
|
-
options: {}
|
57
|
-
}
|
58
|
-
const [error] = await t.throwsAsync(verify({}, context))
|
59
|
-
t.is(error.name, 'SemanticReleaseError')
|
60
|
-
t.is(error.code, 'EWHMCSNOPRODUCTID')
|
61
|
-
})
|
62
|
-
|
63
|
-
test.serial('Verify product id [invalid product id]', async (t) => {
|
64
|
-
const context = {
|
65
|
-
env: {
|
66
|
-
WHMCSMP_LOGIN: 'mylogin',
|
67
|
-
WHMCSMP_PASSWORD: 'mypassword',
|
68
|
-
WHMCSMP_PRODUCTID: 'myproductid'
|
69
|
-
},
|
70
|
-
stdout: t.context.stdout,
|
71
|
-
stderr: t.context.stderr,
|
72
|
-
logger: t.context.logger,
|
73
|
-
options: {}
|
74
|
-
}
|
75
|
-
const [error] = await t.throwsAsync(verify({}, context))
|
76
|
-
t.is(error.name, 'SemanticReleaseError')
|
77
|
-
t.is(error.code, 'EWHMCSINVALIDPRODUCTID')
|
78
|
-
})
|
79
|
-
|
80
|
-
test.serial('Verify data [all fine]', async (t) => {
|
81
|
-
const context = {
|
82
|
-
env: {
|
83
|
-
WHMCSMP_LOGIN: 'mylogin',
|
84
|
-
WHMCSMP_PASSWORD: 'mypassword',
|
85
|
-
WHMCSMP_PRODUCTID: '123456'
|
86
|
-
},
|
87
|
-
stdout: t.context.stdout,
|
88
|
-
stderr: t.context.stderr,
|
89
|
-
logger: t.context.logger,
|
90
|
-
options: {}
|
91
|
-
}
|
92
|
-
await t.notThrowsAsync(verify({}, context))
|
93
|
-
})
|