Skip to content
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

Build: Always set --no-link when creating angular sandboxes #24373

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
always set --no-link when creating angular sandboxes
yannbf committed Oct 4, 2023
commit c028ce22cd6051846a62f6443589352bbf6e32be
24 changes: 18 additions & 6 deletions scripts/tasks/sandbox.ts
Original file line number Diff line number Diff line change
@@ -25,12 +25,24 @@ export const sandbox: Task = {
return pathExists(sandboxDir);
},
async run(details, options) {
if (options.link && details.template.inDevelopment) {
logger.log(
`The ${options.template} has inDevelopment property enabled, therefore the sandbox for that template cannot be linked. Enabling --no-link mode..`
);
// eslint-disable-next-line no-param-reassign
options.link = false;
if (options.link) {
if (details.template.expected.framework === '@storybook/angular') {
// In Angular, tsc is spawn via Webpack and for some reason it follows the symlinks and doesn’t recognize it as node_modules. Hence, it does type checking on regular files.
// Angular's tsconfig compilerOptions are more strict than the ones in the mono-repo and results in many errors, therefore we use --no-link to circumvent them.
logger.log(
`Detected an Angular sandbox, which cannot be linked. Enabling --no-link mode..`
);
// eslint-disable-next-line no-param-reassign
options.link = false;
}

if (details.template.inDevelopment) {
logger.log(
`The ${options.template} has inDevelopment property enabled, therefore the sandbox for that template cannot be linked. Enabling --no-link mode..`
);
// eslint-disable-next-line no-param-reassign
options.link = false;
}
}
if (await this.ready(details)) {
logger.info('🗑 Removing old sandbox dir');