Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
3e66d85077 | ||
|
16430922c4 | ||
|
20b7de127d | ||
|
9def6961a9 | ||
|
f846c5ee47 | ||
|
8133f1f32e | ||
|
19e564c928 | ||
|
9c0b62271d | ||
|
7ceb9cb783 | ||
|
cee1906a39 | ||
|
0211f01bfb | ||
|
970d603c2e | ||
|
e558e07817 | ||
|
202d6fe6c3 | ||
|
ab02c0d880 | ||
|
110a667b31 | ||
|
fc187df45e | ||
|
389dc4441f | ||
|
bbc8ec9ca5 | ||
|
10151792e7 | ||
|
012928bcda |
33
CHANGELOG.md
33
CHANGELOG.md
@@ -1,37 +1,34 @@
|
||||
## <small>1.0.32 (2021-01-22)</small>
|
||||
|
||||
* docs: added documentation ([5753aef](https://github.com/simonecorsi/mawesome/commit/5753aef))
|
||||
* chore: removed unused npm packages ([3ad1555](https://github.com/simonecorsi/mawesome/commit/3ad1555))
|
||||
## <small>1.0.38 (2021-06-23)</small>
|
||||
|
||||
|
||||
|
||||
## <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.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.30 (2021-01-16)</small>
|
||||
## <small>1.0.36 (2021-06-23)</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.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.29 (2021-01-16)</small>
|
||||
## <small>1.0.35 (2021-06-22)</small>
|
||||
|
||||
* chore(release): v1.0.29 ([874894b](https://github.com/simonecorsi/mawesome/commit/874894b))
|
||||
* ci: on pull_request hook ([748c821](https://github.com/simonecorsi/mawesome/commit/748c821))
|
||||
* ci: test on push ([226c942](https://github.com/simonecorsi/mawesome/commit/226c942))
|
||||
* feat: added test workflow for pr ([1bd01f6](https://github.com/simonecorsi/mawesome/commit/1bd01f6))
|
||||
* 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.28 (2021-01-16)</small>
|
||||
## <small>1.0.34 (2021-05-19)</small>
|
||||
|
||||
* chore(release): v1.0.28 ([c805822](https://github.com/simonecorsi/mawesome/commit/c805822))
|
||||
* tests: added tests ([b8890fc](https://github.com/simonecorsi/mawesome/commit/b8890fc))
|
||||
* 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;
|
||||
|
967
package-lock.json
generated
967
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mawesome",
|
||||
"version": "1.0.32",
|
||||
"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