Skip to content
This repository was archived by the owner on Feb 12, 2020. It is now read-only.

Commit 0a76b6c

Browse files
committed
replace grunt with npm scripts
1 parent b1e93a0 commit 0a76b6c

File tree

15 files changed

+270
-181
lines changed

15 files changed

+270
-181
lines changed

Gruntfile.js

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

demo/assets/demo.css

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/assets/demo.css.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/vue-blob-forms.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm_scripts/css-scss.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
#
3+
# NPM: SCSS
4+
#
5+
# These are a little too cumbersome to deal with inside NPM.
6+
##
7+
8+
9+
10+
# Check dependencies.
11+
command -v sassc >/dev/null 2>&1 || {
12+
echo -e "\033[31;1mError:\033[0m sassc must be in \$PATH."
13+
exit 1
14+
}
15+
command -v stylecow >/dev/null 2>&1 || {
16+
echo -e "\033[31;1mError:\033[0m stylecow must be in \$PATH."
17+
echo -e "\033[96;1mFix:\033[0m npm i stylecow -g"
18+
exit 1
19+
}
20+
21+
22+
23+
# Compile the SCSS.
24+
echo -e "\033[2mcompiling:\033[0m demo.css"
25+
sassc --style=compressed src/scss/demo.scss demo/assets/demo.css
26+
if [ $? != 0 ]; then
27+
notify-send -i error --category dev.validate -h int:transient:1 -t 3000 "SCSS: Error" "Your SCSS did not validate."
28+
exit 1
29+
fi
30+
31+
# Run postcss clean ups.
32+
stylecow -c stylecow.json
33+
34+
35+
36+
exit 0

npm_scripts/icon.png

14.6 KB
Loading

npm_scripts/js-eslint-fix.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
#
3+
# NPM: ESlint
4+
#
5+
# These are a little too cumbersome to deal with inside NPM.
6+
##
7+
8+
9+
10+
# Check dependencies.
11+
command -v eslint >/dev/null 2>&1 || {
12+
echo -e "\033[31;1mError:\033[0m eslint must be in \$PATH."
13+
echo -e "\033[96;1mFix:\033[0m npm i eslint -g"
14+
exit 1
15+
}
16+
17+
18+
19+
# Not much to do.
20+
eslint --fix --color src/js/**/*.js
21+
22+
23+
24+
exit 0

npm_scripts/js-eslint.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
#
3+
# NPM: ESlint
4+
#
5+
# These are a little too cumbersome to deal with inside NPM.
6+
##
7+
8+
9+
10+
# Check dependencies.
11+
command -v eslint >/dev/null 2>&1 || {
12+
echo -e "\033[31;1mError:\033[0m eslint must be in \$PATH."
13+
echo -e "\033[96;1mFix:\033[0m npm i eslint -g"
14+
exit 1
15+
}
16+
17+
18+
19+
# Actually we just want to know if there are errors or not.
20+
eslint --color src/js/**/*.js
21+
if [ $? != 0 ]; then
22+
notify-send -i error --category dev.validate -h int:transient:1 -t 3000 "ESLint: Error" "Your Javascript did not validate."
23+
exit 1
24+
fi
25+
26+
27+
28+
exit 0

npm_scripts/js-uglify.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
#
3+
# NPM: Uglify Tasks
4+
#
5+
# These are a little too cumbersome to deal with inside NPM.
6+
##
7+
8+
9+
10+
# Check dependencies.
11+
command -v uglifyjs >/dev/null 2>&1 || {
12+
echo -e "\033[31;1mError:\033[0m uglifyjs must be in \$PATH."
13+
echo -e "\033[96;1mFix:\033[0m npm i uglify-es -g"
14+
exit 1
15+
}
16+
17+
18+
19+
declare -A SOURCES
20+
SOURCES["dist/vue-blob-forms.min.js"]="src/js/vue-blob-forms.js"
21+
SOURCES["demo/assets/demo.min.js"]="src/js/demo.js"
22+
23+
# Now loop through and compile!
24+
for i in "${!SOURCES[@]}"
25+
do
26+
echo -e "\033[2mcompiling:\033[0m $( basename "${SOURCES[$i]}" )"
27+
uglifyjs -c --ecma 6 -o "${i}" -- "${SOURCES[$i]}" &
28+
done
29+
30+
31+
32+
# We've run most of these operations in parallel, but we should wait to
33+
# exit once everything is done.
34+
for JOB in $( jobs -p ); do
35+
wait $JOB || exit 1
36+
done
37+
38+
39+
40+
# We're done!
41+
echo -e "\033[32;1mSuccess:\033[0m Uglification has completed!"
42+
exit 0

npm_scripts/notify-css.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
#
3+
# NPM: Notify CSS
4+
#
5+
# These are a little too cumbersome to deal with inside NPM.
6+
##
7+
8+
9+
10+
# Check dependencies.
11+
command -v notify-send >/dev/null 2>&1 || {
12+
echo -e "\033[31;1mError:\033[0m notify-send must be in \$PATH."
13+
exit 1
14+
}
15+
16+
17+
18+
notify-send -i "$( pwd )/npm_scripts/icon.png" --category dev.validate -h int:transient:1 -t 3000 "CSS" "The CSS has been linted, minified, and exported!"
19+
exit 0

0 commit comments

Comments
 (0)