From 2eef3866fdcbfb916bb7b20c99ea851f002ecbe8 Mon Sep 17 00:00:00 2001 From: Jeremy Smartt Date: Thu, 1 Mar 2018 09:31:07 -0800 Subject: [PATCH] feat(ng-packagr): Add Support for ng-packagr #27 --- package.json | 3 ++- scripts/build-release | 34 ++------------------------ src/platform/code-editor/index.ts | 3 +-- src/platform/code-editor/ng-package.js | 3 +++ src/platform/code-editor/package.json | 2 +- src/platform/code-editor/public-api.ts | 2 ++ src/platform/code-editor/tsconfig.json | 16 ++++++++++++ src/platform/ng-package-common.js | 9 +++++++ tsconfig.json | 3 +++ 9 files changed, 39 insertions(+), 36 deletions(-) create mode 100644 src/platform/code-editor/ng-package.js create mode 100644 src/platform/code-editor/public-api.ts create mode 100644 src/platform/code-editor/tsconfig.json create mode 100644 src/platform/ng-package-common.js diff --git a/package.json b/package.json index 6aeefe6487..ab8f4ae1d1 100644 --- a/package.json +++ b/package.json @@ -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": [ @@ -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", diff --git a/scripts/build-release b/scripts/build-release index d8f40f57c4..ad309dc3e4 100644 --- a/scripts/build-release +++ b/scripts/build-release @@ -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..." diff --git a/src/platform/code-editor/index.ts b/src/platform/code-editor/index.ts index 0041cf1de1..7e1a213e3e 100644 --- a/src/platform/code-editor/index.ts +++ b/src/platform/code-editor/index.ts @@ -1,2 +1 @@ -export { TdCodeEditorComponent } from './code-editor.component'; -export { CovalentCodeEditorModule } from './code-editor.module'; +export * from './public-api'; diff --git a/src/platform/code-editor/ng-package.js b/src/platform/code-editor/ng-package.js new file mode 100644 index 0000000000..2ac194c640 --- /dev/null +++ b/src/platform/code-editor/ng-package.js @@ -0,0 +1,3 @@ +let ngPackageSettings = require('../ng-package-common.js'); +ngPackageSettings["dest"] = "../../../deploy/platform/code-editor" +module.exports = ngPackageSettings; diff --git a/src/platform/code-editor/package.json b/src/platform/code-editor/package.json index 4818e6809d..aea6041ec8 100644 --- a/src/platform/code-editor/package.json +++ b/src/platform/code-editor/package.json @@ -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", diff --git a/src/platform/code-editor/public-api.ts b/src/platform/code-editor/public-api.ts new file mode 100644 index 0000000000..0041cf1de1 --- /dev/null +++ b/src/platform/code-editor/public-api.ts @@ -0,0 +1,2 @@ +export { TdCodeEditorComponent } from './code-editor.component'; +export { CovalentCodeEditorModule } from './code-editor.module'; diff --git a/src/platform/code-editor/tsconfig.json b/src/platform/code-editor/tsconfig.json new file mode 100644 index 0000000000..be8b3c5e1e --- /dev/null +++ b/src/platform/code-editor/tsconfig.json @@ -0,0 +1,16 @@ +// Configuration for IDEs only. +{ + "extends": "../../tsconfig.app.json", + "compilerOptions": { + "rootDir": ".", + "baseUrl": ".", + "paths": { + "@covalent/code-editor/*": [ + "./*" + ] + } + }, + "include": [ + "./**/*.ts" + ] +} \ No newline at end of file diff --git a/src/platform/ng-package-common.js b/src/platform/ng-package-common.js new file mode 100644 index 0000000000..f2d85913bc --- /dev/null +++ b/src/platform/ng-package-common.js @@ -0,0 +1,9 @@ +module.exports = +{ + "lib": { + "entryFile": "index.ts", + "umdModuleIds": { + "@covalent/code-editor": "covalent.code-editor" + } + } +}; \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 6ccf47d48c..2ad4838606 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -15,6 +15,9 @@ "typeRoots": [ "../node_modules/@types" ], + "paths": { + "@covalent/code-editor/*": ["./platform/code-editor/*"] + }, "noUnusedParameters": false, "noUnusedLocals": false, "allowUnreachableCode": false,