From 32708e7dd2459154948a203cb3e77f5972afe693 Mon Sep 17 00:00:00 2001 From: Fabian Date: Wed, 14 Mar 2018 20:41:29 +1300 Subject: [PATCH] build: re-introduce build.sh BREAKING CHANGE: Tokens are now exported from @nguniversal/engineName/tokens This change fixes are regression where using these tokens in your browser app would increase the bundle size by about ~600kb. --- build.sh | 25 +++++++++++++++++++ modules/aspnetcore-engine/public-api.ts | 1 - modules/aspnetcore-engine/src/main.ts | 2 +- modules/aspnetcore-engine/{src => }/tokens.ts | 0 .../aspnetcore-engine/tsconfig.fortokens.json | 7 ++++++ modules/common/public-api.ts | 2 +- modules/express-engine/public-api.ts | 1 - modules/express-engine/src/main.ts | 2 +- modules/express-engine/{src => }/tokens.ts | 0 .../express-engine/tsconfig.fortokens.json | 7 ++++++ modules/hapi-engine/public-api.ts | 1 - modules/hapi-engine/src/main.ts | 2 +- modules/hapi-engine/{src => }/tokens.ts | 0 modules/hapi-engine/tsconfig.fortokens.json | 7 ++++++ publish.sh | 12 ++++----- 15 files changed, 56 insertions(+), 13 deletions(-) create mode 100755 build.sh rename modules/aspnetcore-engine/{src => }/tokens.ts (100%) create mode 100644 modules/aspnetcore-engine/tsconfig.fortokens.json rename modules/express-engine/{src => }/tokens.ts (100%) create mode 100644 modules/express-engine/tsconfig.fortokens.json rename modules/hapi-engine/{src => }/tokens.ts (100%) create mode 100644 modules/hapi-engine/tsconfig.fortokens.json diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..d1e5d9801 --- /dev/null +++ b/build.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -eo pipefail + +rm -rf dist + +yarn ngc -p modules/common/tsconfig.lib.json +cp modules/common/package.json dist/packages/common/package.json +cp modules/common/README.md dist/packages/common/README.md + +yarn ngc -p modules/express-engine/tsconfig.fortokens.json +cp modules/express-engine/package.json dist/packages/express-engine/package.json +cp modules/express-engine/README.md dist/packages/express-engine/README.md + +yarn ngc -p modules/aspnetcore-engine/tsconfig.fortokens.json +cp modules/aspnetcore-engine/package.json dist/packages/aspnetcore-engine/package.json +cp modules/aspnetcore-engine/README.md dist/packages/aspnetcore-engine/README.md + +yarn ngc -p modules/hapi-engine/tsconfig.fortokens.json +cp modules/hapi-engine/package.json dist/packages/hapi-engine/package.json +cp modules/hapi-engine/README.md dist/packages/hapi-engine/README.md + +yarn ngc -p modules/module-map-ngfactory-loader/tsconfig.lib.json +cp modules/module-map-ngfactory-loader/package.json dist/packages/module-map-ngfactory-loader/package.json +cp modules/module-map-ngfactory-loader/README.md dist/packages/module-map-ngfactory-loader/README.md diff --git a/modules/aspnetcore-engine/public-api.ts b/modules/aspnetcore-engine/public-api.ts index a5fda4679..c57f0d395 100644 --- a/modules/aspnetcore-engine/public-api.ts +++ b/modules/aspnetcore-engine/public-api.ts @@ -8,7 +8,6 @@ export { ngAspnetCoreEngine } from './src/main'; export { createTransferScript } from './src/create-transfer-script'; -export { REQUEST, ORIGIN_URL } from './src/tokens'; export { IEngineOptions } from './src/interfaces/engine-options'; export { IRequestParams } from './src/interfaces/request-params'; diff --git a/modules/aspnetcore-engine/src/main.ts b/modules/aspnetcore-engine/src/main.ts index 69a957f7c..bf5a7ca44 100644 --- a/modules/aspnetcore-engine/src/main.ts +++ b/modules/aspnetcore-engine/src/main.ts @@ -10,7 +10,7 @@ import { platformDynamicServer } from '@angular/platform-server'; import { DOCUMENT } from '@angular/common'; import { ResourceLoader } from '@angular/compiler'; -import { REQUEST, ORIGIN_URL } from './tokens'; +import { REQUEST, ORIGIN_URL } from '../tokens'; import { FileLoader } from './file-loader'; import { IEngineOptions } from './interfaces/engine-options'; import { IEngineRenderResult } from './interfaces/engine-render-result'; diff --git a/modules/aspnetcore-engine/src/tokens.ts b/modules/aspnetcore-engine/tokens.ts similarity index 100% rename from modules/aspnetcore-engine/src/tokens.ts rename to modules/aspnetcore-engine/tokens.ts diff --git a/modules/aspnetcore-engine/tsconfig.fortokens.json b/modules/aspnetcore-engine/tsconfig.fortokens.json new file mode 100644 index 000000000..f64a63ad3 --- /dev/null +++ b/modules/aspnetcore-engine/tsconfig.fortokens.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.lib.json", + "files": [ + "./index.ts", + "./tokens.ts" + ] +} \ No newline at end of file diff --git a/modules/common/public-api.ts b/modules/common/public-api.ts index a823b9646..8a60e560f 100644 --- a/modules/common/public-api.ts +++ b/modules/common/public-api.ts @@ -6,4 +6,4 @@ * found in the LICENSE file at https://angular.io/license */ export { TransferHttpCacheModule } from './src/transfer_http'; -export { StateTransferInitializerModule } from './src/state-transfer-initilizer/module'; +// export { StateTransferInitializerModule } from './src/state-transfer-initilizer/module'; diff --git a/modules/express-engine/public-api.ts b/modules/express-engine/public-api.ts index 677805408..8db86c009 100644 --- a/modules/express-engine/public-api.ts +++ b/modules/express-engine/public-api.ts @@ -6,4 +6,3 @@ * found in the LICENSE file at https://angular.io/license */ export { ngExpressEngine, NgSetupOptions, RenderOptions } from './src/main'; -export { RESPONSE, REQUEST } from './src/tokens'; diff --git a/modules/express-engine/src/main.ts b/modules/express-engine/src/main.ts index 6221e8861..386a52f4e 100644 --- a/modules/express-engine/src/main.ts +++ b/modules/express-engine/src/main.ts @@ -17,7 +17,7 @@ import { } from '@angular/platform-server'; import { FileLoader } from './file-loader'; -import { REQUEST, RESPONSE } from './tokens'; +import { REQUEST, RESPONSE } from '../tokens'; /** * These are the allowed options for the engine diff --git a/modules/express-engine/src/tokens.ts b/modules/express-engine/tokens.ts similarity index 100% rename from modules/express-engine/src/tokens.ts rename to modules/express-engine/tokens.ts diff --git a/modules/express-engine/tsconfig.fortokens.json b/modules/express-engine/tsconfig.fortokens.json new file mode 100644 index 000000000..f64a63ad3 --- /dev/null +++ b/modules/express-engine/tsconfig.fortokens.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.lib.json", + "files": [ + "./index.ts", + "./tokens.ts" + ] +} \ No newline at end of file diff --git a/modules/hapi-engine/public-api.ts b/modules/hapi-engine/public-api.ts index 160c7944e..caad762fc 100644 --- a/modules/hapi-engine/public-api.ts +++ b/modules/hapi-engine/public-api.ts @@ -6,4 +6,3 @@ * found in the LICENSE file at https://angular.io/license */ export { ngHapiEngine, NgSetupOptions, RenderOptions } from './src/main'; -export { RESPONSE, REQUEST } from './src/tokens'; diff --git a/modules/hapi-engine/src/main.ts b/modules/hapi-engine/src/main.ts index 9733b2784..d489b923c 100644 --- a/modules/hapi-engine/src/main.ts +++ b/modules/hapi-engine/src/main.ts @@ -17,7 +17,7 @@ import { } from '@angular/platform-server'; import { FileLoader } from './file-loader'; -import { REQUEST, RESPONSE } from './tokens'; +import { REQUEST, RESPONSE } from '../tokens'; /** * These are the allowed options for the engine diff --git a/modules/hapi-engine/src/tokens.ts b/modules/hapi-engine/tokens.ts similarity index 100% rename from modules/hapi-engine/src/tokens.ts rename to modules/hapi-engine/tokens.ts diff --git a/modules/hapi-engine/tsconfig.fortokens.json b/modules/hapi-engine/tsconfig.fortokens.json new file mode 100644 index 000000000..f64a63ad3 --- /dev/null +++ b/modules/hapi-engine/tsconfig.fortokens.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.lib.json", + "files": [ + "./index.ts", + "./tokens.ts" + ] +} \ No newline at end of file diff --git a/publish.sh b/publish.sh index b133154fa..e97d2c2f4 100755 --- a/publish.sh +++ b/publish.sh @@ -2,11 +2,11 @@ set -x -npm run build +./build.sh -npm publish --access public dist/releases/common -npm publish --access public dist/releases/express-engine -npm publish --access public dist/releases/aspnetcore-engine -npm publish --access public dist/releases/module-map-ngfactory-loader -npm publish --access public dist/releases/hapi-engine +npm publish --access public dist/packages/common +npm publish --access public dist/packages/express-engine +npm publish --access public dist/packages/aspnetcore-engine +npm publish --access public dist/packages/module-map-ngfactory-loader +npm publish --access public dist/packages/hapi-engine