Skip to content

Commit

Permalink
[RELEASE] v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
orizens committed Jan 8, 2018
1 parent 8faac39 commit 166f6b1
Show file tree
Hide file tree
Showing 19 changed files with 404 additions and 220 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -52,4 +52,5 @@ src/ngFactory
*.metadata.json
dist

examples/webpack/node_modules
examples/webpack/node_modules
examples/
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -8,7 +8,7 @@ addons:
- google-chrome-stable
language: node_js
node_js:
- stable
- "8"
before_install:
- npm i npm@^4 -g
install:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
## v 0.1.0 (2018/01/08)
* [UPGRADE] - official support for Angular 5
* [UPDATE] - updated repo to ngx-youtube-player
* [REFACTOR] - added more unit tests and increased coverage

## v 0.0.51 (2017/12/29)
* [FIX] - fixes #27 - youtube player iframe api loaded with each instance

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 Oren Farhi
Copyright (c) 2018 Oren Farhi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
110 changes: 61 additions & 49 deletions build.js
@@ -1,61 +1,73 @@
"use strict";

require('shelljs/global');
const shell = require('shelljs');
const chalk = require('chalk');

const PACKAGE = `ngx-youtube-player`;
module.exports.PACKAGE = PACKAGE;
const NPM_DIR = `dist`;
const MODULES_DIR = `${NPM_DIR}/modules`;
const ESM2015_DIR = `${NPM_DIR}/esm2015`;
const ESM5_DIR = `${NPM_DIR}/esm5`;
const BUNDLES_DIR = `${NPM_DIR}/bundles`;
const OUT_DIR_ESM5 = `${NPM_DIR}/package/esm5`;

echo('Start building...');
shell.echo(`Start building...`);

rm(`-Rf`, `${NPM_DIR}/*`);
mkdir(`-p`, `./${MODULES_DIR}`);
mkdir(`-p`, `./${BUNDLES_DIR}`);
shell.rm(`-Rf`, `${NPM_DIR}/*`);
shell.mkdir(`-p`, `./${ESM2015_DIR}`);
shell.mkdir(`-p`, `./${ESM5_DIR}`);
shell.mkdir(`-p`, `./${BUNDLES_DIR}`);

/* TSLint with Codelyzer */
// https://github.com/palantir/tslint/blob/master/src/configs/recommended.ts
// https://github.com/mgechev/codelyzer
echo(`Start TSLint`);
exec(`tslint --project ./tsconfig.json --type-check ./src/**/*.ts`);
echo(chalk.green(`TSLint completed`));

/* Aot compilation: ES2015 sources */
echo(`Start AoT compilation`);
exec(`ngc -p tsconfig-build.json`);
echo(chalk.green(`AoT compilation completed`));

/* Creates bundles: ESM/ES5 and UMD bundles */
echo(`Start bundling`);
echo(`Rollup package`);
exec(`rollup -i ${NPM_DIR}/${PACKAGE}.js -o ${MODULES_DIR}/${PACKAGE}.js --sourcemap`, {silent: true});
exec(`node scripts/map-sources -f ${MODULES_DIR}/${PACKAGE}.js`);

echo(`Downleveling ES2015 to ESM/ES5`);
cp(`${MODULES_DIR}/${PACKAGE}.js`, `${MODULES_DIR}/${PACKAGE}.es5.ts`);
exec(`tsc ${MODULES_DIR}/${PACKAGE}.es5.ts --target es5 --module es2015 --noLib --sourceMap`, {silent: true});
exec(`node scripts/map-sources -f ${MODULES_DIR}/${PACKAGE}.es5.js`);
rm(`-f`, `${MODULES_DIR}/${PACKAGE}.es5.ts`);

echo(`Run Rollup conversion on package`);
exec(`rollup -c rollup.config.js --sourcemap`, {silent: true});
exec(`node scripts/map-sources -f ${BUNDLES_DIR}/${PACKAGE}.umd.js`);

echo(`Minifying`);
cd(`${BUNDLES_DIR}`);
exec(`uglifyjs -c --screw-ie8 --comments -o ${PACKAGE}.umd.min.js --source-map ${PACKAGE}.umd.min.js.map --source-map-include-sources ${PACKAGE}.umd.js`, {silent: true});
exec(`node ../../scripts/map-sources -f ${PACKAGE}.umd.min.js`);
cd(`..`);
cd(`..`);

echo(chalk.green(`Bundling completed`));

rm(`-Rf`, `${NPM_DIR}/*.js`);
rm(`-Rf`, `${NPM_DIR}/*.js.map`);
rm(`-Rf`, `${NPM_DIR}/src/**/*.js`);
rm(`-Rf`, `${NPM_DIR}/src/**/*.js.map`);

cp(`-Rf`, [`package.json`, `LICENSE`, `README.md`], `${NPM_DIR}`);

