Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e5ba2cf34b | ||
|
f68439999d | ||
|
1da350a3d0 | ||
|
6ffe17f8b4 | ||
|
4aef61f232 |
29
CHANGELOG.md
29
CHANGELOG.md
@@ -1,5 +1,19 @@
|
||||
## <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))
|
||||
|
||||
|
||||
|
||||
## <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))
|
||||
|
||||
|
||||
|
||||
## <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))
|
||||
|
||||
|
||||
@@ -19,18 +33,3 @@
|
||||
|
||||
|
||||
|
||||
## <small>1.0.40 (2021-10-13)</small>
|
||||
|
||||
* chore(release): v1.0.40 ([0e016f4](https://github.com/simonecorsi/mawesome/commit/0e016f4))
|
||||
* fix: fixes while exit condition ([8f9b4cc](https://github.com/simonecorsi/mawesome/commit/8f9b4cc))
|
||||
* feat: paginates using async generator ([51da6c2](https://github.com/simonecorsi/mawesome/commit/51da6c2))
|
||||
|
||||
|
||||
|
||||
## <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))
|
||||
|
||||
|
||||
|
||||
|
17
index.js
17
index.js
@@ -21291,7 +21291,16 @@ class Git {
|
||||
}));
|
||||
};
|
||||
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.pull = () => __awaiter(this, void 0, void 0, function* () {
|
||||
const args = ['pull'];
|
||||
@@ -21515,10 +21524,8 @@ function pushNewFiles(files = []) {
|
||||
if (!files.length)
|
||||
return;
|
||||
yield git_1.default.pull();
|
||||
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 Promise.all(files.map(({ filename, data }) => fsp.writeFile(filename, data)));
|
||||
yield git_1.default.add(files.map(({ filename }) => filename));
|
||||
yield git_1.default.commit(`chore(updates): updated entries in files`);
|
||||
yield git_1.default.push();
|
||||
});
|
||||
|
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mawesome",
|
||||
"version": "1.0.38",
|
||||
"version": "1.0.44",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -7414,9 +7414,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"shelljs": {
|
||||
"version": "0.8.4",
|
||||
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz",
|
||||
"integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==",
|
||||
"version": "0.8.5",
|
||||
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz",
|
||||
"integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"glob": "^7.0.0",
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mawesome",
|
||||
"version": "1.0.43",
|
||||
"version": "1.0.45",
|
||||
"description": "Generate awesome list from user starred repositories",
|
||||
"main": "index.js",
|
||||
"author": "Simone Corsi<simonecorsi.dev@gmail.com>",
|
||||
|
10
src/git.ts
10
src/git.ts
@@ -60,7 +60,15 @@ class Git {
|
||||
config = (prop: string, value: string) =>
|
||||
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}"`);
|
||||
|
||||
|
@@ -129,12 +129,10 @@ export async function pushNewFiles(files: File[] = []): Promise<any> {
|
||||
await git.pull();
|
||||
|
||||
await Promise.all(
|
||||
files.map(async ({ filename, data }) => {
|
||||
await fsp.writeFile(filename, data);
|
||||
await git.add(filename);
|
||||
})
|
||||
files.map(({ filename, data }) => fsp.writeFile(filename, data))
|
||||
);
|
||||
|
||||
await git.add(files.map(({ filename }) => filename));
|
||||
await git.commit(`chore(updates): updated entries in files`);
|
||||
await git.push();
|
||||
}
|
||||
|
Reference in New Issue
Block a user