Skip to content

Commit

Permalink
feat(ng-packagr): Add Support for ng-packagr #27
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremysmartt authored and kyleledbetter committed Mar 1, 2018
1 parent ee925ce commit 2eef386
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 36 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@covalent/code-editor",
"version": "1.0.0-rc.1",
"version": "1.0.0",
"private": false,
"description": "Teradata Text and Code Editor built on Covalent and Angular Material",
"keywords": [
Expand Down Expand Up @@ -97,6 +97,7 @@
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"merge2": "1.0.2",
"ng-packagr": "2.0.0",
"node-sass": "3.8.0",
"protractor": "~5.1.0",
"require-dir": "0.3.2",
Expand Down
34 changes: 2 additions & 32 deletions scripts/build-release
Original file line number Diff line number Diff line change
@@ -1,41 +1,11 @@
#!/bin/bash

set -o errexit

# Clear deploy/ so that we guarantee there are no stale artifacts.
echo "Cleaning deploy/"
echo 'Clean up'
rm -rf ./deploy

# Perform a build.
gulp build
echo "SASS compiled..."

# Prepare for aot
gulp prepare-aot
echo "Preparing files for AoT build"

# AoT compilation
npm run aot
echo "Compiled TS and generated *.metadata.json files..."

# copy README.md into deploy
cp -rf README.md deploy/platform/code-editor/
./node_modules/.bin/ng-packagr -p ./src/platform/code-editor/ng-package.js

# copy Monaco
mkdir deploy/platform/code-editor/assets
mkdir deploy/platform/code-editor/assets/monaco
cp -rf node_modules/monaco-editor/min/* deploy/platform/code-editor/assets/monaco/

# 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"

# Inline the css and html into the component files.
gulp inline-resource-files
echo "Resources inlined..."

# Bundle
gulp rollup-code
echo "Bundled..."
3 changes: 1 addition & 2 deletions src/platform/code-editor/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { TdCodeEditorComponent } from './code-editor.component';
export { CovalentCodeEditorModule } from './code-editor.module';
export * from './public-api';
3 changes: 3 additions & 0 deletions src/platform/code-editor/ng-package.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let ngPackageSettings = require('../ng-package-common.js');
ngPackageSettings["dest"] = "../../../deploy/platform/code-editor"
module.exports = ngPackageSettings;
2 changes: 1 addition & 1 deletion src/platform/code-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@covalent/code-editor",
"version": "1.0.0-rc.1",
"version": "1.0.0",
"private": false,
"description": "Teradata Text and Code Editor built on Covalent and Angular Material",
"main": "./code-editor.umd.js",
Expand Down
2 changes: 2 additions & 0 deletions src/platform/code-editor/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { TdCodeEditorComponent } from './code-editor.component';
export { CovalentCodeEditorModule } from './code-editor.module';
16 changes: 16 additions & 0 deletions src/platform/code-editor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Configuration for IDEs only.
{
"extends": "../../tsconfig.app.json",
"compilerOptions": {
"rootDir": ".",
"baseUrl": ".",
"paths": {
"@covalent/code-editor/*": [
"./*"
]
}
},
"include": [
"./**/*.ts"
]
}
9 changes: 9 additions & 0 deletions src/platform/ng-package-common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports =
{
"lib": {
"entryFile": "index.ts",
"umdModuleIds": {
"@covalent/code-editor": "covalent.code-editor"
}
}
};
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"typeRoots": [
"../node_modules/@types"
],
"paths": {
"@covalent/code-editor/*": ["./platform/code-editor/*"]
},
"noUnusedParameters": false,
"noUnusedLocals": false,
"allowUnreachableCode": false,
Expand Down

0 comments on commit 2eef386

Please sign in to comment.