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
1782d681
Unverified
Commit
1782d681
authored
Sep 03, 2019
by
Torkel Ödegaard
Committed by
GitHub
Sep 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Git: Precomit hook slimmed down
parent
adbefcc3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
25 deletions
+4
-25
package.json
+1
-0
packages/grafana-toolkit/bin/grafana-toolkit.js
+2
-1
packages/grafana-toolkit/src/cli/tasks/precommit.ts
+1
-24
No files found.
package.json
View file @
1782d681
...
@@ -152,6 +152,7 @@
...
@@ -152,6 +152,7 @@
"test"
:
"grunt test"
,
"test"
:
"grunt test"
,
"tslint"
:
"tslint -c tslint.json --project tsconfig.json"
,
"tslint"
:
"tslint -c tslint.json --project tsconfig.json"
,
"typecheck"
:
"tsc --noEmit"
,
"typecheck"
:
"tsc --noEmit"
,
"typecheckPackages"
:
"yarn workspaces run typecheck"
,
"jest"
:
"jest --notify --watch"
,
"jest"
:
"jest --notify --watch"
,
"e2e-tests"
:
"jest --runInBand --config=jest.config.e2e.js"
,
"e2e-tests"
:
"jest --runInBand --config=jest.config.e2e.js"
,
"api-tests"
:
"jest --notify --watch --config=devenv/e2e-api-tests/jest.js"
,
"api-tests"
:
"jest --notify --watch --config=devenv/e2e-api-tests/jest.js"
,
...
...
packages/grafana-toolkit/bin/grafana-toolkit.js
View file @
1782d681
...
@@ -7,7 +7,8 @@ var path = require('path') ;
...
@@ -7,7 +7,8 @@ var path = require('path') ;
var
tsProjectPath
=
path
.
resolve
(
__dirname
,
'../tsconfig.json'
);
var
tsProjectPath
=
path
.
resolve
(
__dirname
,
'../tsconfig.json'
);
require
(
'ts-node'
).
register
({
require
(
'ts-node'
).
register
({
project
:
tsProjectPath
project
:
tsProjectPath
,
transpileOnly
:
true
});
});
require
(
'../src/cli/index.ts'
).
run
(
true
);
require
(
'../src/cli/index.ts'
).
run
(
true
);
packages/grafana-toolkit/src/cli/tasks/precommit.ts
View file @
1782d681
...
@@ -12,15 +12,6 @@ const simpleGit = require('simple-git/promise')(process.cwd());
...
@@ -12,15 +12,6 @@ const simpleGit = require('simple-git/promise')(process.cwd());
interface
PrecommitOptions
{}
interface
PrecommitOptions
{}
const
tasks
=
{
const
tasks
=
{
lint
:
{
sass
:
[
'newer:sasslint'
],
core
:
[
'newer:exec:tslintRoot'
],
gui
:
[
'newer:exec:tslintPackages'
],
},
typecheck
:
{
core
:
[
'newer:exec:typecheckRoot'
],
gui
:
[
'newer:exec:typecheckPackages'
],
},
test
:
{
test
:
{
lint
:
{
lint
:
{
ts
:
[
'no-only-tests'
],
ts
:
[
'no-only-tests'
],
...
@@ -43,17 +34,12 @@ const precommitRunner: TaskRunner<PrecommitOptions> = async () => {
...
@@ -43,17 +34,12 @@ const precommitRunner: TaskRunner<PrecommitOptions> = async () => {
file
=>
file
.
path
.
match
(
/^
[
a-zA-Z0-9
\_\-\/]
+
(\.
scss
)
$/g
)
||
file
.
path
.
indexOf
(
'.sass-lint.yml'
)
>
-
1
file
=>
file
.
path
.
match
(
/^
[
a-zA-Z0-9
\_\-\/]
+
(\.
scss
)
$/g
)
||
file
.
path
.
indexOf
(
'.sass-lint.yml'
)
>
-
1
);
);
const
tsFiles
=
status
.
files
.
filter
(
file
=>
file
.
path
.
match
(
/^
[
a-zA-Z0-9
\_\-\/]
+
(\.(
ts|tsx
))
$/g
));
const
testFiles
=
status
.
files
.
filter
(
file
=>
file
.
path
.
match
(
/^
[
a-zA-Z0-9
\_\-\/]
+
(\.
test.
(
ts|tsx
))
$/g
));
const
testFiles
=
status
.
files
.
filter
(
file
=>
file
.
path
.
match
(
/^
[
a-zA-Z0-9
\_\-\/]
+
(\.
test.
(
ts|tsx
))
$/g
));
const
goTestFiles
=
status
.
files
.
filter
(
file
=>
file
.
path
.
match
(
/^
[
a-zA-Z0-9
\_\-\/]
+
(\_
test.go
)
$/g
));
const
goTestFiles
=
status
.
files
.
filter
(
file
=>
file
.
path
.
match
(
/^
[
a-zA-Z0-9
\_\-\/]
+
(\_
test.go
)
$/g
));
const
grafanaUiFiles
=
tsFiles
.
filter
(
file
=>
file
.
path
.
indexOf
(
'grafana-ui'
)
>
-
1
);
const
affectedNodeVersionFiles
=
status
.
files
const
affectedNodeVersionFiles
=
status
.
files
.
filter
(
file
=>
nodeVersionFiles
.
indexOf
(
file
.
path
)
!==
-
1
)
.
filter
(
file
=>
nodeVersionFiles
.
indexOf
(
file
.
path
)
!==
-
1
)
.
map
(
f
=>
f
.
path
);
.
map
(
f
=>
f
.
path
);
const
grafanaUIFilesChangedOnly
=
tsFiles
.
length
>
0
&&
tsFiles
.
length
-
grafanaUiFiles
.
length
===
0
;
const
coreFilesChangedOnly
=
tsFiles
.
length
>
0
&&
grafanaUiFiles
.
length
===
0
;
const
taskPaths
=
[];
const
taskPaths
=
[];
if
(
affectedNodeVersionFiles
.
length
>
0
)
{
if
(
affectedNodeVersionFiles
.
length
>
0
)
{
...
@@ -72,16 +58,6 @@ const precommitRunner: TaskRunner<PrecommitOptions> = async () => {
...
@@ -72,16 +58,6 @@ const precommitRunner: TaskRunner<PrecommitOptions> = async () => {
taskPaths
.
push
(
'test.lint.go'
);
taskPaths
.
push
(
'test.lint.go'
);
}
}
if
(
tsFiles
.
length
>
0
)
{
if
(
grafanaUIFilesChangedOnly
)
{
taskPaths
.
push
(
'lint.gui'
,
'typecheck.core'
,
'typecheck.gui'
);
}
else
if
(
coreFilesChangedOnly
)
{
taskPaths
.
push
(
'lint.core'
,
'typecheck.core'
);
}
else
{
taskPaths
.
push
(
'lint.core'
,
'lint.gui'
,
'typecheck.core'
,
'typecheck.gui'
);
}
}
const
gruntTasks
=
flatten
(
taskPaths
.
map
(
path
=>
get
(
tasks
,
path
)));
const
gruntTasks
=
flatten
(
taskPaths
.
map
(
path
=>
get
(
tasks
,
path
)));
if
(
gruntTasks
.
length
>
0
)
{
if
(
gruntTasks
.
length
>
0
)
{
console
.
log
(
chalk
.
yellow
(
`Precommit checks:
${
taskPaths
.
join
(
', '
)}
`
));
console
.
log
(
chalk
.
yellow
(
`Precommit checks:
${
taskPaths
.
join
(
', '
)}
`
));
...
@@ -93,6 +69,7 @@ const precommitRunner: TaskRunner<PrecommitOptions> = async () => {
...
@@ -93,6 +69,7 @@ const precommitRunner: TaskRunner<PrecommitOptions> = async () => {
}
}
return
task
;
return
task
;
}
}
console
.
log
(
chalk
.
yellow
(
'Skipping precommit checks, not front-end changes detected'
));
console
.
log
(
chalk
.
yellow
(
'Skipping precommit checks, not front-end changes detected'
));
return
;
return
;
};
};
...
...
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