Skip to content

Commit f435d51

Browse files
committed
setup deploys
1 parent dceb9a1 commit f435d51

File tree

9 files changed

+53
-200
lines changed

9 files changed

+53
-200
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ before_install:
99
before_script:
1010
- export DISPLAY=:99.0
1111
- sh -e /etc/init.d/xvfb start
12-
script: npm test && npm run lint && npm run demo:build
12+
script: npm run lint && npm test
1313
sudo: false
1414
deploy:
1515
skip_cleanup: true

gulpfile.js

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ const path = require("path");
1313
const fs = require("fs");
1414
const es = require("event-stream");
1515
const runSequence = require("run-sequence");
16-
// const iconLoader = require("@peretz/icon-loader");
17-
// const through = require("through2");
16+
1817
//
1918
// Variables
2019
// =================================
@@ -25,8 +24,6 @@ const dirs = {
2524
"!src/**/*.stories.ts"
2625
],
2726
i18n: "src/i18n/**/*.json",
28-
FONTS: "node_modules/@peretz/matter/fonts/**/*",
29-
DEMO: "demo",
3027
DIST: "dist"
3128
};
3229

@@ -57,7 +54,6 @@ const licenseTemplate = `/*!
5754
gulp.task("build:angular", _ =>
5855
gulp.src(dirs.TS)
5956
.pipe(replaceTemplates())
60-
// .pipe(replaceIcons())
6157
.pipe(gulp.dest(`${dirs.DIST}/src`))
6258
);
6359

@@ -83,7 +79,6 @@ gulp.task("build:license", _ =>
8379

8480
gulp.task("build:package", _ =>
8581
gulp.src("package.json")
86-
.pipe(version())
8782
.pipe(gulp.dest(dirs.DIST))
8883
);
8984

@@ -97,14 +92,6 @@ gulp.task("build:changelog", _ =>
9792
.pipe(gulp.dest(dirs.DIST))
9893
);
9994

100-
//
101-
// Demo tasks
102-
// =================================
103-
gulp.task("demo:font", _ =>
104-
gulp.src(dirs.FONTS)
105-
.pipe(gulp.dest(`${dirs.DEMO}/fonts`))
106-
);
107-
10895
//
10996
// Running tasks
11097
// =================================
@@ -114,8 +101,6 @@ gulp.task("build:meta", _ =>
114101
runSequence("build:package", ["build:license", "build:readme", "build:changelog"])
115102
);
116103

117-
gulp.task("demo", ["demo:font"]);
118-
119104
//
120105
// Functions
121106
// =================================
@@ -130,48 +115,6 @@ function licenseHeaders() {
130115
});
131116
}
132117

133-
function version() {
134-
return tap(function(file) {
135-
let packageJSON = JSON.parse(file.contents.toString("utf-8"));
136-
if (process.env.TRAVIS) {
137-
// assume beta release on cron
138-
if (process.env.TRAVIS_EVENT_TYPE === "cron") {
139-
const build = process.env.TRAVIS_BUILD_NUMBER; // we'll use the build number so we dont have to think about versions
140-
packageJSON.version = `${packageJSON.version}-beta.${build}`;
141-
// release to alpha unless it's building from a tag
142-
} else if (!process.env.TRAVIS_TAG) {
143-
const commit = process.env.TRAVIS_COMMIT; // we'll just slice up the commit a bit
144-
packageJSON.version = `${packageJSON.version}-alpha.${commit.slice(0, 5)}`;
145-
}
146-
}
147-
// otherwise we'll do a standard release with whatever version is in the package.json
148-
file.contents = new Buffer(JSON.stringify(packageJSON));
149-
});
150-
}
151-
152-
// custom gulp plugin
153-
// TODO: add to icon-loader
154-
// function replaceIcons() {
155-
// return through.obj(function (file, enc, cb) {
156-
// if (file.isNull()) {
157-
// return cb(null, file);
158-
// }
159-
// let asyncTrue = false;
160-
// iconLoader.prototype.async = function () {
161-
// asyncTrue = true;
162-
// };
163-
// iconLoader.prototype.callback = function (error, result) {
164-
// file.contents = new Buffer(result);
165-
// cb(null, file);
166-
// };
167-
// new iconLoader(file.contents.toString());
168-
// // no async means no processing, means return the file!
169-
// if (!asyncTrue) {
170-
// cb(null, file);
171-
// }
172-
// });
173-
// }
174-
175118
function replaceTemplates() {
176119
// regex borrwed from https://github.com/TheLarkInn/angular2-template-loader/blob/1403302e985bf689ee49e9dd8bb953225f32737b/index.js#L5-L7
177120
const templateUrlRegex = /templateUrl\s*:(\s*['"`](.*?)['"`])/g;

package-lock.json

Lines changed: 24 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
"utils:add": "git subtree add --prefix=src/utils [email protected]:peretz/utils.git master --squash",
1515
"utils:update": "git subtree pull --prefix=src/utils [email protected]:peretz/utils.git master --squash",
1616
"prepush": "bash scripts/prepush.sh",
17-
"build-storybook": "build-storybook",
18-
"semantic-release": "semantic-release -d"
17+
"build-storybook": "build-storybook -c .storybook -o dist/docs/storybook",
18+
"semantic-release": "semantic-release"
19+
},
20+
"release": {
21+
"pkgRoot": "dist"
1922
},
2023
"repository": {
2124
"type": "git",
22-
"url": "[email protected]:ibm/carbon-components-angular.git"
25+
"url": "git@github.ibm.com:peretz/carbon-components-angular.git"
2326
},
2427
"license": "Apache-2",
2528
"author": "IBM",
@@ -54,12 +57,12 @@
5457
"@angular/router": "6.1.0",
5558
"@compodoc/compodoc": "1.0.4",
5659
"@ngx-translate/core": "10.0.2",
57-
"@storybook/addon-actions": "^3.4.8",
58-
"@storybook/addon-knobs": "^3.4.8",
59-
"@storybook/addon-links": "^3.4.8",
60-
"@storybook/addon-notes": "^3.4.8",
61-
"@storybook/addons": "^3.4.8",
62-
"@storybook/angular": "^3.4.8",
60+
"@storybook/addon-actions": "3.4.8",
61+
"@storybook/addon-knobs": "3.4.8",
62+
"@storybook/addon-links": "3.4.8",
63+
"@storybook/addon-notes": "3.4.8",
64+
"@storybook/addons": "3.4.8",
65+
"@storybook/angular": "3.4.8",
6366
"@types/jasmine": "2.8.6",
6467
"@types/node": "8.5.2",
6568
"angular2-template-loader": "0.6.2",
@@ -102,7 +105,7 @@
102105
"stylelint-webpack-plugin": "0.10.4",
103106
"svgxuse": "1.2.6",
104107
"ts-helpers": "1.1.2",
105-
"ts-loader": "4.3.0",
108+
"ts-loader": "3.5.0",
106109
"tslint": "5.10.0",
107110
"tslint-loader": "3.6.0",
108111
"typescript": "2.9.2",
@@ -113,6 +116,5 @@
113116
"webpack-node-externals": "1.6.0",
114117
"whatwg-fetch": "2.0.3",
115118
"zone.js": "0.8.26"
116-
},
117-
"dependencies": {}
119+
}
118120
}

