Skip to content

Commit 84cc103

Browse files
authored
Update dependencies (#10)
1 parent fa9e966 commit 84cc103

17 files changed

+9584
-14368
lines changed

.babelrc

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
{
2-
"presets": ["@babel/preset-env"],
3-
"plugins": ["@babel/plugin-transform-runtime", "@babel/plugin-proposal-object-rest-spread"],
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"modules": "commonjs"
7+
}
8+
]
9+
],
10+
"plugins": [
11+
[
12+
"@babel/plugin-transform-modules-commonjs",
13+
{
14+
"allowTopLevelThis": true,
15+
"interop": "auto",
16+
"strictMode": false
17+
}
18+
]
19+
],
420
"env": {
521
"test": {
622
"plugins": ["istanbul"]
723
}
8-
},
9-
"targets": "node 14.0"
24+
}
1025
}

.editorconfig

Lines changed: 0 additions & 14 deletions
This file was deleted.

.eslintrc.yaml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.jsdoc.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
"destination": "./docs/",
1919
"encoding": "utf8",
2020
"private": true,
21-
"template": "./node_modules/minami"
21+
"template": "node_modules/clean-jsdoc-theme"
2222
}
2323
}

eslint.config.mjs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import eslint from "@eslint/js";
2+
import eslintConfigPrettier from "eslint-config-prettier/flat";
3+
import importPlugin from "eslint-plugin-import";
4+
import mochaPlugin from "eslint-plugin-mocha";
5+
import pluginPromise from "eslint-plugin-promise";
6+
// eslint-disable-next-line import/no-unresolved
7+
import { defineConfig, globalIgnores } from "eslint/config";
8+
import globals from "globals";
9+
10+
export default defineConfig([
11+
globalIgnores(["docs/**", "dist/**", "bin/**"]),
12+
eslint.configs.recommended,
13+
mochaPlugin.configs.flat.recommended,
14+
importPlugin.flatConfigs.recommended,
15+
pluginPromise.configs["flat/recommended"],
16+
{
17+
files: ["**/*.{cjs,mjs,js}"],
18+
languageOptions: {
19+
ecmaVersion: 2020,
20+
sourceType: "module",
21+
globals: {
22+
...globals.node,
23+
},
24+
},
25+
rules: {
26+
"no-undef": "error",
27+
"no-unreachable": 1,
28+
"no-empty": "error",
29+
"array-callback-return": "error",
30+
"no-var": "error",
31+
"prefer-const": "error",
32+
"no-template-curly-in-string": "error",
33+
"consistent-return": "error",
34+
"no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0 }],
35+
"arrow-body-style": ["error", "as-needed"],
36+
"prefer-arrow-callback": ["error", { allowNamedFunctions: true }],
37+
"prefer-destructuring": ["error", { object: true, array: false }],
38+
"prefer-spread": "error",
39+
"prefer-rest-params": "error",
40+
"import/no-unresolved": "error",
41+
"import/named": "off", //temp
42+
"import/default": "error",
43+
"import/namespace": "error",
44+
"no-unused-vars": "off",
45+
"no-debugger": "error",
46+
strict: "error",
47+
},
48+
},
49+
{
50+
files: ["**/*.spec.js"],
51+
languageOptions: {
52+
globals: {
53+
...globals.mocha,
54+
},
55+
},
56+
rules: {
57+
"prefer-arrow-callback": "off",
58+
"mocha/no-setup-in-describe": "off",
59+
"promise/no-callback-in-promise": "off",
60+
"promise/catch-or-return": "off",
61+
"promise/always-return": "off",
62+
"mocha/no-mocha-arrows": "off",
63+
},
64+
extends: [],
65+
},
66+
eslintConfigPrettier, // goes last
67+
]);

gulpfile.js

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
const babel = require("gulp-babel");
22
const chmod = require("gulp-chmod");
3-
const eslint = require("gulp-eslint");
4-
const prettier = require("gulp-prettier");
53
const gulp = require("gulp");
64

