FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ionic/.scripts/release.js at css-variable-docs-test · ModusCreateOrg/ionic · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ModusCreateOrg
/
ionic
Public
forked from
ionic-team/ionic-framework
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ionic
/
.scripts
/
release.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
135 lines (114 loc) · 3.15 KB
Breadcrumbs
ionic
/
.scripts
/
release.js
Copy path
File metadata and controls
135 lines (114 loc) · 3.15 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/**
* Deploy script adopted from https://github.com/sindresorhus/np
* MIT License (c) Sindre Sorhus (sindresorhus.com)
*/
const
chalk
=
require
(
'chalk'
)
;
const
execa
=
require
(
'execa'
)
;
const
Listr
=
require
(
'listr'
)
;
const
octokit
=
require
(
'@octokit/rest'
)
(
)
const
common
=
require
(
'./common'
)
;
const
fs
=
require
(
'fs-extra'
)
;
async
function
main
(
)
{
try
{
if
(
!
process
.
env
.
GH_TOKEN
)
{
throw
new
Error
(
'env.GH_TOKEN is undefined'
)
;
}
const
tasks
=
[
]
;
const
{
version
}
=
common
.
readPkg
(
'core'
)
;
const
changelog
=
findChangelog
(
)
;
// repo must be clean
common
.
checkGit
(
tasks
)
;
// publish each package in NPM
publishPackages
(
tasks
,
common
.
packages
,
version
)
;
// push tag to git remote
publishGit
(
tasks
,
version
,
changelog
)
;
const
listr
=
new
Listr
(
tasks
)
;
await
listr
.
run
(
)
;
console
.
log
(
`\nionic
${
version
}
published!! 🎉\n`
)
;
}
catch
(
err
)
{
console
.
log
(
'\n'
,
chalk
.
red
(
err
)
,
'\n'
)
;
process
.
exit
(
1
)
;
}
}
async
function
publishPackages
(
tasks
,
packages
,
version
)
{
// first verify version
packages
.
forEach
(
package
=>
{
if
(
package
===
'core'
)
{
return
;
}
const
pkg
=
common
.
readPkg
(
package
)
;
tasks
.
push
(
{
title
:
`
${
pkg
.
name
}
: check version (must match:
${
version
}
)`
,
task
:
(
)
=>
{
if
(
version
!==
pkg
.
version
)
{
throw
new
Error
(
`
${
pkg
.
name
}
version
${
pkg
.
version
}
must match
${
version
}
`
)
;
}
}
}
)
;
}
)
;
// next publish
packages
.
forEach
(
package
=>
{
const
pkg
=
common
.
readPkg
(
package
)
;
const
projectRoot
=
common
.
projectPath
(
package
)
;
tasks
.
push
(
{
title
:
`
${
pkg
.
name
}
: publish
${
pkg
.
version
}
`
,
task
:
(
)
=>
execa
(
'npm'
,
[
'publish'
,
'--tag'
,
'latest'
]
,
{
cwd
:
projectRoot
}
)
}
)
;
}
)
;
}
function
publishGit
(
tasks
,
version
,
changelog
)
{
const
tag
=
`v
${
version
}
`
;
tasks
.
push
(
{
title
:
`Tag latest commit
${
chalk
.
dim
(
`(
${
tag
}
)`
)
}
`
,
task
:
(
)
=>
execa
(
'git'
,
[
'tag'
,
`
${
tag
}
`
]
,
{
cwd
:
common
.
rootDir
}
)
}
,
{
title
:
'Push branches to remote'
,
task
:
(
)
=>
execa
(
'git'
,
[
'push'
]
,
{
cwd
:
common
.
rootDir
}
)
}
,
{
title
:
'Push tags to remove'
,
task
:
(
)
=>
execa
(
'git'
,
[
'push'
,
'--tags'
]
,
{
cwd
:
common
.
rootDir
}
)
}
,
{
title
:
'Publish Github release'
,
task
:
(
)
=>
publishGithub
(
version
,
tag
,
changelog
)
}
)
;
}
function
findChangelog
(
)
{
const
lines
=
fs
.
readFileSync
(
'CHANGELOG.md'
,
'utf-8'
)
.
toString
(
)
.
split
(
'\n'
)
;
let
start
=
-
1
;
let
end
=
-
1
;
for
(
let
i
=
0
;
i
<
lines
.
length
;
i
++
)
{
const
line
=
lines
[
i
]
;
if
(
line
.
startsWith
(
'# ['
)
)
{
if
(
start
===
-
1
)
{
start
=
i
+
1
;
}
else
{
end
=
i
-
1
;
break
;
}
}
}
if
(
start
===
-
1
||
end
===
-
1
)
{
throw
new
Error
(
'changelog diff was not found'
)
;
}
return
lines
.
slice
(
start
,
end
)
.
join
(
'\n'
)
.
trim
(
)
;
}
async
function
publishGithub
(
version
,
tag
,
changelog
)
{
octokit
.
authenticate
(
{
type
:
'oauth'
,
token
:
process
.
env
.
GH_TOKEN
}
)
;
await
octokit
.
repos
.
createRelease
(
{
owner
:
'ionic-team'
,
repo
:
'ionic'
,
target_commitish
:
'master'
,
tag_name
:
tag
,
name
:
version
,
body
:
changelog
,
}
)
;
}
main
(
)
;
Back
|
FazBrowse Home
|
New Git URL