Skip to content

Commit 97f5966

Browse files
handoff template updates and readme
1 parent 735ebc8 commit 97f5966

File tree

18 files changed

+132
-15
lines changed

18 files changed

+132
-15
lines changed

.deployment

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[config]
2-
command = bash ./scripts/deployment/azure-deploy.sh
2+
SCM_COMMAND_IDLE_TIMEOUT=7200
3+
command = ./scripts/deployment/azure-deploy.cmd

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Indentation override for all JS under src directory
7+
[src/**.{js,jsx,ts,tsx}]
8+
indent_style = space
9+
indent_size = 2

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language:
2+
node_js
3+
4+
node_js:
5+
- "7"
6+
7+
install:
8+
- .travis/setup.sh
9+
10+
script:
11+
- .travis/ci.sh
12+
- .travis/coverage.sh
13+
14+
after_success:
15+
- .travis/push.sh

.travis/ci.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
CI=true yarn lint
4+
CI=true yarn test

.travis/coverage.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
min_coverage="${MIN_COVERAGE:-42}"
4+
line_coverage="$(CI=true yarn coverage | grep '^All files *|' | cut -d'|' -f5 | tr -d ' ' | cut -d'.' -f1)"
5+
6+
if [ ${line_coverage} -lt ${min_coverage} ]; then
7+
echo "Got test coverage of ${line_coverage} which is less than configured minimum of ${min_coverage}" >&2
8+
exit 1
9+
else
10+
echo "Got test coverage of ${line_coverage}, well done" >&2
11+
exit 0
12+
fi

.travis/push.sh

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
readonly GITHUB_ORG="${GITHUB_ORG:-CatalystCode}"
6+
readonly GITHUB_REPO="${GITHUB_REPO:-ibex-dashboard}"
7+
readonly TARGET_BRANCH="${TARGET_BRANCH:-master}"
8+
readonly SOURCE_BRANCH="${SOURCE_BRANCH:-ibex-version-1.0}"
9+
10+
readonly AUTOCOMMIT_NAME="Travis CI"
11+
readonly AUTOCOMMIT_EMAIL="[email protected]"
12+
readonly AUTOCOMMIT_BRANCH="temp"
13+
14+
log() {
15+
echo "$@" >&2
16+
}
17+
18+
ensure_preconditions_met() {
19+
if [ -z "${TRAVIS_PULL_REQUEST_BRANCH}" ]; then
20+
log "Job is CI for a push, skipping creation of production build"
21+
exit 0
22+
fi
23+
if [ "${TRAVIS_BRANCH}_${TRAVIS_PULL_REQUEST_BRANCH}" != "${TARGET_BRANCH}_${SOURCE_BRANCH}" ]; then
24+
log "Skipping creation of production build"
25+
log "We only create production builds for pull requests from '${SOURCE_BRANCH}' to '${TARGET_BRANCH}'"
26+
log "but this pull request is from '${TRAVIS_PULL_REQUEST BRANCH}' to '${TRAVIS_BRANCH}'"
27+
exit 0
28+
fi
29+
if [ -z "${GITHUB_TOKEN}" ]; then
30+
log "GITHUB_TOKEN not set: won't be able to push production build"
31+
log "Please configure the token in .travis.yml or the Travis UI"
32+
exit 1
33+
fi
34+
}
35+
36+
create_production_build() {
37+
yarn build
38+
}
39+
40+
setup_git() {
41+
git config user.name "${AUTOCOMMIT_NAME}"
42+
git config user.email "${AUTOCOMMIT_EMAIL}"
43+
git remote add origin-travis "https://${GITHUB_TOKEN}@github.com/${GITHUB_ORG}/${GITHUB_REPO}.git"
44+
}
45+
46+
commit_build_files() {
47+
git checkout -b "${AUTOCOMMIT_BRANCH}"
48+
git add --all build
49+
echo -e "Travis build: ${TRAVIS_BUILD_NUMBER}\n\nhttps://travis-ci.org/${GITHUB_ORG}/${GITHUB_REPO}/builds/${TRAVIS_BUILD_ID}" | git commit --file -
50+
}
51+
52+
push_to_github() {
53+
git push origin-travis "${AUTOCOMMIT_BRANCH}:${SOURCE_BRANCH}"
54+
}
55+
56+
ensure_preconditions_met
57+
create_production_build
58+
setup_git
59+
commit_build_files
60+
push_to_github

.travis/setup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
yarn install
4+
yarn run css:build

.vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
"type": "node",
99
"request": "launch",
1010
"name": "Launch Server",
11-
"program": "${workspaceRoot}\\server\\index.js",
11+
"program": "${workspaceRoot}/server/index.js",
1212
"outFiles": []
1313
},
1414
{
1515
"type": "node",
1616
"request": "launch",
1717
"name": "Launch Program",
18-
"program": "${workspaceRoot}\\client:start",
18+
"program": "${workspaceRoot}/client:start",
1919
"outFiles": []
2020
},
2121
{

.vscode/settings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,17 @@
22
{
33
"files.exclude": {
44
"**/*.css": { "when": "$(basename).scss"}
5+
},
6+
"editor.tabSize": 2,
7+
"editor.insertSpaces": true,
8+
"editor.detectIndentation": false,
9+
"editor.rulers": [
10+
120
11+
],
12+
"search.exclude": {
13+
"**/.git": true,
14+
"**/node_modules": true,
15+
"**/build": true,
16+
"**/coverage": true
517
}
618
}

