-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: build and export types [TCTC-3320] #1455
Changes from all commits
6f04298
0dd7a32
ab0ccd0
ab9fc0f
5c283f7
77730e4
99f3df8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/sh | ||
rm -rf dist/types | ||
npx tsc -p tsconfig.types.json | ||
for file in dist/types/**/*.* | ||
do | ||
if [ $file = dist/types/main.d.ts ] | ||
then | ||
path_to_src=./ | ||
else | ||
path_to_src=$(echo $file | tr -dc '/' | colrm 1 2 | sed "s#/#../#g") | ||
fi | ||
sed -i -r "s#((import|export) .* from ')@/(.*)#\1$path_to_src\3#g" $file | ||
done | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another approach could have been to use a codemod like this one:https://github.com/tusharmath/ts-codemod/blob/master/transformations/normalize-import-path.ts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Didn't know about this one! Yeah let's switch to AST-based codemods if this build pipeline get too complex |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export * from './main'; | ||
|
||
export { PipelineStep, Pipeline } from './lib/steps'; | ||
export { VariableDelimiters, VariablesBucket } from './lib/variables'; | ||
export { ColumnValueStat } from './lib/dataset/helpers'; | ||
export { PaginationContext } from './lib/dataset/pagination'; | ||
export { DataSetColumnType, DataSetColumn, DataSet } from './lib/dataset'; | ||
export { BackendError, BackendWarning, BackendResponse, BackendService } from './lib/backend'; |
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.
Should we add npx to dev devpendencies then?
We're lucky this is provided in the node image used by the CI ^^
Otherwise, calling tsc directly could be enough? (because this script is called from
npm run ...
which addsnode_modules/.bin
toPATH
(https://docs.npmjs.com/cli/v8/commands/npm-run-script).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.
Wait, isn't npx available wherever node is? If not I don't have any preferences. Maybe the dot command erases the path? Not sure. Probably the safer thing would be to replace
npx tsc
bynode node_modules/.bin/tsc
then?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.
Okay so apparently npx is available wherever npm is and I doubt that it's necessary to handle build systems where npm is not available yet yarn is, I can't even think of one
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.
Oh nice! I thought it was standalone (https://www.npmjs.com/package/npx)
Good to use npx then!