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
0ff19e94
Unverified
Commit
0ff19e94
authored
Feb 10, 2020
by
Ryan McKinley
Committed by
GitHub
Feb 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Toolkit: create manifest files for plugins (#22056)
parent
679acd30
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
0 deletions
+93
-0
packages/grafana-toolkit/src/cli/index.ts
+9
-0
packages/grafana-toolkit/src/cli/tasks/manifest.test.ts
+32
-0
packages/grafana-toolkit/src/cli/tasks/manifest.ts
+47
-0
packages/grafana-toolkit/src/cli/tasks/plugin.ci.ts
+5
-0
No files found.
packages/grafana-toolkit/src/cli/index.ts
View file @
0ff19e94
...
...
@@ -5,6 +5,7 @@ import chalk from 'chalk';
import
{
startTask
}
from
'./tasks/core.start'
;
import
{
changelogTask
}
from
'./tasks/changelog'
;
import
{
cherryPickTask
}
from
'./tasks/cherrypick'
;
import
{
manifestTask
}
from
'./tasks/manifest'
;
import
{
precommitTask
}
from
'./tasks/precommit'
;
import
{
templateTask
}
from
'./tasks/template'
;
import
{
pluginBuildTask
}
from
'./tasks/plugin.build'
;
...
...
@@ -213,6 +214,14 @@ export const run = (includeInternalScripts = false) => {
});
});
// Test the manifest creation
program
.
command
(
'manifest'
)
.
description
(
'create a manifest file in the cwd'
)
.
action
(
async
cmd
=>
{
await
execTask
(
manifestTask
)({
folder
:
process
.
cwd
()
});
});
program
.
on
(
'command:*'
,
()
=>
{
console
.
error
(
'Invalid command: %s
\
nSee --help for a list of available commands.'
,
program
.
args
.
join
(
' '
));
process
.
exit
(
1
);
...
...
packages/grafana-toolkit/src/cli/tasks/manifest.test.ts
0 → 100644
View file @
0ff19e94
import
{
getFilePaths
}
from
'./manifest'
;
describe
(
'Manifest'
,
()
=>
{
it
(
'should collect file paths'
,
()
=>
{
const
info
=
getFilePaths
(
__dirname
);
expect
(
info
).
toMatchInlineSnapshot
(
`
Array [
"changelog.ts",
"cherrypick.ts",
"closeMilestone.ts",
"core.start.ts",
"manifest.test.ts",
"manifest.ts",
"nodeVersionChecker.ts",
"package.build.ts",
"plugin/bundle.ts",
"plugin/create.ts",
"plugin/tests.ts",
"plugin.build.ts",
"plugin.ci.ts",
"plugin.create.ts",
"plugin.dev.ts",
"plugin.tests.ts",
"precommit.ts",
"searchTestDataSetup.ts",
"task.ts",
"template.ts",
"toolkit.build.ts",
]
`
);
});
});
packages/grafana-toolkit/src/cli/tasks/manifest.ts
0 → 100644
View file @
0ff19e94
import
{
Task
,
TaskRunner
}
from
'./task'
;
import
fs
from
'fs'
;
import
path
from
'path'
;
import
execa
from
'execa'
;
interface
ManifestOptions
{
folder
:
string
;
}
export
function
getFilePaths
(
root
:
string
,
work
?:
string
,
acc
?:
string
[]):
string
[]
{
if
(
!
acc
)
{
acc
=
[];
}
let
abs
=
work
??
root
;
const
files
=
fs
.
readdirSync
(
abs
);
files
.
forEach
(
file
=>
{
const
f
=
path
.
join
(
abs
,
file
);
const
stat
=
fs
.
statSync
(
f
);
if
(
stat
.
isDirectory
())
{
acc
=
getFilePaths
(
root
,
f
,
acc
);
}
else
{
acc
!
.
push
(
f
.
substring
(
root
.
length
+
1
).
replace
(
'
\
\'
, '
/
'));
}
});
return acc;
}
const manifestRunner: TaskRunner<ManifestOptions> = async ({ folder }) => {
const filename = '
MANIFEST
.
txt
';
const files = getFilePaths(folder).filter(f => f !== filename);
const originalDir = __dirname;
process.chdir(folder);
const out = await execa('
sha1sum
', files);
// Write the process output
fs.writeFileSync(path.join(folder, filename), out.stdout);
// TODO:
// gpg --output doc.sig --sign doc
// Go back to where you were
process.chdir(originalDir);
console.log('
Wrote
manifest
:
', filename);
};
export const manifestTask = new Task<ManifestOptions>('
Build
Manifest
', manifestRunner);
packages/grafana-toolkit/src/cli/tasks/plugin.ci.ts
View file @
0ff19e94
...
...
@@ -23,6 +23,8 @@ import { agregateWorkflowInfo, agregateCoverageInfo, agregateTestInfo } from '..
import
{
PluginPackageDetails
,
PluginBuildReport
,
TestResultsInfo
}
from
'../../plugins/types'
;
import
{
runEndToEndTests
}
from
'../../plugins/e2e/launcher'
;
import
{
getEndToEndSettings
}
from
'../../plugins/index'
;
import
{
manifestTask
}
from
'./manifest'
;
import
{
execTask
}
from
'../utils/execTask'
;
export
interface
PluginCIOptions
{
backend
?:
boolean
;
...
...
@@ -162,6 +164,9 @@ const packagePluginRunner: TaskRunner<PluginCIOptions> = async () => {
}
});
// Write a manifest.txt file in the dist folder
await
execTask
(
manifestTask
)({
folder
:
distContentDir
});
console
.
log
(
'Building ZIP'
);
let
zipName
=
pluginInfo
.
id
+
'-'
+
pluginInfo
.
info
.
version
+
'.zip'
;
let
zipFile
=
path
.
resolve
(
packagesDir
,
zipName
);
...
...
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