6 Commits

Author SHA1 Message Date
Conventional Changelog Action
c8058222e5 chore(release): v1.0.28 2021-01-16 21:43:10 +00:00
GitHub Actions
b8890fc6d7 tests: added tests 2021-01-16 22:42:23 +01:00
Conventional Changelog Action
bf0785847d chore(release): v1.0.27 2021-01-16 20:27:37 +00:00
Simone Corsi
46172a5274 docs: typo 2021-01-16 21:26:54 +01:00
Conventional Changelog Action
8bc2714b55 chore(release): v1.0.26 2021-01-16 12:17:32 +00:00
Simone Corsi
0543c05431 chore: added link to project 2021-01-16 13:16:41 +01:00
11 changed files with 277 additions and 32 deletions

View File

@@ -19,8 +19,11 @@ jobs:
path: '**/node_modules' path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }} key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: tests
run: npm cit
- name: build - name: build
run: npm ci && npm run build run: npm run build
- name: Bump version and push tag - name: Bump version and push tag
id: changelog id: changelog

View File

@@ -1,22 +1,25 @@
## <small>1.0.28 (2021-01-16)</small>
* tests: added tests ([b8890fc](https://github.com/simonecorsi/mawesome/commit/b8890fc))
## <small>1.0.27 (2021-01-16)</small>
* chore(release): v1.0.27 ([bf07858](https://github.com/simonecorsi/mawesome/commit/bf07858))
* docs: typo ([46172a5](https://github.com/simonecorsi/mawesome/commit/46172a5))
## <small>1.0.26 (2021-01-16)</small>
* chore: added link to project ([0543c05](https://github.com/simonecorsi/mawesome/commit/0543c05))
* chore(release): v1.0.26 ([8bc2714](https://github.com/simonecorsi/mawesome/commit/8bc2714))
## <small>1.0.25 (2021-01-16)</small> ## <small>1.0.25 (2021-01-16)</small>
* fix: should fix unshallow repo ([17c5d85](https://github.com/simonecorsi/mawesome/commit/17c5d85))
## <small>1.0.24 (2021-01-16)</small>
* chore(release): v1.0.22 ([3f66738](https://github.com/simonecorsi/mawesome/commit/3f66738))
* chore(release): v1.0.23 ([f41befa](https://github.com/simonecorsi/mawesome/commit/f41befa))
* chore(release): v1.0.24 ([9badeaf](https://github.com/simonecorsi/mawesome/commit/9badeaf))
* fix: git pull strategy ([edb4a38](https://github.com/simonecorsi/mawesome/commit/edb4a38))
* fix: git push ([c8fb3f4](https://github.com/simonecorsi/mawesome/commit/c8fb3f4))
* docs: added authors ([3de0e12](https://github.com/simonecorsi/mawesome/commit/3de0e12))
## <small>1.0.21 (2021-01-16)</small>
* chore: action name ([8f3ce98](https://github.com/simonecorsi/mawesome/commit/8f3ce98)) * chore: action name ([8f3ce98](https://github.com/simonecorsi/mawesome/commit/8f3ce98))
* chore: moved helpers in own file ([29bcf41](https://github.com/simonecorsi/mawesome/commit/29bcf41)) * chore: moved helpers in own file ([29bcf41](https://github.com/simonecorsi/mawesome/commit/29bcf41))
* chore: namings ([b16fdb0](https://github.com/simonecorsi/mawesome/commit/b16fdb0)) * chore: namings ([b16fdb0](https://github.com/simonecorsi/mawesome/commit/b16fdb0))
@@ -42,6 +45,10 @@
* chore(release): v1.0.2 ([3cba062](https://github.com/simonecorsi/mawesome/commit/3cba062)) * chore(release): v1.0.2 ([3cba062](https://github.com/simonecorsi/mawesome/commit/3cba062))
* chore(release): v1.0.20 ([738785e](https://github.com/simonecorsi/mawesome/commit/738785e)) * chore(release): v1.0.20 ([738785e](https://github.com/simonecorsi/mawesome/commit/738785e))
* chore(release): v1.0.21 ([3c3ab0a](https://github.com/simonecorsi/mawesome/commit/3c3ab0a)) * chore(release): v1.0.21 ([3c3ab0a](https://github.com/simonecorsi/mawesome/commit/3c3ab0a))
* chore(release): v1.0.22 ([3f66738](https://github.com/simonecorsi/mawesome/commit/3f66738))
* chore(release): v1.0.23 ([f41befa](https://github.com/simonecorsi/mawesome/commit/f41befa))
* chore(release): v1.0.24 ([9badeaf](https://github.com/simonecorsi/mawesome/commit/9badeaf))
* chore(release): v1.0.25 ([14ccc97](https://github.com/simonecorsi/mawesome/commit/14ccc97))
* chore(release): v1.0.3 ([71625bd](https://github.com/simonecorsi/mawesome/commit/71625bd)) * chore(release): v1.0.3 ([71625bd](https://github.com/simonecorsi/mawesome/commit/71625bd))
* chore(release): v1.0.4 ([46583c7](https://github.com/simonecorsi/mawesome/commit/46583c7)) * chore(release): v1.0.4 ([46583c7](https://github.com/simonecorsi/mawesome/commit/46583c7))
* chore(release): v1.0.5 ([ba24bdf](https://github.com/simonecorsi/mawesome/commit/ba24bdf)) * chore(release): v1.0.5 ([ba24bdf](https://github.com/simonecorsi/mawesome/commit/ba24bdf))
@@ -56,9 +63,12 @@
* fix: better errors ([f302126](https://github.com/simonecorsi/mawesome/commit/f302126)) * fix: better errors ([f302126](https://github.com/simonecorsi/mawesome/commit/f302126))
* fix: better template management ([9d06abc](https://github.com/simonecorsi/mawesome/commit/9d06abc)) * fix: better template management ([9d06abc](https://github.com/simonecorsi/mawesome/commit/9d06abc))
* fix: exit condition ([914a115](https://github.com/simonecorsi/mawesome/commit/914a115)) * fix: exit condition ([914a115](https://github.com/simonecorsi/mawesome/commit/914a115))
* fix: git pull strategy ([edb4a38](https://github.com/simonecorsi/mawesome/commit/edb4a38))
* fix: git push ([c8fb3f4](https://github.com/simonecorsi/mawesome/commit/c8fb3f4))
* fix: if tempalte fail should exit(1) ([ee824d1](https://github.com/simonecorsi/mawesome/commit/ee824d1)) * fix: if tempalte fail should exit(1) ([ee824d1](https://github.com/simonecorsi/mawesome/commit/ee824d1))
* fix: imports ([2e421f0](https://github.com/simonecorsi/mawesome/commit/2e421f0)) * fix: imports ([2e421f0](https://github.com/simonecorsi/mawesome/commit/2e421f0))
* fix: imports ([376451a](https://github.com/simonecorsi/mawesome/commit/376451a)) * fix: imports ([376451a](https://github.com/simonecorsi/mawesome/commit/376451a))
* fix: should fix unshallow repo ([17c5d85](https://github.com/simonecorsi/mawesome/commit/17c5d85))
* fix: somehow runner wont see template ([808c35c](https://github.com/simonecorsi/mawesome/commit/808c35c)) * fix: somehow runner wont see template ([808c35c](https://github.com/simonecorsi/mawesome/commit/808c35c))
* fix: splitting tokens ([bd47078](https://github.com/simonecorsi/mawesome/commit/bd47078)) * fix: splitting tokens ([bd47078](https://github.com/simonecorsi/mawesome/commit/bd47078))
* fix: template cannot be loaded from ejs file ([78c0f37](https://github.com/simonecorsi/mawesome/commit/78c0f37)) * fix: template cannot be loaded from ejs file ([78c0f37](https://github.com/simonecorsi/mawesome/commit/78c0f37))
@@ -66,6 +76,7 @@
* fix(action.yml): output file now correct path ([98b17f8](https://github.com/simonecorsi/mawesome/commit/98b17f8)) * fix(action.yml): output file now correct path ([98b17f8](https://github.com/simonecorsi/mawesome/commit/98b17f8))
* fix(ci): bad syntax ([caaf6ab](https://github.com/simonecorsi/mawesome/commit/caaf6ab)) * fix(ci): bad syntax ([caaf6ab](https://github.com/simonecorsi/mawesome/commit/caaf6ab))
* fix(index.ts): fs promise fixed path ([285e193](https://github.com/simonecorsi/mawesome/commit/285e193)) * fix(index.ts): fs promise fixed path ([285e193](https://github.com/simonecorsi/mawesome/commit/285e193))
* docs: added authors ([3de0e12](https://github.com/simonecorsi/mawesome/commit/3de0e12))
* docs: added readme ([e1c9ca0](https://github.com/simonecorsi/mawesome/commit/e1c9ca0)) * docs: added readme ([e1c9ca0](https://github.com/simonecorsi/mawesome/commit/e1c9ca0))
* docs: readme updated ([192aa8a](https://github.com/simonecorsi/mawesome/commit/192aa8a)) * docs: readme updated ([192aa8a](https://github.com/simonecorsi/mawesome/commit/192aa8a))
* feat: better errors ([1700aa3](https://github.com/simonecorsi/mawesome/commit/1700aa3)) * feat: better errors ([1700aa3](https://github.com/simonecorsi/mawesome/commit/1700aa3))

View File

@@ -18,7 +18,7 @@ The github workflow token is mandatory
The Personal API Access Token is mandatory to fetch stars from the API without incurring in Rate Limits. The Personal API Access Token is mandatory to fetch stars from the API without incurring in Rate Limits.
You'll have to generate a [personal api token][https://github.com/settings/tokens/new] and then add You'll have to generate a [personal api token](https://github.com/settings/tokens/new) and then add
## Example workflow ## Example workflow

7
ava.config.js Normal file
View File

@@ -0,0 +1,7 @@
/* eslint-disable node/no-unsupported-features/es-syntax */
export default {
files: ['!templates/**/*'],
extensions: ['ts'],
require: ['ts-node/register/transpile-only'],
};

View File

@@ -20801,6 +20801,7 @@ function factory(key, options) {
* https://github.com/jhermsmeier/node-http-link-header * https://github.com/jhermsmeier/node-http-link-header
*/ */
/* istanbul ignore file */
var COMPATIBLE_ENCODING_PATTERN = /^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i; var COMPATIBLE_ENCODING_PATTERN = /^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i;
@@ -21263,7 +21264,7 @@ const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
const { GITHUB_REPOSITORY, GITHUB_REF } = process.env; const { GITHUB_REPOSITORY, GITHUB_REF } = process.env;
const branch = GITHUB_REF === null || GITHUB_REF === void 0 ? void 0 : GITHUB_REF.replace('refs/heads/', ''); const branch = GITHUB_REF === null || GITHUB_REF === void 0 ? void 0 : GITHUB_REF.replace('refs/heads/', '');
exports.default = new (class Git { class Git {
constructor() { constructor() {
this.isShallow = () => __awaiter(this, void 0, void 0, function* () { this.isShallow = () => __awaiter(this, void 0, void 0, function* () {
const isShallow = yield this.exec('rev-parse --is-shallow-repository'); const isShallow = yield this.exec('rev-parse --is-shallow-repository');
@@ -21314,7 +21315,8 @@ exports.default = new (class Git {
// Update the origin // Update the origin
this.updateOrigin(`https://x-access-token:${githubToken}@github.com/${GITHUB_REPOSITORY}.git`); this.updateOrigin(`https://x-access-token:${githubToken}@github.com/${GITHUB_REPOSITORY}.git`);
} }
})(); }
exports.default = new Git();
/***/ }), /***/ }),
@@ -21540,6 +21542,8 @@ run();
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.default = `# <%= username %> Awesome List [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) exports.default = `# <%= username %> Awesome List [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)
> :star: generated with [simonecorsi/mawesome](https://github.com/simonecorsi/mawesome)
## Table of Contents ## Table of Contents
<% for(let [language, repositories] of stars) { %> <% for(let [language, repositories] of stars) { %>

119
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "mawesome", "name": "mawesome",
"version": "1.0.0", "version": "1.0.25",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@@ -751,6 +751,41 @@
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.0.tgz", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.0.tgz",
"integrity": "sha512-FyD2meJpDPjyNQejSjvnhpgI/azsQkA4lGbuu5BQZfjvJ9cbRZXzeWL2HceCekW4lixO9JPesIIQkSoLjeJHNQ==" "integrity": "sha512-FyD2meJpDPjyNQejSjvnhpgI/azsQkA4lGbuu5BQZfjvJ9cbRZXzeWL2HceCekW4lixO9JPesIIQkSoLjeJHNQ=="
}, },
"@sinonjs/commons": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.2.tgz",
"integrity": "sha512-sruwd86RJHdsVf/AtBoijDmUqJp3B6hF/DGC23C+JaegnDHaZyewCjoVGTdg3J0uz3Zs7NnIT05OBOmML72lQw==",
"dev": true,
"requires": {
"type-detect": "4.0.8"
}
},
"@sinonjs/fake-timers": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz",
"integrity": "sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA==",
"dev": true,
"requires": {
"@sinonjs/commons": "^1.7.0"
}
},
"@sinonjs/samsam": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.3.1.tgz",
"integrity": "sha512-1Hc0b1TtyfBu8ixF/tpfSHTVWKwCBLY4QJbkgnE7HcwyvT2xArDxb4K7dMgqRm3szI+LJbzmW/s4xxEhv6hwDg==",
"dev": true,
"requires": {
"@sinonjs/commons": "^1.6.0",
"lodash.get": "^4.4.2",
"type-detect": "^4.0.8"
}
},
"@sinonjs/text-encoding": {
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz",
"integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
"dev": true
},
"@szmarczak/http-timer": { "@szmarczak/http-timer": {
"version": "4.0.5", "version": "4.0.5",
"resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.5.tgz", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.5.tgz",
@@ -845,6 +880,21 @@
"@types/node": "*" "@types/node": "*"
} }
}, },
"@types/sinon": {
"version": "9.0.10",
"resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-9.0.10.tgz",
"integrity": "sha512-/faDC0erR06wMdybwI/uR8wEKV/E83T0k4sepIpB7gXuy2gzx2xiOjmztq6a2Y6rIGJ04D+6UU0VBmWy+4HEMA==",
"dev": true,
"requires": {
"@types/sinonjs__fake-timers": "*"
}
},
"@types/sinonjs__fake-timers": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.2.tgz",
"integrity": "sha512-dIPoZ3g5gcx9zZEszaxLSVTvMReD3xxyyDnQUjA6IYDG9Ba2AV0otMPs+77sG9ojB4Qr2N2Vk5RnKeuA0X/0bg==",
"dev": true
},
"@types/strip-bom": { "@types/strip-bom": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz", "resolved": "https://registry.npmjs.org/@types/strip-bom/-/strip-bom-3.0.0.tgz",
@@ -3367,11 +3417,6 @@
"is-obj": "^2.0.0" "is-obj": "^2.0.0"
} }
}, },
"dotenv": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw=="
},
"dotgitignore": { "dotgitignore": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/dotgitignore/-/dotgitignore-2.1.0.tgz", "resolved": "https://registry.npmjs.org/dotgitignore/-/dotgitignore-2.1.0.tgz",
@@ -6229,6 +6274,12 @@
"integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=",
"dev": true "dev": true
}, },
"just-extend": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.1.tgz",
"integrity": "sha512-aWgeGFW67BP3e5181Ep1Fv2v8z//iBJfrvyTnq8wG86vEESwmonn1zPBJ0VfmT9CJq2FIT0VsETtrNFm2a+SHA==",
"dev": true
},
"keyv": { "keyv": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.3.tgz", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.3.tgz",
@@ -6415,6 +6466,12 @@
"integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=", "integrity": "sha1-+wMJF/hqMTTlvJvsDWngAT3f7bI=",
"dev": true "dev": true
}, },
"lodash.get": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=",
"dev": true
},
"lodash.ismatch": { "lodash.ismatch": {
"version": "4.4.0", "version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz",
@@ -6912,6 +6969,19 @@
"integrity": "sha512-y0PICjHqj7BCA04ayG0neJChSWt0oUKLtnDQZJu6ey+wtlpddQA1JwH0JtB6u+Q/Twkuz+pUIAZeZMHxUqgr4A==", "integrity": "sha512-y0PICjHqj7BCA04ayG0neJChSWt0oUKLtnDQZJu6ey+wtlpddQA1JwH0JtB6u+Q/Twkuz+pUIAZeZMHxUqgr4A==",
"dev": true "dev": true
}, },
"nise": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/nise/-/nise-4.0.4.tgz",
"integrity": "sha512-bTTRUNlemx6deJa+ZyoCUTRvH3liK5+N6VQZ4NIw90AgDXY6iPnsqplNFf6STcj+ePk0H/xqxnP75Lr0J0Fq3A==",
"dev": true,
"requires": {
"@sinonjs/commons": "^1.7.0",
"@sinonjs/fake-timers": "^6.0.0",
"@sinonjs/text-encoding": "^0.7.1",
"just-extend": "^4.0.2",
"path-to-regexp": "^1.7.0"
}
},
"node-fetch": { "node-fetch": {
"version": "2.6.1", "version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
@@ -7438,6 +7508,23 @@
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
"dev": true "dev": true
}, },
"path-to-regexp": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz",
"integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==",
"dev": true,
"requires": {
"isarray": "0.0.1"
},
"dependencies": {
"isarray": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
"dev": true
}
}
},
"path-type": { "path-type": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
@@ -8184,6 +8271,20 @@
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==",
"dev": true "dev": true
}, },
"sinon": {
"version": "9.2.3",
"resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.3.tgz",
"integrity": "sha512-m+DyAWvqVHZtjnjX/nuShasykFeiZ+nPuEfD4G3gpvKGkXRhkF/6NSt2qN2FjZhfrcHXFzUzI+NLnk+42fnLEw==",
"dev": true,
"requires": {
"@sinonjs/commons": "^1.8.1",
"@sinonjs/fake-timers": "^6.0.1",
"@sinonjs/samsam": "^5.3.0",
"diff": "^4.0.2",
"nise": "^4.0.4",
"supports-color": "^7.1.0"
}
},
"slash": { "slash": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
@@ -9447,6 +9548,12 @@
"prelude-ls": "^1.2.1" "prelude-ls": "^1.2.1"
} }
}, },
"type-detect": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true
},
"type-fest": { "type-fest": {
"version": "0.18.1", "version": "0.18.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz",

View File

@@ -1,12 +1,13 @@
{ {
"name": "mawesome", "name": "mawesome",
"version": "1.0.25", "version": "1.0.28",
"description": "Generate awesome list from user starred repositories", "description": "Generate awesome list from user starred repositories",
"main": "index.js", "main": "index.js",
"author": "Simone Corsi<simonecorsi.dev@gmail.com>", "author": "Simone Corsi<simonecorsi.dev@gmail.com>",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "nyc --reporter=lcov --reporter=text-summary ava -s -v",
"test:watch": "ava -w",
"style:lint": "eslint src --ext .ts", "style:lint": "eslint src --ext .ts",
"style:prettier": "prettier \"src/**/*.ts\" --list-different --write", "style:prettier": "prettier \"src/**/*.ts\" --list-different --write",
"build": "./node_modules/.bin/ncc build src/index.ts -o ./", "build": "./node_modules/.bin/ncc build src/index.ts -o ./",
@@ -30,6 +31,7 @@
"@types/ejs": "^3.0.5", "@types/ejs": "^3.0.5",
"@types/got": "^9.6.11", "@types/got": "^9.6.11",
"@types/node": "^14.14.5", "@types/node": "^14.14.5",
"@types/sinon": "^9.0.10",
"@typescript-eslint/eslint-plugin": "^4.6.0", "@typescript-eslint/eslint-plugin": "^4.6.0",
"@typescript-eslint/parser": "^4.6.0", "@typescript-eslint/parser": "^4.6.0",
"@vercel/ncc": "^0.26.2", "@vercel/ncc": "^0.26.2",
@@ -47,6 +49,7 @@
"ninos": "^3.0.0", "ninos": "^3.0.0",
"nyc": "^15.0.1", "nyc": "^15.0.1",
"prettier": "^2.0.5", "prettier": "^2.0.5",
"sinon": "^9.2.3",
"standard-version": "^9.0.0", "standard-version": "^9.0.0",
"ts-node-dev": "^1.1.1", "ts-node-dev": "^1.1.1",
"typescript": "^4.1.3" "typescript": "^4.1.3"

View File

@@ -6,8 +6,7 @@ import * as exec from '@actions/exec';
const { GITHUB_REPOSITORY, GITHUB_REF } = process.env; const { GITHUB_REPOSITORY, GITHUB_REF } = process.env;
const branch = GITHUB_REF?.replace('refs/heads/', ''); const branch = GITHUB_REF?.replace('refs/heads/', '');
class Git {
export default new (class Git {
constructor() { constructor() {
const githubToken = core.getInput('github-token', { required: true }); const githubToken = core.getInput('github-token', { required: true });
core.setSecret(githubToken); core.setSecret(githubToken);
@@ -80,4 +79,6 @@ export default new (class Git {
updateOrigin = (repo: string) => this.exec(`remote set-url origin ${repo}`); updateOrigin = (repo: string) => this.exec(`remote set-url origin ${repo}`);
createTag = (tag: string) => this.exec(`tag -a ${tag} -m "${tag}"`); createTag = (tag: string) => this.exec(`tag -a ${tag} -m "${tag}"`);
})(); }
export default new Git();

View File

@@ -3,6 +3,7 @@
* https://github.com/jhermsmeier/node-http-link-header * https://github.com/jhermsmeier/node-http-link-header
*/ */
/* istanbul ignore file */
'use strict'; 'use strict';
var COMPATIBLE_ENCODING_PATTERN = /^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i; var COMPATIBLE_ENCODING_PATTERN = /^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i;

View File

@@ -1,5 +1,7 @@
export default `# <%= username %> Awesome List [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) export default `# <%= username %> Awesome List [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome)
> :star: generated with [simonecorsi/mawesome](https://github.com/simonecorsi/mawesome)
## Table of Contents ## Table of Contents
<% for(let [language, repositories] of stars) { %> <% for(let [language, repositories] of stars) { %>

106
test/helpers.spec.ts Normal file
View File

@@ -0,0 +1,106 @@
import test from 'ava';
import * as sinon from 'sinon';
import fs from 'fs';
import * as core from '@actions/core';
sinon.replace(core, 'getInput', sinon.fake());
import GithubApi from '../src/api';
const GithubApiFake = sinon.fake((rul) => ({
body: 'data',
headers: {
link:
'<https://api.github.com/user/5617452/starred?page=2>; rel="next", <https://api.github.com/user/5617452/starred?page=2>; rel="last"',
},
}));
sinon.replace(GithubApi, 'get', GithubApiFake);
import Git from '../src/git';
const pull = sinon.fake();
sinon.replace(Git, 'pull', pull);
const add = sinon.fake();
sinon.replace(Git, 'add', add);
const commit = sinon.fake();
sinon.replace(Git, 'commit', commit);
const push = sinon.fake();
sinon.replace(Git, 'push', push);
sinon.replace(Git, 'config', sinon.fake());
sinon.replace(Git, 'updateOrigin', sinon.fake());
const fsp = fs.promises;
const writeFile = sinon.fake();
sinon.replace(fsp, 'writeFile', writeFile);
import {
isLastPage,
wait,
renderer,
apiGetStar,
paginate,
generateMd,
pushNewFile,
} from '../src/helpers';
test('wait should wait', async (t) => {
await wait(200);
t.pass();
});
test('isLastPage', (t) => {
t.true(
isLastPage({
next: 'last',
last: 'last',
})
);
t.false(
isLastPage({
next: 'last',
last: undefined,
})
);
});
test('renderer should render', async (t) => {
const output = await renderer({ variable: 123 }, 'Test: <%= variable %>');
t.is(output, 'Test: 123');
});
test('apiGetStar', async (t) => {
let { data, links } = await apiGetStar('url');
t.true(GithubApiFake.called);
t.is(data, 'data');
t.deepEqual(links, {
last: 'https://api.github.com/user/5617452/starred?page=2',
next: 'https://api.github.com/user/5617452/starred?page=2',
});
});
test('paginate', async (t) => {
await paginate();
const res = await paginate();
t.is(res, null);
});
test('generateMd should create TOC', async (t) => {
const tpl = `# title
## Table of Contents
## Javascript
`;
const result = await generateMd(tpl);
t.is(
result,
`# title\n\n## Table of Contents\n\n* [Javascript](#javascript)\n\n## Javascript\n`
);
});
test('should push', async (t) => {
await pushNewFile('# title');
t.true(writeFile.calledWith('README.md', '# title'));
t.true(pull.called);
t.true(add.calledWith('README.md'));
t.true(commit.calledWith('chore(README.md): updated README.md'));
t.true(push.called);
});