Skip to content

Commit

Permalink
feat: add bin
Browse files Browse the repository at this point in the history
  • Loading branch information
lvjiaxuan committed Aug 17, 2022
1 parent 5b9aeb9 commit 4d78e59
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
21 changes: 21 additions & 0 deletions packages/all/add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { execa } from 'execa'
import path from 'path'
import fs from 'fs'

const cwd = process.cwd()


// Setup
const pkgPath = path.resolve(cwd, 'package.json')

const pkgInfo = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
pkgInfo.eslintConfig = {
// root: true,
extends: '@lvjiaxuan',
}

fs.writeFileSync(pkgPath, JSON.stringify(pkgInfo, null, 2) + '\n')


// Install
execa('ni', [ '@lvjiaxuan/eslint-config', '-D' ], { stdio: 'inherit', cwd })
3 changes: 3 additions & 0 deletions packages/all/bin/add.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node
'use strict'
import '../dist/add.js'
11 changes: 8 additions & 3 deletions packages/all/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
"keywords": [
"eslint-config"
],
"scripts": {
"build": "nx esbuild add.js --bundle --platform=node --format=cjs --outdir=dist",
"prepublishOnly": "nr build"
},
"main": "index.js",
"files": [
"index.js"
],
"bin": {
"add": "./bin/add.mjs"
},
"files": ["*"],
"peerDependencies": {
"eslint": ">=8"
},
Expand Down
3 changes: 2 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4d78e59

Please sign in to comment.