-
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: add clean models to preGen #271
Changes from 1 commit
9f7e31f
13d7b9c
abd3048
49472eb
059915e
eb79948
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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
import { buildJSClientUtils } from './buildClients'; | ||
import { buildSpecs } from './buildSpecs'; | ||
import { buildCustomGenerators, CI, run, runIfExists } from './common'; | ||
import { | ||
buildCustomGenerators, | ||
CI, | ||
run, | ||
runIfExists, | ||
toAbsolutePath, | ||
} from './common'; | ||
import { getCustomGenerator, getLanguageFolder } from './config'; | ||
import { formatter } from './formatter'; | ||
import { createSpinner } from './oraLog'; | ||
|
@@ -15,6 +21,25 @@ async function preGen( | |
verbose, | ||
}); | ||
|
||
// We clean models to avoid outdated files. | ||
let modelPath = ''; | ||
switch (language) { | ||
case 'javascript': | ||
modelPath = 'model'; | ||
break; | ||
case 'java': | ||
modelPath = `algoliasearch-core/com/algolia/model/${client}`; | ||
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. what if we move these to 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. Good idea!! done here: abd3048#diff-64a51f57427aace9dbccb385845d777dc94715dfa53fbac8e1651edfa3674bceR1 |
||
break; | ||
default: | ||
return; | ||
} | ||
|
||
if (modelPath) { | ||
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. small refacto, you could create a function 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. Do you mean having an early if for 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. Actually it make sense coupled with Eunjae's suggestion, I'll do it! 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. |
||
await run(`rm -rf ${toAbsolutePath(`${output}/${modelPath}`)}`, { | ||
verbose, | ||
}); | ||
} | ||
|
||
await setHostsOptions({ client, key }); | ||
} | ||
|
||
|
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 first used workspace commands but went back to
rm -rf
to avoid impacting thepackage.json
of the generated client.