feat(template): adds templates

if an `TEMPLATE.ejs` file is found in the repo it will be used for rendering

closes #14
This commit is contained in:
Simone Corsi 2022-04-13 13:22:40 +02:00
parent 9d140076f7
commit 2c742b8205
No known key found for this signature in database
GPG Key ID: 0F5535005610947A
3 changed files with 32 additions and 28 deletions

View File

@ -1,35 +1,24 @@
## <small>1.0.45 (2022-01-17)</small>
* build(deps): bump shelljs from 0.8.4 to 0.8.5 ([1da350a](https://github.com/simonecorsi/mawesome/commit/1da350a))
- build(deps): bump shelljs from 0.8.4 to 0.8.5 ([1da350a](https://github.com/simonecorsi/mawesome/commit/1da350a))
## <small>1.0.44 (2021-10-26)</small>
* chore(release): v1.0.44 ([6ffe17f](https://github.com/simonecorsi/mawesome/commit/6ffe17f))
* feat: git add multiple files at once ([4aef61f](https://github.com/simonecorsi/mawesome/commit/4aef61f))
- chore(release): v1.0.44 ([6ffe17f](https://github.com/simonecorsi/mawesome/commit/6ffe17f))
- feat: git add multiple files at once ([4aef61f](https://github.com/simonecorsi/mawesome/commit/4aef61f))
## <small>1.0.43 (2021-10-15)</small>
* chore(release): v1.0.43 ([5e0ef82](https://github.com/simonecorsi/mawesome/commit/5e0ef82))
* feat: reduce json output size ([94635fe](https://github.com/simonecorsi/mawesome/commit/94635fe))
- chore(release): v1.0.43 ([5e0ef82](https://github.com/simonecorsi/mawesome/commit/5e0ef82))
- feat: reduce json output size ([94635fe](https://github.com/simonecorsi/mawesome/commit/94635fe))
## <small>1.0.42 (2021-10-14)</small>
* chore(release): v1.0.42 ([5b36813](https://github.com/simonecorsi/mawesome/commit/5b36813))
* fix(paginator): last page now correctly matches rex ([dcf9898](https://github.com/simonecorsi/mawesome/commit/dcf9898))
- chore(release): v1.0.42 ([5b36813](https://github.com/simonecorsi/mawesome/commit/5b36813))
- fix(paginator): last page now correctly matches rex ([dcf9898](https://github.com/simonecorsi/mawesome/commit/dcf9898))
## <small>1.0.41 (2021-10-14)</small>
* chore(release): v1.0.41 ([884fc90](https://github.com/simonecorsi/mawesome/commit/884fc90))
* test: fixs suite ([b97833f](https://github.com/simonecorsi/mawesome/commit/b97833f))
* fix: should avoid index lock ([1d6848c](https://github.com/simonecorsi/mawesome/commit/1d6848c))
- chore(release): v1.0.41 ([884fc90](https://github.com/simonecorsi/mawesome/commit/884fc90))
- test: fixs suite ([b97833f](https://github.com/simonecorsi/mawesome/commit/b97833f))
- fix: should avoid index lock ([1d6848c](https://github.com/simonecorsi/mawesome/commit/1d6848c))

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "mawesome",
"version": "1.0.45",
"version": "1.1.0-next.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "mawesome",
"version": "1.0.45",
"version": "1.1.0-next.1",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.8.0",

View File

@ -1,4 +1,5 @@
import * as core from '@actions/core';
import { readdir, readFile } from 'fs/promises';
import {
renderer,
@ -27,11 +28,25 @@ export async function main(): Promise<any> {
{}
);
const rendered = await renderer({
username: REPO_USERNAME,
stars: Object.entries(sortedByLanguages),
updatedAt: Date.now(),
});
// get template if found in the repo
let template;
try {
const dir = await readdir('./');
core.info(dir.join('\n'));
template = await readFile('TEMPLATE.ejs', 'utf8');
core.info(template);
} catch {
core.warning("Couldn't find template file, using default");
}
const rendered = await renderer(
{
username: REPO_USERNAME,
stars: Object.entries(sortedByLanguages),
updatedAt: Date.now(),
},
template
);
const markdown: string = await generateMd(rendered);