Remove cpy-cli and rimraf dependencies; replace with simple script helper.

This commit is contained in:
David Anson 2021-11-11 22:02:51 -08:00
parent 090bbaa30f
commit 983e586c9c
3 changed files with 24 additions and 5 deletions

View file

@ -10,5 +10,6 @@ demo/*
example
npm-debug.log
schema/*.js
scripts
test
test-repos

View file

@ -16,11 +16,10 @@
"build-config": "npm run build-config-schema && npm run build-config-example",
"build-config-example": "node schema/build-config-example.js",
"build-config-schema": "node schema/build-config-schema.js",
"build-declaration": "tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && rimraf 'lib/{c,md,r}*.d.ts' 'helpers/*.d.ts'",
"build-demo": "cpy node_modules/markdown-it/dist/markdown-it.min.js demo && cd demo && webpack --no-stats",
"build-declaration": "tsc --allowJs --declaration --emitDeclarationOnly --resolveJsonModule lib/markdownlint.js && node scripts delete 'lib/{c,md,r}*.d.ts' 'helpers/*.d.ts'",
"build-demo": "node scripts copy node_modules/markdown-it/dist/markdown-it.min.js demo/markdown-it.min.js && cd demo && webpack --no-stats",
"build-example": "npm install --no-save --ignore-scripts grunt grunt-cli gulp through2",
"ci": "npm-run-all --continue-on-error --parallel test-cover lint declaration build-config build-demo && git diff --exit-code",
"clean-test-repos": "rimraf test-repos",
"clone-test-repos-dotnet-docs": "cd test-repos && git clone https://github.com/dotnet/docs dotnet-docs --depth 1 --no-tags --quiet",
"clone-test-repos-eslint-eslint": "cd test-repos && git clone https://github.com/eslint/eslint eslint-eslint --depth 1 --no-tags --quiet",
"clone-test-repos-mkdocs-mkdocs": "cd test-repos && git clone https://github.com/mkdocs/mkdocs mkdocs-mkdocs --depth 1 --no-tags --quiet",
@ -50,7 +49,6 @@
"devDependencies": {
"ava": "~3.15.0",
"c8": "~7.8.0",
"cpy-cli": "~3.1.1",
"eslint": "~7.32.0",
"eslint-plugin-jsdoc": "~36.0.7",
"eslint-plugin-node": "~11.1.0",
@ -63,7 +61,6 @@
"markdown-it-texmath": "~0.9.1",
"markdownlint-rule-helpers": "~0.14.0",
"npm-run-all": "~4.1.5",
"rimraf": "~3.0.2",
"strip-json-comments": "~3.1.1",
"toml": "~3.0.0",
"ts-loader": "~9.2.5",

21
scripts/index.js Normal file
View file

@ -0,0 +1,21 @@
// @ts-check
"use strict";
const fs = require("fs");
const globby = require("globby");
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);
}
}
} else {
throw new Error(`Unsupported command: ${command}`);
}