This repository has been archived by the owner on Jan 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
okta-angular: Support AOT compilation (#646)
Release: [email protected]
- Loading branch information
1 parent
9ad64ad
commit 15561af
Showing
30 changed files
with
2,195 additions
and
3,204 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
typedocs | ||
dist | ||
node_modules | ||
environment.ts | ||
/node_modules | ||
/dist | ||
/documentation | ||
/coverage | ||
|
||
*.log | ||
*.tgz | ||
|
||
environment.ts |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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,95 @@ | ||
"use strict"; | ||
|
||
const shell = require('shelljs'); | ||
const chalk = require('chalk'); | ||
const fs = require('fs'); | ||
|
||
const PACKAGE = `okta-angular`; | ||
const NPM_DIR = `dist`; | ||
const ESM2015_DIR = `${NPM_DIR}/esm2015`; | ||
const ESM5_DIR = `${NPM_DIR}/esm5`; | ||
const FESM2015_DIR = `${NPM_DIR}/fesm2015`; | ||
const FESM5_DIR = `${NPM_DIR}/fesm5`; | ||
const BUNDLES_DIR = `${NPM_DIR}/bundles`; | ||
const OUT_DIR = `${NPM_DIR}/package`; | ||
const OUT_DIR_ESM5 = `${NPM_DIR}/package/esm5`; | ||
|
||
shell.echo(`Start building...`); | ||
|
||
shell.rm(`-Rf`, `${NPM_DIR}/*`); | ||
shell.mkdir(`-p`, `./${ESM2015_DIR}`); | ||
shell.mkdir(`-p`, `./${ESM5_DIR}`); | ||
shell.mkdir(`-p`, `./${FESM2015_DIR}`); | ||
shell.mkdir(`-p`, `./${FESM5_DIR}`); | ||
shell.mkdir(`-p`, `./${BUNDLES_DIR}`); | ||
shell.mkdir(`-p`, `./${OUT_DIR}`); | ||
|
||
/* TSLint with Codelyzer */ | ||
// https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts | ||
// https://github.com/mgechev/codelyzer | ||
shell.echo(`Start TSLint`); | ||
shell.exec(`tslint -p tsconfig.json -t stylish src/**/*.ts`); | ||
shell.echo(chalk.green(`TSLint completed`)); | ||
|
||
shell.cp(`-Rf`, [`src`, `*.ts`, `*.json`], `${OUT_DIR}`); | ||
|
||
/* AoT compilation */ | ||
shell.echo(`Start AoT compilation`); | ||
if (shell.exec(`ngc -p ${OUT_DIR}/tsconfig-build.json`).code !== 0) { | ||
shell.echo(chalk.red(`Error: AoT compilation failed`)); | ||
shell.exit(1); | ||
} | ||
shell.echo(chalk.green(`AoT compilation completed`)); | ||
|
||
shell.echo(`Copy ES2015 for package`); | ||
shell.cp(`-Rf`, [`${NPM_DIR}/src/`, `${NPM_DIR}/*.js`, `${NPM_DIR}/*.js.map`], `${ESM2015_DIR}`); | ||
|
||
/* BUNDLING PACKAGE */ | ||
shell.echo(`Start bundling`); | ||
shell.echo(`Rollup package`); | ||
if (shell.exec(`rollup -c rollup.es.config.js -i ${NPM_DIR}/${PACKAGE}.js -o ${FESM2015_DIR}/${PACKAGE}.js`).code !== 0) { | ||
shell.echo(chalk.red(`Error: Rollup package failed`)); | ||
shell.exit(1); | ||
} | ||
|
||
shell.echo(`Produce ESM5/FESM5 versions`); | ||
shell.exec(`ngc -p ${OUT_DIR}/tsconfig-build.json --target es5 -d false --outDir ${OUT_DIR_ESM5} --sourceMap`); | ||
shell.cp(`-Rf`, [`${OUT_DIR_ESM5}/src/`, `${OUT_DIR_ESM5}/*.js`, `${OUT_DIR_ESM5}/*.js.map`], `${ESM5_DIR}`); | ||
if (shell.exec(`rollup -c rollup.es.config.js -i ${OUT_DIR_ESM5}/${PACKAGE}.js -o ${FESM5_DIR}/${PACKAGE}.js`).code !== 0) { | ||
shell.echo(chalk.red(`Error: FESM5 version failed`)); | ||
shell.exit(1); | ||
} | ||
|
||
shell.echo(`Run Rollup conversion on package`); | ||
if (shell.exec(`rollup -c rollup.config.js -i ${FESM5_DIR}/${PACKAGE}.js -o ${BUNDLES_DIR}/${PACKAGE}.umd.js`).code !== 0) { | ||
shell.echo(chalk.red(`Error: Rollup conversion failed`)); | ||
shell.exit(1); | ||
} | ||
|
||
shell.echo(`Minifying`); | ||
shell.cd(`${BUNDLES_DIR}`); | ||
if (shell.exec(`uglifyjs ${PACKAGE}.umd.js -c --comments -o ${PACKAGE}.umd.min.js --source-map "includeSources=true,content='${PACKAGE}.umd.js.map',filename='${PACKAGE}.umd.min.js.map'"`).code !== 0) { | ||
shell.echo(chalk.red(`Error: Minifying failed`)); | ||
shell.exit(1); | ||
} | ||
shell.cd(`..`); | ||
shell.cd(`..`); | ||
|
||
shell.echo(chalk.green(`Bundling completed`)); | ||
|
||
shell.rm(`-Rf`, `${NPM_DIR}/package`); | ||
shell.rm(`-Rf`, `${NPM_DIR}/*.js`); | ||
shell.rm(`-Rf`, `${NPM_DIR}/*.js.map`); | ||
shell.rm(`-Rf`, `${NPM_DIR}/src/**/*.js`); | ||
shell.rm(`-Rf`, `${NPM_DIR}/src/**/*.js.map`); | ||
shell.rm(`-Rf`, `${ESM2015_DIR}/src/**/*.d.ts`); | ||
|
||
shell.cp(`-Rf`, [`package.json`, `LICENSE`, `README.md`], `${NPM_DIR}`); | ||
|
||
shell.echo(`Modifying final package.json`); | ||
let packageJSON = JSON.parse(fs.readFileSync(`./${NPM_DIR}/package.json`)); | ||
packageJSON.private = false; | ||
packageJSON.scripts.prepare = ''; | ||
fs.writeFileSync(`./${NPM_DIR}/package.json`, JSON.stringify(packageJSON, null, 4)); | ||
|
||
shell.echo(chalk.green(`End building`)); |
This file was deleted.
Oops, something went wrong.
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,6 @@ | ||
// This file is not used to build the module. It is only used during editing | ||
// by the TypeScript language service and during build for verification. `ngc` | ||
// replaces this file with production okta-angular.ts when it rewrites | ||
// private symbol names. | ||
|
||
export * from './public-api'; |
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,81 +1,114 @@ | ||
{ | ||
"name": "@okta/okta-angular", | ||
"version": "1.3.0", | ||
"description": "Angular support for Okta", | ||
"main": "./dist/src/index.js", | ||
"types": "./dist/src/index.d.ts", | ||
"scripts": { | ||
"build:package-info": "node ../../util/write-package-info.js . src/okta/packageInfo.ts", | ||
"lint": "ng lint", | ||
"ngc": "./node_modules/.bin/ngc -p tsconfig.json", | ||
"prepare": "yarn ngc", | ||
"prengc": "yarn build:package-info", | ||
"start": "yarn --cwd test/e2e/harness/ start", | ||
"test": "yarn lint && yarn test:e2e && yarn test:unit", | ||
"test:e2e": "yarn --cwd test/e2e/harness/ e2e", | ||
"test:unit": "jest" | ||
}, | ||
"repository": "https://github.com/okta/okta-oidc-js", | ||
"homepage": "https://github.com/okta/okta-oidc-js/tree/master/packages/okta-angular", | ||
"keywords": [ | ||
"okta", | ||
"oidc", | ||
"OpenID Connect", | ||
"authentication", | ||
"auth", | ||
"oauth2" | ||
], | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@okta/configuration-validation": "^0.4.1", | ||
"@okta/okta-auth-js": "^2.11.0" | ||
}, | ||
"devDependencies": { | ||
"@angular-devkit/build-angular": "~0.8.1", | ||
"@angular/cli": "^7.0.0", | ||
"@angular/common": "^7.0.0", | ||
"@angular/compiler": "^7.0.0", | ||
"@angular/compiler-cli": "^7.0.0", | ||
"@angular/core": "^7.0.0", | ||
"@angular/http": "^7.0.0", | ||
"@angular/platform-browser": "^7.0.0", | ||
"@angular/platform-browser-dynamic": "7.0.0", | ||
"@angular/router": "^7.0.0", | ||
"@types/jest": "^24.0.18", | ||
"@types/json-schema": "^7.0.3", | ||
"@types/minimatch": "^3.0.3", | ||
"core-js": "^2.4.1", | ||
"jest": "^24.9.0", | ||
"jest-preset-angular": "^7.1.1", | ||
"rxjs": "^6.2.1", | ||
"tslint": "~5.5.0", | ||
"typescript": "~3.1.6", | ||
"zone.js": "^0.8.14" | ||
}, | ||
"peerDependencies": { | ||
"@angular/common": ">=4", | ||
"@angular/core": ">=4", | ||
"@angular/platform-browser": ">=4", | ||
"@angular/router": ">=4", | ||
"rxjs": ">=5.4.3" | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.(ts|html)$": "ts-jest" | ||
"name": "@okta/okta-angular", | ||
"private": true, | ||
"version": "1.3.1", | ||
"description": "Angular support for Okta", | ||
"main": "./bundles/okta-angular.umd.js", | ||
"module": "./fesm5/okta-angular.js", | ||
"es2015": "./fesm2015/okta-angular.js", | ||
"esm5": "./esm5/okta-angular.js", | ||
"esm2015": "./esm2015/okta-angular.js", | ||
"fesm5": "./fesm5/okta-angular.js", | ||
"fesm2015": "./fesm2015/okta-angular.js", | ||
"typings": "./okta-angular.d.ts", | ||
"scripts": { | ||
"build:package-info": "node ../../util/write-package-info.js . src/okta/packageInfo.ts", | ||
"lint": "tslint -p tsconfig.json -t stylish src/**/*.ts", | ||
"prebuild": "yarn build:package-info", | ||
"build": "node build.js", | ||
"prepare": "yarn build", | ||
"start": "yarn --cwd test/e2e/harness/ start", | ||
"test": "yarn lint && yarn test:e2e && yarn test:unit", | ||
"test:e2e": "yarn --cwd test/e2e/harness/ e2e", | ||
"test:unit": "jest", | ||
"pack:lib": "npm run build && npm pack ./dist", | ||
"publish:lib": "npm run build && npm publish ./dist", | ||
"publish:lib:next": "npm run build && npm publish --tag next ./dist", | ||
"compodoc": "compodoc -p tsconfig.json", | ||
"compodoc:serve": "compodoc -s" | ||
}, | ||
"transformIgnorePatterns": [ | ||
"node_modules", | ||
"packages/(?!okta-angular)" | ||
"repository": "https://github.com/okta/okta-oidc-js", | ||
"homepage": "https://github.com/okta/okta-oidc-js/tree/master/packages/okta-angular", | ||
"keywords": [ | ||
"okta", | ||
"oidc", | ||
"OpenID Connect", | ||
"authentication", | ||
"auth", | ||
"oauth2" | ||
], | ||
"globals": { | ||
"ts-jest": { | ||
"tsConfig": "<rootDir>/tsconfig.spec.json" | ||
} | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"@okta/configuration-validation": "^0.4.1", | ||
"@okta/okta-auth-js": "^2.11.0", | ||
"tslib": "^1.9.0" | ||
}, | ||
"preset": "jest-preset-angular", | ||
"rootDir": "./test/spec", | ||
"setupFilesAfterEnv": [ | ||
"../support/setupJest.ts" | ||
] | ||
} | ||
"devDependencies": { | ||
"@angular/animations": "8.0.0", | ||
"@angular/common": "8.0.0", | ||
"@angular/compiler": "8.0.0", | ||
"@angular/compiler-cli": "8.0.0", | ||
"@angular/core": "8.0.0", | ||
"@angular/platform-browser": "8.0.0", | ||
"@angular/platform-browser-dynamic": "8.0.0", | ||
"@angular/platform-server": "8.0.0", | ||
"@angular/router": "8.0.0", | ||
"@compodoc/compodoc": "1.1.9", | ||
"@rollup/plugin-commonjs": "11.0.1", | ||
"@rollup/plugin-node-resolve": "7.0.0", | ||
"@types/jest": "^24.0.18", | ||
"@types/json-schema": "^7.0.3", | ||
"@types/node": "12.0.4", | ||
"angular2-template-loader": "0.6.2", | ||
"chalk": "2.4.2", | ||
"codelyzer": "5.0.1", | ||
"core-js": "3.1.3", | ||
"jest": "^24.9.0", | ||
"jest-preset-angular": "^7.1.1", | ||
"raw-loader": "1.0.0", | ||
"reflect-metadata": "0.1.13", | ||
"rollup": "1.29.0", | ||
"rollup-plugin-license": "0.8.1", | ||
"rollup-plugin-sourcemaps": "0.4.2", | ||
"rxjs": "6.5.2", | ||
"shelljs": "0.8.3", | ||
"source-map-loader": "0.2.4", | ||
"to-string-loader": "1.1.5", | ||
"ts-loader": "6.0.1", | ||
"tsickle": "0.33.0", | ||
"tslint": "5.16.0", | ||
"tslint-angular": "3.0.2", | ||
"typescript": "3.4.5", | ||
"uglify-js": "3.6.0", | ||
"webpack": "4.32.2", | ||
"webpack-filter-warnings-plugin": "1.2.1", | ||
"zone.js": "0.9.1" | ||
}, | ||
"peerDependencies": { | ||
"@angular/common": ">=4", | ||
"@angular/core": ">=4", | ||
"@angular/platform-browser": ">=4", | ||
"@angular/router": ">=4", | ||
"rxjs": ">=5.4.3" | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.(ts|html)$": "ts-jest" | ||
}, | ||
"transformIgnorePatterns": [ | ||
"node_modules", | ||
"packages/(?!okta-angular)" | ||
], | ||
"globals": { | ||
"ts-jest": { | ||
"tsConfig": "<rootDir>/tsconfig.spec.json" | ||
} | ||
}, | ||
"preset": "jest-preset-angular", | ||
"rootDir": "./test/spec", | ||
"setupFilesAfterEnv": [ | ||
"../support/setupJest.ts" | ||
] | ||
}, | ||
"sideEffects": false | ||
} |
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,6 @@ | ||
/** | ||
* Entry point for all public APIs of the package. | ||
*/ | ||
export * from './src/okta-angular'; | ||
|
||
// This file only reexports content of the `src` folder. Keep it that way. |
Oops, something went wrong.