Skip to content

Commit 50a540c

Browse files
rewrite redot on top of ts-graphviz
* replace custom grammar with ts-graphviz * use jsdoc based typescript * align with unified toolchain * upgrade unified version * add tests * upgrade CI
1 parent c09e4b2 commit 50a540c

39 files changed

+390
-844
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,12 @@ jobs:
1010
strategy:
1111
matrix:
1212
platform: [ubuntu-latest, windows-latest, macos-latest]
13-
nodejs-version: [8, 10, 12]
13+
nodejs-version: [16, 18, 20]
1414
runs-on: ${{ matrix.platform }}
1515
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v2
18-
- name: Set up Node.js
19-
uses: actions/setup-node@v2
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-node@v3
2018
with:
2119
version: ${{ matrix.nodejs-version }}
22-
- name: Build and test
23-
run: |
24-
npm install
25-
npm test
20+
- run: npm install
21+
- run: npm test

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# Visual Studio Code - https://code.visualstudio.com/
55
.settings/
66
.vscode/
7-
tsconfig.json
87
jsconfig.json
98

109
### Linux ###
@@ -136,4 +135,4 @@ $RECYCLE.BIN/
136135

137136
package-lock.json
138137
yarn.lock
139-
dot.js
138+
*.d.ts

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ignore-scripts=true
2+
package-lock=false

CODE_OF_CONDUCT.md

Lines changed: 0 additions & 73 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 0 additions & 94 deletions
This file was deleted.

lerna.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

LICENSE renamed to license

File renamed without changes.

package.json

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,55 @@
11
{
2+
"type": "module",
23
"devDependencies": {
3-
"eslint": "^6.0.0",
4-
"eslint-plugin-node": "^10.0.0",
5-
"husky": "^3.0.0",
6-
"lerna": "^3.0.0",
7-
"lint-staged": "^9.0.0",
8-
"npm-run-all": "^4.1.3",
9-
"prettier-eslint-cli": "^5.0.0",
10-
"remark-cli": "^7.0.0",
11-
"remark-preset-lint-consistent": "^2.0.1",
12-
"remark-preset-lint-recommended": "^3.0.1"
4+
"@types/node": "^20.0.0",
5+
"c8": "^8.0.0",
6+
"prettier": "^3.0.0",
7+
"remark-cli": "^11.0.0",
8+
"remark-preset-wooorm": "^9.0.0",
9+
"type-coverage": "^2.0.0",
10+
"typescript": "^5.0.0",
11+
"xo": "^0.55.0"
1312
},
1413
"scripts": {
15-
"precommit": "lint-staged",
16-
"postinstall": "lerna bootstrap --no-ci",
17-
"test": "npm-run-all lint-js lint-md",
18-
"lint-js": "eslint . --ignore-path=.gitignore",
19-
"lint-md": "remark *.md packages/*/*.md --ignore-path .gitignore"
14+
"prepack": "npm run build && npm run format",
15+
"build": "tsc --build --clean && tsc --build && type-coverage",
16+
"format": "remark . -qfo && prettier . -w --loglevel warn && xo --fix",
17+
"test-api": "npm run test --workspaces",
18+
"test-coverage": "c8 --100 --reporter lcov npm run test-api",
19+
"test": "npm run build && npm run format && npm run test-coverage"
2020
},
21-
"lint-staged": {
22-
"*.{js,md}": [
23-
"prettier-eslint --write",
24-
"git add"
25-
]
21+
"workspaces": [
22+
"packages/redot-parse",
23+
"packages/redot-stringify",
24+
"packages/redot",
25+
"packages/redot-cli"
26+
],
27+
"prettier": {
28+
"tabWidth": 2,
29+
"useTabs": false,
30+
"singleQuote": true,
31+
"bracketSpacing": false,
32+
"semi": false,
33+
"trailingComma": "none"
2634
},
27-
"eslintConfig": {
28-
"plugins": [
29-
"node"
30-
],
31-
"extends": [
32-
"eslint:recommended",
33-
"plugin:node/recommended"
34-
]
35+
"xo": {
36+
"prettier": true
3537
},
3638
"remarkConfig": {
3739
"plugins": [
38-
"preset-lint-recommended",
39-
"preset-lint-consistent",
40+
"remark-preset-wooorm",
4041
[
41-
"remark-lint-list-item-indent",
42+
"remark-lint-no-html",
4243
false
4344
]
4445
]
4546
},
47+
"typeCoverage": {
48+
"atLeast": 100,
49+
"detail": true,
50+
"strict": true,
51+
"ignoreCatch": true
52+
},
4653
"renovate": {
4754
"extends": [
4855
"schedule:weekly",

packages/redot-cli/cli.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env node
2+
import {createRequire} from 'node:module'
3+
import {args} from 'unified-args'
4+
// eslint-disable-next-line import/order
5+
import {redot} from 'redot'
6+
7+
const require = createRequire(import.meta.url)
8+
9+
const proc = require('redot/package.json')
10+
const cli = require('./package.json')
11+
12+
const extensions = ['dot', 'gv']
13+
14+
args({
15+
processor: redot,
16+
name: proc.name,
17+
description: cli.description,
18+
version: [
19+
proc.name + ': ' + proc.version,
20+
cli.name + ': ' + cli.version
21+
].join(', '),
22+
pluginPrefix: proc.name,
23+
packageField: proc.name + 'Config',
24+
rcName: '.' + proc.name + 'rc',
25+
ignoreName: '.' + proc.name + 'ignore',
26+
extensions
27+
})

packages/redot-parse/NOTICE renamed to packages/redot-cli/license

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The MIT License (MIT)
1+
MIT License
22

3-
Copyright (c) 2014 Andrei Kashcha
3+
Copyright (c) 2018 Christian Murphy
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)