@@ -56,14 +56,14 @@ describe('EntryPoint Schematic', () => {
5656
5757 expect ( tree . files ) . toEqual (
5858 jasmine . arrayContaining ( [
59- '/projects/foo/src/ secondary/public-api.ts' ,
60- '/projects/foo/src/ secondary/lib /secondary.ts' ,
61- '/projects/foo/src/ secondary/lib /secondary.spec.ts' ,
59+ '/projects/foo/secondary/src /public-api.ts' ,
60+ '/projects/foo/secondary/src /secondary.ts' ,
61+ '/projects/foo/secondary/src /secondary.spec.ts' ,
6262 ] ) ,
6363 ) ;
6464
65- const publicApiContent = tree . readContent ( '/projects/foo/src/ secondary/public-api.ts' ) ;
66- expect ( publicApiContent ) . toContain ( "export * from './lib/ secondary';" ) ;
65+ const publicApiContent = tree . readContent ( '/projects/foo/secondary/src /public-api.ts' ) ;
66+ expect ( publicApiContent ) . toContain ( "export * from './secondary';" ) ;
6767 expect ( publicApiContent ) . not . toContain ( 'secondary-module' ) ;
6868 } ) ;
6969
@@ -79,14 +79,14 @@ describe('EntryPoint Schematic', () => {
7979
8080 expect ( tree . files ) . toEqual (
8181 jasmine . arrayContaining ( [
82- '/projects/foo/src/ feature/sub/public-api.ts' ,
83- '/projects/foo/src/ feature/sub/lib /sub.ts' ,
84- '/projects/foo/src/ feature/sub/lib /sub.spec.ts' ,
82+ '/projects/foo/feature/sub/src /public-api.ts' ,
83+ '/projects/foo/feature/sub/src /sub.ts' ,
84+ '/projects/foo/feature/sub/src /sub.spec.ts' ,
8585 ] ) ,
8686 ) ;
8787
8888 const pkgJson = getJsonFileContent ( tree , '/projects/foo/package.json' ) ;
89- expect ( pkgJson . exports [ './feature/sub' ] ) . toBe ( './src/ feature/sub/public-api.ts' ) ;
89+ expect ( pkgJson . exports [ './feature/sub' ] ) . toBe ( './feature/sub/src /public-api.ts' ) ;
9090
9191 const tsConfigJson = getJsonFileContent ( tree , '/tsconfig.json' ) ;
9292 expect ( tsConfigJson . compilerOptions . paths [ 'foo/*' ] ) . toEqual ( [ './dist/foo/*' ] ) ;
@@ -102,9 +102,9 @@ describe('EntryPoint Schematic', () => {
102102 workspaceTree ,
103103 ) ;
104104
105- expect ( tree . files ) . toContain ( '/projects/foo/src/ secondary/my-entry.ts' ) ;
105+ expect ( tree . files ) . toContain ( '/projects/foo/secondary/src /my-entry.ts' ) ;
106106 const pkgJson = getJsonFileContent ( tree , '/projects/foo/package.json' ) ;
107- expect ( pkgJson . exports [ './secondary' ] ) . toBe ( './src/ secondary/my-entry.ts' ) ;
107+ expect ( pkgJson . exports [ './secondary' ] ) . toBe ( './secondary/src /my-entry.ts' ) ;
108108 } ) ;
109109
110110 it ( 'should strip .ts suffix from entryFile option' , async ( ) => {
@@ -117,10 +117,10 @@ describe('EntryPoint Schematic', () => {
117117 workspaceTree ,
118118 ) ;
119119
120- expect ( tree . files ) . toContain ( '/projects/foo/src/ secondary/my-entry.ts' ) ;
121- expect ( tree . files ) . not . toContain ( '/projects/foo/src/ secondary/my-entry.ts.ts' ) ;
120+ expect ( tree . files ) . toContain ( '/projects/foo/secondary/src /my-entry.ts' ) ;
121+ expect ( tree . files ) . not . toContain ( '/projects/foo/secondary/src /my-entry.ts.ts' ) ;
122122 const pkgJson = getJsonFileContent ( tree , '/projects/foo/package.json' ) ;
123- expect ( pkgJson . exports [ './secondary' ] ) . toBe ( './src/ secondary/my-entry.ts' ) ;
123+ expect ( pkgJson . exports [ './secondary' ] ) . toBe ( './secondary/src /my-entry.ts' ) ;
124124 } ) ;
125125
126126 it ( 'should update library package.json exports' , async ( ) => {
@@ -129,7 +129,7 @@ describe('EntryPoint Schematic', () => {
129129 const pkgJson = getJsonFileContent ( tree , '/projects/foo/package.json' ) ;
130130 expect ( pkgJson . exports ) . toEqual ( {
131131 '.' : './src/public-api.ts' ,
132- './secondary' : './src/ secondary/public-api.ts' ,
132+ './secondary' : './secondary/src /public-api.ts' ,
133133 } ) ;
134134 expect ( Object . keys ( pkgJson ) [ 0 ] ) . toBe ( 'name' ) ;
135135 } ) ;
@@ -144,7 +144,7 @@ describe('EntryPoint Schematic', () => {
144144 const updatedPkgJson = getJsonFileContent ( tree , '/projects/foo/package.json' ) ;
145145 expect ( updatedPkgJson . exports ) . toEqual ( {
146146 '.' : './src/public-api.ts' ,
147- './secondary' : './src/ secondary/public-api.ts' ,
147+ './secondary' : './secondary/src /public-api.ts' ,
148148 } ) ;
149149 } ) ;
150150
@@ -158,7 +158,7 @@ describe('EntryPoint Schematic', () => {
158158 const updatedPkgJson = getJsonFileContent ( tree , '/projects/foo/package.json' ) ;
159159 expect ( updatedPkgJson . exports ) . toEqual ( {
160160 '.' : [ './src/public-api.ts' ] ,
161- './secondary' : './src/ secondary/public-api.ts' ,
161+ './secondary' : './secondary/src /public-api.ts' ,
162162 } ) ;
163163 } ) ;
164164
@@ -172,7 +172,7 @@ describe('EntryPoint Schematic', () => {
172172 const updatedPkgJson = getJsonFileContent ( tree , '/projects/foo/package.json' ) ;
173173 expect ( updatedPkgJson . exports ) . toEqual ( {
174174 '.' : { default : './src/public-api.ts' } ,
175- './secondary' : './src/ secondary/public-api.ts' ,
175+ './secondary' : './secondary/src /public-api.ts' ,
176176 } ) ;
177177 } ) ;
178178
@@ -206,25 +206,6 @@ describe('EntryPoint Schematic', () => {
206206 expect ( tsConfigJson . compilerOptions . paths [ 'foo/*' ] ) . toEqual ( [ './custom-dist/foo/*' ] ) ;
207207 } ) ;
208208
209- it ( 'should respect custom sourceRoot in angular.json' , async ( ) => {
210- const angularJson = getJsonFileContent ( workspaceTree , '/angular.json' ) ;
211- angularJson . projects . foo . sourceRoot = 'projects/foo/custom-src' ;
212- workspaceTree . overwrite ( '/angular.json' , JSON . stringify ( angularJson , null , 2 ) ) ;
213-
214- const tree = await schematicRunner . runSchematic ( 'entry-point' , defaultOptions , workspaceTree ) ;
215-
216- expect ( tree . files ) . toEqual (
217- jasmine . arrayContaining ( [
218- '/projects/foo/custom-src/secondary/public-api.ts' ,
219- '/projects/foo/custom-src/secondary/lib/secondary.ts' ,
220- '/projects/foo/custom-src/secondary/lib/secondary.spec.ts' ,
221- ] ) ,
222- ) ;
223-
224- const pkgJson = getJsonFileContent ( tree , '/projects/foo/package.json' ) ;
225- expect ( pkgJson . exports [ './secondary' ] ) . toBe ( './custom-src/secondary/public-api.ts' ) ;
226- } ) ;
227-
228209 it ( 'should not modify root tsconfig.json when skipTsConfig is true' , async ( ) => {
229210 const tree = await schematicRunner . runSchematic (
230211 'entry-point' ,
@@ -259,9 +240,7 @@ describe('EntryPoint Schematic', () => {
259240 tree ,
260241 ) ;
261242
262- const componentContent = tree . readContent (
263- '/projects/prefixed-lib/src/secondary/lib/secondary.ts' ,
264- ) ;
243+ const componentContent = tree . readContent ( '/projects/prefixed-lib/secondary/src/secondary.ts' ) ;
265244 expect ( componentContent ) . toContain ( "selector: 'custom-secondary'" ) ;
266245 } ) ;
267246
@@ -272,7 +251,7 @@ describe('EntryPoint Schematic', () => {
272251
273252 const tree = await schematicRunner . runSchematic ( 'entry-point' , defaultOptions , workspaceTree ) ;
274253
275- const componentContent = tree . readContent ( '/projects/foo/src/ secondary/lib /secondary.ts' ) ;
254+ const componentContent = tree . readContent ( '/projects/foo/secondary/src /secondary.ts' ) ;
276255 expect ( componentContent ) . toContain ( "selector: 'lib-secondary'" ) ;
277256 } ) ;
278257
@@ -286,7 +265,7 @@ describe('EntryPoint Schematic', () => {
286265 workspaceTree ,
287266 ) ;
288267
289- const componentContent = tree . readContent ( '/projects/foo/src/ secondary/lib /secondary.ts' ) ;
268+ const componentContent = tree . readContent ( '/projects/foo/secondary/src /secondary.ts' ) ;
290269 expect ( componentContent ) . toContain ( "selector: 'override-secondary'" ) ;
291270 } ) ;
292271
@@ -311,16 +290,16 @@ describe('EntryPoint Schematic', () => {
311290
312291 expect ( tree . files ) . toEqual (
313292 jasmine . arrayContaining ( [
314- '/projects/my-scope/my-lib/src/ secondary/public-api.ts' ,
315- '/projects/my-scope/my-lib/src/ secondary/lib /secondary.ts' ,
316- '/projects/my-scope/my-lib/src/ secondary/lib /secondary.spec.ts' ,
293+ '/projects/my-scope/my-lib/secondary/src /public-api.ts' ,
294+ '/projects/my-scope/my-lib/secondary/src /secondary.ts' ,
295+ '/projects/my-scope/my-lib/secondary/src /secondary.spec.ts' ,
317296 ] ) ,
318297 ) ;
319298
320299 const pkgJson = getJsonFileContent ( tree , '/projects/my-scope/my-lib/package.json' ) ;
321300 expect ( pkgJson . exports ) . toEqual ( {
322301 '.' : './src/public-api.ts' ,
323- './secondary' : './src/ secondary/public-api.ts' ,
302+ './secondary' : './secondary/src /public-api.ts' ,
324303 } ) ;
325304
326305 const tsConfigJson = getJsonFileContent ( tree , '/tsconfig.json' ) ;
@@ -339,8 +318,8 @@ describe('EntryPoint Schematic', () => {
339318 workspaceTree ,
340319 ) ;
341320
342- expect ( tree . files ) . toContain ( '/projects/foo/src/ secondary/lib /secondary.ts' ) ;
343- expect ( tree . files ) . not . toContain ( '/projects/foo/src/ secondary/lib /secondary.spec.ts' ) ;
321+ expect ( tree . files ) . toContain ( '/projects/foo/secondary/src /secondary.ts' ) ;
322+ expect ( tree . files ) . not . toContain ( '/projects/foo/secondary/src /secondary.spec.ts' ) ;
344323 } ) ;
345324
346325 it ( 'should not be affected by workspace component schematic type and exportDefault defaults' , async ( ) => {
@@ -355,8 +334,8 @@ describe('EntryPoint Schematic', () => {
355334
356335 const tree = await schematicRunner . runSchematic ( 'entry-point' , defaultOptions , workspaceTree ) ;
357336
358- expect ( tree . files ) . toContain ( '/projects/foo/src/ secondary/lib /secondary.ts' ) ;
359- const componentContent = tree . readContent ( '/projects/foo/src/ secondary/lib /secondary.ts' ) ;
337+ expect ( tree . files ) . toContain ( '/projects/foo/secondary/src /secondary.ts' ) ;
338+ const componentContent = tree . readContent ( '/projects/foo/secondary/src /secondary.ts' ) ;
360339 expect ( componentContent ) . toContain ( 'export class Secondary' ) ;
361340 expect ( componentContent ) . not . toContain ( 'export default' ) ;
362341 } ) ;
@@ -374,16 +353,16 @@ describe('EntryPoint Schematic', () => {
374353
375354 expect ( tree . files ) . toEqual (
376355 jasmine . arrayContaining ( [
377- '/projects/foo/src/ secondary/public-api.ts' ,
378- '/projects/foo/src/ secondary/lib /secondary-module.ts' ,
379- '/projects/foo/src/ secondary/lib /secondary.ts' ,
380- '/projects/foo/src/ secondary/lib /secondary.spec.ts' ,
356+ '/projects/foo/secondary/src /public-api.ts' ,
357+ '/projects/foo/secondary/src /secondary-module.ts' ,
358+ '/projects/foo/secondary/src /secondary.ts' ,
359+ '/projects/foo/secondary/src /secondary.spec.ts' ,
381360 ] ) ,
382361 ) ;
383362
384- const publicApiContent = tree . readContent ( '/projects/foo/src/ secondary/public-api.ts' ) ;
385- expect ( publicApiContent ) . toContain ( "export * from './lib/ secondary';" ) ;
386- expect ( publicApiContent ) . toContain ( "export * from './lib/ secondary-module';" ) ;
363+ const publicApiContent = tree . readContent ( '/projects/foo/secondary/src /public-api.ts' ) ;
364+ expect ( publicApiContent ) . toContain ( "export * from './secondary';" ) ;
365+ expect ( publicApiContent ) . toContain ( "export * from './secondary-module';" ) ;
387366 } ) ;
388367 } ) ;
389368
@@ -451,8 +430,8 @@ describe('EntryPoint Schematic', () => {
451430 ) . toBeRejectedWithError ( 'Entry point name "package.json" is reserved.' ) ;
452431 } ) ;
453432
454- it ( 'should throw if the entry-point name is "lib" or contains a "lib" segment ' , async ( ) => {
455- for ( const invalidName of [ 'lib ' , 'lib/sub' , 'feature/lib' , 'feature/lib /sub'] ) {
433+ it ( 'should throw if the entry-point name conflicts with the primary source directory ' , async ( ) => {
434+ for ( const invalidName of [ 'src ' , 'src /sub' ] ) {
456435 await expectAsync (
457436 schematicRunner . runSchematic (
458437 'entry-point' ,
@@ -463,8 +442,8 @@ describe('EntryPoint Schematic', () => {
463442 workspaceTree ,
464443 ) ,
465444 ) . toBeRejectedWithError (
466- `Entry point name "${ invalidName } " cannot be "lib " or contain a "lib" segment ` +
467- 'as it conflicts with the entry point source directory.' ,
445+ `Entry point name "${ invalidName } " cannot be "src " or start with "src/" ` +
446+ 'as it conflicts with the primary entry point source directory.' ,
468447 ) ;
469448 }
470449 } ) ;
0 commit comments