Skip to content

Commit

Permalink
Update dependency: globby to 12.0.2.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Dec 27, 2021
1 parent 05b9e6e commit 11e9a20
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"eslint-plugin-jsdoc": "~37.4.0",
"eslint-plugin-node": "~11.1.0",
"eslint-plugin-unicorn": "~39.0.0",
"globby": "~11.0.4",
"globby": "~12.0.2",
"js-yaml": "~4.1.0",
"markdown-it-for-inline": "~0.1.1",
"markdown-it-sub": "~1.0.0",
Expand Down
33 changes: 20 additions & 13 deletions scripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@

"use strict";

const fs = require("fs");
const globby = require("globby");
const fs = require("fs").promises;

const [ command, ...args ] = process.argv.slice(2);

if (command === "copy") {
const [ src, dest ] = args;
fs.copyFileSync(src, dest);
} else if (command === "delete") {
for (const arg of args) {
for (const file of globby.sync(arg)) {
fs.unlinkSync(file);
}
// eslint-disable-next-line unicorn/prefer-top-level-await
(async() => {
if (command === "copy") {
const [ src, dest ] = args;
await fs.copyFile(src, dest);
} else if (command === "delete") {
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const { globby } = await import("globby");
await Promise.all(
args.flatMap(
(glob) => globby(glob)
.then(
(files) => files.map((file) => fs.unlink(file))
)
)
);
} else {
throw new Error(`Unsupported command: ${command}`);
}
} else {
throw new Error(`Unsupported command: ${command}`);
}
})();
15 changes: 6 additions & 9 deletions test/markdownlint-test-extra-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@

"use strict";

const globby = require("globby");
const test = require("ava").default;
const markdownlint = require("../lib/markdownlint");

// Parses all Markdown files in all package dependencies
test.cb("parseAllFiles", (t) => {
test("parseAllFiles", async(t) => {
t.plan(1);
const options = {
"files": globby.sync("**/*.{md,markdown}")
};
markdownlint(options, (err) => {
t.falsy(err);
t.end();
});
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const { globby } = await import("globby");
const files = await globby("**/*.{md,markdown}");
await markdownlint.promises.markdownlint({ files });
t.pass();
});
3 changes: 2 additions & 1 deletion test/markdownlint-test-repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const { existsSync } = require("fs");
// eslint-disable-next-line unicorn/import-style
const { join } = require("path");
const { promisify } = require("util");
const globby = require("globby");
const jsYaml = require("js-yaml");
const test = require("ava").default;
const markdownlint = require("../lib/markdownlint");
Expand All @@ -25,6 +24,8 @@ const readConfigPromise = promisify(markdownlint.readConfig);
async function lintTestRepo(t, globPatterns, configPath, ignoreRes) {
t.plan(1);
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const { globby } = await import("globby");
// eslint-disable-next-line node/no-unsupported-features/es-syntax
const { "default": stripJsonComments } = await import("strip-json-comments");
const jsoncParse = (json) => JSON.parse(stripJsonComments(json));
const yamlParse = (yaml) => jsYaml.load(yaml);
Expand Down

0 comments on commit 11e9a20

Please sign in to comment.