echo(chalk.green(`End building`));
shell.echo(`Start TSLint`);
shell.exec(`tslint -c tslint.json -t stylish src/**/*.ts`);
shell.echo(chalk.green(`TSLint completed`));

/* AoT compilation */
shell.echo(`Start AoT compilation`);
if (shell.exec(`ngc -p tsconfig-build.json`).code !== 0) {
shell.echo(chalk.red(`Error: AoT compilation failed`));
shell.exit(1);
}
shell.echo(chalk.green(`AoT compilation completed`));

/* 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 ${ESM2015_DIR}/${PACKAGE}.js`).code !== 0) {
shell.echo(chalk.red(`Error: Rollup package failed`));
shell.exit(1);
}

shell.echo(`Produce ESM5 version`);
shell.exec(`ngc -p tsconfig-build.json --target es5 -d false --outDir ${OUT_DIR_ESM5} --importHelpers true --sourceMap`);
if (shell.exec(`rollup -c rollup.es.config.js -i ${OUT_DIR_ESM5}/${PACKAGE}.js -o ${ESM5_DIR}/${PACKAGE}.js`).code !== 0) {
shell.echo(chalk.red(`Error: ESM5 version failed`));
shell.exit(1);
}

shell.echo(`Run Rollup conversion on package`);
if (shell.exec(`rollup -c rollup.config.js -i ${ESM5_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}`);
shell.exec(`uglifyjs ${PACKAGE}.umd.js -c --comments -o ${PACKAGE}.umd.min.js --source-map "filename='${PACKAGE}.umd.min.js.map', includeSources"`);
shell.cd(`..`);
shell.cd(`..`);

shell.echo(chalk.green(`Bundling completed`));

shell.rm(`-Rf`, `${NPM_DIR}/package`);
shell.rm(`-Rf`, `${NPM_DIR}/node_modules`);
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.cp(`-Rf`, [`package.json`, `LICENSE`, `README.md`], `${NPM_DIR}`);

shell.echo(chalk.green(`End building`));
23 changes: 23 additions & 0 deletions license-banner.txt
@@ -0,0 +1,23 @@
/**
* @license ngx-youtube-library
* Copyright (c) 2018 Oren Farhi
* MIT license

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
Binary file added ngx-youtube-player-0.0.52.tgz
Binary file not shown.
File renamed without changes.
84 changes: 45 additions & 39 deletions package.json
@@ -1,13 +1,14 @@
{
"name": "ngx-youtube-player",
"version": "0.0.51",
"version": "0.1.0",
"description": "A Powerful Youtube Player Component for Angular",
"main": "./bundles/ngx-youtube-player.umd.js",
"module": "./modules/ngx-youtube-player.es5.js",
"es2015": "./modules/ngx-youtube-player.js",
"module": "./esm5/ngx-youtube-player.js",
"es2015": "./esm2015/ngx-youtube-player.js",
"scripts": {
"build": "node build.js",
"test": "karma start",
"test:watch": "karma start --single-run=false",
"pack-lib": "npm pack ./dist",
"publish-lib": "npm publish ./dist",
"publish-lib:next": "npm publish --tag next ./dist",
Expand All @@ -18,12 +19,12 @@
"author": "Oren Farhi (orizens.com)",
"repository": {
"type": "git",
"url": "https://github.com/orizens/ng2-youtube-player.git"
"url": "https://github.com/orizens/ngx-youtube-player.git"
},
"bugs": {
"url": "https://github.com/orizens/ng2-youtube-player/issues"
"url": "https://github.com/orizens/ngx-youtube-player/issues"
},
"homepage": "https://github.com/orizens/ng2-youtube-player",
"homepage": "https://github.com/orizens/ngx-youtube-player",
"keywords": [
"angular",
"javascript",
Expand All @@ -32,46 +33,51 @@
"youtube player"
],
"license": "MIT",
"dependencies": {
"tslib": "^1.7.1"
},
"peerDependencies": {
"@angular/common": ">= 4.0.0",
"@angular/core": ">= 4.0.0"
"@angular/common": ">= 5.0.0",
"@angular/core": ">= 5.0.0"
},
"devDependencies": {
"@angular/animations": "^4.0.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/platform-server": "^4.0.0",
"@types/jasmine": "2.5.46",
"@types/node": "7.0.10",
"@angular/animations": "5.0.0",
"@angular/common": "5.0.0",
"@angular/compiler": "5.0.0",
"@angular/compiler-cli": "5.0.0",
"@angular/core": "5.0.0",
"@angular/platform-browser": "5.0.0",
"@angular/platform-browser-dynamic": "5.0.0",
"@angular/platform-server": "5.0.0",
"@types/jasmine": "2.6.1",
"@types/node": "8.0.47",
"@types/youtube": "0.0.29",
"chalk": "1.1.3",
"codelyzer": "3.0.0-beta.4",
"chalk": "2.3.0",
"codelyzer": "4.0.0",
"compodoc": "0.0.41",
"core-js": "2.4.1",
"jasmine-core": "2.5.2",
"karma": "1.5.0",
"karma-chrome-launcher": "2.0.0",
"core-js": "2.5.1",
"jasmine-core": "2.8.0",
"karma": "1.7.1",
"karma-chrome-launcher": "2.2.0",
"karma-jasmine": "1.1.0",
"karma-sourcemap-loader": "0.3.7",
"karma-spec-reporter": "0.0.30",
"karma-webpack": "2.0.3",
"karma-spec-reporter": "0.0.31",
"karma-webpack": "2.0.5",
"karma-coverage-istanbul-reporter": "1.3.0",
"istanbul-instrumenter-loader": "3.0.0",
"reflect-metadata": "0.1.10",
"rollup": "0.41.6",
"rxjs": "5.2.0",
"shelljs": "0.7.7",
"sorcery": "0.10.0",
"ts-helpers": "1.1.2",
"ts-loader": "2.0.3",
"tslint": "4.5.1",
"typescript": "^2.1.5",
"uglify-js": "2.8.15",
"webpack": "2.3.1",
"yargs": "7.0.2",
"zone.js": "0.8.5"
"rollup": "0.50.0",
"rollup-plugin-node-resolve": "3.0.0",
"rollup-plugin-sourcemaps": "0.4.2",
"rollup-plugin-license": "0.5.0",
"rxjs": "5.5.2",
"shelljs": "0.7.8",
"source-map-loader": "0.2.3",
"ts-loader": "3.1.1",
"tslint": "5.8.0",
"typescript": "2.4.2",
"uglify-js": "3.1.6",
"webpack": "3.8.1",
"zone.js": "0.8.18"
}
}
2 changes: 1 addition & 1 deletion public_api.ts
@@ -1,7 +1,7 @@
/**
* Angular library starter.
* Build an Angular library compatible with AoT compilation & Tree shaking.
* Written by Roberto Simonetti.
* Copyright Roberto Simonetti.
* MIT license.
* https://github.com/robisim74/angular-library-starter
*/
Expand Down
55 changes: 37 additions & 18 deletions rollup.config.js
@@ -1,20 +1,39 @@
import resolve from 'rollup-plugin-node-resolve';
import sourcemaps from 'rollup-plugin-sourcemaps';

