-
Notifications
You must be signed in to change notification settings - Fork 1
fix(link-replacer): add common helper to replace link references #259
Conversation
@@ -5,6 +5,7 @@ import Routes, * as IndividualRoutes from './routes'; | |||
|
|||
import * as models from './models'; | |||
import * as routes from './routes/routes'; | |||
import * as commons from './commons'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with commons
, but hesitated with shared
. Please, I'm open to suggestions. (At least shared
would match one pattern we have in the client)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have picked shared but without any particular reason. Both are completely fine as far as I'm concerned so I would leave it like this.
const matchers = [ | ||
[ | ||
'issues', | ||
new RegExp(`(?<key>${issue.join('|')}) #(?<hashid>[\\w\\d]{6,})`, 'gi'), | ||
], | ||
[ | ||
'reports', | ||
new RegExp(`(?<key>${report.join('|')}) #(?<hashid>[\\w\\d]{6,})`, 'gi'), | ||
], | ||
[ | ||
'commands', | ||
new RegExp(`(?<key>${command.join('|')}) #(?<hashid>[\\w\\d]{6,})`, 'gi'), | ||
], | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only match on strict strings (not space before or after), because it should be up to the consumer of this module to decide how to format.
And there were issues with the previous regexp I think ((^|\s)
would match on the start string token before space in all cases I think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks clean and polished
@@ -5,6 +5,7 @@ import Routes, * as IndividualRoutes from './routes'; | |||
|
|||
import * as models from './models'; | |||
import * as routes from './routes/routes'; | |||
import * as commons from './commons'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have picked shared but without any particular reason. Both are completely fine as far as I'm concerned so I would leave it like this.
@@ -27,7 +27,7 @@ | |||
"build:open-api-file": "ts-node -P tsconfig.cjs.json --files ./documentation/", | |||
"build:redoc-index-html": "redoc-cli bundle ./documentation/redoc.json --output ./docs/index.html -t ./documentation/html-template.hbs", | |||
"prepare": "npm run build", | |||
"lint": "npm run build:cjs && eslint --ext .ts src", | |||
"lint": "npm run build:cjs && eslint --ext .ts src test", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I wanted the test files to also be formatted/linted
## [17.46.5](v17.46.4...v17.46.5) (2022-07-19) ### Bug Fixes * **link-replacer:** add common helper to replace link references ([#259](#259)) ([5f2ae4a](5f2ae4a)), closes [withthegrid/platform-client#1368](https://github.com/withthegrid/platform-client/issues/1368)
🎉 This PR is included in version 17.46.5 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Authors
@Arinono
Issues
refs withthegrid/platform-client#1368
Implementation details
Mostly taking what was on both the client and the platform, refactoring it a bit and adding unit tests.