src/data-sources/plugins/ApplicationInsights/Query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default class ApplicationInsightsQuery extends DataSourcePlugin<IQueryPar
4040
* @param {object} dependencies
4141
* @param {function} callback
4242
*/
43-
updateDependenciesInternal(dependencies: any) {
43+
dependenciesUpdated(dependencies: any) {
4444
let emptyDependency = false;
4545
Object.keys(this._props.dependencies).forEach((key) => {
4646
//we use the 'optional_' naming convention key, to setup an optoinal dependacy.

src/data-sources/plugins/Azure.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class Azure extends DataSourcePlugin<IAzureParams> {
3737
* @param {object} dependencies
3838
* @param {function} callback
3939
*/
40-
updateDependenciesInternal(dependencies: any) {
40+
dependenciesUpdated(dependencies: any) {
4141
let emptyDependency = false;
4242
Object.keys(this._props.dependencies).forEach((key) => {
4343
if (typeof dependencies[key] === 'undefined') { emptyDependency = true; }

src/data-sources/plugins/BotFramework/DirectLine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default class BotFrameworkDirectLine extends DataSourcePlugin<IQueryParam
2727
* @param {object} dependencies
2828
* @param {function} callback
2929
*/
30-
updateDependenciesInternal(dependencies: any) {
30+
dependenciesUpdated(dependencies: any) {
3131
let emptyDependency = false;
3232
Object.keys(this._props.dependencies).forEach((key) => {
3333
if (typeof dependencies[key] === 'undefined') { emptyDependency = true; }

src/data-sources/plugins/Constant/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class Constant extends DataSourcePlugin<IConstantParams> {
3131
/**
3232
* updateDependencies - called when dependencies are created
3333
*/
34-
updateDependenciesInternal(dependencies: IDictionary, args: IDictionary, callback: (result: any) => void) {
34+
dependenciesUpdated(dependencies: IDictionary, args: IDictionary, callback: (result: any) => void) {
3535
var result = _.extend(dependencies, args);
3636

3737
if (typeof callback === 'function') {

src/data-sources/plugins/CosmosDB/Query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default class CosmosDBQuery extends DataSourcePlugin<IQueryParams> {
3030
* @param {object} dependencies
3131
* @param {function} callback
3232
*/
33-
updateDependenciesInternal(dependencies: any) {
33+
dependenciesUpdated(dependencies: any) {
3434
let emptyDependency = false;
3535
Object.keys(this._props.dependencies).forEach((key) => {
3636
if (typeof dependencies[key] === 'undefined') { emptyDependency = true; }

src/data-sources/plugins/DataSourcePlugin.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface IDataSourcePlugin {
3131
};
3232

3333
bind (actionClass: any): void;
34-
updateDependenciesInternal (dependencies: IDictionary, args: IDictionary, callback: () => void): void;
34+
dependenciesUpdated (dependencies: IDictionary, args: IDictionary, callback: () => void): void;
3535
getDependencies(): { [ key: string]: string };
3636
getDependables(): string[];
3737
getActions(): string[];
@@ -77,7 +77,7 @@ export abstract class DataSourcePlugin<T> implements IDataSourcePlugin {
7777
props.autoUpdateIntervalMs = options.autoUpdateIntervalMs || -1;
7878

7979
this.updateDependencies = this.updateDependencies.bind(this);
80-
this.updateDependenciesInternal = this.updateDependenciesInternal.bind(this);
80+
this.dependenciesUpdated = this.dependenciesUpdated.bind(this);
8181
this.updateSelectedValues = this.updateSelectedValues.bind(this);
8282
this.getCalculated = this.getCalculated.bind(this);
8383

@@ -91,14 +91,14 @@ export abstract class DataSourcePlugin<T> implements IDataSourcePlugin {
9191
return;
9292
}
9393

94-
const returnValue = this.updateDependenciesInternal(dependencies, args, callback);
94+
const returnValue = this.dependenciesUpdated(dependencies, args, callback);
9595
this.lastDependencies = dependencies;
9696
this.lastArgs = args;
9797
this.lastCallback = callback;
9898
return returnValue;
9999
}
100100

101-
abstract updateDependenciesInternal (dependencies: IDictionary, args: IDictionary,
101+
abstract dependenciesUpdated (dependencies: IDictionary, args: IDictionary,
102102
callback: (result: any) => void): void;
103103
abstract updateSelectedValues (dependencies: IDictionary, selectedValues: any, callback: (result: any) => void): void;
104104

src/data-sources/plugins/GraphQL.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default class GraphQL extends DataSourcePlugin<IGraphQLParams> {
2121
this.validateParams(this._props.params);
2222
}
2323

24-
updateDependenciesInternal(dependencies: any) {
24+
dependenciesUpdated(dependencies: any) {
2525
// Ensure dependencies exist
2626
const isAnyDependencyMissing = Object.keys(this.getDependencies()).some(key => dependencies[key] == null);
2727
if (isAnyDependencyMissing) {

src/data-sources/plugins/Sample.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class Sample extends DataSourcePlugin<ISampleParams> {
2828
/**
2929
* updateDependencies - called when dependencies are created
3030
*/
31-
updateDependenciesInternal(dependencies: IDictionary, args: IDictionary, callback: (result: any) => void) {
31+
dependenciesUpdated(dependencies: IDictionary, args: IDictionary, callback: (result: any) => void) {
3232
var result = _.extend(dependencies, args);
3333

3434
if (typeof callback === 'function') {

src/data-sources/plugins/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ export default {
1111
'Azure': Azure,
1212
'Constant': Constant,
1313
'BotFramework/DirectLine': BotFrameworkDirectLine,
14-
'Sample': Sample
14+
'Sample': Sample,
1515
};

0 commit comments

Comments
 (0)