Skip to content

Commit

Permalink
Merge pull request #24373 from storybookjs/yann/no-link-angular
Browse files Browse the repository at this point in the history
Build: Always set `--no-link` when creating angular sandboxes
  • Loading branch information
valentinpalkovic authored Oct 5, 2023
2 parents abe0d61 + c028ce2 commit f0a10f7
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions scripts/tasks/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit f0a10f7

Please sign in to comment.