Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(): change to Covalent Angular package format build w/ ng-packagr #1065

Merged
merged 56 commits into from
Jan 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
997cadc
feat(): cherry-pick over inital ssr research/solution to new clean br…
Jan 4, 2018
eecfb4d
feat(): mod paging, virtual scroll, notifications to follow ng-packag…
Jan 4, 2018
173afdf
feat(): push yarn.lock update
Jan 4, 2018
94d92c4
Merge branch 'develop' into angular-package-format-build
Jan 4, 2018
209ffe2
feat(): ng-packagr mod for @covalent/common and resove new file paths…
Jan 4, 2018
82c354d
feat(): common folder setup for Angular Package Format and cleaned up…
Jan 4, 2018
cedead7
Merge branch 'develop' into angular-package-format-build
Jan 4, 2018
f7ef9e1
fix(): forgot to save merge conflict resolution
Jan 4, 2018
4879c30
refactor(): remove outdated custom build config
Jan 4, 2018
bcf397c
refactor(): remove package-lock.json
Jan 4, 2018
4a57e1d
feat(): enable imports from secondary entry points
Jan 5, 2018
be55234
Merge branch 'develop' into angular-package-format-build
Jan 5, 2018
cebc70d
fix(): linting issue
Jan 5, 2018
0cfbec7
fix(): breaking test because of import location
Jan 5, 2018
a58ce37
feat(): Angular package format build for /messages with /common ng-pa…
Jan 9, 2018
bb608aa
feat(): mod build path to be deploy/platform instead of dist/
Jan 9, 2018
781c059
Merge branch 'develop' into angular-package-format-build
Jan 9, 2018
0f461a9
feat(): fix linting issue
Jan 9, 2018
eb5bdf3
fix(): remove message export from message.module and update common pu…
Jan 9, 2018
054a832
feat(): ng-packagr setup for chips
Jan 9, 2018
85f83e1
feat(): ng-packagr setup for data-table
Jan 9, 2018
d2e318d
fix(): forgot to export chips in platform/index
Jan 9, 2018
a6ee73b
feat(): ng-packagr setup for dialogs
Jan 9, 2018
7d397f2
fix(): export dialogs from core public-api
Jan 9, 2018
fde27ca
feat(): ng-packagr setup for expansion-panel
Jan 9, 2018
b7db4b8
feat(): ng-packagr setup for file
Jan 9, 2018
36699dd
feat(): ng-packagr setup for json-formatter
Jan 9, 2018
204470e
fix(): breaking test because of filepath
Jan 9, 2018
2a70adc
feat(): ng-packagr setup for layout
Jan 10, 2018
ec9c01f
feat(): ng-packagr setup for loading
Jan 10, 2018
b187455
feat(): ng-packagr setup for media
Jan 10, 2018
74ef3bd
feat(): ng-packagr setup for menu
Jan 10, 2018
18c66c0
feat(): ng-packagr setup for search
Jan 10, 2018
29c6380
ng-packagr setup for steps
Jan 10, 2018
30581ca
feat(): clean up post ng-packagr conversion for /core
Jan 10, 2018
3bb42e4
feat(): move and build required files that ng-packagr doesn't handle
Jan 10, 2018
6b186a7
fix(): breaking testing because of file path
Jan 10, 2018
d8e3a7b
feat(): ng-packagr setup for primary entrypoint: dynamic-forms
Jan 11, 2018
d9bc96d
feat(): ng-packagr setup for primary entrypoint: highlight
Jan 11, 2018
1421986
feat(): ng-packagr setup for primary entrypoint: http
Jan 11, 2018
84baea5
feat(): ng-packagr setup for primary entrypoint: markdown
Jan 11, 2018
4d068ed
feat(): updated ng-packangr to 2.0.0-rc.0
Jan 12, 2018
13835b8
fix(): double exporting
Jan 12, 2018
a408318
feat(): upgrade ng-packagr to 2.0.0-rc-6
Jan 12, 2018
8086b95
feat(): upgrade ng-packagr to 2.0.0-rc-7 and consolidated ng-package …
Jan 12, 2018
8db7827
fix(): change ng-packagr.json to ng-packagr.js for last ng-packagr up…
Jan 12, 2018
709b10e
feat(): upgrade ng-packagr to 2.0.0-rc-8
Jan 12, 2018
08ec515
feat(): upgrade ng-packagr to 2.0.0-rc-10
Jan 12, 2018
c461887
refactor(): clean up + consolidate code/scripts
Jan 13, 2018
2c84e4b
refactor(): additional clean up
Jan 13, 2018
cc88235
fix(): linting issues
Jan 13, 2018
d601b57
chore(): delete unneeded tsconfig-aot.json
Jan 15, 2018
8b56b75
chore(): set -e in build scripts to stop script if it fails
Jan 15, 2018
88c1c34
chore(): ignore failure if .tgz pack is not there
Jan 15, 2018
1ab6531
fix(): test run different sed command based on platform
Jan 15, 2018
f533cca
refactor(): remove platform echo test
Jan 15, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

