Skip to content

Commit 1b9481d

Browse files
张乐lexmin0412
张乐
authored andcommitted
feat: init
0 parents  commit 1b9481d

File tree

9 files changed

+805
-0
lines changed

9 files changed

+805
-0
lines changed

Diff for: .editorConfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_style = tab
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false

Diff for: .github/workflows/npmPublish.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: publish node package
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
publish-npm:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-node@v1
14+
with:
15+
node-version: 14
16+
registry-url: https://registry.npmjs.org/
17+
- run: npm i
18+
- run: npm run build
19+
- run: npm publish -access public
20+
env:
21+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
lib
2+
es
3+
node_modules

Diff for: gen.ps1

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
$cwd = Get-Location
2+
$baseDir = "$cwd/src/PC/Workbench/components/SaaSUncertain"
3+
4+
$outputFilePath = Join-Path -Path $PSScriptRoot -ChildPath "output.txt"
5+
$scriptFilePath = Join-Path -Path $PSScriptRoot -ChildPath "analyze.ts"
6+
7+
Write-Output $outputFilePath
8+
9+
Write-Output "Current Workspace Directory: $baseDir"
10+
11+
# # 将上面的输出写入文件并指定 utf-8 编码
12+
oxlint --format github | Out-File -FilePath $outputFilePath -Encoding utf8
13+
14+
npx ts-node $scriptFilePath
15+
16+
Write-Output "Generate Success"

Diff for: gen.ts

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import path from 'path'
2+
import fs from 'fs'
3+
4+
const genAnalyzeRes = async() => {
5+
const result = fs.readFileSync(path.resolve(__dirname, '..', './output.txt'), {
6+
encoding: 'utf-8'
7+
}).toString()
8+
const lines = result.toString().split('\n')
9+
const formattedRes = lines.map(line => {
10+
const [type, message] = line.split(' ')
11+
const typeText = type.split('::')[1]
12+
const otherProps: Record<string, unknown> = {}
13+
if (message) {
14+
message.split(',').forEach((item)=>{
15+
const [key, value] = item.split('=')
16+
otherProps[key] = value
17+
})
18+
}
19+
return { type: typeText, otherProps }
20+
})
21+
console.log('json', result)
22+
fs.writeFileSync(path.resolve(__dirname, '..', './output.json'), JSON.stringify(formattedRes, null, 2), {
23+
encoding: 'utf-8',
24+
25+
})
26+
}
27+
28+
genAnalyzeRes()

Diff for: package.json

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "woodpecker",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "./lib/index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"build:commonjs": "rimraf lib && tsc --target es5 --outDir lib --module commonjs --declaration",
9+
"build:es": "rimraf es && tsc --target es6 --outDir es --module es6",
10+
"build": "npm run build:commonjs && npm run build:es",
11+
"ts": "ts-node src/",
12+
"prepublishOnly": "npm run build"
13+
},
14+
"keywords": [],
15+
"author": {
16+
"name": "lexmin0412",
17+
"email": "[email protected]",
18+
"url": "https://github.com/lexmin0412"
19+
},
20+
"license": "ISC",
21+
"files": [
22+
"es",
23+
"lib"
24+
],
25+
"types": "./lib/index.d.ts",
26+
"jsnext:main": "./es/index.js",
27+
"module": "./es/index.js",
28+
"repository": {
29+
"type": "git",
30+
"url": "https://github.com/lexmin0412/woodpecker.git",
31+
"directory": ""
32+
},
33+
"bugs": {
34+
"url": "https://github.com/lexmin0412/woodpecker/issues"
35+
},
36+
"homepage": "https://github.com/lexmin0412/woodpecker#readme",
37+
"private": false,
38+
"publishConfig": {
39+
"access": "public",
40+
"registry": "https://registry.npmjs.org/"
41+
},
42+
"bin": {
43+
"woodpecker": "./lib/cli.js",
44+
"ttt": "./gen.ps1"
45+
},
46+
"devDependencies": {
47+
"@types/node": "^20.12.13",
48+
"rimraf": "^5.0.7",
49+
"ts-node": "^10.9.2",
50+
"typescript": "^5.4.5"
51+
},
52+
"dependencies": {
53+
"inquirer": "8.x"
54+
}
55+
}

0 commit comments

Comments
 (0)