Skip to content

Commit ebe7563

Browse files
authored
Merge pull request imas#1 from foooomio/add-prettier
Add prettier
2 parents a9d3444 + db5a9ef commit ebe7563

File tree

5 files changed

+38
-4
lines changed

5 files changed

+38
-4
lines changed

.github/workflows/ci.yml

+11
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,14 @@ jobs:
1111
java-version: 11
1212
- uses: ./
1313
- run: rdflint -v
14+
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: actions/setup-node@v1
20+
with:
21+
node-version: 12.x
22+
- run: npm ci
23+
- run: npm run build
24+
- run: npm run format-check

.prettierrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"parser": "typescript"
4+
}

package-lock.json

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"description": "GitHub Action to setup rdflint",
55
"main": "dist/index.js",
66
"scripts": {
7-
"build": "ncc build src/setup-rdflint.ts"
7+
"build": "ncc build src/setup-rdflint.ts",
8+
"format": "prettier --write **/*.ts",
9+
"format-check": "prettier --check **/*.ts"
810
},
911
"repository": {
1012
"type": "git",
@@ -25,6 +27,7 @@
2527
"devDependencies": {
2628
"@types/node-fetch": "^2.5.4",
2729
"@zeit/ncc": "^0.21.0",
30+
"prettier": "^1.19.1",
2831
"typescript": "^3.7.5"
2932
}
3033
}

src/setup-rdflint.ts

+13-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import * as fs from 'fs';
55
import * as path from 'path';
66

77
async function getLatestRdflintVersion(): Promise<string> {
8-
const response = await fetch('https://jitpack.io/api/builds/com.github.imas/rdflint/latestOk');
8+
const response = await fetch(
9+
'https://jitpack.io/api/builds/com.github.imas/rdflint/latestOk'
10+
);
911
const { version } = await response.json();
1012

1113
if (typeof version !== 'string') {
@@ -18,10 +20,18 @@ async function installRdflint(version: string): Promise<string> {
1820
const downloadUrl = `https://jitpack.io/com/github/imas/rdflint/${version}/rdflint-${version}.jar`;
1921

2022
const downloadPath = await tc.downloadTool(downloadUrl);
21-
const cachePath = await tc.cacheFile(downloadPath, 'rdflint.jar', 'rdflint', version);
23+
const cachePath = await tc.cacheFile(
24+
downloadPath,
25+
'rdflint.jar',
26+
'rdflint',
27+
version
28+
);
2229

2330
const executablePath = path.join(cachePath, 'rdflint');
24-
fs.writeFileSync(executablePath, `#!/bin/sh\njava -jar ${cachePath}/rdflint.jar $@`);
31+
fs.writeFileSync(
32+
executablePath,
33+
`#!/bin/sh\njava -jar ${cachePath}/rdflint.jar $@`
34+
);
2535
fs.chmodSync(executablePath, 0o555);
2636

2737
core.addPath(cachePath);

0 commit comments

Comments
 (0)