scripts/build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ ngc -p tsconfig-aot.json
88
webpack --config webpack.build.js
99
rm -rf dist/src dist/waste demo/bundle/documentation
1010

11+
# move/generate/update meta files into dist
1112
gulp build:meta
1213

13-
npm run docs:build && mv documentation demo/bundle/
14+
# generate ALL the documentation
15+
mkdir dist/docs
16+
npm run build-storybook
17+
npm run docs:build && mv documentation dist/docs/

scripts/deploy.sh

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,4 @@ if [[ ${TRAVIS_TEST_RESULT=0} == 1 ]]; then
77
exit 1;
88
fi
99

10-
# exit if the branch is wrong
11-
if [[ ${TRAVIS_BRANCH} =~ (master$|beta$|^v?[0-9]*\.[0-9]*\.[0-9]*$) || ${TRAVIS_EVENT_TYPE} == 'cron' ]]; then
12-
npm run build
13-
cd dist
14-
15-
#setup npm publishing
16-
npm publish
17-
18-
if [[ ${TRAVIS_BRANCH} =~ (master$|beta$|^v?[0-9]*\.[0-9]*\.[0-9]*$) ]]; then
19-
# Move to the top level folder, and make a "deploy" directory
20-
cd ../
21-
mkdir deploy
22-
cd deploy
23-
git init
24-
25-
# Configure Git
26-
git config user.name "Travis CI"
27-
git config user.email "[email protected]"
28-
29-
# pull the upstream pages
30-
git pull "[email protected]:ibm/carbon-components-angular.git" gh-pages
31-
32-
# copy to the master/alpha folder
33-
if [[ ${TRAVIS_BRANCH} == "master" ]]; then
34-
cp -R ../demo/bundle/* ./
35-
# copy to the beta folder
36-
elif [[ ${TRAVIS_EVENT_TYPE} == "cron" ]]; then
37-
mkdir -p beta
38-
cp -R ../demo/bundle/* beta
39-
# copy to the version folder
40-
elif [[ ${TRAVIS_BRANCH} =~ (^v?[0-9]*\.[0-9]*\.[0-9]*$) ]]; then
41-
mkdir -p $TRAVIS_BRANCH
42-
cp -R ../demo/bundle/* $TRAVIS_BRANCH
43-
fi
44-
45-
# in this case we want the script to keep running, so we can actually check the $? (status) var
46-
set +e
47-
# Commit all the things into the repo
48-
git add .
49-
git commit -m "Deploy to GitHub Pages"
50-
51-
# Force push to gh-pages if there was something to commit
52-
if [ $? -eq 0 ]; then
53-
git push --force "[email protected]:ibm/carbon-components-angular.git" master:gh-pages > /dev/null 2>&1
54-
fi
55-
exit 0;
56-
fi
57-
else
58-
echo "Branch type not recognized";
59-
echo "Skipping deploy";
60-
exit 0;
61-
fi
10+
npm run semantic-release

scripts/prepush.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ set -e
55
[email protected]:ibm/carbon-components-angular.git
66

77
# Refresh code
8-
git pull upstream master
8+
# git pull upstream master
99

10-
if [ $? -ne 0 ]
11-
then
12-
echo "Error: Couldn't pull from upstream."
13-
echo "Try running 'git remote add upstream $GITHUB_UPSTREAM' and try again."
14-
exit 1
15-
fi
10+
# if [ $? -ne 0 ]
11+
# then
12+
# echo "Error: Couldn't pull from upstream."
13+
# echo "Try running 'git remote add upstream $GITHUB_UPSTREAM' and try again."
14+
# exit 1
15+
# fi
1616

1717
#exit 1 # stops push from running, good for testing

webpack.build.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function rxjsExternal(context, request, cb) {
2020
}
2121

2222
module.exports = [{
23-
mode: "production",
2423
devtool: "source-map",
2524
entry: {
2625
neutrino: "./src/index.ts",

webpack.config.js

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)