Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
local-cdn
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eterfund
local-cdn
Commits
de586eac
Commit
de586eac
authored
7 years ago
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small refactoring and fix shellcheck warnings
parent
4804c61a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
17 deletions
+20
-17
add.sh
add.sh
+1
-1
check_code.sh
check_code.sh
+5
-1
functions.sh
functions.sh
+12
-13
init.sh
init.sh
+1
-1
update.sh
update.sh
+1
-1
No files found.
add.sh
View file @
de586eac
...
...
@@ -42,6 +42,6 @@ fi
[
-n
"
$force
"
]
&&
remove_package
"
$library
"
"
$version
"
add_package
"
$library
"
"
$version
"
"
$main
"
"
$main_minified
"
add_package
"
$library
"
"
$version
"
"
$main
"
"
$main_minified
"
||
fatal
registry_add_library_version
"
$library
"
"
$version
"
"
$main
"
"
$main_minified
"
This diff is collapsed.
Click to expand it.
check_code.sh
View file @
de586eac
...
...
@@ -8,6 +8,10 @@ epm assure shellcheck || exit
EXCL
=
-eSC2086
,SC2039,SC2034,SC2068,SC2155
# taste case
# SC2002: Useless cat.
EXCL
=
"
$EXCL
,SC2002"
if
[
-n
"
$1
"
]
;
then
shellcheck
$EXCL
"
$1
"
#checkbashisms -f "$1"
...
...
@@ -17,4 +21,4 @@ fi
#checkbashisms -f *.sh
#checkbashisms -f Makefile
shellcheck
$EXCL
*
.sh
shellcheck
$EXCL
./
*
.sh
This diff is collapsed.
Click to expand it.
functions.sh
View file @
de586eac
#!/bin/bash
fatal
()
{
echo
"Error:
$*
"
>
&2
exit
1
...
...
@@ -37,7 +39,7 @@ create_dist_link () {
public_base
=
"public/
$library
/
$version
"
library_base
=
"packages/
$library
/
$version
/node_modules/
$library
"
mkdir
-p
"
$public_base
"
mkdir
-p
"
$public_base
"
||
fatal
#if [ -z "$3" ]; then
# main_file=$(npm view "$1" main)
#else
...
...
@@ -62,32 +64,29 @@ create_package_version () {
"description": "",
"version": "0.1.0",
"dependencies": {
EOL
echo
"
\"
$1
\"
:
\"
$semver_version
\"
"
>>
"packages/
$1
/
$2
/package.json"
cat
>>
"packages/
$1
/
$2
/package.json"
<<
EOL
"
$1
": "
$semver_version
"
}
}
EOL
}
install_or_update_package
()
{
cd
"packages/
$1
/
$2
/"
if
!
npm i
>
/dev/null 2>&1
;
then
fatal
"Failed to install
$1
@
$2
"
fi
cd
../../../
cd
"packages/
$1
/
$2
/"
||
fatal
npm i
>
/dev/null
||
fatal
"Failed to install
$1
@
$2
"
cd
../../../
||
fatal
}
link_and_print
()
{
if
!
[
-e
"
$1
"
]
;
then
fatal
"File not found:
$1
"
fi
[
-e
"
$1
"
]
||
fatal
"File not found:
$1
"
ln
-f
"
$1
"
"
$2
"
echo
"Created hardlink:
$2
->
$1
"
}
registry_add_library_version
()
{
new_registry
=
$(
cat
registry.json | jq
--arg
lib
"
$1
"
--arg
version
"
$2
"
--arg
main
"
$3
"
--arg
minified
"
$4
"
".installedLibraries[
\"
$1
\"
][
\"
$2
\"
] = {
"
main
":
\$
main, "
minified
":
\$
minified}"
)
||
fatal
"jq error"
new_registry
=
$(
cat
registry.json | jq
--arg
lib
"
$1
"
--arg
version
"
$2
"
--arg
main
"
$3
"
--arg
minified
"
$4
"
".installedLibraries[
\"
$1
\"
][
\"
$2
\"
] = {
\"
main
\"
:
\$
main,
\"
minified
\
"
:
\$
minified}"
)
||
fatal
"jq error"
echo
"
$new_registry
"
>
registry.json
}
...
...
This diff is collapsed.
Click to expand it.
init.sh
View file @
de586eac
...
...
@@ -12,4 +12,4 @@ cat >> registry.json << EOL
EOL
echo
"Created new registry.json (list of installed libraries)."
echo
"Now use
add.sh
to add some libraries."
echo
"Now use
'./add.sh library version main main-minified'
to add some libraries."
This diff is collapsed.
Click to expand it.
update.sh
View file @
de586eac
...
...
@@ -21,6 +21,6 @@ if [ -z "$library" ] || [ -z "$version" ]; then
exit
fi
registry_package_exists
"
$library
"
"
$version
"
||
fatal
"Package not installed:
$library
@
$version
"
registry_package_exists
"
$library
"
"
$version
"
||
fatal
"Package
is
not installed:
$library
@
$version
"
update_package
"
$library
"
"
$version
"
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment