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
e507cb2e
Commit
e507cb2e
authored
Nov 28, 2017
by
Дмитрий Никулин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for custom links, not only main/minified
parent
43688ce3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
1 deletion
+41
-1
functions.sh
functions.sh
+32
-1
registry.example.json
registry.example.json
+9
-0
No files found.
functions.sh
View file @
e507cb2e
...
...
@@ -32,6 +32,31 @@ remove_package() {
echo
"Removed old version (packages/
$library
/
$version
)"
}
add_custom_link
()
{
local
library
=
"
$1
"
local
version
=
"
$2
"
local
local_name
=
"
$3
"
local
public_name
=
"
$(
cat
registry.json | jq
-r
".installedLibraries[
\"
$library
\"
][
\"
$version
\"
].customLinks[
\"
$local_name
\"
]"
)
"
local
public_base
=
"public/
$library
/
$version
"
local
library_base
=
"packages/
$library
/
$version
/node_modules/
$library
"
link_and_print
"
$library_base
/
$local_name
"
"
$public_base
/
$public_name
"
}
add_custom_links
()
{
local
library
=
"
$1
"
local
version
=
"
$2
"
if
[
"
$(
cat
registry.json | jq
-r
".installedLibraries[
\"
$library
\"
][
\"
$version
\"
].customLinks"
)
"
!=
"null"
]
;
then
local
links
=
"
$(
cat
registry.json | jq
-r
".installedLibraries[
\"
$library
\"
][
\"
$version
\"
].customLinks | keys[]"
)
"
for
link
in
$links
;
do
add_custom_link
"
$library
"
"
$version
"
"
$link
"
done
fi
}
add_package
()
{
local
library
=
"
$1
"
local
version
=
"
$2
"
...
...
@@ -64,6 +89,7 @@ create_dist_link () {
link_and_print
"
$library_base
/
$main_file_minified
"
"
$public_base
/
$library
.min.js"
link_and_print
"
$public_base
/
$library
.min.js"
"
$public_base
/
$library
.js"
link_and_print
"
$library_base
/
$main_file
"
"
$public_base
/
$library
.development.js"
add_custom_links
"
$library
"
"
$version
"
}
create_package_version
()
{
...
...
@@ -104,7 +130,12 @@ install_or_update_package () {
link_and_print
()
{
[
-e
"
$1
"
]
||
fatal
"File not found:
$1
"
ln
-f
"
$1
"
"
$2
"
local
target_dirname
=
"
$(
dirname
"
$2
"
)
"
if
[
"
$target_dirname
"
!=
"."
]
;
then
mkdir
-p
"
$target_dirname
"
||
fatal
fi
ln
-f
"
$1
"
"
$2
"
||
fatal
echo
"Created hardlink:
$2
->
$1
"
}
...
...
registry.example.json
View file @
e507cb2e
...
...
@@ -6,6 +6,15 @@
"minified"
:
"umd/react.production.min.js"
}
},
"moment"
:
{
"2"
:
{
"main"
:
"moment.js"
,
"minified"
:
"min/moment.min.js"
,
"customLinks"
:
{
"locale"
:
"locale"
}
}
},
"jquery"
:
{
"latest"
:
{
"main"
:
"dist/jquery.js"
,
...
...
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