videomail-client 8.3.0 → 8.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -2
- package/prototype/js/videomail-client.js +12 -15
- package/prototype/js/videomail-client.min.js +1 -1
- package/prototype/js/videomail-client.min.js.map +1 -1
- package/videomail-client.code-workspace +25 -0
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -46
- package/.nvmrc +0 -1
- package/.prettierignore +0 -1
- package/.travis.yml +0 -14
- package/audit-ci.json +0 -12
- package/babel.config.js +0 -38
- package/browserstack.png +0 -0
- package/env/dev/cert.pem +0 -26
- package/env/dev/key.pem +0 -28
- package/env/dev/release.sh +0 -96
- package/gulpfile.js +0 -241
- package/prettier.config.js +0 -8
- package/src/js/client.js +0 -210
- package/src/js/constants.js +0 -11
- package/src/js/events.js +0 -46
- package/src/js/index.js +0 -15
- package/src/js/options.js +0 -180
- package/src/js/resource.js +0 -206
- package/src/js/util/audioRecorder.js +0 -152
- package/src/js/util/browser.js +0 -319
- package/src/js/util/collectLogger.js +0 -72
- package/src/js/util/eventEmitter.js +0 -72
- package/src/js/util/humanize.js +0 -16
- package/src/js/util/mediaEvents.js +0 -148
- package/src/js/util/pretty.js +0 -70
- package/src/js/util/standardize.js +0 -71
- package/src/js/util/videomailError.js +0 -431
- package/src/js/wrappers/buttons.js +0 -670
- package/src/js/wrappers/container.js +0 -797
- package/src/js/wrappers/dimension.js +0 -149
- package/src/js/wrappers/form.js +0 -319
- package/src/js/wrappers/optionsWrapper.js +0 -81
- package/src/js/wrappers/visuals/inside/recorder/countdown.js +0 -83
- package/src/js/wrappers/visuals/inside/recorder/facingMode.js +0 -53
- package/src/js/wrappers/visuals/inside/recorder/pausedNote.js +0 -59
- package/src/js/wrappers/visuals/inside/recorder/recordNote.js +0 -42
- package/src/js/wrappers/visuals/inside/recorder/recordTimer.js +0 -149
- package/src/js/wrappers/visuals/inside/recorderInsides.js +0 -144
- package/src/js/wrappers/visuals/notifier.js +0 -341
- package/src/js/wrappers/visuals/recorder.js +0 -1492
- package/src/js/wrappers/visuals/replay.js +0 -355
- package/src/js/wrappers/visuals/userMedia.js +0 -541
- package/src/js/wrappers/visuals.js +0 -410
- package/src/styles/css/main.min.css.js +0 -1
- package/src/styles/styl/keyframes/blink.styl +0 -16
- package/src/styles/styl/main.styl +0 -126
- package/test/core/client.test.js +0 -64
- package/test/core/resource.test.js +0 -12
- package/test/util/audioRecorder.test.js +0 -13
- package/test/util/browser.test.js +0 -157
- package/test/util/collectLogger.test.js +0 -13
- package/test/util/eventEmitter.test.js +0 -13
- package/test/util/humanize.test.js +0 -21
- package/test/util/pretty.test.js +0 -116
- package/test/util/videomailError.test.js +0 -323
- package/test/wrappers/buttons.test.js +0 -15
- package/test/wrappers/container.test.js +0 -18
- package/test/wrappers/form.test.js +0 -13
- package/test/wrappers/notifier.test.js +0 -13
- package/test/wrappers/recorder.test.js +0 -18
- package/test/wrappers/replay.test.js +0 -15
- package/test/wrappers/userMedia.test.js +0 -13
- package/test/wrappers/visuals.test.js +0 -18
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"folders": [
|
|
3
|
+
{
|
|
4
|
+
"path": ".",
|
|
5
|
+
},
|
|
6
|
+
],
|
|
7
|
+
"settings": {
|
|
8
|
+
"cSpell.words": [
|
|
9
|
+
"animitter",
|
|
10
|
+
"browserlistrc",
|
|
11
|
+
"bytediff",
|
|
12
|
+
"corejs",
|
|
13
|
+
"cssnano",
|
|
14
|
+
"deepmerge",
|
|
15
|
+
"derequire",
|
|
16
|
+
"getusermedia",
|
|
17
|
+
"gulpfile",
|
|
18
|
+
"hyperscript",
|
|
19
|
+
"plusplus",
|
|
20
|
+
"styl",
|
|
21
|
+
"videomail",
|
|
22
|
+
"videomails",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
}
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
src/styles/css/main.min.css.js
|
package/.eslintrc.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: "@babel/eslint-parser",
|
|
3
|
-
extends: ["eslint:recommended", "plugin:import/recommended", "prettier"],
|
|
4
|
-
env: {
|
|
5
|
-
browser: true,
|
|
6
|
-
node: true,
|
|
7
|
-
es6: true,
|
|
8
|
-
},
|
|
9
|
-
settings: {
|
|
10
|
-
"import/resolver": {
|
|
11
|
-
node: true,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
rules: {
|
|
15
|
-
// Turns on errors for missing imports which is great
|
|
16
|
-
"import/no-unresolved": "error",
|
|
17
|
-
|
|
18
|
-
// TODO Fix later
|
|
19
|
-
"sort-imports": "off",
|
|
20
|
-
"sort-keys": "off",
|
|
21
|
-
"no-warning-comments": "off",
|
|
22
|
-
"prefer-arrow-callback": "off",
|
|
23
|
-
"func-names": "off",
|
|
24
|
-
"no-magic-numbers": "off",
|
|
25
|
-
"id-length": "off",
|
|
26
|
-
"no-empty-function": "off",
|
|
27
|
-
"no-shadow": "off",
|
|
28
|
-
"max-lines": "off",
|
|
29
|
-
"max-statements": "off",
|
|
30
|
-
"max-lines-per-function": "off",
|
|
31
|
-
"no-undefined": "off",
|
|
32
|
-
"one-var": "off",
|
|
33
|
-
"no-inline-comments": "off",
|
|
34
|
-
"line-comment-position": "off",
|
|
35
|
-
"capitalized-comments": "off",
|
|
36
|
-
"func-style": "off",
|
|
37
|
-
"prefer-destructuring": "off",
|
|
38
|
-
"init-declarations": "off",
|
|
39
|
-
"no-invalid-this": "off",
|
|
40
|
-
"no-multi-assign": "off",
|
|
41
|
-
"max-params": "off",
|
|
42
|
-
"no-plusplus": "off",
|
|
43
|
-
"no-ternary": "off",
|
|
44
|
-
complexity: "off",
|
|
45
|
-
},
|
|
46
|
-
};
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
20.12.2
|
package/.prettierignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
src/styles/css/main.min.css.js
|
package/.travis.yml
DELETED
package/audit-ci.json
DELETED
package/babel.config.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const getPresetOptions = (isTest = false, isProduction = false) => {
|
|
2
|
-
if (isTest) return { targets: { node: 'current' } } // for speed
|
|
3
|
-
|
|
4
|
-
return {
|
|
5
|
-
// undefined means parse .browserlistrc by default
|
|
6
|
-
targets: !isProduction ? 'last 2 versions' : undefined
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const getBabelConfig = (api) => {
|
|
11
|
-
const isDev = api.env('development')
|
|
12
|
-
const isTest = api.env('test')
|
|
13
|
-
const isProduction = api.env('production')
|
|
14
|
-
|
|
15
|
-
api.cache.using(() => isDev || isTest)
|
|
16
|
-
|
|
17
|
-
const presets = [['@babel/preset-env', getPresetOptions(isTest, isProduction)]]
|
|
18
|
-
|
|
19
|
-
const plugins = [
|
|
20
|
-
// Polyfills the runtime needed for async/await, generators, and friends
|
|
21
|
-
// https://babeljs.io/docs/en/babel-plugin-transform-runtime
|
|
22
|
-
!isTest && [
|
|
23
|
-
'@babel/plugin-transform-runtime',
|
|
24
|
-
{
|
|
25
|
-
corejs: false,
|
|
26
|
-
regenerator: true
|
|
27
|
-
}
|
|
28
|
-
]
|
|
29
|
-
].filter(Boolean)
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
presets: presets,
|
|
33
|
-
plugins: plugins,
|
|
34
|
-
compact: isProduction
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = getBabelConfig
|
package/browserstack.png
DELETED
|
Binary file
|
package/env/dev/cert.pem
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
-----BEGIN CERTIFICATE-----
|
|
2
|
-
MIIEdDCCAtygAwIBAgIQahesr100LQNx3g/dA6Ub9jANBgkqhkiG9w0BAQsFADB1
|
|
3
|
-
MR4wHAYDVQQKEx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9XFxZsoVQyWd
|
|
21
|
-
4zGIjINPowBj/uVkcZxN9fWcCQ758uftD7gPhXTI9rnrvzZXAwVTOxxJAoGBAMWS
|
|
22
|
-
3cWlFLdVX30Kx2h36KWv1bTpLwnu9IQ7V+/YSsVZFxC+VuiKOjouwbeHwgJvBPmR
|
|
23
|
-
j7WkFCiv+mQia0BcvnqSKt7DKCxtvOw46QeBSV45AGB79kl1wmCIwYW4LOVhPe9U
|
|
24
|
-
AiXEIWwyRrjFzJ9kBiorP+ZrVRbB2AZS+jR0qNdDAoGBAPAtyDsb/0cFLnGka30l
|
|
25
|
-
efGvPnOTlzVarfmqK9YAZUF4SaEZAzDWqdLUD03eN6IIXtbS/CGGv+pqxZA4GYlL
|
|
26
|
-
7DvDOh3fRlB/Ak0iHRiqss84noXuZ6tQWTXkY/ew02RzO/gjFEhgwI3C2B8BfYhi
|
|
27
|
-
OfNBtRJmoHQLrW8jMMLAm81c
|
|
28
|
-
-----END PRIVATE KEY-----
|
package/env/dev/release.sh
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
set -eo pipefail
|
|
3
|
-
|
|
4
|
-
GREEN='\033[0;32m'
|
|
5
|
-
NC='\033[0m' # No Color
|
|
6
|
-
|
|
7
|
-
info() {
|
|
8
|
-
printf "${GREEN}$@${NC}"
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export GIT_MERGE_AUTOEDIT=no
|
|
12
|
-
|
|
13
|
-
die() {
|
|
14
|
-
unset GIT_MERGE_AUTOEDIT
|
|
15
|
-
echo >&2 "☠ ☠ ☠ ☠ ☠ ☠ ☠ $@ ☠ ☠ ☠ ☠ ☠ ☠ ☠"
|
|
16
|
-
exit 1
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
info "Checking for vulnerabilities...\n"
|
|
20
|
-
|
|
21
|
-
# thanks to set -e it will exit here if audit fails
|
|
22
|
-
npm run audit
|
|
23
|
-
|
|
24
|
-
# todo: figure out an elegant solution to avoid duplicate code
|
|
25
|
-
# when having three bash scripts for patches, features and releases
|
|
26
|
-
# maybe with command line args?
|
|
27
|
-
# when done, rename this file
|
|
28
|
-
|
|
29
|
-
for i in "$@"; do
|
|
30
|
-
case $i in
|
|
31
|
-
-i=* | --importance=*)
|
|
32
|
-
IMPORTANCE="${i#*=}"
|
|
33
|
-
shift # past argument=value
|
|
34
|
-
;;
|
|
35
|
-
*)
|
|
36
|
-
# unknown option
|
|
37
|
-
;;
|
|
38
|
-
esac
|
|
39
|
-
done
|
|
40
|
-
|
|
41
|
-
if [[ -z ${IMPORTANCE:-} ]]; then
|
|
42
|
-
die "Aborting the bump! Argument --importance is missing"
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
# ensures all is commited
|
|
46
|
-
if [[ $(git status --porcelain) ]]; then
|
|
47
|
-
die "Aborting the bump! You have uncommitted changes"
|
|
48
|
-
fi
|
|
49
|
-
|
|
50
|
-
# Ensures master is up to date
|
|
51
|
-
git checkout master
|
|
52
|
-
git pull
|
|
53
|
-
git checkout develop
|
|
54
|
-
|
|
55
|
-
info "Figuring next version for importance ${IMPORTANCE}...\n"
|
|
56
|
-
read VERSION <<<$(gulp bumpVersion --importance=$IMPORTANCE | awk '/to/ {print $5}')
|
|
57
|
-
info "It's version ${VERSION}\n"
|
|
58
|
-
|
|
59
|
-
git checkout master
|
|
60
|
-
git push
|
|
61
|
-
git checkout develop
|
|
62
|
-
git push
|
|
63
|
-
|
|
64
|
-
# Start a new release
|
|
65
|
-
git flow release start $VERSION
|
|
66
|
-
|
|
67
|
-
# This will increment version in package.json
|
|
68
|
-
gulp bumpVersion --write --version=$VERSION
|
|
69
|
-
|
|
70
|
-
# Ensure dependencies are okay
|
|
71
|
-
npm install
|
|
72
|
-
|
|
73
|
-
# Rebuild all assets
|
|
74
|
-
gulp build --minify
|
|
75
|
-
|
|
76
|
-
git add -A
|
|
77
|
-
git commit -m "Final commit of version $VERSION" --no-edit
|
|
78
|
-
|
|
79
|
-
info "Publishing to npm ...\n"
|
|
80
|
-
npm publish
|
|
81
|
-
|
|
82
|
-
# Complete the release. This will also tag it.
|
|
83
|
-
git flow release finish $VERSION -p -m "Completing release of $VERSION"
|
|
84
|
-
|
|
85
|
-
git checkout master
|
|
86
|
-
git push --follow-tags
|
|
87
|
-
|
|
88
|
-
# Prepare the develop branch for the new cycle
|
|
89
|
-
git checkout develop
|
|
90
|
-
|
|
91
|
-
# Strange bug, have to bump it again
|
|
92
|
-
gulp bumpVersion --write --version=$VERSION
|
|
93
|
-
|
|
94
|
-
unset GIT_MERGE_AUTOEDIT
|
|
95
|
-
|
|
96
|
-
info "\nAll good. Ready for the next cycle!\n"
|
package/gulpfile.js
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* todo write this in ES6 once i have figured out how to
|
|
3
|
-
* transpile it with babelify itself
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const fs = require("fs");
|
|
8
|
-
const gulp = require("gulp");
|
|
9
|
-
const plugins = require("gulp-load-plugins")();
|
|
10
|
-
const nib = require("nib");
|
|
11
|
-
const browserify = require("browserify");
|
|
12
|
-
const source = require("vinyl-source-stream");
|
|
13
|
-
const buffer = require("vinyl-buffer");
|
|
14
|
-
const Router = require("router");
|
|
15
|
-
const bodyParser = require("body-parser");
|
|
16
|
-
const send = require("connect-send-json");
|
|
17
|
-
const del = require("del");
|
|
18
|
-
const minimist = require("minimist");
|
|
19
|
-
const watchify = require("watchify");
|
|
20
|
-
const babelify = require("babelify");
|
|
21
|
-
const tapeRun = require("tape-run");
|
|
22
|
-
const glob = require("glob");
|
|
23
|
-
const log = require("fancy-log");
|
|
24
|
-
const autoprefixer = require("autoprefixer");
|
|
25
|
-
const cssnano = require("cssnano");
|
|
26
|
-
|
|
27
|
-
const packageJson = require("./package.json");
|
|
28
|
-
|
|
29
|
-
const defaultOptions = {
|
|
30
|
-
minify: true,
|
|
31
|
-
importance: null,
|
|
32
|
-
write: false,
|
|
33
|
-
version: null,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const options = minimist(process.argv.slice(2), { default: defaultOptions });
|
|
37
|
-
|
|
38
|
-
log.info("Options:", options);
|
|
39
|
-
|
|
40
|
-
function cleanJs(cb) {
|
|
41
|
-
del.sync(["prototype/js/*.js", "prototype/js/*.js.map"]);
|
|
42
|
-
cb();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function stylus() {
|
|
46
|
-
const postCssPlugins = [autoprefixer(), cssnano()];
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
gulp
|
|
50
|
-
.src("src/styles/styl/main.styl")
|
|
51
|
-
.pipe(plugins.plumber()) // with the plumber the gulp task won't crash on errors
|
|
52
|
-
.pipe(
|
|
53
|
-
plugins.stylus({
|
|
54
|
-
use: [nib()],
|
|
55
|
-
errors: true,
|
|
56
|
-
}),
|
|
57
|
-
)
|
|
58
|
-
/*
|
|
59
|
-
* always minify otherwise it gets broken with line-breaks
|
|
60
|
-
* when surrounded with `'s when injected
|
|
61
|
-
* todo: fix this, so that it also works when not minified, this
|
|
62
|
-
* for faster builds during development
|
|
63
|
-
*/
|
|
64
|
-
.pipe(plugins.postcss(postCssPlugins))
|
|
65
|
-
.pipe(plugins.rename({ suffix: ".min", extname: ".css.js" }))
|
|
66
|
-
.pipe(plugins.injectString.wrap("module.exports='", "'"))
|
|
67
|
-
// todo: location is bad, should be in a temp folder or so
|
|
68
|
-
.pipe(gulp.dest("src/styles/css"))
|
|
69
|
-
.pipe(plugins.connect.reload())
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const cache = {};
|
|
74
|
-
const packageCache = {};
|
|
75
|
-
|
|
76
|
-
function bundle(done, watching) {
|
|
77
|
-
const entry = path.join(__dirname, packageJson.module);
|
|
78
|
-
const bundler = browserify({
|
|
79
|
-
entries: [entry],
|
|
80
|
-
cache,
|
|
81
|
-
standalone: "VideomailClient",
|
|
82
|
-
packageCache,
|
|
83
|
-
plugin: watching ? [watchify] : null,
|
|
84
|
-
debug: !options.minify, // enables inline source maps
|
|
85
|
-
})
|
|
86
|
-
.on("update", () => {
|
|
87
|
-
pump();
|
|
88
|
-
log("Re-bundling ...");
|
|
89
|
-
})
|
|
90
|
-
.on("log", log)
|
|
91
|
-
.require(entry, { expose: "videomail-client" })
|
|
92
|
-
.transform(babelify);
|
|
93
|
-
|
|
94
|
-
function pump() {
|
|
95
|
-
return bundler
|
|
96
|
-
.bundle()
|
|
97
|
-
.on("error", function (err) {
|
|
98
|
-
console.error(err.toString());
|
|
99
|
-
this.emit("end");
|
|
100
|
-
})
|
|
101
|
-
.on("end", done)
|
|
102
|
-
.pipe(source("./src/")) // gives streaming vinyl file object
|
|
103
|
-
.pipe(buffer()) // required because the next steps do not support streams
|
|
104
|
-
.pipe(plugins.concat("videomail-client.js"))
|
|
105
|
-
.pipe(plugins.derequire())
|
|
106
|
-
.pipe(gulp.dest("prototype/js"))
|
|
107
|
-
.pipe(plugins.plumber())
|
|
108
|
-
.pipe(plugins.if(options.minify, plugins.rename({ suffix: ".min" })))
|
|
109
|
-
.pipe(plugins.if(options.minify, plugins.sourcemaps.init()))
|
|
110
|
-
.pipe(plugins.if(options.minify, plugins.bytediff.start()))
|
|
111
|
-
.pipe(plugins.if(options.minify, plugins.terser()))
|
|
112
|
-
.pipe(plugins.if(options.minify, plugins.bytediff.stop()))
|
|
113
|
-
.pipe(plugins.if(options.minify, plugins.sourcemaps.write("/")))
|
|
114
|
-
.pipe(plugins.if(options.minify, gulp.dest("prototype/js")))
|
|
115
|
-
.pipe(plugins.connect.reload());
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return pump();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function bundleWithWatchify(done) {
|
|
122
|
-
bundle(done, true);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function middleware() {
|
|
126
|
-
const router = new Router();
|
|
127
|
-
|
|
128
|
-
router.use(bodyParser.json());
|
|
129
|
-
router.use(send.json());
|
|
130
|
-
|
|
131
|
-
// does not work, see bug https://github.com/AveVlad/gulp-connect/issues/170
|
|
132
|
-
router.post("/contact", function (req, res) {
|
|
133
|
-
log.info("Videomail data received (with meta data):", req.body);
|
|
134
|
-
|
|
135
|
-
/*
|
|
136
|
-
* At this stage, a backend could store the videomail_key in req.body
|
|
137
|
-
* into a database for replay functionality
|
|
138
|
-
*/
|
|
139
|
-
|
|
140
|
-
// Just an example to see that the backend can do anything with the data
|
|
141
|
-
res.json({
|
|
142
|
-
status: `Inserted on ${new Date().toISOString()}`,
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
return [router];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const connectOptions = {
|
|
150
|
-
root: ["prototype"],
|
|
151
|
-
port: 8080,
|
|
152
|
-
debug: true,
|
|
153
|
-
livereload: false, // disabled since it's broken unfortunately, see https://github.com/intesso/connect-livereload/issues/79
|
|
154
|
-
middleware,
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
function connectHttp(done) {
|
|
158
|
-
plugins.connect.server(connectOptions);
|
|
159
|
-
done();
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function connectHttps(done) {
|
|
163
|
-
const SSL_CERTS_PATH = path.join(__dirname, "env", "dev");
|
|
164
|
-
|
|
165
|
-
plugins.connect.server({
|
|
166
|
-
...connectOptions,
|
|
167
|
-
port: 8443,
|
|
168
|
-
https: {
|
|
169
|
-
key: fs.readFileSync(path.join(SSL_CERTS_PATH, "key.pem")),
|
|
170
|
-
cert: fs.readFileSync(path.join(SSL_CERTS_PATH, "cert.pem")),
|
|
171
|
-
},
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
done();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function reload(done) {
|
|
178
|
-
plugins.connect.reload();
|
|
179
|
-
done();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function watch(done) {
|
|
183
|
-
gulp.watch(["src/styles/styl/**/*.styl"], stylus);
|
|
184
|
-
gulp.watch(["prototype/*.html"], reload);
|
|
185
|
-
|
|
186
|
-
done();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
exports.test = function (done) {
|
|
190
|
-
const testFiles = glob.sync("test/**/*.test.js");
|
|
191
|
-
const bundler = browserify({
|
|
192
|
-
entries: testFiles,
|
|
193
|
-
}).transform(babelify);
|
|
194
|
-
|
|
195
|
-
bundler
|
|
196
|
-
.bundle()
|
|
197
|
-
.on("error", function (err) {
|
|
198
|
-
console.error(err.toString());
|
|
199
|
-
this.emit("end");
|
|
200
|
-
done();
|
|
201
|
-
})
|
|
202
|
-
.pipe(tapeRun({ sandbox: false }))
|
|
203
|
-
.on("results", function () {
|
|
204
|
-
done();
|
|
205
|
-
})
|
|
206
|
-
.pipe(process.stdout);
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
/*
|
|
210
|
-
* get inspired by
|
|
211
|
-
* https://www.npmjs.com/package/gulp-tag-version and
|
|
212
|
-
* https://github.com/nicksrandall/gulp-release-tasks/blob/master/tasks/release.js
|
|
213
|
-
*/
|
|
214
|
-
exports.bumpVersion = function () {
|
|
215
|
-
const bumpOptions = {};
|
|
216
|
-
|
|
217
|
-
if (options.version) {
|
|
218
|
-
bumpOptions.version = options.version;
|
|
219
|
-
} else if (options.importance) {
|
|
220
|
-
bumpOptions.type = options.importance;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
console.log({ bumpOptions });
|
|
224
|
-
|
|
225
|
-
return gulp
|
|
226
|
-
.src(["./package.json"])
|
|
227
|
-
.pipe(plugins.bump(bumpOptions))
|
|
228
|
-
.pipe(plugins.if(options.write, gulp.dest("./")))
|
|
229
|
-
.on("error", log.error);
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
const build = gulp.series(gulp.parallel(gulp.series(stylus, cleanJs, bundle)));
|
|
233
|
-
|
|
234
|
-
exports.watch = gulp.series(
|
|
235
|
-
gulp.parallel(gulp.series(stylus, cleanJs, bundleWithWatchify)),
|
|
236
|
-
gulp.parallel(connectHttp, connectHttps),
|
|
237
|
-
watch,
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
exports.build = build;
|
|
241
|
-
exports.default = build;
|