-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4118 from kroeder/angular-build-time-optimization
Angular build time optimization
- Loading branch information
Showing
10 changed files
with
130 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; | ||
import { logger } from '@storybook/node-logger'; | ||
|
||
export default function(tsLoaderOptions) { | ||
if (tsLoaderOptions && tsLoaderOptions.configFile) { | ||
return new ForkTsCheckerWebpackPlugin({ | ||
tsconfig: tsLoaderOptions.configFile, | ||
}); | ||
} | ||
|
||
logger.info('=> Using default options for ForkTsCheckerWebpackPlugin'); | ||
return new ForkTsCheckerWebpackPlugin(); | ||
} |
31 changes: 31 additions & 0 deletions
31
app/angular/src/server/create-fork-ts-checker-plugin.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; | ||
import getTsLoaderOptions from './ts_config'; | ||
import createForkTsCheckerInstance from './create-fork-ts-checker-plugin'; | ||
|
||
// eslint-disable-next-line global-require | ||
jest.mock('fs', () => require('../../../../__mocks__/fs')); | ||
jest.mock('path', () => ({ | ||
resolve: () => 'tsconfig.json', | ||
})); | ||
|
||
const setupFiles = files => { | ||
// eslint-disable-next-line no-underscore-dangle, global-require | ||
require('fs').__setMockFiles(files); | ||
}; | ||
|
||
describe('create-fork-ts-checker-plugin.test', () => { | ||
it('should create a ForkTsCheckerWebpackPlugin instance', () => { | ||
setupFiles({ 'tsconfig.json': '{}' }); | ||
|
||
const tsLoaderOptions = getTsLoaderOptions('.foo'); | ||
const instance = createForkTsCheckerInstance(tsLoaderOptions); | ||
|
||
expect(instance).toBeInstanceOf(ForkTsCheckerWebpackPlugin); | ||
expect(instance.tsconfig).toEqual(tsLoaderOptions.configFile); | ||
}); | ||
|
||
it('should create a ForkTsCheckerWebpackPlugin instance without passing options', () => { | ||
const instance = createForkTsCheckerInstance({}); | ||
expect(instance).toBeInstanceOf(ForkTsCheckerWebpackPlugin); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
lib/cli/generators/ANGULAR/template/.storybook/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"exclude": [ | ||
"../src/test.ts", | ||
"../src/**/*.spec.ts", | ||
"../projects/**/*.spec.ts" | ||
], | ||
"include": [ | ||
"../src/**/*", | ||
"../projects/**/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters