Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
63e7330f
Commit
63e7330f
authored
Mar 06, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/cli/refactor-commands'
parents
e9e2c85a
aef09fe1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
1 deletions
+116
-1
package.json
+1
-1
scripts/cli/index.ts
+24
-0
scripts/cli/tasks/changelog.ts
+49
-0
scripts/cli/tasks/cherrypick.ts
+42
-0
No files found.
package.json
View file @
63e7330f
...
...
@@ -140,7 +140,7 @@
"gui:releasePrepare"
:
"ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/index.ts gui:release"
,
"gui:publish"
:
"cd packages/grafana-ui/dist && npm publish --access public"
,
"gui:release"
:
"ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/index.ts gui:release -p"
,
"cli
:help"
:
"ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/index.ts --help
"
"cli
"
:
"ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/index.ts
"
},
"husky"
:
{
"hooks"
:
{
...
...
scripts/cli/index.ts
View file @
63e7330f
...
...
@@ -4,6 +4,8 @@ import chalk from 'chalk';
import
{
startTask
}
from
'./tasks/core.start'
;
import
{
buildTask
}
from
'./tasks/grafanaui.build'
;
import
{
releaseTask
}
from
'./tasks/grafanaui.release'
;
import
{
changelogTask
}
from
'./tasks/changelog'
;
import
{
cherryPickTask
}
from
'./tasks/cherrypick'
;
program
.
option
(
'-d, --depreciate <scripts>'
,
'Inform about npm script deprecation'
,
v
=>
v
.
split
(
','
));
...
...
@@ -38,6 +40,28 @@ program
});
});
program
.
command
(
'changelog'
)
.
option
(
'-m, --milestone <milestone>'
,
'Specify milestone'
)
.
description
(
'Builds changelog markdown'
)
.
action
(
async
cmd
=>
{
if
(
!
cmd
.
milestone
)
{
console
.
log
(
'Please specify milestone, example: --m 6.0.1'
);
return
;
}
await
execTask
(
changelogTask
)({
milestone
:
cmd
.
milestone
,
});
});
program
.
command
(
'cherrypick'
)
.
description
(
'Helps find commits to cherry pick'
)
.
action
(
async
cmd
=>
{
await
execTask
(
cherryPickTask
)({});
});
program
.
parse
(
process
.
argv
);
if
(
program
.
depreciate
&&
program
.
depreciate
.
length
===
2
)
{
...
...
scripts/cli/tasks/changelog.ts
0 → 100644
View file @
63e7330f
import
{
Task
,
TaskRunner
}
from
'./task'
;
import
axios
from
'axios'
;
const
githubGrafanaUrl
=
'https://github.com/grafana/grafana'
;
interface
ChangelogOptions
{
milestone
:
string
;
}
const
changelogTaskRunner
:
TaskRunner
<
ChangelogOptions
>
=
async
({
milestone
})
=>
{
let
client
=
axios
.
create
({
baseURL
:
'https://api.github.com/repos/grafana/grafana'
,
timeout
:
10000
,
});
const
res
=
await
client
.
get
(
'/issues'
,
{
params
:
{
state
:
'closed'
,
labels
:
'add to changelog'
,
},
});
let
markdown
=
''
;
for
(
const
item
of
res
.
data
)
{
if
(
!
item
.
milestone
)
{
console
.
log
(
'Item missing milestone'
,
item
.
number
);
continue
;
}
// For some reason I could not get the github api to filter on milestone and label
// So doing this filter here
if
(
item
.
milestone
.
title
!==
milestone
)
{
continue
;
}
markdown
+=
'* '
+
item
.
title
+
'.'
;
markdown
+=
` [#
${
item
.
number
}
](
${
githubGrafanaUrl
}
/pull/
${
item
.
number
}
)`
;
markdown
+=
`, [@
${
item
.
user
.
login
}
](
${
item
.
user
.
html_url
}
)`
;
markdown
+=
'
\
n'
;
}
console
.
log
(
markdown
);
};
export
const
changelogTask
=
new
Task
<
ChangelogOptions
>
();
changelogTask
.
setName
(
'Changelog generator task'
);
changelogTask
.
setRunner
(
changelogTaskRunner
);
scripts/cli/tasks/cherrypick.ts
0 → 100644
View file @
63e7330f
import
{
Task
,
TaskRunner
}
from
'./task'
;
import
axios
from
'axios'
;
interface
CherryPickOptions
{}
const
cherryPickRunner
:
TaskRunner
<
CherryPickOptions
>
=
async
()
=>
{
let
client
=
axios
.
create
({
baseURL
:
'https://api.github.com/repos/grafana/grafana'
,
timeout
:
10000
,
});
const
res
=
await
client
.
get
(
'/issues'
,
{
params
:
{
state
:
'closed'
,
labels
:
'cherry-pick needed'
,
},
});
// sort by closed date
res
.
data
.
sort
(
function
(
a
,
b
)
{
return
new
Date
(
b
.
closed_at
).
getTime
()
-
new
Date
(
a
.
closed_at
).
getTime
();
});
for
(
const
item
of
res
.
data
)
{
if
(
!
item
.
milestone
)
{
console
.
log
(
item
.
number
+
' missing milestone!'
);
continue
;
}
console
.
log
(
item
.
number
+
' closed_at '
+
item
.
closed_at
+
' '
+
item
.
html_url
);
const
issueDetails
=
await
client
.
get
(
item
.
pull_request
.
url
);
const
commits
=
await
client
.
get
(
issueDetails
.
data
.
commits_url
);
for
(
const
commit
of
commits
.
data
)
{
console
.
log
(
commit
.
commit
.
message
+
' sha: '
+
commit
.
sha
);
}
}
};
export
const
cherryPickTask
=
new
Task
<
CherryPickOptions
>
();
cherryPickTask
.
setName
(
'Cherry pick task'
);
cherryPickTask
.
setRunner
(
cherryPickRunner
);
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