Skip to content

Commit bcfd536

Browse files
committed
chore: format bash
1 parent 1a4327c commit bcfd536

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

publish.sh

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,72 +2,72 @@
22
# Usage: bash publish.sh --build-only --emit
33

44
set -e # -x
5-
dir=$(pwd);
6-
bash_args="$@";
7-
prefix="doc-editor-";
8-
packages=(delta utils core plugin);
5+
dir=$(pwd)
6+
bash_args="$@"
7+
prefix="doc-editor-"
8+
packages=(delta utils core plugin)
99
# npm version patch --no-git-tag-version
10-
version=`echo "console.log(require(\"./package.json\").version)" | node`;
10+
version=$(echo "console.log(require(\"./package.json\").version)" | node)
1111

1212
function check_argument {
13-
local value=$1;
13+
local value=$1
1414
for arg in $bash_args; do
15-
if [ "$arg" == "$value" ] ; then
16-
return 0; # success
15+
if [ "$arg" == "$value" ]; then
16+
return 0 # success
1717
fi
1818
done
19-
return 1; # failure
19+
return 1 # failure
2020
}
2121

2222
function echo_notice {
23-
local value=$1;
23+
local value=$1
2424
echo -e "\033[32m$value\033[0m"
2525
}
2626

27-
echo_notice "Version: $version";
27+
echo_notice "Version: $version"
2828

2929
if ! check_argument "--emit" || check_argument "--build-only"; then
30-
echo_notice "Notice: Current Version Will Not Publish To NPM";
30+
echo_notice "Notice: Current Version Will Not Publish To NPM"
3131
fi
3232

3333
for item in "${packages[@]}"; do
34-
cd $dir;
35-
path="./packages/$item";
36-
cd $path;
37-
npm run build
34+
cd $dir
35+
path="./packages/$item"
36+
cd $path
37+
npm run build
3838
done
3939

4040
if check_argument "--build-only"; then
41-
exit 0;
41+
exit 0
4242
fi
4343

4444
for item in "${packages[@]}"; do
45-
cd $dir;
46-
path="./packages/$item";
47-
cd $path;
48-
echo "const fs = require('fs');
45+
cd $dir
46+
path="./packages/$item"
47+
cd $path
48+
echo "const fs = require('fs');
4949
const json = require('./package.json');
5050
json.version = '$version';
5151
const dep = json.dependencies || {};
5252
for(const [key, value] of Object.entries(dep)) {
5353
if(key.startsWith('$prefix')) dep[key] = '$version';
5454
}
5555
fs.writeFileSync('./package.json', JSON.stringify(json, null, 2));
56-
" | node;
57-
set +e;
58-
if check_argument "--emit"; then
59-
npm publish --registry=https://registry.npmjs.org/
60-
else
61-
npm publish --registry=https://registry.npmjs.org/ --dry-run
62-
fi
63-
set -e;
64-
echo "const fs = require('fs');
56+
" | node
57+
set +e
58+
if check_argument "--emit"; then
59+
npm publish --registry=https://registry.npmjs.org/
60+
else
61+
npm publish --registry=https://registry.npmjs.org/ --dry-run
62+
fi
63+
set -e
64+
echo "const fs = require('fs');
6565
const json = require('./package.json');
6666
json.version = '1.0.0';
6767
const dep = json.dependencies || {};
6868
for(const [key, value] of Object.entries(dep)) {
6969
if(key.startsWith('$prefix')) dep[key] = 'workspace: *';
7070
}
7171
fs.writeFileSync('./package.json', JSON.stringify(json, null, 2));
72-
" | node;
72+
" | node
7373
done

0 commit comments

Comments
 (0)