Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3e66d85077 | ||
|
16430922c4 | ||
|
20b7de127d | ||
|
9def6961a9 | ||
|
f846c5ee47 | ||
|
8133f1f32e | ||
|
19e564c928 | ||
|
9c0b62271d | ||
|
7ceb9cb783 | ||
|
cee1906a39 | ||
|
0211f01bfb | ||
|
970d603c2e | ||
|
e558e07817 | ||
|
202d6fe6c3 | ||
|
110a667b31 |
59
CHANGELOG.md
59
CHANGELOG.md
@@ -1,35 +1,34 @@
|
||||
## <small>1.0.38 (2021-06-23)</small>
|
||||
|
||||
|
||||
|
||||
|
||||
## <small>1.0.37 (2021-06-23)</small>
|
||||
|
||||
* chore(release): v1.0.37 ([1643092](https://github.com/simonecorsi/mawesome/commit/1643092))
|
||||
* build(deps): bump glob-parent from 5.1.1 to 5.1.2 ([e558e07](https://github.com/simonecorsi/mawesome/commit/e558e07))
|
||||
* build(deps): bump hosted-git-info from 2.8.8 to 2.8.9 ([110a667](https://github.com/simonecorsi/mawesome/commit/110a667))
|
||||
* build(deps): bump normalize-url from 4.5.0 to 4.5.1 ([202d6fe](https://github.com/simonecorsi/mawesome/commit/202d6fe))
|
||||
|
||||
|
||||
|
||||
## <small>1.0.36 (2021-06-23)</small>
|
||||
|
||||
* chore(release): v1.0.36 ([9c0b622](https://github.com/simonecorsi/mawesome/commit/9c0b622))
|
||||
* feat: saving json data for future use ([7ceb9cb](https://github.com/simonecorsi/mawesome/commit/7ceb9cb))
|
||||
|
||||
|
||||
|
||||
## <small>1.0.35 (2021-06-22)</small>
|
||||
|
||||
* chore(release): v1.0.35 ([cee1906](https://github.com/simonecorsi/mawesome/commit/cee1906))
|
||||
* build(deps): bump set-getter from 0.1.0 to 0.1.1 ([970d603](https://github.com/simonecorsi/mawesome/commit/970d603))
|
||||
|
||||
|
||||
|
||||
## <small>1.0.34 (2021-05-19)</small>
|
||||
|
||||
|
||||
|
||||
|
||||
## <small>1.0.33 (2021-05-19)</small>
|
||||
|
||||
* chore(release): v1.0.33 ([fc187df](https://github.com/simonecorsi/mawesome/commit/fc187df))
|
||||
* build(deps): bump handlebars from 4.7.6 to 4.7.7 ([012928b](https://github.com/simonecorsi/mawesome/commit/012928b))
|
||||
* build(deps): bump lodash from 4.17.20 to 4.17.21 ([1015179](https://github.com/simonecorsi/mawesome/commit/1015179))
|
||||
|
||||
|
||||
|
||||
## <small>1.0.32 (2021-01-22)</small>
|
||||
|
||||
* chore: removed unused npm packages ([3ad1555](https://github.com/simonecorsi/mawesome/commit/3ad1555))
|
||||
* chore(release): v1.0.32 ([fe15d93](https://github.com/simonecorsi/mawesome/commit/fe15d93))
|
||||
* docs: added documentation ([5753aef](https://github.com/simonecorsi/mawesome/commit/5753aef))
|
||||
|
||||
|
||||
|
||||
## <small>1.0.31 (2021-01-21)</small>
|
||||
|
||||
* chore(release): v1.0.31 ([903c070](https://github.com/simonecorsi/mawesome/commit/903c070))
|
||||
* feat: added user/email input for commiting ([58a7dc1](https://github.com/simonecorsi/mawesome/commit/58a7dc1))
|
||||
|
||||
|
||||
|
||||
## <small>1.0.30 (2021-01-16)</small>
|
||||
|
||||
* chore(release): v1.0.30 ([a5f15da](https://github.com/simonecorsi/mawesome/commit/a5f15da))
|
||||
* fix: removed push ([7f42ca0](https://github.com/simonecorsi/mawesome/commit/7f42ca0))
|
||||
* chore(release): v1.0.34 ([ab02c0d](https://github.com/simonecorsi/mawesome/commit/ab02c0d))
|
||||
|
||||
|
||||
|
||||
|
31
index.js
31
index.js
@@ -18482,7 +18482,7 @@ const testParameter = (name, filters) => {
|
||||
};
|
||||
|
||||
const normalizeDataURL = (urlString, {stripHash}) => {
|
||||
const parts = urlString.match(/^data:(.*?),(.*?)(?:#(.*))?$/);
|
||||
const parts = urlString.match(/^data:([^,]*?),([^#]*?)(?:#(.*))?$/);
|
||||
|
||||
if (!parts) {
|
||||
throw new Error(`Invalid URL: ${urlString}`);
|
||||
@@ -21361,7 +21361,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
};
|
||||
var _a;
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.pushNewFile = exports.OUTPUT_FILENAME = exports.generateMd = exports.paginate = exports.API_STARRED_URL = exports.REPO_USERNAME = exports.apiGetStar = exports.renderer = exports.isLastPage = exports.wait = void 0;
|
||||
exports.pushNewFiles = exports.MARKDOWN_FILENAME = exports.generateMd = exports.paginate = exports.API_STARRED_URL = exports.REPO_USERNAME = exports.apiGetStar = exports.renderer = exports.isLastPage = exports.wait = void 0;
|
||||
const ejs_1 = __importDefault(__nccwpck_require__(8431));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const remark_1 = __importDefault(__nccwpck_require__(2081));
|
||||
@@ -21433,17 +21433,21 @@ function generateMd(data) {
|
||||
});
|
||||
}
|
||||
exports.generateMd = generateMd;
|
||||
exports.OUTPUT_FILENAME = core.getInput('output-filename') || 'README.md';
|
||||
function pushNewFile(markdown) {
|
||||
exports.MARKDOWN_FILENAME = core.getInput('output-filename') || 'README.md';
|
||||
function pushNewFiles(files = []) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield fsp.writeFile(exports.OUTPUT_FILENAME, markdown);
|
||||
if (!files.length)
|
||||
return;
|
||||
yield git_1.default.pull();
|
||||
yield git_1.default.add(exports.OUTPUT_FILENAME);
|
||||
yield git_1.default.commit(`chore(${exports.OUTPUT_FILENAME}): updated ${exports.OUTPUT_FILENAME}`);
|
||||
yield Promise.all(files.map(({ filename, data }) => __awaiter(this, void 0, void 0, function* () {
|
||||
yield fsp.writeFile(filename, data);
|
||||
yield git_1.default.add(filename);
|
||||
yield git_1.default.commit(`chore(${filename}): updated ${filename}`);
|
||||
})));
|
||||
yield git_1.default.push();
|
||||
});
|
||||
}
|
||||
exports.pushNewFile = pushNewFile;
|
||||
exports.pushNewFiles = pushNewFiles;
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -21511,7 +21515,16 @@ function main() {
|
||||
updatedAt: Date.now(),
|
||||
});
|
||||
const markdown = yield helpers_1.generateMd(rendered);
|
||||
yield helpers_1.pushNewFile(markdown);
|
||||
yield helpers_1.pushNewFiles([
|
||||
{
|
||||
filename: helpers_1.MARKDOWN_FILENAME,
|
||||
data: markdown,
|
||||
},
|
||||
{
|
||||
filename: 'data.json',
|
||||
data: JSON.stringify(sortedByLanguages, null, 2),
|
||||
},
|
||||
]);
|
||||
});
|
||||
}
|
||||
exports.main = main;
|
||||
|
56
package-lock.json
generated
56
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mawesome",
|
||||
"version": "1.0.32",
|
||||
"version": "1.0.36",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -2339,9 +2339,9 @@
|
||||
}
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "2.8.8",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
|
||||
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
|
||||
"version": "2.8.9",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
|
||||
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
|
||||
"dev": true
|
||||
},
|
||||
"indent-string": {
|
||||
@@ -3980,9 +3980,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "2.8.8",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
|
||||
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
|
||||
"version": "2.8.9",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
|
||||
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
|
||||
"dev": true
|
||||
},
|
||||
"indent-string": {
|
||||
@@ -4263,9 +4263,9 @@
|
||||
}
|
||||
},
|
||||
"glob-parent": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz",
|
||||
"integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==",
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"is-glob": "^4.0.1"
|
||||
@@ -4532,9 +4532,9 @@
|
||||
}
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "3.0.7",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.7.tgz",
|
||||
"integrity": "sha512-fWqc0IcuXs+BmE9orLDyVykAG9GJtGLGuZAAqgcckPgv5xad4AcXGIv8galtQvlwutxSlaMcdw7BUtq2EIvqCQ==",
|
||||
"version": "3.0.8",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-3.0.8.tgz",
|
||||
"integrity": "sha512-aXpmwoOhRBrw6X3j0h5RloK4x1OzsxMPyxqIHyNfSe2pypkVTZFpEiRoSipPEPlMrh0HW/XsjkJ5WgnCirpNUw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"lru-cache": "^6.0.0"
|
||||
@@ -6180,9 +6180,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"normalize-url": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz",
|
||||
"integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ=="
|
||||
"version": "4.5.1",
|
||||
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.1.tgz",
|
||||
"integrity": "sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA=="
|
||||
},
|
||||
"npm-run-path": {
|
||||
"version": "4.0.1",
|
||||
@@ -6944,9 +6944,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"hosted-git-info": {
|
||||
"version": "2.8.8",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
|
||||
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
|
||||
"version": "2.8.9",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
|
||||
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
|
||||
"dev": true
|
||||
},
|
||||
"normalize-package-data": {
|
||||
@@ -7358,9 +7358,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"set-getter": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz",
|
||||
"integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=",
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.1.tgz",
|
||||
"integrity": "sha512-9sVWOy+gthr+0G9DzqqLaYNA7+5OKkSmcqjL9cBpDEaZrr3ShQlyX2cZ/O/ozE41oxn/Tt0LGEM/w4Rub3A3gw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"to-object-path": "^0.3.0"
|
||||
@@ -7922,9 +7922,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "2.8.8",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
|
||||
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
|
||||
"version": "2.8.9",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
|
||||
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
|
||||
"dev": true
|
||||
},
|
||||
"load-json-file": {
|
||||
@@ -8490,9 +8490,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"hosted-git-info": {
|
||||
"version": "2.8.8",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.8.tgz",
|
||||
"integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==",
|
||||
"version": "2.8.9",
|
||||
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
|
||||
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
|
||||
"dev": true
|
||||
},
|
||||
"indent-string": {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mawesome",
|
||||
"version": "1.0.34",
|
||||
"version": "1.0.38",
|
||||
"description": "Generate awesome list from user starred repositories",
|
||||
"main": "index.js",
|
||||
"author": "Simone Corsi<simonecorsi.dev@gmail.com>",
|
||||
|
@@ -77,12 +77,26 @@ export function generateMd(data: string): Promise<string> {
|
||||
});
|
||||
}
|
||||
|
||||
export const OUTPUT_FILENAME: string =
|
||||
export const MARKDOWN_FILENAME: string =
|
||||
core.getInput('output-filename') || 'README.md';
|
||||
export async function pushNewFile(markdown: string): Promise<any> {
|
||||
await fsp.writeFile(OUTPUT_FILENAME, markdown);
|
||||
|
||||
type File = {
|
||||
filename: string;
|
||||
data: string;
|
||||
};
|
||||
|
||||
export async function pushNewFiles(files: File[] = []): Promise<any> {
|
||||
if (!files.length) return;
|
||||
|
||||
await git.pull();
|
||||
await git.add(OUTPUT_FILENAME);
|
||||
await git.commit(`chore(${OUTPUT_FILENAME}): updated ${OUTPUT_FILENAME}`);
|
||||
|
||||
await Promise.all(
|
||||
files.map(async ({ filename, data }) => {
|
||||
await fsp.writeFile(filename, data);
|
||||
await git.add(filename);
|
||||
await git.commit(`chore(${filename}): updated ${filename}`);
|
||||
})
|
||||
);
|
||||
|
||||
await git.push();
|
||||
}
|
||||
|
15
src/index.ts
15
src/index.ts
@@ -1,11 +1,13 @@
|
||||
import * as core from '@actions/core';
|
||||
import { data } from 'remark';
|
||||
|
||||
import {
|
||||
renderer,
|
||||
paginate,
|
||||
REPO_USERNAME,
|
||||
generateMd,
|
||||
pushNewFile,
|
||||
pushNewFiles,
|
||||
MARKDOWN_FILENAME,
|
||||
} from './helpers';
|
||||
|
||||
import type { SortedLanguageList, Stars, Star } from './types';
|
||||
@@ -41,7 +43,16 @@ export async function main(): Promise<any> {
|
||||
|
||||
const markdown: string = await generateMd(rendered);
|
||||
|
||||
await pushNewFile(markdown);
|
||||
await pushNewFiles([
|
||||
{
|
||||
filename: MARKDOWN_FILENAME,
|
||||
data: markdown,
|
||||
},
|
||||
{
|
||||
filename: 'data.json',
|
||||
data: JSON.stringify(sortedByLanguages, null, 2),
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
export async function run(): Promise<any> {
|
||||
|
@@ -38,7 +38,7 @@ import {
|
||||
apiGetStar,
|
||||
paginate,
|
||||
generateMd,
|
||||
pushNewFile,
|
||||
pushNewFiles,
|
||||
} from '../src/helpers';
|
||||
|
||||
test('wait should wait', async (t) => {
|
||||
@@ -97,7 +97,7 @@ test('generateMd should create TOC', async (t) => {
|
||||
});
|
||||
|
||||
test('should push', async (t) => {
|
||||
await pushNewFile('# title');
|
||||
await pushNewFiles([{filename: "README.md", data: '# title'}]);
|
||||
t.true(writeFile.calledWith('README.md', '# title'));
|
||||
t.true(pull.called);
|
||||
t.true(add.calledWith('README.md'));
|
||||
|
Reference in New Issue
Block a user