forked from Teradata/covalent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): change to Covalent Angular package format build w/ ng-packagr (…
…Teradata#1065) * feat(): cherry-pick over inital ssr research/solution to new clean branch last 2 branches were outdated and getting too dirty * feat(): mod paging, virtual scroll, notifications to follow ng-packagr consumption style to produce respective angular package format v5 * feat(): push yarn.lock update * feat(): ng-packagr mod for @covalent/common and resove new file paths breaking npm run serve * feat(): common folder setup for Angular Package Format and cleaned up scripts used for building @covalent/core and testing ssr * fix(): forgot to save merge conflict resolution * refactor(): remove outdated custom build config * refactor(): remove package-lock.json * feat(): enable imports from secondary entry points For paging, virtual-scroll, notifications, and common. Example for paging: import { CovalentPagingModule } from '@covalent/core'; import { CovalentPagingModule } from '@covalent/core/paging'; ... * fix(): linting issue * fix(): breaking test because of import location * feat(): Angular package format build for /messages with /common ng-packangr hack work around * feat(): mod build path to be deploy/platform instead of dist/ * feat(): fix linting issue * fix(): remove message export from message.module and update common public_api * feat(): ng-packagr setup for chips * feat(): ng-packagr setup for data-table * fix(): forgot to export chips in platform/index * feat(): ng-packagr setup for dialogs * fix(): export dialogs from core public-api * feat(): ng-packagr setup for expansion-panel * feat(): ng-packagr setup for file * feat(): ng-packagr setup for json-formatter * fix(): breaking test because of filepath * feat(): ng-packagr setup for layout * feat(): ng-packagr setup for loading * feat(): ng-packagr setup for media * feat(): ng-packagr setup for menu * feat(): ng-packagr setup for search * ng-packagr setup for steps * feat(): clean up post ng-packagr conversion for /core * feat(): move and build required files that ng-packagr doesn't handle * fix(): breaking testing because of file path * feat(): ng-packagr setup for primary entrypoint: dynamic-forms * feat(): ng-packagr setup for primary entrypoint: highlight * feat(): ng-packagr setup for primary entrypoint: http * feat(): ng-packagr setup for primary entrypoint: markdown * feat(): updated ng-packangr to 2.0.0-rc.0 * fix(): double exporting * feat(): upgrade ng-packagr to 2.0.0-rc-6 * feat(): upgrade ng-packagr to 2.0.0-rc-7 and consolidated ng-package settings * fix(): change ng-packagr.json to ng-packagr.js for last ng-packagr update * feat(): upgrade ng-packagr to 2.0.0-rc-8 * feat(): upgrade ng-packagr to 2.0.0-rc-10 * refactor(): clean up + consolidate code/scripts * refactor(): additional clean up * fix(): linting issues * chore(): delete unneeded tsconfig-aot.json * chore(): set -e in build scripts to stop script if it fails * chore(): ignore failure if .tgz pack is not there * fix(): test run different sed command based on platform * refactor(): remove platform echo test
- Loading branch information
1 parent
8e18beb
commit 24b29d3
Showing
147 changed files
with
2,188 additions
and
1,733 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
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 |
---|---|---|
@@ -1,33 +1,98 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
set -o errexit | ||
################### | ||
# START: BUILD @covalent/core primary and secondary entrypoints | ||
################### | ||
|
||
# Clear deploy/ so that we guarantee there are no stale artifacts. | ||
echo "Cleaning deploy/" | ||
# HACK START - common | ||
# (Remove in future): used to resolve ng-packagr current lack of support for Intra-package dependencies between entry points && ability to override tsconfig: | ||
# this hack builds common using ng-packagr to generate @covalent/core/common and puts it into the projects root 'node_modules' | ||
# https://github.com/dherges/ng-packagr/issues/379 && https://github.com/dherges/ng-packagr/issues/256 | ||
# Reason for hack: we need these missing features because we use '/common' between multiple entry points both primary and secondary | ||
# and ng-packagr currently doesn't support it. So for now we are going to create/build the package that contains | ||
# @covalent/core/common just by itself, we will then copy the generated './deploy/platform' that was generated into | ||
# our projects root './node_modules' and then in the respective modules/components under /core we will replaces '../common/*' | ||
# with '@covalent/core/common'. Now when we run ng-packagr on the whole /core suit when it see's '@covalent/core/common' it will | ||
# take it from our root's './node_modules' instead of trying to find its intra-package dependency '../common' like before (which is | ||
# not there because of ng-packagr build alogrithm changing the filepath). So this hack resolve | ||
# the issue for ng-packagr but it bring up an issue when trying to serve the app with 'npm run serve' | ||
# we also had to add inside the roots tsconfig.json a new path for the core's secondary entrypoints '"@covalent/core/*": ["./platform/core/*"],' | ||
# because we are not using a relative path anymore '../common'. | ||
|
||
# clean up first if building again | ||
rm -rf ./node_modules/@covalent/core | ||
rm -rf ./src/platform/node_modules | ||
rm -rf ./deploy | ||
rm -rf ./src/platform/.td_build_common | ||
|
||
echo 'Creating @covalent/core/common secondary entrypoint hack' | ||
cd ./src/platform | ||
mkdir .td_build_common | ||
# move files to build only '@covalent/core/common' into its own build station to not cause other secondary entry points to build | ||
cp -r ./core/common .td_build_common/ | ||
cp ./core/ng-package.js .td_build_common/ | ||
cp ./core/index.ts .td_build_common/ | ||
cd .td_build_common | ||
|
||
# create necessary files for building @covalent/core/common | ||
echo '{ "name": "@covalent/core" }' > package.json | ||
echo "export * from './common';" > public-api.ts | ||
echo "export * from './public-api';" > index.ts | ||
|
||
# regex replace as needed for specific build of @covalent/core/common | ||
if [ "$(uname)" == "Darwin" ]; then | ||
# Do under Mac OS X platform | ||
sed -i '' 's/..\/..\/..\/deploy\/platform/.\/deploy\/platform/' ng-package.js | ||
else | ||
sed -i 's/..\/..\/..\/deploy\/platform/.\/deploy\/platform/' ng-package.js | ||
fi | ||
|
||
../../../node_modules/.bin/ng-packagr -p ng-package.js | ||
|
||
# move completed build over to root node_modules as @covalent/core/* | ||
cp -r ./deploy/platform/core ../../../node_modules/@covalent/ | ||
|
||
# kill build station don't need it anymore | ||
rm -rf ../.td_build_common | ||
cd ../../.. | ||
echo 'Completed @covalent/core/common secondary entrypoint hack' | ||
# HACK END - common | ||
|
||
# Steps to package '@covalent/core' and it's children '@covalent/core/*' | ||
echo 'Creating @covalent/core @covalent/core/* build' | ||
./node_modules/.bin/ng-packagr -p src/platform/core/ng-package.js | ||
# move over additional required files manually that ng-packagr doesn't do automatically | ||
echo 'Compiling and moving moving some requried files not handled by ng-packagr files' | ||
gulp move-required-core-files | ||
gulp compile-core-sass | ||
echo 'Completed compiling and moving moving some requried files not handled by ng-packagr files' | ||
|
||
# Perform a build. | ||
gulp build | ||
echo "SASS compiled..." | ||
# HACK (Remove in future): remove remnants of @covalent/core/common see script/ng-packagr-common for details | ||
rm -rf ./node_modules/@covalent/core | ||
echo 'Completed @covalent/core @covalent/core/* build' | ||
|
||
# Prepare for aot | ||
gulp prepare-aot | ||
echo "Preparing files for AoT build" | ||
################### | ||
# END: BUILD @covalent/core primary and secondary entrypoints | ||
################### | ||
|
||
# AoT compilation | ||
npm run aot | ||
echo "Compiled TS and generated *.metadata.json files..." | ||
|
||
# Clean source .ts files | ||
cd deploy/ | ||
find . -name "*.ts" ! -name "*.d.ts" -type f -delete | ||
cd .. | ||
echo "Remove source .ts files so they arent published" | ||
# HACK (Remove in future): used to resolve ng-packagr current lack of support for Intra-package dependencies between entry points && ability to override tsconfig: | ||
# HACK START | ||
mkdir -p src/platform/node_modules/@covalent | ||
cp -r deploy/platform/core src/platform/node_modules/@covalent | ||
# HACK END | ||
|
||
# Inline the css and html into the component files. | ||
gulp inline-resource-files | ||
echo "Resources inlined..." | ||
# BUILD: @covalent/dynamic-forms primary entrypoint | ||
./node_modules/.bin/ng-packagr -p src/platform/dynamic-forms/ng-package.js | ||
# BUILD: @covalent/highlight primary entrypoint | ||
./node_modules/.bin/ng-packagr -p src/platform/highlight/ng-package.js | ||
# BUILD: @covalent/http primary entrypoint | ||
./node_modules/.bin/ng-packagr -p src/platform/http/ng-package.js | ||
# BUILD: @covalent/markdown primary entrypoint | ||
./node_modules/.bin/ng-packagr -p src/platform/markdown/ng-package.js | ||
|
||
# Bundle | ||
gulp rollup-code | ||
echo "Bundled..." | ||
# HACK (Remove in future): remove remnants of platform/node_modules was used for building purposes | ||
rm -rf src/platform/node_modules | ||
# Need to move required file after ng-packagr runs because ng-packagr overrides primary entrypoint folders | ||
gulp move-additional-platform-files |
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,24 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# build and test ssr in universal app | ||
npm run build:release | ||
rm -rf .td_test_universal | ||
rm -f deploy/platform/core/covalent-core-*.tgz | ||
|
||
cd deploy/platform/core | ||
npm pack | ||
cd ../../.. | ||
|
||
cp -r src/universal-app .td_test_universal | ||
cd .td_test_universal | ||
npm install | ||
npm install ../deploy/platform/core/covalent-core-*.tgz | ||
../node_modules/.bin/ngc -p tsconfig-battle-zone.json | ||
../node_modules/.bin/tsc -p tsconfig-battle-royale.json | ||
|
||
node battle-royale.js | ||
|
||
cd .. | ||
rm -rf .td_test_universal | ||
rm deploy/platform/core/covalent-core-*.tgz |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.