# compiled output
/**/dist
/**/.ng_pkg_build
/**/.td_build_common
/**/.td_test_universal
/deploy
/tmp

# dependencies
/node_modules
/**/node_modules
/bower_components

# IDEs and editors
Expand Down
60 changes: 24 additions & 36 deletions build.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,30 @@ module.exports = {
'src/**/**/package.json'
],
deployed: 'deploy/platform/',
styles: [
'!src/theme.scss',
'!src/styles.scss',
'src/**/**.scss',
'!src/app/**/**.scss',
'src/**/**.css',
'!src/app/**/**.css'
PostNgPackngrBuildRequiredFiles: [
'!src/platform/core/**/*.component.scss',
'src/platform/core/**/*.scss',

'src/platform/core/**/codepoints',
'src/platform/core/**/MaterialIcons-Regular.eot',
'src/platform/core/**/MaterialIcons-Regular.ijmap',
'src/platform/core/**/MaterialIcons-Regular.ttf',
'src/platform/core/**/MaterialIcons-Regular.woff',
'src/platform/core/**/MaterialIcons-Regular.woff2',
'src/platform/core/**/*.md',
],
PostNgPackngrCompileStyles: [
'deploy/platform/core/**/material-icons.scss',
'deploy/platform/core/**/platform.scss',
'deploy/platform/core/**/theming/prebuilt/**/*.scss'
],
PostNgPackngrAdditionalFiles: [
'!src/platform/core/**/*.component.scss',
'!src/platform/core/**/*.scss',
'!src/platform/**/*.component.scss',
'src/platform/**/*.scss',
'!src/platform/core/**/*.md',
'src/platform/**/*.md',
],
requiredfiles: [
'src/**/codepoints',
'src/**/MaterialIcons-Regular.eot',
'src/**/MaterialIcons-Regular.ijmap',
'src/**/MaterialIcons-Regular.ttf',
'src/**/MaterialIcons-Regular.woff',
'src/**/MaterialIcons-Regular.woff2',
'!src/theme.scss',
'!src/styles.scss',
'src/**/**.scss',
'!src/app/**/**.scss',
'src/**/**.html',
'src/**/**.md',
'src/**/**.js',
'src/**/**.ts',
'!src/**/**.spec.ts',
'src/**/**/package.json',
'src/**/tsconfig-aot.json',
'!src/tests/**/**.ts',
'!src/app/**/**.html',
'!src/app/**/**.js',
'!src/app/**/**.ts',
'!src/environments/**/**.ts',
'!src/polyfills.ts',
'!src/main.ts',
'!src/test.ts',
'src/typings.d.ts',
'!src/index.html'
]
}
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,16 @@
"bump-patch": "gulp bump-version --ver patch",
"bump-minor": "gulp bump-version --ver minor",
"bump-major": "gulp bump-version --ver major",
"aot": "./node_modules/.bin/ngc -p deploy/platform/tsconfig-aot.json && tsc -p src/platform/tsconfig-aot.json",
"serve": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng serve",
"serve:prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng serve --aot --prod --sourcemap=false --build-optimizer",
"build:docs": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --aot --prod --sourcemap=false --build-optimizer",
"build:release": "bash scripts/build-release",
"build:universal": "bash scripts/build-universal",
"publish:npm": "npm run build:release && bash scripts/npm-publish",
"publish:nightly": "npm run build:release && bash scripts/nightly-publish",
"ghpages:deploy": "npm run build:docs -- --base-href /covalent/ && bash scripts/ghpages-deploy",
"release:start": "bash scripts/start-release",
"release:finish": "bash scripts/finish-release",
"combat-training": "bash scripts/combat-training",
"bundle-report": "npm run build:docs -- --stats-json && webpack-bundle-analyzer dist/stats.json",
"generate:changelog": "./node_modules/.bin/conventional-changelog -i docs/CHANGELOG.md -s -p angular"
},
Expand Down Expand Up @@ -127,6 +126,7 @@
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "1.0.1",
"merge2": "1.0.2",
"ng-packagr": "2.0.0-rc.10",
"node-sass": "3.8.0",
"phantomjs-prebuilt": "2.1.14",
"protractor": "~5.1.0",
Expand Down
113 changes: 89 additions & 24 deletions scripts/build-release
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
24 changes: 24 additions & 0 deletions scripts/build-universal
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
8 changes: 0 additions & 8 deletions scripts/build.js

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/clean.js

This file was deleted.

31 changes: 0 additions & 31 deletions scripts/combat-training

This file was deleted.

27 changes: 0 additions & 27 deletions scripts/compile-sass.js

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/inline-resource-files.js

This file was deleted.

Loading