75
gulp.task("scripts", (done) => {
@@ -14,20 +12,5 @@ gulp.task("scripts", (done) => {
1412
done();
1513
});
1614

17-
gulp.task("lint", () =>
18-
gulp
19-
.src("./lib/**/*.js")
20-
.pipe(
21-
eslint({
22-
fix: true,
23-
}),
24-
)
25-
.pipe(eslint.format())
26-
.pipe(prettier())
27-
.pipe(gulp.dest("./lib/")),
28-
);
29-
30-
gulp.task("watch", () => gulp.watch("./lib/**/*.js", gulp.series(["lint", "scripts"])));
31-
32-
gulp.task("build", gulp.series(["lint", "scripts"]));
33-
gulp.task("default", gulp.series(["build", "watch"]));
15+
gulp.task("build", gulp.series(["scripts"]));
16+
gulp.task("default", gulp.series(["build"]));

lib/gren-examples.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/usr/bin/env node
22

3-
import gren from "commander";
3+
import { Command } from "commander";
44
import chalk from "chalk";
55
import examples from "./_examples";
66

7+
const gren = new Command();
8+
79
let command;
810
const commandList = Object.keys(examples).filter(
911
(example) => example !== "default" && example !== "generateExamples",

lib/gren-init.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/usr/bin/env node
22

3-
import gren from "commander";
3+
import { Command } from "commander";
44
import { green } from "chalk";
55
import ObjectAssignDeep from "object-assign-deep";
66
import init from "../dist/_init";
77
import utils from "../dist/_utils";
88
import fs from "fs";
99

10+
const gren = new Command();
11+
1012
gren
1113
.name(`${green("gren")} release`)
1214
.description("Initialise the module options.")
@@ -48,6 +50,7 @@ init()
4850
fs.writeFileSync(fileType, fileContent);
4951

5052
console.log(green(`\nGreat news! Your ${fileType} as been created!`));
53+
return;
5154
},
5255
)
5356
.catch((error) => {

lib/gren.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env node
22

3-
import gren from "commander";
3+
import { Command } from "commander";
44
import { version, description } from "../package.json";
55

6+
const gren = new Command("gren");
67
const argvWithVersion = (argvs) => {
78
const vPos = argvs.indexOf("-v");
89

@@ -15,7 +16,7 @@ const argvWithVersion = (argvs) => {
1516

1617
gren
1718
.version(version)
18-
.description(`gren (🤖 ) ${description}`)
19+
.description(`gren (🤖) ${description}`)
1920
.usage("<command> [options]")
2021
.command("init", "Initialise the module options")
2122
.alias("i")

lib/src/GitHubInfo.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { exec } from "child_process";
22
import chalk from "chalk";
3-
import { matchAll } from "regex-match-all";
43

54
/** Class retrieving GitHub informations from the folder where .git is initialised. */
65
class GitHubInfo {
@@ -52,7 +51,7 @@ class GitHubInfo {
5251
}
5352
});
5453
})
55-
.then(callback)
54+
.then(callback) // eslint-disable-line promise/no-callback-in-promise
5655
.catch((error) => {
5756
throw new Error(
5857
chalk.red(error) +
@@ -75,20 +74,21 @@ class GitHubInfo {
7574
*/
7675
_repo(callback) {
7776
return this._executeCommand("git config remote.origin.url", (repo) => {
78-
const repoPath = matchAll(/([\w-.]+)\/([\w-.]+?)(\.git)?$/g, repo);
77+
const regex = /([\w-.]+)\/([\w-.]+?)(\.git)?$/g;
78+
const matches = [...repo.matchAll(regex)];
7979

80-
if (!repoPath[1]) {
80+
if (!matches[0]) {
8181
return Promise.reject(new Error("No repo found"));
8282
}
8383

84-
const user = repoPath[1][0];
85-
const name = repoPath[1][1];
84+
const user = matches[0][1];
85+
const name = matches[0][2];
8686

8787
return {
8888
username: user,
8989
repo: name,
9090
};
91-
}).then(callback);
91+
}).then(callback); // eslint-disable-line promise/no-callback-in-promise
9292
}
9393

9494
/**

0 commit comments

Comments
 (0)