/**
* Add here external dependencies that actually you use.
*
* About RxJS
* Each RxJS functionality that you use in the library must be added as external dependency.
* - For main classes use 'Rx':
* e.g. import { Observable } from 'rxjs/Observable'; => 'rxjs/Observable': 'Rx'
* - For observable methods use 'Rx.Observable':
* e.g. import 'rxjs/add/observable/merge'; => 'rxjs/add/observable/merge': 'Rx.Observable'
* or for lettable operators:
* e.g. import { merge } from 'rxjs/observable/merge'; => 'rxjs/observable/merge': 'Rx.Observable'
* - For operators use 'Rx.Observable.prototype':
* e.g. import 'rxjs/add/operator/map'; => 'rxjs/add/operator/map': 'Rx.Observable.prototype'
* or for lettable operators:
* e.g. import { map } from 'rxjs/operators'; => 'rxjs/operators': 'Rx.Observable.prototype'
*/
const globals = {
'@angular/core': 'ng.core',
'@angular/common': 'ng.common',
'rxjs/Observable': 'Rx',
'rxjs/ReplaySubject': 'Rx',
'rxjs/Observer': 'Rx'
};

export default {
entry: './dist/modules/ngx-youtube-player.es5.js',
dest: './dist/bundles/ngx-youtube-player.umd.js',
format: 'umd',
exports: 'named',
moduleName: 'ng.ngxYoutubePlayer',
external: [
'@angular/core',
'@angular/common',
'rxjs/Observable',
'rxjs/Observer'
],
globals: {
'@angular/core': 'ng.core',
'@angular/common': 'ng.common',
'rxjs/Observable': 'Rx',
'rxjs/Observer': 'Rx'
},
onwarn: () => { return }
external: Object.keys(globals),
plugins: [resolve(), sourcemaps()],
onwarn: () => { return },
output: {
format: 'umd',
name: 'ng.ngxYoutubePlayer',
globals: globals,
sourcemap: true,
exports: 'named'
}
}
23 changes: 23 additions & 0 deletions rollup.es.config.js
@@ -0,0 +1,23 @@
import sourcemaps from 'rollup-plugin-sourcemaps';
import license from 'rollup-plugin-license';

const path = require('path');

export default {
output: {
format: 'es',
sourcemap: true
},
plugins: [
sourcemaps(),
license({
sourceMap: true,

banner: {
file: path.join(__dirname, 'license-banner.txt'),
encoding: 'utf-8',
}
})
],
onwarn: () => { return }
}

0 comments on commit 166f6b1

Please sign in to comment.