Skip to content

Commit

Permalink
fix: fix executable
Browse files Browse the repository at this point in the history
  • Loading branch information
levchak0910 committed Mar 31, 2024
1 parent 0309412 commit cc98462
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ Options: `<files>` and `<ignore>` should be an array of patterns (provided by [g
Use it via a shell

```bash
pnpm @vkcn/reporter <files> -i <ignore>
pnpm vkcn-reporter <files> -i <ignore>
```

Where `files` and `ignore` - are patterns provided by [glob](https://www.npmjs.com/package/glob) package. Can be used for multiple patterns split by a space `@vkcn/reporter components/**/*.vue styles/**/*.scss`
Where `files` and `ignore` - are patterns provided by [glob](https://www.npmjs.com/package/glob) package. Can be used for multiple patterns split by a space `vkcn-reporter components/**/*.vue styles/**/*.scss`

If violations are found, the process will finish with a code `1`
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"description": "Tool that helps to detect VKCN violations across the whole project",
"type": "module",
"main": "./dist/program.js",
"bin": "./dist/cli.js",
"bin": {
"vkcn-reporter": "./dist/cli.js"
},
"types": "./dist/program.d.ts",
"files": [
"dist"
Expand Down
11 changes: 8 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/usr/bin/env node

import fs from "node:fs"
import path from "node:path"

// @ts-expect-error
import makeCli from "make-cli"

import { type SelectorFiles, findDuplicatesInFiles } from "./program.js"

const { version } = JSON.parse(fs.readFileSync(path.resolve("package.json"), "utf-8"))

const report = (selectorFiles: SelectorFiles) => {
const duplicateClassSelectors = Object.keys(selectorFiles)
if (duplicateClassSelectors.length === 0) {
Expand All @@ -27,11 +32,11 @@ const report = (selectorFiles: SelectorFiles) => {
}

makeCli({
name: "@vkcn/reporter",
version: "0.1.4",
name: "vkcn-reporter",
version,
usage: `
@vkcn/reporter <files> -i <ignore>
vkcn-reporter <files> -i <ignore>
For details please check docs: https://www.npmjs.com/package/@vkcn/reporter#cli-usage
`,
Expand Down

0 comments on commit cc98462

Please sign in to comment.