mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Include Node.js version in notice file (#20133)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
This commit is contained in:
parent
2c1fcf9604
commit
3b983e9c22
5 changed files with 20 additions and 6 deletions
|
@ -35,6 +35,7 @@ export function getNodeDownloadInfo(config, platform) {
|
|||
url,
|
||||
downloadName,
|
||||
downloadPath,
|
||||
extractDir
|
||||
extractDir,
|
||||
version,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -49,11 +49,16 @@ export const CreateNoticeFileTask = {
|
|||
|
||||
|
||||
log.info('Generating build notice');
|
||||
const { extractDir: nodeDir } = getNodeDownloadInfo(config, config.getLinuxPlatform());
|
||||
const {
|
||||
extractDir: nodeDir,
|
||||
version: nodeVersion,
|
||||
} = getNodeDownloadInfo(config, config.getLinuxPlatform());
|
||||
|
||||
const notice = await generateBuildNoticeText({
|
||||
noticeFromSource,
|
||||
packages,
|
||||
nodeDir,
|
||||
nodeVersion,
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ import { generateNodeNoticeText } from './generate_node_notice_text';
|
|||
* @return {undefined}
|
||||
*/
|
||||
export async function generateBuildNoticeText(options = {}) {
|
||||
const { packages, nodeDir, noticeFromSource } = options;
|
||||
const { packages, nodeDir, nodeVersion, noticeFromSource } = options;
|
||||
|
||||
const packageNotices = await Promise.all(
|
||||
packages.map(generatePackageNoticeText)
|
||||
|
@ -42,6 +42,6 @@ export async function generateBuildNoticeText(options = {}) {
|
|||
return [
|
||||
noticeFromSource,
|
||||
...packageNotices,
|
||||
generateNodeNoticeText(nodeDir),
|
||||
generateNodeNoticeText(nodeDir, nodeVersion),
|
||||
].join('\n---\n');
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import { generateBuildNoticeText } from './generate_build_notice_text';
|
|||
|
||||
const NODE_MODULES = resolve(__dirname, '__fixtures__/node_modules');
|
||||
const NODE_DIR = resolve(process.execPath, '../..');
|
||||
const NODE_VERSION = '8.11.3';
|
||||
const PACKAGES = [
|
||||
{
|
||||
name: 'bar',
|
||||
|
@ -49,6 +50,7 @@ describe('src/dev/build/tasks/notice_file/generate_notice', () => {
|
|||
(notice = await generateBuildNoticeText({
|
||||
packages: PACKAGES,
|
||||
nodeDir: NODE_DIR,
|
||||
nodeVersion: NODE_VERSION,
|
||||
noticeFromSource: 'NOTICE_FROM_SOURCE\n'
|
||||
}))
|
||||
);
|
||||
|
@ -78,6 +80,12 @@ describe('src/dev/build/tasks/notice_file/generate_notice', () => {
|
|||
));
|
||||
});
|
||||
|
||||
it('includes node version', () => {
|
||||
expect(notice).toEqual(expect.stringContaining(
|
||||
'This product bundles Node.js v8.11.3'
|
||||
));
|
||||
});
|
||||
|
||||
it('includes the noticeFromSource', () => {
|
||||
expect(notice).toEqual(expect.stringContaining(
|
||||
'NOTICE_FROM_SOURCE'
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
import { resolve } from 'path';
|
||||
import { readFileSync } from 'fs';
|
||||
|
||||
export function generateNodeNoticeText(nodeDir) {
|
||||
export function generateNodeNoticeText(nodeDir, nodeVersion) {
|
||||
const licensePath = resolve(nodeDir, 'LICENSE');
|
||||
const license = readFileSync(licensePath, 'utf8');
|
||||
return `This product bundles Node.js.\n\n${license}`;
|
||||
return `This product bundles Node.js v${nodeVersion}.\n\n${license}`;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue