@reflexions/string-to-boolean 1.0.0 → 1.0.1
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/bump-version.sh +43 -0
- package/cjs/StringToBoolean.cjs +1 -0
- package/esm/StringToBoolean.mjs +1 -0
- package/package.json +1 -1
- package/publish.sh +1 -1
package/bump-version.sh
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# note: realpath isn't always installed, so use pwd in subshell instead
|
|
4
|
+
script_dir="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" || exit 1
|
|
5
|
+
cd "$script_dir" || exit 1
|
|
6
|
+
|
|
7
|
+
git diff-index --quiet HEAD --
|
|
8
|
+
has_changes=$?
|
|
9
|
+
|
|
10
|
+
if [ $has_changes == 1 ]; then
|
|
11
|
+
echo ""
|
|
12
|
+
echo "Must commit all changes before publishing"
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# bump the version for npm
|
|
17
|
+
echo "What type of update is this?"
|
|
18
|
+
echo "Options are: A/1 (major), I/2 (minor), P/3 (patch)"
|
|
19
|
+
|
|
20
|
+
read -p "Type: " -n 1 -r
|
|
21
|
+
echo ''
|
|
22
|
+
|
|
23
|
+
version=
|
|
24
|
+
if [[ $REPLY =~ ^[Aa1]$ ]]; then
|
|
25
|
+
version=$(npm --no-git-tag-version version major)
|
|
26
|
+
elif [[ $REPLY =~ ^[Ii2]$ ]]; then
|
|
27
|
+
version=$(npm --no-git-tag-version version minor)
|
|
28
|
+
elif [[ $REPLY =~ ^[Pp3]$ ]]; then
|
|
29
|
+
version=$(npm --no-git-tag-version version patch)
|
|
30
|
+
else
|
|
31
|
+
echo "Invalid option provided as update type. Valid options are: A, I, P."
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
if [ -z "$version" ]; then
|
|
36
|
+
echo "Failed to update version."
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
git push \
|
|
41
|
+
|| { echo "git push failed"; exit 1; }
|
|
42
|
+
|
|
43
|
+
echo "Successfully published $version"
|
package/cjs/StringToBoolean.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Converts a string to a boolean, treating '0', 'false', 'FALSE', 'off' and falsy values like '' to false, the rest to true.
|
|
5
5
|
* @param {string|boolean} value
|
|
6
|
+
* @returns Boolean
|
|
6
7
|
*/
|
|
7
8
|
const stringToBoolean = (value) => typeof value === 'boolean'
|
|
8
9
|
? value // param is already boolean
|
package/esm/StringToBoolean.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts a string to a boolean, treating '0', 'false', 'FALSE', 'off' and falsy values like '' to false, the rest to true.
|
|
3
3
|
* @param {string|boolean} value
|
|
4
|
+
* @returns Boolean
|
|
4
5
|
*/
|
|
5
6
|
const stringToBoolean = (value) => typeof value === 'boolean'
|
|
6
7
|
? value // param is already boolean
|
package/package.json
CHANGED
package/publish.sh
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
npm publish --access public
|
|
2
|
+
exec npm publish --access public
|