Skip to content

Commit

Permalink
always set --no-link when creating angular sandboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Oct 4, 2023
1 parent 109eb20 commit c028ce2
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 c028ce2

Please sign in to comment.