Skip to content

Commit

Permalink
simplify npm run clean
Browse files Browse the repository at this point in the history
  • Loading branch information
iccicci committed Dec 30, 2023
1 parent abb247b commit 62e7d36
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"linebreak",
"nonblock",
"nonwords",
"npmignore",
"parens",
"pyues",
"rakshith",
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"description": "Opens a stream.Writable to a file rotated by interval and/or size. A logrotate alternative.",
"scripts": {
"all": "npm run eslint && npm run coverage",
"clean": "node -r ts-node/register utils.ts clean",
"coverage": "npm run clean && TZ=\"Europe/Rome\" nyc -r lcov -r text -r text-summary -r html mocha -r ts-node/register test/*ts",
"coverage": "rm -rf dist && TZ=\"Europe/Rome\" nyc -r lcov -r text -r text-summary -r html mocha -r ts-node/register test/*ts",
"eslint": "eslint index.ts utils.ts test/*ts",
"ignore": "node -r ts-node/register utils.ts ignore",
"ignore": "ts-node utils.ts ignore",
"prepare": "npm run ignore && tsc -p tsconfig.cjs.json && tsc -p tsconfig.es.json && tsc -p tsconfig.types.json",
"test": "npm run clean && mocha -r ts-node/register test/*ts"
"test": "rm -rf dist && mocha -r ts-node/register test/*ts"
},
"bugs": "https://github.com/iccicci/rotating-file-stream/issues",
"repository": "https://github.com/iccicci/rotating-file-stream",
Expand Down
3 changes: 1 addition & 2 deletions utils.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { rm, writeFile } from "fs/promises";
import { writeFile } from "fs/promises";

const common: string[] = ["*gz", "*log", "*tmp", "*txt", ".gitignore", ".npmignore", ".nyc_output", "coverage", "node_modules", ""];
const git: string[] = ["dist"];
const npm: string[] = [".*", "index.ts", "test", "tsconfig.*", "utils.ts"];

if(process.argv[2] === "clean") rm("dist", { force: true, recursive: true });
if(process.argv[2] === "ignore") {
(async () => {
await writeFile(".gitignore", git.concat(common).join("\n"));
Expand Down

0 comments on commit 62e7d36

Please sign in to comment.