Skip to content

Commit

Permalink
update(build): remove use of typings, update CI scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBurleson committed Nov 10, 2016
1 parent 796cea3 commit bceb5f7
Show file tree
Hide file tree
Showing 17 changed files with 581 additions and 157 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ language: node_js
sudo: false

node_js:
- '5.6.0'
- '6'
- '6.9.1'
- 'node'

addons:
Expand All @@ -25,7 +24,7 @@ env:
- BROWSER_STACK_USERNAME=angularteam1
- BROWSER_STACK_ACCESS_KEY=BWCd4SynLzdDcv8xtzsB
- ARCH=linux-x64
- BROWSER_PROVIDER_READY_FILE=/tmp/flex-layout2-build/readyfile
- BROWSER_PROVIDER_READY_FILE=/tmp/flex-layout-build/readyfile
# GITHUB_TOKEN_ANGULAR
- secure: "fq/U7VDMWO8O8SnAQkdbkoSe2X92PVqg4d044HmRYVmcf6YbO48+xeGJ8yOk0pCBwl3ISO4Q2ot0x546kxfiYBuHkZetlngZxZCtQiFT9kyId8ZKcYdXaIW9OVdw3Gh3tQyUwDucfkVhqcs52D6NZjyE2aWZ4/d1V4kWRO/LMgo="
matrix:
Expand Down
44 changes: 27 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,58 @@
],
"scripts": {
"analyze": "webpack -p --config ./src/demo-app/webpack.config.js --profile --json > ./dist/stats.json; webpack-bundle-analyzer ./dist/stats.json ./dist -m static;",
"build": "gulp build:components; ",
"deploy": "webpack -p --config ./src/demo-app/webpack.config.js --output-path ./dist --progress --colors ",
"dev": "webpack-dev-server --config ./src/demo-app/webpack.config.js --content-base ./ --inline -d --hot --watch --port 8080",
"docker-build": "docker build -t ng2-flex-layout-demo .",
"docker": "npm run docker-build && docker run -it --rm -p 3000:3000 -p 3001:3001 ng2-flex-layout-demo",
"open": "opn http://localhost:8080/",
"reinstall": "npm cache clean && npm install",
"start": "concurrently \"npm run dev\" \"npm run open\""
"start": "concurrently \"npm run dev\" \"npm run open\"",
"tslint": "gulp lint",
"stylelint": "gulp lint",
"webdriver-manager": "webdriver-manager"
},
"license": "MIT",
"engines": {
"node": ">= 5.4.1 < 7"
},
"dependencies": {
"@angular/common": "^2.0.0",
"@angular/compiler": "^2.0.0",
"@angular/core": "^2.0.0",
"@angular/platform-browser": "^2.0.0",
"@angular/platform-browser-dynamic": "^2.0.0",
"@angular/platform-server": "^2.0.0",
"@types/requirejs": "^2.1.28",
"@angular/common": "~2.1.1",
"@angular/compiler": "~2.1.1",
"@angular/core": "~2.1.1",
"@angular/platform-browser": "~2.1.1",
"@angular/platform-browser-dynamic": "~2.1.1",
"angular-in-memory-web-api": "~0.1.13",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"es-module-loader": "^1.3.5",
"ie-shim": "^0.1.0",
"rxjs": "^5.0.0-rc.1",
"systemjs": "0.19.38",
"zone.js": "^0.6.23"
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.39",
"zone.js": "^0.6.25"
},
"devDependencies": {
"@angular/compiler-cli": "^2.0.0",
"@angular/platform-server": "^2.0.0",
"@angular/forms": "^2.0.0",
"@angular/http": "^2.0.0",
"@angular/material": "^2.0.0-alpha.9-3",
"@angular/router": "^3.0.0",
"@angular/router": "~3.1.1",
"@angular/tsc-wrapped": "^0.3.0",
"@angularclass/conventions-loader": "^1.0.2",
"@angularclass/hmr": "~1.2.0",
"@angularclass/hmr-loader": "~3.0.2",
"@angularclass/request-idle-callback": "^1.0.7",
"@angularclass/webpack-toolkit": "^1.3.3",
"@types/core-js": "^0.9.34",
"@types/glob": "^5.0.29",
"@types/gulp": "^3.8.29",
"@types/hammerjs": "^2.0.33",
"@types/jasmine": "^2.2.34",
"@types/merge2": "0.0.28",
"@types/minimist": "^1.1.28",
"@types/node": "^6.0.38",
"@types/node": "^6.0.45",
"@types/protractor": "^1.5.20",
"@types/requirejs": "^2.1.28",
"@types/run-sequence": "0.0.27",
"@types/selenium-webdriver": "2.44.29",
"@types/source-map": "^0.1.27",
Expand All @@ -70,6 +77,7 @@
"angular2-template-loader": "^0.6.0",
"assets-webpack-plugin": "^3.4.0",
"awesome-typescript-loader": "^2.2.1",
"browserstacktunnel-wrapper": "^2.0.0",
"clang-format": "^1.0.45",
"concurrently": "^2.2.0",
"copy-webpack-plugin": "^4.0.0",
Expand All @@ -92,13 +100,16 @@
"html-loader": "^0.4.3",
"html-webpack-plugin": "^2.22.0",
"imports-loader": "^0.6.5",
"jasmine-core": "^2.4.1",
"karma": "^1.2.0",
"karma-browserstack-launcher": "^1.0.1",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-jasmine": "^1.0.2",
"karma-mocha-reporter": "^2.0.0",
"karma-remap-coverage": "^0.1.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-sauce-launcher": "^1.0.0",
"karma-webpack": "1.8.0",
"madge": "^0.6.0",
"merge2": "^1.0.2",
Expand All @@ -118,15 +129,14 @@
"source-map-loader": "^0.1.5",
"strip-ansi": "^3.0.0",
"style-loader": "^0.13.1",
"stylelint": "^6.9.0",
"stylelint": "^7.5.0",
"symlink-or-copy": "^1.0.1",
"ts-helpers": "1.1.2",
"ts-node": "^1.3.0",
"tslint": "^4.0.0-dev.0",
"tslint-loader": "^2.1.3",
"typedoc": "^0.5.0",
"typescript": "^2.0.6",
"typings": "^1.3.1",
"url-loader": "^0.5.7",
"webpack": "2.1.0-beta.22",
"webpack-bundle-analyzer": "^1.4.1",
Expand Down
9 changes: 7 additions & 2 deletions scripts/browserstack/start_tunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ var tunnel = new BrowserStackTunnel({
});

console.log('Starting tunnel on ports', PORTS.join(', '));
tunnel.start(function(error) {

// Emit a `newer_available` event to force an update of the Browserstack binaries (necessary due to Travis caching)
// This also starts a new tunnel after the latest binaries are available.
tunnel.emit('newer_available');

tunnel.once('started', function(error) {
if (error) {
console.error('Can not establish the tunnel', error);
} else {
Expand All @@ -44,7 +49,7 @@ tunnel.start(function(error) {
});

if (READY_FILE) {
fs.writeFile(READY_FILE, '');
fs.writeFile(READY_FILE, process.pid);
}
}
});
Expand Down
16 changes: 14 additions & 2 deletions scripts/browserstack/teardown_tunnel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,17 @@ set -e -o pipefail


echo "Shutting down Browserstack tunnel"
echo "TODO: implement me"
exit 1

PID=$(cat $BROWSER_PROVIDER_READY_FILE);

# Resolving the PID from the readyfile.
kill $PID


while [[ -n `ps -ef | grep $PID | grep -v "grep"` ]]; do
printf "."
sleep .5
done

echo ""
echo "Browserstack tunnel has been shut down"
12 changes: 6 additions & 6 deletions scripts/browserstack/waitfor_tunnel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@


# Wait for Connect to be ready before exiting
# Time out if we wait for more than 2 minutes, so that we can print logs.
# Time out if we wait for more than 2 minutes, so the process won't run forever.
let "counter=0"

while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do
let "counter++"

if [ $counter -gt 240 ]; then
echo "Timed out after 2 minutes waiting for browser provider ready file"
# We must manually print logs here because travis will not run
# after_script commands if the failure occurs before the script
# phase.
./scripts/ci/print-logs.sh
echo
echo "Timed out after 2 minutes waiting for tunnel ready file"
exit 5
fi

printf "."
sleep .5
done
2 changes: 1 addition & 1 deletion scripts/ci/sources/tunnel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ teardown_tunnel() {
./scripts/sauce/sauce_connect_teardown.sh
;;
browserstack*)
# ./scripts/browserstack/teardown_tunnel.sh
./scripts/browserstack/teardown_tunnel.sh
;;
*)
;;
Expand Down
6 changes: 3 additions & 3 deletions scripts/release/enact-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

# Run this script after running `stage-release.sh` to publish the packages staged to deploy/
# Optionally uses the first argument as the tag for the release (such as "next").
# This script should be run from the root of the layouts repo.
# This script should be run from the root of the angular/flex-layout repo.


# `npm whoami` errors and dies if you're not logged in,
# so we redirect the stderr output to /dev/null since we don't care.
NPM_USER=$(npm whoami 2> /dev/null)

if [ "${NPM_USER}" != "angular2-layouts" ]; then
echo "You must be logged in as 'angular2-layouts' to publish. Use 'npm login'."
if [ "${NPM_USER}" != "flex-layout" ]; then
echo "You must be logged in as 'flex-layout' to publish. Use 'npm login'."
exit
fi

Expand Down
14 changes: 14 additions & 0 deletions scripts/sauce/sauce_connect_block.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,21 @@

# Wait for Connect to be ready before exiting
echo "Connecting to Sauce Labs"


# Wait for Saucelabs Connect to be ready before exiting
# Time out if we wait for more than 2 minutes, so the process won't run forever.
let "counter=0"

while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do
let "counter++"

if [ $counter -gt 240 ]; then
echo
echo "Timed out after 2 minutes waiting for tunnel ready file"
exit 5
fi

printf "."
sleep .5
done
Expand Down
4 changes: 3 additions & 1 deletion stylelint-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@

"property-case": "lower",

"declaration-block-no-duplicate-properties": true,
"declaration-block-no-duplicate-properties": [ true, {
"ignore": ["consecutive-duplicates-with-different-values"]
}],
"declaration-block-no-ignored-properties": true,
"declaration-block-trailing-semicolon": "always",
"declaration-block-single-line-max-declarations": 1,
Expand Down
6 changes: 3 additions & 3 deletions test/browser-providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const configuration: { [name: string]: ConfigurationInfo } = {
'IE10': { unitTest: {target: null, required: true}, e2e: {target: null, required: true}},
'IE11': { unitTest: {target: 'SL', required: true}, e2e: {target: null, required: true}},
'Edge': { unitTest: {target: 'SL', required: true}, e2e: {target: null, required: true}},
'Android4.1': { unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
'Android4.2': { unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
'Android4.3': { unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
'Android4.1': { unitTest: {target: null, required: false}, e2e: {target: null, required: true}},
'Android4.2': { unitTest: {target: null, required: false}, e2e: {target: null, required: true}},
'Android4.3': { unitTest: {target: null, required: false}, e2e: {target: null, required: true}},
'Android4.4': { unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
'Android5': { unitTest: {target: 'SL', required: false}, e2e: {target: null, required: true}},
'Safari7': { unitTest: {target: null, required: false}, e2e: {target: null, required: true}},
Expand Down
4 changes: 3 additions & 1 deletion tools/gulp/gulpfile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import './tasks/ci';
import './tasks/clean';
import './tasks/components';
import './tasks/default';
import './tasks/lint';
import './tasks/release';
import './tasks/clang-format.js';

import './tasks/unit-test';
28 changes: 16 additions & 12 deletions tools/gulp/task_helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const gulpAutoprefixer = require('gulp-autoprefixer');
const resolveBin = require('resolve-bin');



/** If the string passed in is a glob, returns it, otherwise append '**\/*' to it. */
function _globify(maybeGlob: string, suffix = '**/*') {
if (maybeGlob.indexOf('*') != -1) {
Expand All @@ -33,10 +32,10 @@ function _globify(maybeGlob: string, suffix = '**/*') {
return path.join(maybeGlob, suffix);
}


/** Create a TS Build Task, based on the options. */
export function tsBuildTask(tsConfigPath: string, tsConfigName = 'tsconfig.json') {
let tsConfigDir = tsConfigPath;

if (fs.existsSync(path.join(tsConfigDir, tsConfigName))) {
// Append tsconfig.json
tsConfigPath = path.join(tsConfigDir, tsConfigName);
Expand All @@ -48,8 +47,6 @@ export function tsBuildTask(tsConfigPath: string, tsConfigName = 'tsconfig.json'
const tsConfig: any = JSON.parse(fs.readFileSync(tsConfigPath, 'utf-8'));
const dest: string = path.join(tsConfigDir, tsConfig['compilerOptions']['outDir']);

//console.log(`tsBuildTask dest = ${dest}`);

const tsProject = gulpTs.createProject(tsConfigPath, {
typescript: require('typescript')
});
Expand All @@ -69,7 +66,6 @@ export function tsBuildTask(tsConfigPath: string, tsConfigName = 'tsconfig.json'
}



/** Create a SASS Build Task. */
export function sassBuildTask(dest: string, root: string, includePaths: string[]) {
const sassOptions = { includePaths };
Expand All @@ -78,6 +74,7 @@ export function sassBuildTask(dest: string, root: string, includePaths: string[]
return gulp.src(_globify(root, '**/*.scss'))
.pipe(gulpSourcemaps.init())
.pipe(gulpSass(sassOptions).on('error', gulpSass.logError))
.pipe(gulpAutoprefixer(SASS_AUTOPREFIXER_OPTIONS))
.pipe(gulpSourcemaps.write('.'))
.pipe(gulp.dest(dest));
};
Expand Down Expand Up @@ -118,7 +115,7 @@ export function execTask(binPath: string, args: string[], options: ExecTaskOptio
done();
}
});
}
};
}

/**
Expand All @@ -138,11 +135,13 @@ export function execNodeTask(packageName: string, executable: string | string[],
if (err) {
done(err);
} else {
// Forward to execTask.
execTask(binPath, args, options)(done);
// Execute the node binary within a new child process using spawn.
// The binary needs to be `node` because on Windows the shell cannot determine the correct
// interpreter from the shebang.
execTask('node', [binPath].concat(args), options)(done);
}
});
}
};
}


Expand Down Expand Up @@ -186,10 +185,15 @@ export function vendorTask() {
}));
}

export type livereloadOptions = boolean | {
enable: boolean;
filter: (filename: string, callback: (isAllowed: boolean) => void) => void;
}

/** Create a task that serves the dist folder. */
export function serverTask(liveReload: boolean = true,
export function serverTask(liveReload: livereloadOptions = true,
streamCallback: (stream: NodeJS.ReadWriteStream) => void = null) {

return () => {
const stream = gulp.src('dist').pipe(gulpServer({
livereload: liveReload,
Expand All @@ -201,7 +205,7 @@ export function serverTask(liveReload: boolean = true,
streamCallback(stream);
}
return stream;
}
};
}


Expand All @@ -212,5 +216,5 @@ export function sequenceTask(...args: any[]) {
...args,
done
);
}
};
}
Loading

0 comments on commit bceb5f7

Please sign in to comment.