From a5aad22a300a221c7fc2014334eea96afab6828c Mon Sep 17 00:00:00 2001 From: Jeff Cross Date: Tue, 18 Jul 2017 15:07:26 -0700 Subject: [PATCH] fix(effects): make correct export path for testing module (#96) Closes #94 --- build/tasks.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/build/tasks.ts b/build/tasks.ts index 870906e685..927e2ca709 100644 --- a/build/tasks.ts +++ b/build/tasks.ts @@ -27,7 +27,20 @@ export async function compilePackagesWithNgc(config: Config) { async function _compilePackagesWithNgc(pkg: string) { await util.exec('ngc', [`-p ./modules/${pkg}/tsconfig-build.json`]); - const entryTypeDefinition = `export * from './${pkg}/index';`; + /** + * Test modules are treated differently because nested inside top-level. + * This step removes the top-level package from testing modules from the + * export statement. + * Also changes the module name from 'index' to 'testing' + * i.e. export * from './effects/testing/index' becomes './testing/testing'; + * + * See https://github.com/ngrx/platform/issues/94 + */ + let [exportPath, moduleName] = /\/testing$/.test(pkg) + ? [pkg.replace(/(.*\/)testing/i, 'testing'), 'testing'] + : [pkg, 'index']; + + const entryTypeDefinition = `export * from './${exportPath}/${moduleName}';`; const entryMetadata = `{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./${pkg}/index"}]}`; await Promise.all([