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
0135a223
Commit
0135a223
authored
May 09, 2013
by
Dave Methvin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create CDN archives in the build script.
parent
9260f6c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
13 deletions
+59
-13
release.js
build/release.js
+59
-13
No files found.
build/release.js
View file @
0135a223
...
@@ -13,7 +13,6 @@ var fs = require("fs"),
...
@@ -13,7 +13,6 @@ var fs = require("fs"),
var
releaseVersion
,
var
releaseVersion
,
nextVersion
,
nextVersion
,
CDNFiles
,
isBeta
,
isBeta
,
pkg
,
pkg
,
branch
,
branch
,
...
@@ -40,7 +39,18 @@ var releaseVersion,
...
@@ -40,7 +39,18 @@ var releaseVersion,
"jquery-latest.js"
:
devFile
,
"jquery-latest.js"
:
devFile
,
"jquery-latest.min.js"
:
minFile
,
"jquery-latest.min.js"
:
minFile
,
"jquery-latest.min.map"
:
mapFile
"jquery-latest.min.map"
:
mapFile
};
},
jQueryFilesCDN
=
[],
googleFilesCDN
=
[
"jquery.js"
,
"jquery.min.js"
,
"jquery.min.map"
],
msFilesCDN
=
[
"jquery-VER.js"
,
"jquery-VER.min.js"
,
"jquery-VER.min.map"
];
steps
(
steps
(
initialize
,
initialize
,
...
@@ -49,7 +59,9 @@ steps(
...
@@ -49,7 +59,9 @@ steps(
gruntBuild
,
gruntBuild
,
makeReleaseCopies
,
makeReleaseCopies
,
setNextVersion
,
setNextVersion
,
uploadToCDN
,
copyTojQueryCDN
,
buildGoogleCDN
,
buildMicrosoftCDN
,
pushToGithub
,
pushToGithub
,
exit
exit
);
);
...
@@ -64,8 +76,8 @@ function initialize( next ) {
...
@@ -64,8 +76,8 @@ function initialize( next ) {
// First arg should be the version number being released
// First arg should be the version number being released
var
newver
,
oldver
,
var
newver
,
oldver
,
r
version
=
/^
(\d)\.(\d
+
)\.(\d)((?:
a|b|rc
)\d
|pre
)?
$/
,
r
semver
=
/^
(\d
+
)\.(\d
+
)\.(\d
+
)(?:
-
([\d
A-Za-z
\-]
+
(?:\.[\d
A-Za-z
\-]
+
)
*
)
)?
$/
,
version
=
(
process
.
argv
[
3
]
||
""
).
toLowerCase
().
match
(
r
version
)
||
{},
version
=
(
process
.
argv
[
3
]
||
""
).
toLowerCase
().
match
(
r
semver
)
||
{},
major
=
version
[
1
],
major
=
version
[
1
],
minor
=
version
[
2
],
minor
=
version
[
2
],
patch
=
version
[
3
],
patch
=
version
[
3
],
...
@@ -87,14 +99,14 @@ function initialize( next ) {
...
@@ -87,14 +99,14 @@ function initialize( next ) {
pkg
=
JSON
.
parse
(
fs
.
readFileSync
(
"package.json"
)
);
pkg
=
JSON
.
parse
(
fs
.
readFileSync
(
"package.json"
)
);
console
.
log
(
"Current version is "
+
pkg
.
version
+
"; generating release "
+
releaseVersion
);
console
.
log
(
"Current version is "
+
pkg
.
version
+
"; generating release "
+
releaseVersion
);
version
=
pkg
.
version
.
match
(
r
version
);
version
=
pkg
.
version
.
match
(
r
semver
);
oldver
=
(
+
version
[
1
]
)
*
10000
+
(
+
version
[
2
]
*
100
)
+
(
+
version
[
3
]
)
oldver
=
(
+
version
[
1
]
)
*
10000
+
(
+
version
[
2
]
*
100
)
+
(
+
version
[
3
]
)
newver
=
(
+
major
)
*
10000
+
(
+
minor
*
100
)
+
(
+
patch
);
newver
=
(
+
major
)
*
10000
+
(
+
minor
*
100
)
+
(
+
patch
);
if
(
newver
<
oldver
)
{
if
(
newver
<
oldver
)
{
die
(
"Next version is older than current version!"
);
die
(
"Next version is older than current version!"
);
}
}
nextVersion
=
major
+
"."
+
minor
+
"."
+
(
isBeta
?
patch
:
+
patch
+
1
)
+
"pre"
;
nextVersion
=
major
+
"."
+
minor
+
"."
+
(
isBeta
?
patch
:
+
patch
+
1
)
+
"
-
pre"
;
next
();
next
();
}
}
...
@@ -105,10 +117,10 @@ function checkGitStatus( next ) {
...
@@ -105,10 +117,10 @@ function checkGitStatus( next ) {
die
(
"Branches don't match: Wanted "
+
branch
+
", got "
+
onBranch
);
die
(
"Branches don't match: Wanted "
+
branch
+
", got "
+
onBranch
);
}
}
if
(
/Changes to be committed/i
.
test
(
stdout
)
)
{
if
(
/Changes to be committed/i
.
test
(
stdout
)
)
{
die
(
"Please commit changed files before attemping to push a release."
);
die
IfReal
(
"Please commit changed files before attemping to push a release."
);
}
}
if
(
/Changes not staged for commit/i
.
test
(
stdout
)
)
{
if
(
/Changes not staged for commit/i
.
test
(
stdout
)
)
{
die
(
"Please stash files before attempting to push a release."
);
die
IfReal
(
"Please stash files before attempting to push a release."
);
}
}
next
();
next
();
});
});
...
@@ -132,7 +144,6 @@ function gruntBuild( next ) {
...
@@ -132,7 +144,6 @@ function gruntBuild( next ) {
}
}
function
makeReleaseCopies
(
next
)
{
function
makeReleaseCopies
(
next
)
{
CDNFiles
=
{};
Object
.
keys
(
releaseFiles
).
forEach
(
function
(
key
)
{
Object
.
keys
(
releaseFiles
).
forEach
(
function
(
key
)
{
var
text
,
var
text
,
builtFile
=
releaseFiles
[
key
],
builtFile
=
releaseFiles
[
key
],
...
@@ -157,7 +168,7 @@ function makeReleaseCopies( next ) {
...
@@ -157,7 +168,7 @@ function makeReleaseCopies( next ) {
copy
(
builtFile
,
releaseFile
);
copy
(
builtFile
,
releaseFile
);
}
}
CDNFiles
[
releaseFile
]
=
builtFile
;
jQueryFilesCDN
.
push
(
releaseFile
)
;
}
}
});
});
next
();
next
();
...
@@ -168,10 +179,10 @@ function setNextVersion( next ) {
...
@@ -168,10 +179,10 @@ function setNextVersion( next ) {
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
uploadTo
CDN
(
next
)
{
function
copyTojQuery
CDN
(
next
)
{
var
cmds
=
[];
var
cmds
=
[];
Object
.
keys
(
CDNFiles
)
.
forEach
(
function
(
name
)
{
jQueryFilesCDN
.
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
);
});
});
...
@@ -184,6 +195,14 @@ function uploadToCDN( next ) {
...
@@ -184,6 +195,14 @@ function uploadToCDN( next ) {
steps
.
apply
(
this
,
cmds
);
steps
.
apply
(
this
,
cmds
);
}
}
function
buildGoogleCDN
(
next
)
{
makeArchive
(
"googlecdn"
,
googleFilesCDN
,
next
);
}
function
buildMicrosoftCDN
(
next
)
{
makeArchive
(
"mscdn"
,
msFilesCDN
,
next
);
}
function
pushToGithub
(
next
)
{
function
pushToGithub
(
next
)
{
git
(
[
"push"
,
"--tags"
,
repoURL
,
branch
],
next
,
debug
||
skipRemote
);
git
(
[
"push"
,
"--tags"
,
repoURL
,
branch
],
next
,
debug
||
skipRemote
);
}
}
...
@@ -208,6 +227,25 @@ function updatePackageVersion( ver ) {
...
@@ -208,6 +227,25 @@ function updatePackageVersion( ver ) {
}
}
}
}
function
makeArchive
(
cdn
,
files
,
fn
)
{
if
(
isBeta
)
{
console
.
log
(
"Skipping archive creation for "
+
cdn
+
"; "
+
releaseVersion
+
" is beta"
);
process
.
nextTick
(
fn
);
return
}
console
.
log
(
"Creating production archive for "
+
cdn
);
files
=
files
.
map
(
function
(
item
)
{
return
"dist/"
+
item
.
replace
(
/VER/g
,
releaseVersion
);
});
var
md5file
=
"dist/"
+
cdn
+
"-md5.txt"
;
exec
(
"md5sum"
,
files
,
function
(
err
,
stdout
,
stderr
)
{
fs
.
writeFileSync
(
md5file
,
stdout
);
files
.
push
(
md5file
);
exec
(
"tar"
,
[
"-czvf"
,
"dist/"
+
cdn
+
"-jquery-"
+
releaseVersion
+
".tar.gz"
].
concat
(
files
),
fn
,
false
);
},
false
);
}
function
copy
(
oldFile
,
newFile
)
{
function
copy
(
oldFile
,
newFile
)
{
console
.
log
(
"Copying "
+
oldFile
+
" to "
+
newFile
);
console
.
log
(
"Copying "
+
oldFile
+
" to "
+
newFile
);
if
(
!
debug
)
{
if
(
!
debug
)
{
...
@@ -236,6 +274,14 @@ function exec( cmd, args, fn, skip ) {
...
@@ -236,6 +274,14 @@ function exec( cmd, args, fn, skip ) {
}
}
}
}
function
dieIfReal
(
msg
)
{
if
(
debug
)
{
console
.
log
(
"DIE: "
+
msg
);
}
else
{
die
(
msg
);
}
}
function
die
(
msg
)
{
function
die
(
msg
)
{
console
.
error
(
"ERROR: "
+
msg
);
console
.
error
(
"ERROR: "
+
msg
);
process
.
exit
(
1
);
process
.
exit
(
1
);
...
...
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