2 Commits

Author SHA1 Message Date
Conventional Changelog Action
6ffe17f8b4 chore(release): v1.0.44 2021-10-26 07:51:36 +00:00
GitHub Actions
4aef61f232 feat: git add multiple files at once 2021-10-26 09:50:38 +02:00
5 changed files with 31 additions and 18 deletions

View File

@@ -1,5 +1,12 @@
## <small>1.0.44 (2021-10-26)</small>
* feat: git add multiple files at once ([4aef61f](https://github.com/simonecorsi/mawesome/commit/4aef61f))
## <small>1.0.43 (2021-10-15)</small> ## <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)) * feat: reduce json output size ([94635fe](https://github.com/simonecorsi/mawesome/commit/94635fe))
@@ -27,10 +34,3 @@
## <small>1.0.39 (2021-08-31)</small>
* chore(release): v1.0.39 ([f7a8341](https://github.com/simonecorsi/mawesome/commit/f7a8341))
* build(deps): bump path-parse from 1.0.6 to 1.0.7 ([ef137b5](https://github.com/simonecorsi/mawesome/commit/ef137b5))

View File

@@ -21291,7 +21291,16 @@ class Git {
})); }));
}; };
this.config = (prop, value) => this.exec(`config ${prop} "${value}"`); this.config = (prop, value) => this.exec(`config ${prop} "${value}"`);
this.add = (file) => this.exec(`add ${file}`); this.add = (file) => {
let str = '';
if (Array.isArray(file)) {
file.map((f) => (str += ` ${f}`));
}
else {
str = file;
}
return this.exec(`add ${str}`);
};
this.commit = (message) => this.exec(`commit -m "${message}"`); this.commit = (message) => this.exec(`commit -m "${message}"`);
this.pull = () => __awaiter(this, void 0, void 0, function* () { this.pull = () => __awaiter(this, void 0, void 0, function* () {
const args = ['pull']; const args = ['pull'];
@@ -21515,10 +21524,8 @@ function pushNewFiles(files = []) {
if (!files.length) if (!files.length)
return; return;
yield git_1.default.pull(); yield git_1.default.pull();
yield Promise.all(files.map(({ filename, data }) => __awaiter(this, void 0, void 0, function* () { yield Promise.all(files.map(({ filename, data }) => fsp.writeFile(filename, data)));
yield fsp.writeFile(filename, data); yield git_1.default.add(files.map(({ filename }) => filename));
yield git_1.default.add(filename);
})));
yield git_1.default.commit(`chore(updates): updated entries in files`); yield git_1.default.commit(`chore(updates): updated entries in files`);
yield git_1.default.push(); yield git_1.default.push();
}); });

View File

@@ -1,6 +1,6 @@
{ {
"name": "mawesome", "name": "mawesome",
"version": "1.0.43", "version": "1.0.44",
"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>",

View File

@@ -60,7 +60,15 @@ class Git {
config = (prop: string, value: string) => config = (prop: string, value: string) =>
this.exec(`config ${prop} "${value}"`); this.exec(`config ${prop} "${value}"`);
add = (file: string) => this.exec(`add ${file}`); add = (file: string | string[]) => {
let str = '';
if (Array.isArray(file)) {
file.map((f) => (str += ` ${f}`));
} else {
str = file;
}
return this.exec(`add ${str}`);
};
commit = (message: string) => this.exec(`commit -m "${message}"`); commit = (message: string) => this.exec(`commit -m "${message}"`);

View File

@@ -129,12 +129,10 @@ export async function pushNewFiles(files: File[] = []): Promise<any> {
await git.pull(); await git.pull();
await Promise.all( await Promise.all(
files.map(async ({ filename, data }) => { files.map(({ filename, data }) => fsp.writeFile(filename, data))
await fsp.writeFile(filename, data);
await git.add(filename);
})
); );
await git.add(files.map(({ filename }) => filename));
await git.commit(`chore(updates): updated entries in files`); await git.commit(`chore(updates): updated entries in files`);
await git.push(); await git.push();
} }