Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
c9b75df7
Commit
c9b75df7
authored
Dec 29, 2012
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add release support for map files.
parent
861a45b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
10 deletions
+45
-10
release.js
build/release.js
+45
-10
No files found.
build/release.js
View file @
c9b75df7
...
@@ -13,7 +13,7 @@ var fs = require("fs"),
...
@@ -13,7 +13,7 @@ var fs = require("fs"),
var
releaseVersion
,
var
releaseVersion
,
nextVersion
,
nextVersion
,
final
Files
,
CDN
Files
,
isBeta
,
isBeta
,
pkg
,
pkg
,
branch
,
branch
,
...
@@ -28,14 +28,18 @@ var releaseVersion,
...
@@ -28,14 +28,18 @@ var releaseVersion,
devFile
=
"dist/jquery.js"
,
devFile
=
"dist/jquery.js"
,
minFile
=
"dist/jquery.min.js"
,
minFile
=
"dist/jquery.min.js"
,
mapFile
=
"dist/jquery.min.map"
,
releaseFiles
=
{
releaseFiles
=
{
"jquery-VER.js"
:
devFile
,
"jquery-VER.js"
:
devFile
,
"jquery-VER.min.js"
:
minFile
,
"jquery-VER.min.js"
:
minFile
,
"jquery-VER.min.map"
:
mapFile
,
"jquery.js"
:
devFile
,
"jquery.js"
:
devFile
,
"jquery-latest.js"
:
devFile
,
"jquery.min.js"
:
minFile
,
"jquery.min.js"
:
minFile
,
"jquery-latest.min.js"
:
minFile
"jquery.min.map"
:
mapFile
,
"jquery-latest.js"
:
devFile
,
"jquery-latest.min.js"
:
minFile
,
"jquery-latest.min.map"
:
mapFile
};
};
steps
(
steps
(
...
@@ -93,6 +97,7 @@ function initialize( next ) {
...
@@ -93,6 +97,7 @@ function initialize( next ) {
nextVersion
=
major
+
"."
+
minor
+
"."
+
(
isBeta
?
patch
:
+
patch
+
1
)
+
"pre"
;
nextVersion
=
major
+
"."
+
minor
+
"."
+
(
isBeta
?
patch
:
+
patch
+
1
)
+
"pre"
;
next
();
next
();
}
}
function
checkGitStatus
(
next
)
{
function
checkGitStatus
(
next
)
{
git
(
[
"status"
],
function
(
error
,
stdout
,
stderr
)
{
git
(
[
"status"
],
function
(
error
,
stdout
,
stderr
)
{
var
onBranch
=
((
stdout
||
""
).
match
(
/On branch
(\S
+
)
/
)
||
[])[
1
];
var
onBranch
=
((
stdout
||
""
).
match
(
/On branch
(\S
+
)
/
)
||
[])[
1
];
...
@@ -108,12 +113,14 @@ function checkGitStatus( next ) {
...
@@ -108,12 +113,14 @@ function checkGitStatus( next ) {
next
();
next
();
});
});
}
}
function
tagReleaseVersion
(
next
)
{
function
tagReleaseVersion
(
next
)
{
updatePackageVersion
(
releaseVersion
);
updatePackageVersion
(
releaseVersion
);
git
(
[
"commit"
,
"-a"
,
"-m"
,
"Tagging the "
+
releaseVersion
+
" release."
],
function
(){
git
(
[
"commit"
,
"-a"
,
"-m"
,
"Tagging the "
+
releaseVersion
+
" release."
],
function
(){
git
(
[
"tag"
,
releaseVersion
],
next
,
debug
);
git
(
[
"tag"
,
releaseVersion
],
next
,
debug
);
},
debug
);
},
debug
);
}
}
function
gruntBuild
(
next
)
{
function
gruntBuild
(
next
)
{
exec
(
gruntCmd
,
[],
function
(
error
,
stdout
)
{
exec
(
gruntCmd
,
[],
function
(
error
,
stdout
)
{
if
(
error
)
{
if
(
error
)
{
...
@@ -123,28 +130,48 @@ function gruntBuild( next ) {
...
@@ -123,28 +130,48 @@ function gruntBuild( next ) {
next
();
next
();
},
debug
);
},
debug
);
}
}
function
makeReleaseCopies
(
next
)
{
function
makeReleaseCopies
(
next
)
{
final
Files
=
{};
CDN
Files
=
{};
Object
.
keys
(
releaseFiles
).
forEach
(
function
(
key
)
{
Object
.
keys
(
releaseFiles
).
forEach
(
function
(
key
)
{
var
builtFile
=
releaseFiles
[
key
],
var
text
,
builtFile
=
releaseFiles
[
key
],
releaseFile
=
key
.
replace
(
/VER/g
,
releaseVersion
);
releaseFile
=
key
.
replace
(
/VER/g
,
releaseVersion
);
// Beta releases don't update the jquery-latest etc. copies
// Beta releases don't update the jquery-latest etc. copies
if
(
!
isBeta
||
key
!==
releaseFile
)
{
if
(
!
isBeta
||
key
!==
releaseFile
)
{
copy
(
builtFile
,
releaseFile
);
finalFiles
[
releaseFile
]
=
builtFile
;
if
(
/
\.
map$/
.
test
(
releaseFile
)
)
{
// Map files need to reference the new uncompressed name;
// assume that all files reside in the same directory.
// "file":"jquery.min.js","sources":["jquery.js"]
text
=
fs
.
readFileSync
(
builtFile
,
"utf8"
)
.
replace
(
/"file":"
([^
"
]
+
)
","sources":
\[
"
([^
"
]
+
)
"
\]
/
,
"
\"
file
\"
:
\"
"
+
releaseFile
.
replace
(
/
\.
min
\.
map/
,
".min.js"
)
+
"
\"
,
\"
sources
\"
:[
\"
"
+
releaseFile
.
replace
(
/
\.
min
\.
map/
,
".js"
)
+
"
\"
]"
);
console
.
log
(
"Modifying map "
+
builtFile
+
" to "
+
releaseFile
);
if
(
!
debug
)
{
fs
.
writeFileSync
(
releaseFile
,
text
);
}
}
else
{
copy
(
builtFile
,
releaseFile
);
}
CDNFiles
[
releaseFile
]
=
builtFile
;
}
}
});
});
next
();
next
();
}
}
function
setNextVersion
(
next
)
{
function
setNextVersion
(
next
)
{
updatePackageVersion
(
nextVersion
);
updatePackageVersion
(
nextVersion
);
git
(
[
"commit"
,
"-a"
,
"-m"
,
"Updating the source version to "
+
nextVersion
],
next
,
debug
);
git
(
[
"commit"
,
"-a"
,
"-m"
,
"Updating the source version to "
+
nextVersion
],
next
,
debug
);
}
}
function
uploadToCDN
(
next
)
{
function
uploadToCDN
(
next
)
{
var
cmds
=
[];
var
cmds
=
[];
Object
.
keys
(
final
Files
).
forEach
(
function
(
name
)
{
Object
.
keys
(
CDN
Files
).
forEach
(
function
(
name
)
{
cmds
.
push
(
function
(
nxt
){
cmds
.
push
(
function
(
nxt
){
exec
(
"scp"
,
[
name
,
scpURL
],
nxt
,
debug
||
skipRemote
);
exec
(
"scp"
,
[
name
,
scpURL
],
nxt
,
debug
||
skipRemote
);
});
});
...
@@ -156,6 +183,7 @@ function uploadToCDN( next ) {
...
@@ -156,6 +183,7 @@ function uploadToCDN( next ) {
steps
.
apply
(
this
,
cmds
);
steps
.
apply
(
this
,
cmds
);
}
}
function
pushToGithub
(
next
)
{
function
pushToGithub
(
next
)
{
git
(
[
"push"
,
"--tags"
,
repoURL
,
branch
],
next
,
debug
||
skipRemote
);
git
(
[
"push"
,
"--tags"
,
repoURL
,
branch
],
next
,
debug
||
skipRemote
);
}
}
...
@@ -166,10 +194,12 @@ function steps() {
...
@@ -166,10 +194,12 @@ function steps() {
var
cur
=
0
,
var
cur
=
0
,
steps
=
arguments
;
steps
=
arguments
;
(
function
next
(){
(
function
next
(){
var
step
=
steps
[
cur
++
];
process
.
nextTick
(
function
(){
step
(
next
);
steps
[
cur
++
](
next
);
});
})();
})();
}
}
function
updatePackageVersion
(
ver
)
{
function
updatePackageVersion
(
ver
)
{
console
.
log
(
"Updating package.json version to "
+
ver
);
console
.
log
(
"Updating package.json version to "
+
ver
);
pkg
.
version
=
ver
;
pkg
.
version
=
ver
;
...
@@ -177,15 +207,18 @@ function updatePackageVersion( ver ) {
...
@@ -177,15 +207,18 @@ function updatePackageVersion( ver ) {
fs
.
writeFileSync
(
"package.json"
,
JSON
.
stringify
(
pkg
,
null
,
"
\
t"
)
+
"
\n
"
);
fs
.
writeFileSync
(
"package.json"
,
JSON
.
stringify
(
pkg
,
null
,
"
\
t"
)
+
"
\n
"
);
}
}
}
}
function
copy
(
oldFile
,
newFile
)
{
function
copy
(
oldFile
,
newFile
)
{
console
.
log
(
"Copying "
+
oldFile
+
" to "
+
newFile
);
console
.
log
(
"Copying "
+
oldFile
+
" to "
+
newFile
);
if
(
!
debug
)
{
if
(
!
debug
)
{
fs
.
writeFileSync
(
newFile
,
fs
.
readFileSync
(
oldFile
,
"utf8"
)
);
fs
.
writeFileSync
(
newFile
,
fs
.
readFileSync
(
oldFile
,
"utf8"
)
);
}
}
}
}
function
git
(
args
,
fn
,
skip
)
{
function
git
(
args
,
fn
,
skip
)
{
exec
(
"git"
,
args
,
fn
,
skip
);
exec
(
"git"
,
args
,
fn
,
skip
);
}
}
function
exec
(
cmd
,
args
,
fn
,
skip
)
{
function
exec
(
cmd
,
args
,
fn
,
skip
)
{
if
(
skip
)
{
if
(
skip
)
{
console
.
log
(
"# "
+
cmd
+
" "
+
args
.
join
(
" "
)
);
console
.
log
(
"# "
+
cmd
+
" "
+
args
.
join
(
" "
)
);
...
@@ -202,10 +235,12 @@ function exec( cmd, args, fn, skip ) {
...
@@ -202,10 +235,12 @@ function exec( cmd, args, fn, skip ) {
);
);
}
}
}
}
function
die
(
msg
)
{
function
die
(
msg
)
{
console
.
error
(
"ERROR: "
+
msg
);
console
.
error
(
"ERROR: "
+
msg
);
process
.
exit
(
1
);
process
.
exit
(
1
);
}
}
function
exit
()
{
function
exit
()
{
process
.
exit
(
0
);
process
.
exit
(
0
);
}
}
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