@eclipse-glsp/cli
Advanced tools
Comparing version 2.1.0-next.e32e40e.153 to 2.2.0-next.063af47.158
#!/usr/bin/env node | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.COMMAND_VERSION = void 0; | ||
/******************************************************************************** | ||
@@ -20,14 +17,18 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
const check_header_1 = require("./commands/check-header"); | ||
const coverage_report_1 = require("./commands/coverage-report"); | ||
const release_1 = require("./commands/release/release"); | ||
const command_util_1 = require("./util/command-util"); | ||
exports.COMMAND_VERSION = '1.1.0-next'; | ||
const app = (0, command_util_1.baseCommand)() // | ||
.version(exports.COMMAND_VERSION) | ||
import { CheckHeaderCommand } from './commands/check-header.js'; | ||
import { CoverageReportCommand } from './commands/coverage-report.js'; | ||
import { GenerateIndex } from './commands/generate-index.js'; | ||
import { ReleaseCommand } from './commands/release/release.js'; | ||
import { UpdateNextCommand } from './commands/update-next.js'; | ||
import { baseCommand } from './util/command-util.js'; | ||
export const COMMAND_VERSION = '1.1.0-next'; | ||
const app = baseCommand() // | ||
.version(COMMAND_VERSION) | ||
.name('glsp') | ||
.addCommand(coverage_report_1.CoverageReportCommand) | ||
.addCommand(release_1.ReleaseCommand) | ||
.addCommand(check_header_1.CheckHeaderCommand); | ||
.addCommand(CoverageReportCommand) | ||
.addCommand(ReleaseCommand) | ||
.addCommand(CheckHeaderCommand) | ||
.addCommand(UpdateNextCommand) | ||
.addCommand(GenerateIndex); | ||
app.parse(process.argv); | ||
//# sourceMappingURL=app.js.map |
@@ -8,8 +8,5 @@ export interface HeaderCheckOptions { | ||
autoFix: boolean; | ||
severity: Severity; | ||
} | ||
declare const checkTypes: readonly ["full", "changes", "lastCommit"]; | ||
type CheckType = typeof checkTypes[number]; | ||
declare const severityTypes: readonly ["error", "warn", "ok"]; | ||
type Severity = typeof severityTypes[number]; | ||
type CheckType = (typeof checkTypes)[number]; | ||
export declare const CheckHeaderCommand: import("commander").Command; | ||
@@ -20,7 +17,7 @@ export declare function checkHeaders(rootDir: string, options: HeaderCheckOptions): void; | ||
file: string; | ||
severity: Severity; | ||
violation: Violation; | ||
line?: string; | ||
} | ||
type Violation = 'none' | 'noOrMissingHeader' | 'incorrectCopyrightPeriod' | 'invalidCopyrightYear'; | ||
type Violation = 'none' | 'noOrMissingHeader' | 'invalidEndYear' | 'noYear'; | ||
export {}; | ||
//# sourceMappingURL=check-header.d.ts.map |
@@ -1,27 +0,1 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.handleValidationResults = exports.checkHeaders = exports.CheckHeaderCommand = void 0; | ||
/******************************************************************************** | ||
@@ -43,24 +17,23 @@ * Copyright (c) 2022-2023 EclipseSource and others. | ||
/* eslint-disable max-len */ | ||
const commander_1 = require("commander"); | ||
const fs = __importStar(require("fs")); | ||
const glob_1 = require("glob"); | ||
const minimatch = __importStar(require("minimatch")); | ||
const readline = __importStar(require("readline-sync")); | ||
const sh = __importStar(require("shelljs")); | ||
const command_util_1 = require("../util/command-util"); | ||
const git_util_1 = require("../util/git-util"); | ||
const logger_1 = require("../util/logger"); | ||
const validation_util_1 = require("../util/validation-util"); | ||
const path = require("path"); | ||
import { Option } from 'commander'; | ||
import * as fs from 'fs'; | ||
import { glob } from 'glob'; | ||
import * as minimatch from 'minimatch'; | ||
import * as readline from 'readline-sync'; | ||
import sh from 'shelljs'; | ||
import { baseCommand, configureShell, getShellConfig } from '../util/command-util.js'; | ||
import { getChangesOfLastCommit, getLastModificationDate, getUncommittedChanges } from '../util/git-util.js'; | ||
import * as path from 'path'; | ||
import { LOGGER } from '../util/logger.js'; | ||
import { validateGitDirectory } from '../util/validation-util.js'; | ||
const checkTypes = ['full', 'changes', 'lastCommit']; | ||
const severityTypes = ['error', 'warn', 'ok']; | ||
const DEFAULT_EXCLUDES = ['**/@(node_modules|lib|dist|bundle)/**']; | ||
const YEAR_RANGE_REGEX = /\d{4}(?:-d{4})?/g; | ||
const HEADER_PATTERN = 'Copyright \\([cC]\\) \\d{4}(-d{4})?'; | ||
const YEAR_RANGE_REGEX = /\d{4}/g; | ||
const HEADER_PATTERN = 'Copyright \\([cC]\\) \\d{4}'; | ||
const AUTO_FIX_MESSAGE = 'Fix copyright header violations'; | ||
exports.CheckHeaderCommand = (0, command_util_1.baseCommand)() // | ||
export const CheckHeaderCommand = baseCommand() // | ||
.name('checkHeaders') | ||
.description('Validates the copyright year range of license header files') | ||
.argument('<rootDir>', 'The starting directory for the check', validation_util_1.validateGitDirectory) | ||
.addOption(new commander_1.Option('-t, --type <type>', 'The scope of the check. In addition to a full recursive check, is also possible to only' + | ||
.description('Validates the copyright year range (end year) of license header files') | ||
.argument('<rootDir>', 'The starting directory for the check', validateGitDirectory) | ||
.addOption(new Option('-t, --type <type>', 'The scope of the check. In addition to a full recursive check, is also possible to only' + | ||
' consider pending changes or the last commit') | ||
@@ -70,12 +43,9 @@ .choices(checkTypes) | ||
.option('-f, --fileExtensions <extensions...>', 'File extensions that should be checked', ['ts', 'tsx']) | ||
.addOption(new commander_1.Option('-e, --exclude <exclude...>', 'File patterns that should be excluded from the check. New exclude patterns are added to the default patterns').default([], `[${DEFAULT_EXCLUDES}]`)) | ||
.addOption(new Option('-e, --exclude <exclude...>', 'File patterns that should be excluded from the check. New exclude patterns are added to the default patterns').default([], `[${DEFAULT_EXCLUDES}]`)) | ||
.option('--no-exclude-defaults', 'Disables the default excludes patterns. Only explicitly passed exclude patterns (-e, --exclude) are considered') | ||
.option('-j, --json', 'Also persist validation results as json file', false) | ||
.addOption(new commander_1.Option('-s, --severity <severity>', 'The severity of validation results that should be printed.') | ||
.choices(severityTypes) | ||
.default('error', '"error" (only)')) | ||
.option('-a, --autoFix', 'Auto apply & commit fixes without prompting the user', false) | ||
.action(checkHeaders); | ||
function checkHeaders(rootDir, options) { | ||
(0, command_util_1.configureShell)({ silent: true, fatal: true }); | ||
export function checkHeaders(rootDir, options) { | ||
configureShell({ silent: true, fatal: true }); | ||
if (options.excludeDefaults) { | ||
@@ -86,5 +56,5 @@ options.exclude.push(...DEFAULT_EXCLUDES); | ||
const files = getFiles(rootDir, options); | ||
logger_1.LOGGER.info(`Check copy right headers of ${files.length} files`); | ||
LOGGER.info(`Check copy right headers of ${files.length} files`); | ||
if (files.length === 0) { | ||
logger_1.LOGGER.info('Check completed'); | ||
LOGGER.info('Check completed'); | ||
return; | ||
@@ -95,3 +65,2 @@ } | ||
} | ||
exports.checkHeaders = checkHeaders; | ||
function getFiles(rootDir, options) { | ||
@@ -101,3 +70,3 @@ const includePattern = `**/*.@(${options.fileExtensions.join('|')})`; | ||
if (options.type === 'full') { | ||
return glob_1.glob.sync(includePattern, { | ||
return glob.sync(includePattern, { | ||
cwd: rootDir, | ||
@@ -107,3 +76,3 @@ ignore: excludePattern | ||
} | ||
let changedFiles = options.type === 'changes' ? (0, git_util_1.getUncommittedChanges)(rootDir) : (0, git_util_1.getChangesOfLastCommit)(rootDir); | ||
let changedFiles = options.type === 'changes' ? getUncommittedChanges(rootDir) : getChangesOfLastCommit(rootDir); | ||
changedFiles = changedFiles.filter(minimatch.filter(includePattern)); | ||
@@ -117,9 +86,4 @@ excludePattern.forEach(pattern => { | ||
var _a; | ||
// Derives all files with valid headers, their copyright years and all files with no or invalid headers | ||
// Derives all files with valid headers and all files with no or invalid headers | ||
const filesWithHeader = sh.grep('-l', HEADER_PATTERN, files).stdout.trim().split('\n'); | ||
const copyrightYears = sh | ||
.grep(HEADER_PATTERN, files) | ||
.stdout.trim() | ||
.split('\n') | ||
.map(line => line.match(YEAR_RANGE_REGEX).map(string => Number.parseInt(string, 10))); | ||
const noHeaders = files.filter(file => !filesWithHeader.includes(file)); | ||
@@ -131,7 +95,7 @@ const results = []; | ||
if (noHeadersLength > 0) { | ||
logger_1.LOGGER.info(`Found ${noHeadersLength} files with no (or an invalid) copyright header`); | ||
LOGGER.info(`Found ${noHeadersLength} files with no (or an invalid) copyright header`); | ||
} | ||
noHeaders.forEach((file, i) => { | ||
printFileProgress(i + 1, allFilesLength, `Validating ${file}`); | ||
results.push({ file: path.resolve(rootDir, file), violation: 'noOrMissingHeader', severity: 'error' }); | ||
results.push({ file: path.resolve(rootDir, file), violation: 'noOrMissingHeader' }); | ||
}); | ||
@@ -144,3 +108,3 @@ // Performance optimization: avoid retrieving the dates for each individual file by precalculating the endYear if possible. | ||
else if (options.type === 'lastCommit') { | ||
defaultEndYear = (_a = (0, git_util_1.getLastModificationDate)(undefined, rootDir)) === null || _a === void 0 ? void 0 : _a.getFullYear(); | ||
defaultEndYear = (_a = getLastModificationDate(undefined, rootDir)) === null || _a === void 0 ? void 0 : _a.getFullYear(); | ||
} | ||
@@ -150,18 +114,21 @@ // Create validation results for all files with valid headers | ||
printFileProgress(i + 1 + noHeadersLength, allFilesLength, `Validating ${file}`); | ||
const result = { | ||
currentStartYear: copyrightYears[i].shift(), | ||
expectedStartYear: (0, git_util_1.getFirstModificationDate)(file, rootDir, AUTO_FIX_MESSAGE).getFullYear(), | ||
currentEndYear: copyrightYears[i].shift(), | ||
expectedEndYear: defaultEndYear !== null && defaultEndYear !== void 0 ? defaultEndYear : (0, git_util_1.getLastModificationDate)(file, rootDir, AUTO_FIX_MESSAGE).getFullYear(), | ||
file, | ||
severity: 'ok', | ||
violation: 'none' | ||
}; | ||
if (result.expectedStartYear === result.expectedEndYear) { | ||
validateSingleYear(result); | ||
const copyrightLine = sh.head({ '-n': 2 }, file).stdout.trim().split('\n')[1]; | ||
const copyRightYears = copyrightLine.match(YEAR_RANGE_REGEX); | ||
if (!copyRightYears) { | ||
const result = { file, violation: 'noYear', line: copyrightLine }; | ||
results.push(result); | ||
} | ||
else { | ||
validateTimePeriod(result); | ||
const currentStartYear = Number.parseInt(copyRightYears[0], 10); | ||
const currentEndYear = copyRightYears[1] ? Number.parseInt(copyRightYears[1], 10) : undefined; | ||
const result = { | ||
currentStartYear, | ||
currentEndYear, | ||
expectedEndYear: defaultEndYear !== null && defaultEndYear !== void 0 ? defaultEndYear : getLastModificationDate(file, rootDir, AUTO_FIX_MESSAGE).getFullYear(), | ||
file, | ||
violation: 'none' | ||
}; | ||
validateEndYear(result); | ||
results.push(result); | ||
} | ||
results.push(result); | ||
}); | ||
@@ -172,49 +139,10 @@ results.sort((a, b) => a.file.localeCompare(b.file)); | ||
} | ||
function validateSingleYear(result) { | ||
const { currentStartYear, expectedStartYear, currentEndYear } = result; | ||
result.violation = 'invalidCopyrightYear'; | ||
result.severity = 'error'; | ||
if (!currentEndYear) { | ||
if (currentStartYear === expectedStartYear) { | ||
result.violation = 'none'; | ||
result.severity = 'ok'; | ||
} | ||
return; | ||
} | ||
// Cornercase: For files of the initial contribution the copyright header predates the first git modification date. | ||
// => declare as warning if not part of the initial contribution. | ||
if (expectedStartYear === currentEndYear && currentStartYear < expectedStartYear) { | ||
if ((0, git_util_1.getFirstCommit)(result.file) === (0, git_util_1.getInitialCommit)()) { | ||
result.violation = 'none'; | ||
result.severity = 'ok'; | ||
} | ||
else { | ||
result.severity = 'warn'; | ||
} | ||
} | ||
} | ||
function validateTimePeriod(result) { | ||
const { currentStartYear, expectedStartYear, expectedEndYear, currentEndYear } = result; | ||
result.violation = 'incorrectCopyrightPeriod'; | ||
result.severity = 'error'; | ||
if (!currentEndYear) { | ||
result.severity = 'error'; | ||
return; | ||
} | ||
if (currentStartYear === expectedStartYear && currentEndYear === expectedEndYear) { | ||
function validateEndYear(result) { | ||
const { currentStartYear, expectedEndYear, currentEndYear } = result; | ||
result.violation = 'invalidEndYear'; | ||
const valid = currentEndYear ? currentEndYear === expectedEndYear : currentStartYear === expectedEndYear; | ||
if (valid) { | ||
result.violation = 'none'; | ||
result.severity = 'ok'; | ||
return; | ||
} | ||
// Cornercase: For files of the initial contribution the copyright header predates the first git modification date. | ||
// => declare as warning if not part of the initial contribution. | ||
if (currentEndYear === expectedEndYear && currentStartYear < expectedEndYear) { | ||
if ((0, git_util_1.getFirstCommit)(result.file) === (0, git_util_1.getInitialCommit)()) { | ||
result.violation = 'none'; | ||
result.severity = 'ok'; | ||
} | ||
else { | ||
result.severity = 'warn'; | ||
} | ||
} | ||
} | ||
@@ -231,72 +159,63 @@ function printFileProgress(currentFileCount, maxFileCount, message, clear = true) { | ||
} | ||
function handleValidationResults(rootDir, results, options) { | ||
logger_1.LOGGER.newLine(); | ||
logger_1.LOGGER.info(`Header validation for ${results.length} files completed`); | ||
const violations = results.filter(result => result.severity === 'error'); | ||
export function handleValidationResults(rootDir, results, options) { | ||
LOGGER.newLine(); | ||
LOGGER.info(`Header validation for ${results.length} files completed`); | ||
const violations = results.filter(result => result.violation !== 'none'); | ||
// Adjust results to print based on configured severity level | ||
let toPrint = results; | ||
if (options.severity === 'error') { | ||
toPrint = violations; | ||
} | ||
else if (options.severity === 'warn') { | ||
toPrint = results.filter(result => result.severity !== 'ok'); | ||
} | ||
logger_1.LOGGER.info(`Found ${toPrint.length} copyright header violations:`); | ||
logger_1.LOGGER.newLine(); | ||
toPrint.forEach((result, i) => logger_1.LOGGER.info(`${i + 1}. `, result.file, ':', toPrintMessage(result))); | ||
logger_1.LOGGER.newLine(); | ||
const toPrint = violations; | ||
LOGGER.info(`Found ${toPrint.length} copyright header violations:`); | ||
LOGGER.newLine(); | ||
toPrint.forEach((result, i) => LOGGER.info(`${i + 1}. `, result.file, ':', toPrintMessage(result))); | ||
LOGGER.newLine(); | ||
if (options.json) { | ||
fs.writeFileSync(path.join(rootDir, 'headerCheck.json'), JSON.stringify(results, undefined, 2)); | ||
} | ||
if (violations.length > 0 && (options.autoFix || readline.keyInYN('Do you want automatically fix copyright year range violations?'))) { | ||
const toFix = violations.filter(violation => violation.severity === 'error' && isDateValidationResult(violation)); | ||
if (violations.length > 0 && | ||
(options.autoFix || readline.keyInYN('Do you want to automatically fix copyright year range violations?'))) { | ||
const toFix = violations.filter(violation => isDateValidationResult(violation)); | ||
fixViolations(rootDir, toFix, options); | ||
} | ||
logger_1.LOGGER.info('Check completed'); | ||
LOGGER.info('Check completed'); | ||
} | ||
exports.handleValidationResults = handleValidationResults; | ||
function toPrintMessage(result) { | ||
const colors = { | ||
error: '\x1b[31m', | ||
warn: '\x1b[33m', | ||
ok: '\x1b[32m' | ||
}; | ||
if (isDateValidationResult(result) && | ||
(result.violation === 'incorrectCopyrightPeriod' || result.violation === 'invalidCopyrightYear')) { | ||
const expected = result.expectedStartYear !== result.expectedEndYear | ||
? `${result.expectedStartYear}-${result.expectedEndYear}` | ||
: result.expectedStartYear.toString(); | ||
const actual = result.currentEndYear ? `${result.currentStartYear}-${result.currentEndYear}` : result.currentStartYear.toString(); | ||
const message = result.violation === 'incorrectCopyrightPeriod' ? 'Invalid copyright period' : 'Invalid copyright year'; | ||
return `${colors[result.severity]} ${message}! Expected '${expected}' but is '${actual}'`; | ||
const error = '\x1b[31m'; | ||
const info = '\x1b[32m'; | ||
if (isDateValidationResult(result) && result.violation === 'invalidEndYear') { | ||
const expected = result.expectedEndYear.toString(); | ||
const actual = result.currentEndYear | ||
? `${result.currentEndYear} (${result.currentStartYear}-${result.currentEndYear})` | ||
: result.currentStartYear.toString(); | ||
const message = 'Invalid copyright end year'; | ||
return `${error} ${message}! Expected end year '${expected}' but is '${actual}'`; | ||
} | ||
else if (result.violation === 'noOrMissingHeader') { | ||
return `${colors[result.severity]} No or invalid copyright header!`; | ||
return `${error} No or invalid copyright header!`; | ||
} | ||
return `${colors[result.severity]} OK`; | ||
else if (result.violation === 'noYear') { | ||
return `${error} No year found!${result.line ? ' (line: ' + result.line + ')' : ''}`; | ||
} | ||
return `${info} OK`; | ||
} | ||
function fixViolations(rootDir, violations, options) { | ||
logger_1.LOGGER.newLine(); | ||
LOGGER.newLine(); | ||
violations.forEach((violation, i) => { | ||
printFileProgress(i + 1, violations.length, `Fix ${violation.file}`, false); | ||
const fixedStartYear = violation.currentStartYear < violation.expectedStartYear ? violation.currentStartYear : violation.expectedStartYear; | ||
const currentRange = `${violation.currentStartYear}${violation.currentEndYear ? '-' + violation.currentEndYear : ''}`; | ||
let fixedRange = `${fixedStartYear}`; | ||
if (violation.expectedEndYear !== violation.expectedStartYear || fixedStartYear !== violation.expectedStartYear) { | ||
fixedRange = `${fixedStartYear}-${violation.expectedEndYear}`; | ||
} | ||
const fixedRange = violation.currentEndYear || violation.currentStartYear < violation.expectedEndYear | ||
? `${violation.currentStartYear}-${violation.expectedEndYear}` | ||
: `${violation.expectedEndYear}`; | ||
sh.sed('-i', RegExp('Copyright \\([cC]\\) ' + currentRange), `Copyright (c) ${fixedRange}`, violation.file); | ||
}); | ||
logger_1.LOGGER.newLine(); | ||
LOGGER.newLine(); | ||
if (options.autoFix || readline.keyInYN('Do you want to create a commit for the fixed files?')) { | ||
logger_1.LOGGER.newLine(); | ||
LOGGER.newLine(); | ||
const files = violations.map(violation => violation.file).join(' '); | ||
sh.exec(`git add ${files}`, (0, command_util_1.getShellConfig)()); | ||
sh.exec(`git add ${files}`, getShellConfig()); | ||
sh.exec(`git commit -m "${AUTO_FIX_MESSAGE}"`); | ||
logger_1.LOGGER.newLine(); | ||
LOGGER.newLine(); | ||
} | ||
} | ||
function isDateValidationResult(object) { | ||
return 'currentStartYear' in object && 'expectedStartYear' in object && 'expectedEndYear' in object; | ||
return 'currentStartYear' in object && 'expectedEndYear' in object; | ||
} | ||
//# sourceMappingURL=check-header.js.map |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/******************************************************************************** | ||
@@ -17,37 +16,12 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.collectPackageReportFiles = exports.validateAndRetrievePackages = exports.generateCoverageReport = exports.CoverageReportCommand = void 0; | ||
const fs = __importStar(require("fs")); | ||
const path = __importStar(require("path")); | ||
const sh = __importStar(require("shelljs")); | ||
const command_util_1 = require("../util/command-util"); | ||
const logger_1 = require("../util/logger"); | ||
const validation_util_1 = require("../util/validation-util"); | ||
exports.CoverageReportCommand = (0, command_util_1.baseCommand)() // | ||
import * as fs from 'fs'; | ||
import * as path from 'path'; | ||
import sh from 'shelljs'; | ||
import { baseCommand, fatalExec, getShellConfig } from '../util/command-util.js'; | ||
import { LOGGER } from '../util/logger.js'; | ||
import { validateDirectory } from '../util/validation-util.js'; | ||
export const CoverageReportCommand = baseCommand() // | ||
.name('coverageReport') | ||
.description('Generate a test coverage report for a glsp component') | ||
.option('-p, --projectRoot <projectRoot>', 'The root directory of the GLSP component', validation_util_1.validateDirectory, process.cwd()) | ||
.option('-p, --projectRoot <projectRoot>', 'The root directory of the GLSP component', validateDirectory, process.cwd()) | ||
.option('-c, --coverageScript <script>', 'Script command of the package root for creating coverage reports', 'test:coverage') | ||
@@ -60,30 +34,28 @@ .action(generateCoverageReport); | ||
*/ | ||
function generateCoverageReport(options) { | ||
export function generateCoverageReport(options) { | ||
sh.cd(options.projectRoot); | ||
const packages = validateAndRetrievePackages(options); | ||
logger_1.LOGGER.info('Create individual package coverage reports'); | ||
LOGGER.info('Create individual package coverage reports'); | ||
const jsonReports = collectPackageReportFiles(packages, options); | ||
combineReports(jsonReports, options); | ||
logger_1.LOGGER.info('Coverage reported generation successful'); | ||
LOGGER.info('Coverage reported generation successful'); | ||
} | ||
exports.generateCoverageReport = generateCoverageReport; | ||
function validateAndRetrievePackages(options) { | ||
export function validateAndRetrievePackages(options) { | ||
var _a; | ||
const packagePath = path.join(options.projectRoot, 'package.json'); | ||
if (!fs.existsSync(packagePath)) { | ||
exports.CoverageReportCommand.error(`Invalid root directory. '${options.projectRoot}' does not contain a package.json.`); | ||
CoverageReportCommand.error(`Invalid root directory. '${options.projectRoot}' does not contain a package.json.`); | ||
} | ||
(0, command_util_1.fatalExec)('yarn nyc -h', 'Nyc is not installed!', (0, command_util_1.getShellConfig)({ silent: true })); | ||
fatalExec('yarn nyc -h', 'Nyc is not installed!', getShellConfig({ silent: true })); | ||
const packageJson = JSON.parse(fs.readFileSync(packagePath).toString()); | ||
if (!((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.scripts) === null || _a === void 0 ? void 0 : _a[options.coverageScript])) { | ||
exports.CoverageReportCommand.error(`Invalid coverage script! The package.json does not have a script with name '${options.coverageScript}'!`); | ||
CoverageReportCommand.error(`Invalid coverage script! The package.json does not have a script with name '${options.coverageScript}'!`); | ||
} | ||
if (!Array.isArray(packageJson.workspaces)) { | ||
exports.CoverageReportCommand.error('Invalid package.json! No yarn workspaces are configured!'); | ||
CoverageReportCommand.error('Invalid package.json! No yarn workspaces are configured!'); | ||
} | ||
return packageJson.workspaces.map(pkg => pkg.replace('/*', '')); | ||
} | ||
exports.validateAndRetrievePackages = validateAndRetrievePackages; | ||
function collectPackageReportFiles(packages, options) { | ||
logger_1.LOGGER.info('Create combined report'); | ||
export function collectPackageReportFiles(packages, options) { | ||
LOGGER.info('Create combined report'); | ||
sh.exec(`yarn ${options.coverageScript}`); | ||
@@ -99,3 +71,2 @@ // collect reports | ||
} | ||
exports.collectPackageReportFiles = collectPackageReportFiles; | ||
function combineReports(reportFiles, options) { | ||
@@ -122,3 +93,3 @@ // Copy coverage into root/.nyc_output | ||
// Generate report | ||
sh.exec('yarn nyc report --reporter html', (0, command_util_1.getShellConfig)()); | ||
sh.exec('yarn nyc report --reporter html', getShellConfig()); | ||
// Restore nyc configs (if any) | ||
@@ -125,0 +96,0 @@ tempFiles.forEach(config => sh.mv(config, config.substring(1))); |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/******************************************************************************** | ||
@@ -17,42 +16,14 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.updateLernaForDryRun = exports.checkJavaServerVersion = exports.isExistingMavenVersion = exports.checkIfMavenVersionExists = exports.checkIfNpmVersionIsNew = exports.asMvnVersion = exports.updateVersion = exports.upgradeCommand = exports.yarnInstall = exports.lernaSetVersion = exports.publish = exports.commitAndTag = exports.checkoutAndCd = exports.ReleaseType = exports.Component = exports.VERDACCIO_REGISTRY = void 0; | ||
const fs = __importStar(require("fs")); | ||
const node_fetch_1 = __importDefault(require("node-fetch")); | ||
const path_1 = require("path"); | ||
const readline = __importStar(require("readline-sync")); | ||
const semver = __importStar(require("semver")); | ||
const sh = __importStar(require("shelljs")); | ||
const command_util_1 = require("../../util/command-util"); | ||
const git_util_1 = require("../../util/git-util"); | ||
const logger_1 = require("../../util/logger"); | ||
const validation_util_1 = require("../../util/validation-util"); | ||
exports.VERDACCIO_REGISTRY = 'http://localhost:4873/'; | ||
var Component; | ||
import * as fs from 'fs'; | ||
import fetch from 'node-fetch'; | ||
import { resolve } from 'path'; | ||
import * as readline from 'readline-sync'; | ||
import * as semver from 'semver'; | ||
import sh from 'shelljs'; | ||
import { fatalExec, getShellConfig } from '../../util/command-util.js'; | ||
import { getLatestGithubRelease, getLatestTag, hasGitChanges, isGitRepository } from '../../util/git-util.js'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { validateVersion } from '../../util/validation-util.js'; | ||
export const VERDACCIO_REGISTRY = 'http://localhost:4873/'; | ||
export var Component; | ||
(function (Component) { | ||
@@ -117,18 +88,18 @@ Component.CLIENT = { | ||
Component.is = is; | ||
})(Component || (exports.Component = Component = {})); | ||
var ReleaseType; | ||
})(Component || (Component = {})); | ||
export var ReleaseType; | ||
(function (ReleaseType) { | ||
ReleaseType.CLI_CHOICES = ['major', 'minor', 'patch', 'rc', 'custom']; | ||
})(ReleaseType || (exports.ReleaseType = ReleaseType = {})); | ||
function checkoutAndCd(options) { | ||
})(ReleaseType || (ReleaseType = {})); | ||
export function checkoutAndCd(options) { | ||
const ghUrl = options.component.githubRepo; | ||
logger_1.LOGGER.info(`Clone repository '${ghUrl}' to directory: ${options.checkoutDir}`); | ||
LOGGER.info(`Clone repository '${ghUrl}' to directory: ${options.checkoutDir}`); | ||
sh.cd(options.checkoutDir); | ||
const directory = ghUrl.substring(ghUrl.lastIndexOf('/') + 1); | ||
const repoPath = (0, path_1.resolve)(options.checkoutDir, directory); | ||
if (fs.existsSync((0, path_1.resolve)(options.checkoutDir, directory))) { | ||
const repoPath = resolve(options.checkoutDir, directory); | ||
if (fs.existsSync(resolve(options.checkoutDir, directory))) { | ||
if (options.force) { | ||
logger_1.LOGGER.debug('A directory with the checkout name already exists.'); | ||
logger_1.LOGGER.debug('Force mode is enabled. The directory will be removed'); | ||
(0, command_util_1.fatalExec)(`rm -rf ${repoPath}`, `Could not remove directory: ${repoPath}`); | ||
LOGGER.debug('A directory with the checkout name already exists.'); | ||
LOGGER.debug('Force mode is enabled. The directory will be removed'); | ||
fatalExec(`rm -rf ${repoPath}`, `Could not remove directory: ${repoPath}`); | ||
} | ||
@@ -139,4 +110,4 @@ else { | ||
} | ||
sh.exec(`gh repo clone ${ghUrl}`, (0, command_util_1.getShellConfig)()); | ||
logger_1.LOGGER.debug(`Successfully cloned to ${directory}`); | ||
sh.exec(`gh repo clone ${ghUrl}`, getShellConfig()); | ||
LOGGER.debug(`Successfully cloned to ${directory}`); | ||
sh.cd(directory); | ||
@@ -148,34 +119,32 @@ if (options.branch !== 'master' && options.branch !== 'main') { | ||
} | ||
exports.checkoutAndCd = checkoutAndCd; | ||
function commitAndTag(version, repositoryPath) { | ||
logger_1.LOGGER.info('Commit changes and create new tag'); | ||
export function commitAndTag(version, repositoryPath) { | ||
LOGGER.info('Commit changes and create new tag'); | ||
sh.cd(repositoryPath); | ||
logger_1.LOGGER.debug('Check wether the given url is a git repository'); | ||
if (!(0, git_util_1.isGitRepository)(sh.pwd())) { | ||
LOGGER.debug('Check wether the given url is a git repository'); | ||
if (!isGitRepository(sh.pwd())) { | ||
throw new Error(`The given path is not a git repository: ${repositoryPath}`); | ||
} | ||
const tag = `v${version}`; | ||
logger_1.LOGGER.debug(`Create tag with label: ${tag}}`); | ||
sh.exec(`git checkout -b ${tag}`, (0, command_util_1.getShellConfig)()); | ||
sh.exec('git add .', (0, command_util_1.getShellConfig)()); | ||
sh.exec(`git commit -m "${tag}"`, (0, command_util_1.getShellConfig)()); | ||
sh.exec(`git tag ${tag}`, (0, command_util_1.getShellConfig)()); | ||
LOGGER.debug(`Create tag with label: ${tag}}`); | ||
sh.exec(`git checkout -b ${tag}`, getShellConfig()); | ||
sh.exec('git add .', getShellConfig()); | ||
sh.exec(`git commit -m "${tag}"`, getShellConfig()); | ||
sh.exec(`git tag ${tag}`, getShellConfig()); | ||
return tag; | ||
} | ||
exports.commitAndTag = commitAndTag; | ||
function publish(repositoryPath, options) { | ||
export function publish(repositoryPath, options) { | ||
if (!options.publish || options.npmDryRun) { | ||
logger_1.LOGGER.info('Skip publishing to Github'); | ||
LOGGER.info('Skip publishing to Github'); | ||
if (options.npmDryRun && options.component.releaseRepo === 'npm') { | ||
(0, command_util_1.fatalExec)('lerna publish from-git --no-git-reset --no-git-tag-version --no-verify-access --no-push --dist-tag rc --yes', 'Dry-run publish failed', { silent: false }); | ||
fatalExec('lerna publish from-git --no-git-reset --no-git-tag-version --no-verify-access --no-push --dist-tag rc --yes', 'Dry-run publish failed', { silent: false }); | ||
} | ||
return; | ||
} | ||
logger_1.LOGGER.info(`Publish new GH release ${options.draft ? '[DRAFT]' : ''}`); | ||
LOGGER.info(`Publish new GH release ${options.draft ? '[DRAFT]' : ''}`); | ||
sh.cd(repositoryPath); | ||
if (!options.force && (0, git_util_1.hasGitChanges)()) { | ||
if (!options.force && hasGitChanges()) { | ||
throw new Error('Publish failed. The repository has pending changes'); | ||
} | ||
const latestReleaseTag = (0, git_util_1.getLatestGithubRelease)(); | ||
const localTag = (0, git_util_1.getLatestTag)(); | ||
const latestReleaseTag = getLatestGithubRelease(); | ||
const localTag = getLatestTag(); | ||
validateTag(latestReleaseTag, localTag); | ||
@@ -185,10 +154,9 @@ const preRelease = options.releaseType === 'rc' || localTag.includes('-'); | ||
} | ||
exports.publish = publish; | ||
function doPublish(tag, preRelease, latestRelease, draft) { | ||
(0, command_util_1.fatalExec)(`git push origin HEAD:${tag}`, 'Could not push release branch to Github', (0, command_util_1.getShellConfig)({ silent: false })); | ||
(0, command_util_1.fatalExec)(`git push origin tag ${tag}`, 'Could not push tag to Github', (0, command_util_1.getShellConfig)({ silent: false })); | ||
fatalExec(`git push origin HEAD:${tag}`, 'Could not push release branch to Github', getShellConfig({ silent: false })); | ||
fatalExec(`git push origin tag ${tag}`, 'Could not push tag to Github', getShellConfig({ silent: false })); | ||
const version = tagToVersion(tag); | ||
const titleSuffix = preRelease ? ` Candidate ${version.substring(version.lastIndexOf('-RC') + 3)}` : ''; | ||
const title = `${version.replace(/-.*/, '')} Release${titleSuffix} `; | ||
sh.exec(`gh release create ${tag} -t "${title}" --notes-start-tag ${latestRelease} --generate-notes ${draft ? '-d' : ''} ${preRelease ? '-p' : ''}`, (0, command_util_1.getShellConfig)()); | ||
sh.exec(`gh release create ${tag} -t "${title}" --notes-start-tag ${latestRelease} --generate-notes ${draft ? '-d' : ''} ${preRelease ? '-p' : ''}`, getShellConfig()); | ||
} | ||
@@ -207,29 +175,26 @@ function validateTag(currentReleaseTag, newTag) { | ||
const version = tag.substring(1).replace('.RC', '-RC'); | ||
return (0, validation_util_1.validateVersion)(version); | ||
return validateVersion(version); | ||
} | ||
function lernaSetVersion(repositoryPath, version) { | ||
logger_1.LOGGER.info(`Bump version in ${repositoryPath} to: ${version}`); | ||
export function lernaSetVersion(repositoryPath, version) { | ||
LOGGER.info(`Bump version in ${repositoryPath} to: ${version}`); | ||
sh.cd(repositoryPath); | ||
(0, command_util_1.fatalExec)(`lerna version --exact ${version} --ignore-scripts --yes --no-push --no-git-tag-version`, 'Lerna version bump failed!', { | ||
fatalExec(`lerna version --exact ${version} --ignore-scripts --yes --no-push --no-git-tag-version`, 'Lerna version bump failed!', { | ||
silent: false | ||
}); | ||
logger_1.LOGGER.debug('Update root package.json version'); | ||
sh.exec(`jq '.version="${version}"' package.json > temp.json`, (0, command_util_1.getShellConfig)()); | ||
sh.exec('mv temp.json package.json ', (0, command_util_1.getShellConfig)()); | ||
LOGGER.debug('Update root package.json version'); | ||
sh.exec(`jq '.version="${version}"' package.json > temp.json`, getShellConfig()); | ||
sh.exec('mv temp.json package.json ', getShellConfig()); | ||
} | ||
exports.lernaSetVersion = lernaSetVersion; | ||
function yarnInstall(repositoryPath) { | ||
logger_1.LOGGER.debug(`Build ${repositoryPath}`); | ||
export function yarnInstall(repositoryPath) { | ||
LOGGER.debug(`Build ${repositoryPath}`); | ||
sh.cd(repositoryPath); | ||
(0, command_util_1.fatalExec)('yarn', 'Yarn build failed', (0, command_util_1.getShellConfig)({ silent: false })); | ||
fatalExec('yarn', 'Yarn build failed', getShellConfig({ silent: false })); | ||
} | ||
exports.yarnInstall = yarnInstall; | ||
function upgradeCommand(pckName, version) { | ||
logger_1.LOGGER.debug(`Upgrade '${pckName}' to version ${version}`); | ||
export function upgradeCommand(pckName, version) { | ||
LOGGER.debug(`Upgrade '${pckName}' to version ${version}`); | ||
return `lernaupdate --non-interactive --dependency ${pckName}@${version}`; | ||
} | ||
exports.upgradeCommand = upgradeCommand; | ||
function updateVersion(...packages) { | ||
export function updateVersion(...packages) { | ||
packages.forEach(pckg => { | ||
const result = sh.exec(upgradeCommand(pckg.name, pckg.version), (0, command_util_1.getShellConfig)({ silent: false })).stdout.trim(); | ||
const result = sh.exec(upgradeCommand(pckg.name, pckg.version), getShellConfig({ silent: false })).stdout.trim(); | ||
if (result.includes('An error occurred:')) { | ||
@@ -241,16 +206,14 @@ const errorMsg = result.substring(result.lastIndexOf('An error occurred:')).trim(); | ||
} | ||
exports.updateVersion = updateVersion; | ||
function asMvnVersion(version) { | ||
logger_1.LOGGER.debug(`Convert to maven conform version: ${version}`); | ||
export function asMvnVersion(version) { | ||
LOGGER.debug(`Convert to maven conform version: ${version}`); | ||
const mavenVersion = version.replace('-', '.'); | ||
logger_1.LOGGER.debug(`Maven version :${mavenVersion}`); | ||
LOGGER.debug(`Maven version :${mavenVersion}`); | ||
return mavenVersion; | ||
} | ||
exports.asMvnVersion = asMvnVersion; | ||
async function checkIfNpmVersionIsNew(pckgName, newVersion) { | ||
logger_1.LOGGER.debug(`Check that the release version is new i.e. does not exist on npm: ${newVersion}`); | ||
const response = await (0, node_fetch_1.default)(`https://registry.npmjs.org/${pckgName}/${newVersion}`); | ||
export async function checkIfNpmVersionIsNew(pckgName, newVersion) { | ||
LOGGER.debug(`Check that the release version is new i.e. does not exist on npm: ${newVersion}`); | ||
const response = await fetch(`https://registry.npmjs.org/${pckgName}/${newVersion}`); | ||
const data = await response.json(); | ||
if (typeof data === 'string' && data.includes('version not found:')) { | ||
logger_1.LOGGER.debug(`Version '${newVersion}' does not exist on NPM. Continue with release`); | ||
LOGGER.debug(`Version '${newVersion}' does not exist on NPM. Continue with release`); | ||
return; | ||
@@ -260,23 +223,20 @@ } | ||
} | ||
exports.checkIfNpmVersionIsNew = checkIfNpmVersionIsNew; | ||
function checkIfMavenVersionExists(groupId, artifactId, newVersion) { | ||
logger_1.LOGGER.debug('Check if maven version exists'); | ||
export function checkIfMavenVersionExists(groupId, artifactId, newVersion) { | ||
LOGGER.debug('Check if maven version exists'); | ||
if (isExistingMavenVersion(groupId, artifactId, newVersion)) { | ||
throw new Error(`Version '${newVersion} is already present on maven central!}`); | ||
} | ||
logger_1.LOGGER.debug(`Version '${newVersion}' does not exist on maven central. Continue with release`); | ||
LOGGER.debug(`Version '${newVersion}' does not exist on maven central. Continue with release`); | ||
} | ||
exports.checkIfMavenVersionExists = checkIfMavenVersionExists; | ||
function isExistingMavenVersion(groupId, artifactId, version) { | ||
export function isExistingMavenVersion(groupId, artifactId, version) { | ||
const versions = sh | ||
.exec(`wget -q -O - https://repo1.maven.org/maven2/${groupId.replace(/\./g, '/')}/${artifactId}/maven-metadata.xml`, (0, command_util_1.getShellConfig)()) | ||
.exec("grep -P '<version>\\K[^<]*'", (0, command_util_1.getShellConfig)()) | ||
.exec(`wget -q -O - https://repo1.maven.org/maven2/${groupId.replace(/\./g, '/')}/${artifactId}/maven-metadata.xml`, getShellConfig()) | ||
.exec("grep -P '<version>\\K[^<]*'", getShellConfig()) | ||
.stdout.replace(/<\/?version>/g, '') | ||
.split('\n') | ||
.map(versionString => versionString.trim()); | ||
logger_1.LOGGER.debug(`${versions.length} released versions found:`, versions); | ||
LOGGER.debug(`${versions.length} released versions found:`, versions); | ||
return versions.includes(version); | ||
} | ||
exports.isExistingMavenVersion = isExistingMavenVersion; | ||
function checkJavaServerVersion(version, force = false) { | ||
export function checkJavaServerVersion(version, force = false) { | ||
const mvnVersion = asMvnVersion(version); | ||
@@ -286,3 +246,3 @@ if (!isExistingMavenVersion('org.eclipse.glsp', 'org.eclipse.glsp.server', mvnVersion)) { | ||
const errorMsg = `No Java GLSP server with version ${mvnVersion} found on maven central!. Please release a new Java GLSP Server version before publishing this release!`; | ||
logger_1.LOGGER.warn(errorMsg); | ||
LOGGER.warn(errorMsg); | ||
if (force || readline.keyInYN('No Java GLSP server with corresponding version found. Do you want to continue anyways?')) { | ||
@@ -294,10 +254,8 @@ return; | ||
} | ||
exports.checkJavaServerVersion = checkJavaServerVersion; | ||
function updateLernaForDryRun() { | ||
logger_1.LOGGER.debug('Update lerna.json to use local publish registry'); | ||
sh.exec(`jq '.command.publish.registry="${exports.VERDACCIO_REGISTRY}"' lerna.json > temp.json`, (0, command_util_1.getShellConfig)()); | ||
sh.exec('mv temp.json lerna.json', (0, command_util_1.getShellConfig)()); | ||
sh.exec(`npm set registry ${exports.VERDACCIO_REGISTRY}`); | ||
export function updateLernaForDryRun() { | ||
LOGGER.debug('Update lerna.json to use local publish registry'); | ||
sh.exec(`jq '.command.publish.registry="${VERDACCIO_REGISTRY}"' lerna.json > temp.json`, getShellConfig()); | ||
sh.exec('mv temp.json lerna.json', getShellConfig()); | ||
sh.exec(`npm set registry ${VERDACCIO_REGISTRY}`); | ||
} | ||
exports.updateLernaForDryRun = updateLernaForDryRun; | ||
//# sourceMappingURL=common.js.map |
@@ -1,3 +0,3 @@ | ||
import { ReleaseOptions } from './common'; | ||
import { ReleaseOptions } from './common.js'; | ||
export declare function releaseClient(options: ReleaseOptions): Promise<void>; | ||
//# sourceMappingURL=release-client.d.ts.map |
@@ -1,27 +0,1 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.releaseClient = void 0; | ||
/******************************************************************************** | ||
@@ -42,29 +16,28 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
const sh = __importStar(require("shelljs")); | ||
const command_util_1 = require("../../util/command-util"); | ||
const logger_1 = require("../../util/logger"); | ||
const common_1 = require("./common"); | ||
import * as sh from 'shelljs'; | ||
import { getShellConfig } from '../../util/command-util.js'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { checkoutAndCd, commitAndTag, lernaSetVersion, publish, updateLernaForDryRun, yarnInstall } from './common.js'; | ||
let REPO_ROOT; | ||
async function releaseClient(options) { | ||
logger_1.LOGGER.info('Prepare glsp-client release'); | ||
logger_1.LOGGER.debug('Release options: ', options.version); | ||
REPO_ROOT = (0, common_1.checkoutAndCd)(options); | ||
export async function releaseClient(options) { | ||
LOGGER.info('Prepare glsp-client release'); | ||
LOGGER.debug('Release options: ', options.version); | ||
REPO_ROOT = checkoutAndCd(options); | ||
updateDownloadServerScript(options.version); | ||
generateChangeLog(); | ||
(0, common_1.lernaSetVersion)(REPO_ROOT, options.version); | ||
lernaSetVersion(REPO_ROOT, options.version); | ||
build(); | ||
if (options.npmDryRun) { | ||
(0, common_1.updateLernaForDryRun)(); | ||
updateLernaForDryRun(); | ||
} | ||
(0, common_1.commitAndTag)(options.version, REPO_ROOT); | ||
(0, common_1.publish)(REPO_ROOT, options); | ||
commitAndTag(options.version, REPO_ROOT); | ||
publish(REPO_ROOT, options); | ||
} | ||
exports.releaseClient = releaseClient; | ||
async function updateDownloadServerScript(version) { | ||
logger_1.LOGGER.info('Update example server download config'); | ||
LOGGER.info('Update example server download config'); | ||
sh.cd(`${REPO_ROOT}/examples/workflow-standalone/scripts`); | ||
const configFile = 'config.json'; | ||
logger_1.LOGGER.info('Update example server download config'); | ||
sh.exec(`jq '.version="${version}"' ${configFile} > temp.json`, (0, command_util_1.getShellConfig)()); | ||
sh.exec(`mv temp.json ${configFile}`, (0, command_util_1.getShellConfig)()); | ||
LOGGER.info('Update example server download config'); | ||
sh.exec(`jq '.version="${version}"' ${configFile} > temp.json`, getShellConfig()); | ||
sh.exec(`mv temp.json ${configFile}`, getShellConfig()); | ||
} | ||
@@ -75,6 +48,6 @@ function generateChangeLog() { | ||
function build() { | ||
logger_1.LOGGER.info('Install & Build with yarn'); | ||
(0, common_1.yarnInstall)(REPO_ROOT); | ||
logger_1.LOGGER.debug('Build successful'); | ||
LOGGER.info('Install & Build with yarn'); | ||
yarnInstall(REPO_ROOT); | ||
LOGGER.debug('Build successful'); | ||
} | ||
//# sourceMappingURL=release-client.js.map |
@@ -16,4 +16,4 @@ /******************************************************************************** | ||
********************************************************************************/ | ||
import { ReleaseOptions } from './common'; | ||
import { ReleaseOptions } from './common.js'; | ||
export declare function releaseEclipseIntegration(options: ReleaseOptions): Promise<void>; | ||
//# sourceMappingURL=release-eclipse-integration.d.ts.map |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/******************************************************************************** | ||
@@ -17,63 +16,37 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.releaseEclipseIntegration = void 0; | ||
const sh = __importStar(require("shelljs")); | ||
const command_util_1 = require("../../util/command-util"); | ||
const logger_1 = require("../../util/logger"); | ||
const common_1 = require("./common"); | ||
import sh from 'shelljs'; | ||
import { fatalExec, getShellConfig } from '../../util/command-util.js'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { asMvnVersion, checkJavaServerVersion, checkoutAndCd, commitAndTag, lernaSetVersion, publish, updateLernaForDryRun, updateVersion, yarnInstall } from './common.js'; | ||
let REPO_ROOT; | ||
async function releaseEclipseIntegration(options) { | ||
logger_1.LOGGER.info('Prepare glsp-eclipse-integration release'); | ||
logger_1.LOGGER.debug('Release options: ', options); | ||
(0, common_1.checkJavaServerVersion)(options.version); | ||
REPO_ROOT = (0, common_1.checkoutAndCd)(options); | ||
export async function releaseEclipseIntegration(options) { | ||
LOGGER.info('Prepare glsp-eclipse-integration release'); | ||
LOGGER.debug('Release options: ', options); | ||
checkJavaServerVersion(options.version); | ||
REPO_ROOT = checkoutAndCd(options); | ||
prepareClient(options); | ||
prepareServer(options); | ||
generateChangeLog(); | ||
(0, common_1.commitAndTag)((0, common_1.asMvnVersion)(options.version), REPO_ROOT); | ||
(0, common_1.publish)(REPO_ROOT, options); | ||
logger_1.LOGGER.info('glsp-eclipse-integration release successful!'); | ||
commitAndTag(asMvnVersion(options.version), REPO_ROOT); | ||
publish(REPO_ROOT, options); | ||
LOGGER.info('glsp-eclipse-integration release successful!'); | ||
} | ||
exports.releaseEclipseIntegration = releaseEclipseIntegration; | ||
function prepareClient(options) { | ||
logger_1.LOGGER.info('Prepare client'); | ||
LOGGER.info('Prepare client'); | ||
updateExternalGLSPDependencies(options.version); | ||
(0, common_1.lernaSetVersion)(`${REPO_ROOT}/client`, options.version); | ||
lernaSetVersion(`${REPO_ROOT}/client`, options.version); | ||
buildClient(); | ||
if (options.npmDryRun) { | ||
(0, common_1.updateLernaForDryRun)(); | ||
updateLernaForDryRun(); | ||
} | ||
} | ||
function updateExternalGLSPDependencies(version) { | ||
logger_1.LOGGER.info('Update external GLSP dependencies (Client and workflow example)'); | ||
LOGGER.info('Update external GLSP dependencies (Client and workflow example)'); | ||
sh.cd(`${REPO_ROOT}/client`); | ||
(0, common_1.updateVersion)({ name: '@eclipse-glsp/client', version }, { name: '@eclipse-glsp-examples/workflow-glsp', version }); | ||
updateVersion({ name: '@eclipse-glsp/client', version }, { name: '@eclipse-glsp-examples/workflow-glsp', version }); | ||
} | ||
function buildClient() { | ||
logger_1.LOGGER.info('[Client] Install & Build with yarn'); | ||
(0, common_1.yarnInstall)(`${REPO_ROOT}/client`); | ||
logger_1.LOGGER.debug('Build successful'); | ||
LOGGER.info('[Client] Install & Build with yarn'); | ||
yarnInstall(`${REPO_ROOT}/client`); | ||
LOGGER.debug('Build successful'); | ||
} | ||
@@ -84,3 +57,3 @@ function generateChangeLog() { | ||
function prepareServer(options) { | ||
const mvnVersion = (0, common_1.asMvnVersion)(options.version); | ||
const mvnVersion = asMvnVersion(options.version); | ||
setServerVersion(mvnVersion); | ||
@@ -91,12 +64,12 @@ updateTarget(mvnVersion, options.releaseType); | ||
function setServerVersion(version) { | ||
logger_1.LOGGER.info(`Set pom version to ${version}`); | ||
LOGGER.info(`Set pom version to ${version}`); | ||
sh.cd(`${REPO_ROOT}/server`); | ||
// Execute tycho-versions plugin | ||
(0, command_util_1.fatalExec)(`mvn tycho-versions:set-version -DnewVersion=${version}`, 'Mvn set-versions failed', (0, command_util_1.getShellConfig)({ silent: false })); | ||
logger_1.LOGGER.debug('Version update complete!'); | ||
fatalExec(`mvn tycho-versions:set-version -DnewVersion=${version}`, 'Mvn set-versions failed', getShellConfig({ silent: false })); | ||
LOGGER.debug('Version update complete!'); | ||
} | ||
function buildServer() { | ||
sh.cd(`${REPO_ROOT}/server`); | ||
logger_1.LOGGER.info('Build Server(P2)'); | ||
(0, command_util_1.fatalExec)('mvn clean install', 'P2 build failed', (0, command_util_1.getShellConfig)({ silent: false })); | ||
LOGGER.info('Build Server(P2)'); | ||
fatalExec('mvn clean install', 'P2 build failed', getShellConfig({ silent: false })); | ||
} | ||
@@ -106,12 +79,12 @@ function updateTarget(mvnVersion, releaseType) { | ||
const p2Location = `https://download.eclipse.org/glsp/server/p2/${p2SubLocation}/${mvnVersion}/`; | ||
logger_1.LOGGER.info(`Update glsp server p2 repository to ${p2Location}`); | ||
LOGGER.info(`Update glsp server p2 repository to ${p2Location}`); | ||
sh.cd(`${REPO_ROOT}/server/releng/org.eclipse.glsp.ide.releng.target`); | ||
logger_1.LOGGER.debug('Update r2021-03.tpd file'); | ||
sh.exec(`sed -i 's_location "https://download.eclipse.org/glsp/server/p2/.*"_location "${p2Location}"_' r2021-03.tpd`, (0, command_util_1.getShellConfig)()); | ||
logger_1.LOGGER.debug('Update r2021-03.target file'); | ||
LOGGER.debug('Update r2021-03.tpd file'); | ||
sh.exec(`sed -i 's_location "https://download.eclipse.org/glsp/server/p2/.*"_location "${p2Location}"_' r2021-03.tpd`, getShellConfig()); | ||
LOGGER.debug('Update r2021-03.target file'); | ||
sh.exec( | ||
// eslint-disable-next-line max-len | ||
`sed -i 's_ <repository location="https://download.eclipse.org/glsp/server/p2/.*"_ <repository location="${p2Location}"_g' r2021-03.target`, (0, command_util_1.getShellConfig)()); | ||
logger_1.LOGGER.debug('Target update successful'); | ||
`sed -i 's_ <repository location="https://download.eclipse.org/glsp/server/p2/.*"_ <repository location="${p2Location}"_g' r2021-03.target`, getShellConfig()); | ||
LOGGER.debug('Target update successful'); | ||
} | ||
//# sourceMappingURL=release-eclipse-integration.js.map |
@@ -1,3 +0,3 @@ | ||
import { ReleaseOptions } from './common'; | ||
import { ReleaseOptions } from './common.js'; | ||
export declare function releaseJavaServer(options: ReleaseOptions): Promise<void>; | ||
//# sourceMappingURL=release-java-server.d.ts.map |
@@ -1,27 +0,1 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.releaseJavaServer = void 0; | ||
/******************************************************************************** | ||
@@ -42,12 +16,12 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
const sh = __importStar(require("shelljs")); | ||
const command_util_1 = require("../../util/command-util"); | ||
const logger_1 = require("../../util/logger"); | ||
const common_1 = require("./common"); | ||
import sh from 'shelljs'; | ||
import { fatalExec, getShellConfig } from '../../util/command-util.js'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { asMvnVersion, checkoutAndCd, commitAndTag, publish } from './common.js'; | ||
let REPO_ROOT; | ||
async function releaseJavaServer(options) { | ||
logger_1.LOGGER.info('Prepare glsp-server release'); | ||
logger_1.LOGGER.debug('Release options: ', options); | ||
const mvnVersion = (0, common_1.asMvnVersion)(options.version); | ||
REPO_ROOT = (0, common_1.checkoutAndCd)(options); | ||
export async function releaseJavaServer(options) { | ||
LOGGER.info('Prepare glsp-server release'); | ||
LOGGER.debug('Release options: ', options); | ||
const mvnVersion = asMvnVersion(options.version); | ||
REPO_ROOT = checkoutAndCd(options); | ||
sh.find(); | ||
@@ -57,14 +31,13 @@ setVersion(mvnVersion); | ||
generateChangeLog(); | ||
(0, common_1.commitAndTag)(mvnVersion, REPO_ROOT); | ||
(0, common_1.publish)(REPO_ROOT, options); | ||
logger_1.LOGGER.info('glsp-server release successful!'); | ||
commitAndTag(mvnVersion, REPO_ROOT); | ||
publish(REPO_ROOT, options); | ||
LOGGER.info('glsp-server release successful!'); | ||
} | ||
exports.releaseJavaServer = releaseJavaServer; | ||
function setVersion(version) { | ||
logger_1.LOGGER.info(`Set pom version to ${version}`); | ||
LOGGER.info(`Set pom version to ${version}`); | ||
sh.cd(REPO_ROOT); | ||
logger_1.LOGGER.debug('Preprocessing eclipse-plugins poms'); | ||
LOGGER.debug('Preprocessing eclipse-plugins poms'); | ||
// Capture all poms with a `${package.type}` property | ||
const pluginPoms = sh | ||
.exec('grep -ril --include pom.xml \\${package-type}', (0, command_util_1.getShellConfig)()) // | ||
.exec('grep -ril --include pom.xml \\${package-type}', getShellConfig()) // | ||
.stdout.trim() | ||
@@ -75,8 +48,8 @@ .split('\n') | ||
sh.sed('-i', /\${package-type}/, 'eclipse-plugin', pluginPoms); | ||
logger_1.LOGGER.debug('Preprocessing complete'); | ||
LOGGER.debug('Preprocessing complete'); | ||
// Execute tycho-versions plugin | ||
(0, command_util_1.fatalExec)(`mvn tycho-versions:set-version -DnewVersion=${version}`, 'Mvn set-versions failed', (0, command_util_1.getShellConfig)({ silent: false })); | ||
logger_1.LOGGER.debug('Restore eclipse-plugin poms'); | ||
fatalExec(`mvn tycho-versions:set-version -DnewVersion=${version}`, 'Mvn set-versions failed', getShellConfig({ silent: false })); | ||
LOGGER.debug('Restore eclipse-plugin poms'); | ||
sh.sed('-i', /<packaging>eclipse-plugin/, '<packaging>${package-type}', pluginPoms); | ||
logger_1.LOGGER.debug('Version update complete!'); | ||
LOGGER.debug('Version update complete!'); | ||
} | ||
@@ -87,9 +60,9 @@ function generateChangeLog() { | ||
function build() { | ||
logger_1.LOGGER.info('Build M2 & P2'); | ||
logger_1.LOGGER.debug('M2'); | ||
(0, command_util_1.fatalExec)('mvn clean install -Pm2', 'M2 build failed', (0, command_util_1.getShellConfig)({ silent: false })); | ||
logger_1.LOGGER.newLine(); | ||
logger_1.LOGGER.debug('P2'); | ||
(0, command_util_1.fatalExec)('mvn clean install -Pp2', 'P2 build failed', (0, command_util_1.getShellConfig)({ silent: false })); | ||
LOGGER.info('Build M2 & P2'); | ||
LOGGER.debug('M2'); | ||
fatalExec('mvn clean install -Pm2', 'M2 build failed', getShellConfig({ silent: false })); | ||
LOGGER.newLine(); | ||
LOGGER.debug('P2'); | ||
fatalExec('mvn clean install -Pp2', 'P2 build failed', getShellConfig({ silent: false })); | ||
} | ||
//# sourceMappingURL=release-java-server.js.map |
@@ -16,4 +16,4 @@ /******************************************************************************** | ||
********************************************************************************/ | ||
import { ReleaseOptions } from './common'; | ||
import { ReleaseOptions } from './common.js'; | ||
export declare function releaseServerNode(options: ReleaseOptions): Promise<void>; | ||
//# sourceMappingURL=release-server-node.d.ts.map |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/******************************************************************************** | ||
@@ -17,55 +16,29 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.releaseServerNode = void 0; | ||
const sh = __importStar(require("shelljs")); | ||
const logger_1 = require("../../util/logger"); | ||
const common_1 = require("./common"); | ||
import sh from 'shelljs'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { checkoutAndCd, commitAndTag, lernaSetVersion, publish, updateLernaForDryRun, updateVersion, yarnInstall } from './common.js'; | ||
let REPO_ROOT; | ||
async function releaseServerNode(options) { | ||
logger_1.LOGGER.info('Prepare glsp-server-node release'); | ||
logger_1.LOGGER.debug('Release options: ', options); | ||
REPO_ROOT = (0, common_1.checkoutAndCd)(options); | ||
export async function releaseServerNode(options) { | ||
LOGGER.info('Prepare glsp-server-node release'); | ||
LOGGER.debug('Release options: ', options); | ||
REPO_ROOT = checkoutAndCd(options); | ||
updateExternalGLSPDependencies(options.version); | ||
generateChangeLog(); | ||
(0, common_1.lernaSetVersion)(REPO_ROOT, options.version); | ||
lernaSetVersion(REPO_ROOT, options.version); | ||
build(); | ||
if (options.npmDryRun) { | ||
(0, common_1.updateLernaForDryRun)(); | ||
updateLernaForDryRun(); | ||
} | ||
(0, common_1.commitAndTag)(options.version, REPO_ROOT); | ||
(0, common_1.publish)(REPO_ROOT, options); | ||
commitAndTag(options.version, REPO_ROOT); | ||
publish(REPO_ROOT, options); | ||
} | ||
exports.releaseServerNode = releaseServerNode; | ||
function updateExternalGLSPDependencies(version) { | ||
logger_1.LOGGER.info('Update external GLSP dependencies (Protocol)'); | ||
LOGGER.info('Update external GLSP dependencies (Protocol)'); | ||
sh.cd(REPO_ROOT); | ||
(0, common_1.updateVersion)({ name: '@eclipse-glsp/protocol', version }); | ||
updateVersion({ name: '@eclipse-glsp/protocol', version }); | ||
} | ||
function build() { | ||
logger_1.LOGGER.info('Install & Build with yarn'); | ||
(0, common_1.yarnInstall)(REPO_ROOT); | ||
logger_1.LOGGER.debug('Build successful'); | ||
LOGGER.info('Install & Build with yarn'); | ||
yarnInstall(REPO_ROOT); | ||
LOGGER.debug('Build successful'); | ||
} | ||
@@ -72,0 +45,0 @@ function generateChangeLog() { |
@@ -16,4 +16,4 @@ /******************************************************************************** | ||
********************************************************************************/ | ||
import { ReleaseOptions } from './common'; | ||
import { ReleaseOptions } from './common.js'; | ||
export declare function releaseTheiaIntegration(options: ReleaseOptions): Promise<void>; | ||
//# sourceMappingURL=release-theia-integration.d.ts.map |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/******************************************************************************** | ||
@@ -17,55 +16,29 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.releaseTheiaIntegration = void 0; | ||
const sh = __importStar(require("shelljs")); | ||
const logger_1 = require("../../util/logger"); | ||
const common_1 = require("./common"); | ||
import sh from 'shelljs'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { checkoutAndCd, commitAndTag, lernaSetVersion, publish, updateLernaForDryRun, updateVersion, yarnInstall } from './common.js'; | ||
let REPO_ROOT; | ||
async function releaseTheiaIntegration(options) { | ||
logger_1.LOGGER.info('Prepare glsp-theia-integration release'); | ||
logger_1.LOGGER.debug('Release options: ', options); | ||
REPO_ROOT = (0, common_1.checkoutAndCd)(options); | ||
export async function releaseTheiaIntegration(options) { | ||
LOGGER.info('Prepare glsp-theia-integration release'); | ||
LOGGER.debug('Release options: ', options); | ||
REPO_ROOT = checkoutAndCd(options); | ||
updateExternalGLSPDependencies(options.version); | ||
generateChangeLog(); | ||
(0, common_1.lernaSetVersion)(REPO_ROOT, options.version); | ||
lernaSetVersion(REPO_ROOT, options.version); | ||
build(); | ||
if (options.npmDryRun) { | ||
(0, common_1.updateLernaForDryRun)(); | ||
updateLernaForDryRun(); | ||
} | ||
(0, common_1.commitAndTag)(options.version, REPO_ROOT); | ||
(0, common_1.publish)(REPO_ROOT, options); | ||
commitAndTag(options.version, REPO_ROOT); | ||
publish(REPO_ROOT, options); | ||
} | ||
exports.releaseTheiaIntegration = releaseTheiaIntegration; | ||
function updateExternalGLSPDependencies(version) { | ||
logger_1.LOGGER.info('Update external GLSP dependencies (Client and workflow example & server)'); | ||
LOGGER.info('Update external GLSP dependencies (Client and workflow example & server)'); | ||
sh.cd(REPO_ROOT); | ||
(0, common_1.updateVersion)({ name: '@eclipse-glsp/client', version }, { name: '@eclipse-glsp-examples/workflow-glsp', version }, { name: '@eclipse-glsp-examples/workflow-server', version }); | ||
updateVersion({ name: '@eclipse-glsp/client', version }, { name: '@eclipse-glsp-examples/workflow-glsp', version }, { name: '@eclipse-glsp-examples/workflow-server', version }); | ||
} | ||
function build() { | ||
logger_1.LOGGER.info('Install & Build with yarn'); | ||
(0, common_1.yarnInstall)(REPO_ROOT); | ||
logger_1.LOGGER.debug('Build successful'); | ||
LOGGER.info('Install & Build with yarn'); | ||
yarnInstall(REPO_ROOT); | ||
LOGGER.debug('Build successful'); | ||
} | ||
@@ -72,0 +45,0 @@ function generateChangeLog() { |
@@ -16,4 +16,4 @@ /******************************************************************************** | ||
********************************************************************************/ | ||
import { ReleaseOptions } from './common'; | ||
import { ReleaseOptions } from './common.js'; | ||
export declare function releaseVscodeIntegration(options: ReleaseOptions): Promise<void>; | ||
//# sourceMappingURL=release-vscode-integration.d.ts.map |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/******************************************************************************** | ||
@@ -17,55 +16,29 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.releaseVscodeIntegration = void 0; | ||
const sh = __importStar(require("shelljs")); | ||
const logger_1 = require("../../util/logger"); | ||
const common_1 = require("./common"); | ||
import sh from 'shelljs'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { checkoutAndCd, commitAndTag, lernaSetVersion, publish, updateLernaForDryRun, updateVersion, yarnInstall } from './common.js'; | ||
let REPO_ROOT; | ||
async function releaseVscodeIntegration(options) { | ||
logger_1.LOGGER.info('Prepare glsp-vscode-integration release'); | ||
logger_1.LOGGER.debug('Release options: ', options); | ||
REPO_ROOT = (0, common_1.checkoutAndCd)(options); | ||
export async function releaseVscodeIntegration(options) { | ||
LOGGER.info('Prepare glsp-vscode-integration release'); | ||
LOGGER.debug('Release options: ', options); | ||
REPO_ROOT = checkoutAndCd(options); | ||
updateExternalGLSPDependencies(options.version); | ||
generateChangeLog(); | ||
(0, common_1.lernaSetVersion)(REPO_ROOT, options.version); | ||
lernaSetVersion(REPO_ROOT, options.version); | ||
build(); | ||
if (options.npmDryRun) { | ||
(0, common_1.updateLernaForDryRun)(); | ||
updateLernaForDryRun(); | ||
} | ||
(0, common_1.commitAndTag)(options.version, REPO_ROOT); | ||
(0, common_1.publish)(REPO_ROOT, options); | ||
commitAndTag(options.version, REPO_ROOT); | ||
publish(REPO_ROOT, options); | ||
} | ||
exports.releaseVscodeIntegration = releaseVscodeIntegration; | ||
function updateExternalGLSPDependencies(version) { | ||
logger_1.LOGGER.info('Update external GLSP dependencies (Protocol)'); | ||
LOGGER.info('Update external GLSP dependencies (Protocol)'); | ||
sh.cd(REPO_ROOT); | ||
(0, common_1.updateVersion)({ name: '@eclipse-glsp/protocol', version }, { name: '@eclipse-glsp/client', version }, { name: '@eclipse-glsp-examples/workflow-glsp', version }, { name: '@eclipse-glsp-examples/workflow-server', version }); | ||
updateVersion({ name: '@eclipse-glsp/protocol', version }, { name: '@eclipse-glsp/client', version }, { name: '@eclipse-glsp-examples/workflow-glsp', version }, { name: '@eclipse-glsp-examples/workflow-server', version }, { name: '@eclipse-glsp-examples/workflow-server-bundled', version }); | ||
} | ||
function build() { | ||
logger_1.LOGGER.info('Install & Build with yarn'); | ||
(0, common_1.yarnInstall)(REPO_ROOT); | ||
logger_1.LOGGER.debug('Build successful'); | ||
LOGGER.info('Install & Build with yarn'); | ||
yarnInstall(REPO_ROOT); | ||
LOGGER.debug('Build successful'); | ||
} | ||
@@ -72,0 +45,0 @@ function generateChangeLog() { |
@@ -1,2 +0,2 @@ | ||
import { Component, ReleaseType } from './common'; | ||
import { Component, ReleaseType } from './common.js'; | ||
interface ReleaseCmdOptions { | ||
@@ -3,0 +3,0 @@ checkoutDir: string; |
@@ -1,51 +0,25 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.release = exports.ReleaseCommand = void 0; | ||
const commander_1 = require("commander"); | ||
const process_1 = require("process"); | ||
const readline_1 = require("readline"); | ||
const readline = __importStar(require("readline-sync")); | ||
const semver = __importStar(require("semver")); | ||
const sh = __importStar(require("shelljs")); | ||
const command_util_1 = require("../../util/command-util"); | ||
const logger_1 = require("../../util/logger"); | ||
const validation_util_1 = require("../../util/validation-util"); | ||
const common_1 = require("./common"); | ||
const release_client_1 = require("./release-client"); | ||
const release_eclipse_integration_1 = require("./release-eclipse-integration"); | ||
const release_java_server_1 = require("./release-java-server"); | ||
const release_server_node_1 = require("./release-server-node"); | ||
const release_theia_integration_1 = require("./release-theia-integration"); | ||
const release_vscode_integration_1 = require("./release-vscode-integration"); | ||
exports.ReleaseCommand = (0, command_util_1.baseCommand)() | ||
import { Argument } from 'commander'; | ||
import { exit } from 'process'; | ||
import { createInterface } from 'readline'; | ||
import * as readline from 'readline-sync'; | ||
import * as semver from 'semver'; | ||
import sh from 'shelljs'; | ||
import { baseCommand, configureShell, fatalExec, getShellConfig } from '../../util/command-util.js'; | ||
import { LOGGER, configureLogger } from '../../util/logger.js'; | ||
import { validateDirectory, validateVersion } from '../../util/validation-util.js'; | ||
import { Component, ReleaseType, VERDACCIO_REGISTRY, asMvnVersion, checkIfMavenVersionExists, checkIfNpmVersionIsNew } from './common.js'; | ||
import { releaseClient } from './release-client.js'; | ||
import { releaseEclipseIntegration } from './release-eclipse-integration.js'; | ||
import { releaseJavaServer } from './release-java-server.js'; | ||
import { releaseServerNode } from './release-server-node.js'; | ||
import { releaseTheiaIntegration } from './release-theia-integration.js'; | ||
import { releaseVscodeIntegration } from './release-vscode-integration.js'; | ||
export const ReleaseCommand = baseCommand() | ||
.name('release') | ||
.description('Prepare & publish a new release for a glsp component') | ||
.addArgument(new commander_1.Argument('<component>', 'The glsp component to be released').choices(common_1.Component.CLI_CHOICES).argParser(common_1.Component.parse)) | ||
.addArgument(new commander_1.Argument('<releaseType>', 'The release type').choices(common_1.ReleaseType.CLI_CHOICES)) | ||
.argument('[customVersion]', 'Custom version number. Will be ignored if the release type is not "custom"', validation_util_1.validateVersion) | ||
.addArgument(new Argument('<component>', 'The glsp component to be released').choices(Component.CLI_CHOICES).argParser(Component.parse)) | ||
.addArgument(new Argument('<releaseType>', 'The release type').choices(ReleaseType.CLI_CHOICES)) | ||
.argument('[customVersion]', 'Custom version number. Will be ignored if the release type is not "custom"', validateVersion) | ||
.option('-f, --force', 'Enable force mode', false) | ||
.option('-d, --checkoutDir <checkoutDir>', 'The git checkout directory', validation_util_1.validateDirectory, process.cwd()) | ||
.option('-d, --checkoutDir <checkoutDir>', 'The git checkout directory', validateDirectory, process.cwd()) | ||
.option('-b, --branch <branch>', 'The git branch to checkout', 'master') | ||
@@ -58,7 +32,7 @@ .option('-v, --verbose', 'Enable verbose (debug) log output', false) | ||
let verdaccioChildProcess = undefined; | ||
async function release(component, releaseType, customVersion, cliOptions) { | ||
export async function release(component, releaseType, customVersion, cliOptions) { | ||
try { | ||
logger_1.LOGGER.debug('Cli options:', cliOptions); | ||
(0, command_util_1.configureShell)({ silent: !cliOptions.verbose }); | ||
(0, logger_1.configureLogger)(cliOptions.verbose); | ||
configureLogger(cliOptions.verbose); | ||
LOGGER.debug('Cli options:', cliOptions); | ||
configureShell({ silent: !cliOptions.verbose }); | ||
checkGHCli(); | ||
@@ -68,23 +42,23 @@ const version = deriveVersion(releaseType, customVersion); | ||
if (cliOptions.npmDryRun && options.component.releaseRepo === 'npm') { | ||
await launchVerdaccio().catch(error => logger_1.LOGGER.error('Error occurred during verdaccio launch', error)); | ||
await launchVerdaccio().catch(error => LOGGER.error('Error occurred during verdaccio launch', error)); | ||
} | ||
switch (component.type) { | ||
case 'server-java': | ||
(0, common_1.checkIfMavenVersionExists)('org.eclipse.glsp', 'org.eclipse.glsp.server', (0, common_1.asMvnVersion)(version)); | ||
return (0, release_java_server_1.releaseJavaServer)(options); | ||
checkIfMavenVersionExists('org.eclipse.glsp', 'org.eclipse.glsp.server', asMvnVersion(version)); | ||
return releaseJavaServer(options); | ||
case 'server-node': | ||
await (0, common_1.checkIfNpmVersionIsNew)('@eclipse-glsp/server-node', version); | ||
return (0, release_server_node_1.releaseServerNode)(options); | ||
await checkIfNpmVersionIsNew('@eclipse-glsp/server-node', version); | ||
return releaseServerNode(options); | ||
case 'client': | ||
await (0, common_1.checkIfNpmVersionIsNew)('@eclipse-glsp/client', version); | ||
return (0, release_client_1.releaseClient)(options); | ||
await checkIfNpmVersionIsNew('@eclipse-glsp/client', version); | ||
return releaseClient(options); | ||
case 'theia-integration': | ||
await (0, common_1.checkIfNpmVersionIsNew)('@eclipse-glsp/theia-integration', version); | ||
return (0, release_theia_integration_1.releaseTheiaIntegration)(options); | ||
await checkIfNpmVersionIsNew('@eclipse-glsp/theia-integration', version); | ||
return releaseTheiaIntegration(options); | ||
case 'vscode-integration': | ||
await (0, common_1.checkIfNpmVersionIsNew)('@eclipse-glsp/vscode-integration', version); | ||
return (0, release_vscode_integration_1.releaseVscodeIntegration)(options); | ||
await checkIfNpmVersionIsNew('@eclipse-glsp/vscode-integration', version); | ||
return releaseVscodeIntegration(options); | ||
case 'eclipse-integration': | ||
await (0, common_1.checkIfNpmVersionIsNew)('@eclipse-glsp/ide', version); | ||
return (0, release_eclipse_integration_1.releaseEclipseIntegration)(options); | ||
await checkIfNpmVersionIsNew('@eclipse-glsp/ide', version); | ||
return releaseEclipseIntegration(options); | ||
} | ||
@@ -94,3 +68,3 @@ } | ||
console.error('An error occurred during command execution:', err); | ||
(0, process_1.exit)(1); | ||
exit(1); | ||
} | ||
@@ -103,5 +77,4 @@ finally { | ||
} | ||
exports.release = release; | ||
function checkGHCli() { | ||
logger_1.LOGGER.debug('Verify that Github CLI is configured correctly'); | ||
LOGGER.debug('Verify that Github CLI is configured correctly'); | ||
if (!isGithubCLIAuthenticated()) { | ||
@@ -112,5 +85,5 @@ throw new Error("Github CLI is not configured properly. No user is logged in for host 'github.com'"); | ||
function isGithubCLIAuthenticated() { | ||
logger_1.LOGGER.debug('Verify that Github CLI is installed'); | ||
(0, command_util_1.fatalExec)('which gh', 'Github CLI is not installed!'); | ||
const status = sh.exec('gh auth status', (0, command_util_1.getShellConfig)()); | ||
LOGGER.debug('Verify that Github CLI is installed'); | ||
fatalExec('which gh', 'Github CLI is not installed!'); | ||
const status = sh.exec('gh auth status', getShellConfig()); | ||
if (status.code !== 0) { | ||
@@ -123,19 +96,19 @@ if (status.stderr.includes('You are not logged into any GitHub hosts')) { | ||
if (!status.stdout.trim().includes('Logged in to github.com')) { | ||
logger_1.LOGGER.debug("No user is logged in for host 'github.com'"); | ||
LOGGER.debug("No user is logged in for host 'github.com'"); | ||
return false; | ||
} | ||
logger_1.LOGGER.debug('Github CLI is authenticated and ready to use'); | ||
LOGGER.debug('Github CLI is authenticated and ready to use'); | ||
return true; | ||
} | ||
function launchVerdaccio() { | ||
logger_1.LOGGER.debug('Verify that verdaccio is installed and start if necessary'); | ||
(0, command_util_1.fatalExec)('which verdaccio', 'Verdaccio is not installed!'); | ||
LOGGER.debug('Verify that verdaccio is installed and start if necessary'); | ||
fatalExec('which verdaccio', 'Verdaccio is not installed!'); | ||
// Check if verdaccio is alreaddy running | ||
const result = sh.exec(`curl -i ${common_1.VERDACCIO_REGISTRY}`, (0, command_util_1.getShellConfig)()); | ||
const result = sh.exec(`curl -i ${VERDACCIO_REGISTRY}`, getShellConfig()); | ||
if (result.code !== 0) { | ||
logger_1.LOGGER.info('Starting local verdaccio registry'); | ||
LOGGER.info('Starting local verdaccio registry'); | ||
verdaccioChildProcess = sh.exec('verdaccio', { async: true, silent: true }); | ||
return new Promise(resolve => { | ||
(0, readline_1.createInterface)(verdaccioChildProcess.stdout).on('line', line => { | ||
if (line.includes(`http address - ${common_1.VERDACCIO_REGISTRY}`)) { | ||
createInterface(verdaccioChildProcess.stdout).on('line', line => { | ||
if (line.includes(`http address - ${VERDACCIO_REGISTRY}`)) { | ||
resolve(); | ||
@@ -149,3 +122,3 @@ } | ||
function deriveVersion(releaseType, customVersion) { | ||
logger_1.LOGGER.debug(`Derive version from release type: ${release}`); | ||
LOGGER.debug(`Derive version from release type: ${release}`); | ||
switch (releaseType) { | ||
@@ -164,5 +137,5 @@ case 'custom': | ||
function getRCVersion() { | ||
logger_1.LOGGER.debug('Retrieve and new RC version'); | ||
LOGGER.debug('Retrieve and new RC version'); | ||
const newBaseVersion = semverInc('minor'); | ||
const currentRcVersion = sh.exec(`npm view ${REFERENCE_NPM_PACKAGE} dist-tags.rc`, (0, command_util_1.getShellConfig)()).stdout.trim(); | ||
const currentRcVersion = sh.exec(`npm view ${REFERENCE_NPM_PACKAGE} dist-tags.rc`, getShellConfig()).stdout.trim(); | ||
const currentRcBaseVersion = currentRcVersion.split('-')[0]; | ||
@@ -177,15 +150,15 @@ if (currentRcBaseVersion !== newBaseVersion) { | ||
function getCustomVersion(customVersion) { | ||
logger_1.LOGGER.debug('Retrieve and validate custom version'); | ||
logger_1.LOGGER.debug(customVersion ? `Custom version has been passed as argument: ${customVersion}` : 'Prompt custom version from user'); | ||
LOGGER.debug('Retrieve and validate custom version'); | ||
LOGGER.debug(customVersion ? `Custom version has been passed as argument: ${customVersion}` : 'Prompt custom version from user'); | ||
const version = customVersion !== null && customVersion !== void 0 ? customVersion : readline.question('> Please enter the new version'); | ||
return (0, validation_util_1.validateVersion)(version); | ||
return validateVersion(version); | ||
} | ||
function getCurrentVersion() { | ||
logger_1.LOGGER.debug('Retrieve base version by querying the latest tag of the reference npm package'); | ||
const version = sh.exec(`npm view ${REFERENCE_NPM_PACKAGE} dist-tags.latest`, (0, command_util_1.getShellConfig)()).stdout.trim(); | ||
return (0, validation_util_1.validateVersion)(version); | ||
LOGGER.debug('Retrieve base version by querying the latest tag of the reference npm package'); | ||
const version = sh.exec(`npm view ${REFERENCE_NPM_PACKAGE} dist-tags.latest`, getShellConfig()).stdout.trim(); | ||
return validateVersion(version); | ||
} | ||
function semverInc(releaseType, identifier) { | ||
const currentVersion = getCurrentVersion(); | ||
logger_1.LOGGER.debug(`Execute: semver.inc("${currentVersion}", ${releaseType}, ${identifier})`); | ||
LOGGER.debug(`Execute: semver.inc("${currentVersion}", ${releaseType}, ${identifier})`); | ||
const newVersion = semver.inc(currentVersion, releaseType, identifier); | ||
@@ -192,0 +165,0 @@ if (!newVersion) { |
@@ -17,3 +17,3 @@ /******************************************************************************** | ||
import { Command } from 'commander'; | ||
import * as sh from 'shelljs'; | ||
import sh from 'shelljs'; | ||
export declare function baseCommand(cmd?: Command): Command; | ||
@@ -20,0 +20,0 @@ export type ShellConfig = sh.ExecOptions & { |
@@ -1,27 +0,1 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fatalExec = exports.configureShell = exports.getShellConfig = exports.SH_CONFIG = exports.baseCommand = void 0; | ||
/******************************************************************************** | ||
@@ -42,6 +16,6 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
const commander_1 = require("commander"); | ||
const sh = __importStar(require("shelljs")); | ||
import { Command } from 'commander'; | ||
import sh from 'shelljs'; | ||
// Commander.js utils | ||
function baseCommand(cmd = new commander_1.Command()) { | ||
export function baseCommand(cmd = new Command()) { | ||
return cmd // | ||
@@ -52,4 +26,3 @@ .showSuggestionAfterError(true) | ||
} | ||
exports.baseCommand = baseCommand; | ||
exports.SH_CONFIG = { | ||
export const SH_CONFIG = { | ||
async: false, | ||
@@ -59,14 +32,12 @@ fatal: true, | ||
}; | ||
function getShellConfig(options = {}) { | ||
return Object.assign(Object.assign({}, exports.SH_CONFIG), options); | ||
export function getShellConfig(options = {}) { | ||
return Object.assign(Object.assign({}, SH_CONFIG), options); | ||
} | ||
exports.getShellConfig = getShellConfig; | ||
function configureShell(config) { | ||
export function configureShell(config) { | ||
sh.config.reset(); | ||
getShellConfig({}); | ||
exports.SH_CONFIG.silent = config.silent; | ||
exports.SH_CONFIG.fatal = config.fatal; | ||
SH_CONFIG.silent = config.silent; | ||
SH_CONFIG.fatal = config.fatal; | ||
} | ||
exports.configureShell = configureShell; | ||
function fatalExec(command, fatalErrorMessage, options = {}) { | ||
export function fatalExec(command, fatalErrorMessage, options = {}) { | ||
const result = sh.exec(command, getShellConfig(options)); | ||
@@ -78,3 +49,2 @@ if (result.code !== 0) { | ||
} | ||
exports.fatalExec = fatalExec; | ||
//# sourceMappingURL=command-util.js.map |
@@ -37,23 +37,3 @@ /******************************************************************************** | ||
export declare function getLastModificationDate(filePath?: string, repoRoot?: string, excludeMessage?: string): Date | undefined; | ||
/** | ||
* Returns the last modification date of a file in a git repo. | ||
* @param filePath The file | ||
* @param repoRoot The path to the repo root. If undefined the current working directory is used. | ||
* @param excludeMessage Only consider commits that don`t match the excludeMessage | ||
* @returns The date or undefined if the file is outside of the git repo. | ||
*/ | ||
export declare function getFirstModificationDate(filePath: string, repoRoot?: string, excludeMessage?: string): Date | undefined; | ||
export declare function getFilesOfCommit(commitHash: string, repoRoot?: string): string[]; | ||
/** | ||
* Returns the commit hash of the initial commit of the given repository | ||
* @param repoRoot The path to the repo root. If undefined the current working directory is used. | ||
* @returns The commit hash or undefined if something went wrong. | ||
*/ | ||
export declare function getInitialCommit(repoRoot?: string): string | undefined; | ||
/** | ||
* Returns the commit hash of the first commit for a given file (across renames). | ||
* @param repoRoot The path to the repo root. If undefined the current working directory is used. | ||
* @returns The commit hash or undefined if something went wrong. | ||
*/ | ||
export declare function getFirstCommit(filePath: string, repoRoot?: string): string | undefined; | ||
export declare function getLatestGithubRelease(path?: string): string; | ||
@@ -60,0 +40,0 @@ export declare function getLatestTag(path?: string): string; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/******************************************************************************** | ||
@@ -17,34 +16,9 @@ * Copyright (c) 2022-2022 EclipseSource and others. | ||
********************************************************************************/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getRemoteUrl = exports.hasBranch = exports.getLatestTag = exports.getLatestGithubRelease = exports.getFirstCommit = exports.getInitialCommit = exports.getFilesOfCommit = exports.getFirstModificationDate = exports.getLastModificationDate = exports.getChangesOfLastCommit = exports.getUncommittedChanges = exports.hasGitChanges = exports.getGitRoot = exports.isGitRepository = void 0; | ||
const path_1 = require("path"); | ||
const sh = __importStar(require("shelljs")); | ||
const command_util_1 = require("./command-util"); | ||
function isGitRepository(path) { | ||
import { resolve } from 'path'; | ||
import sh from 'shelljs'; | ||
import { getShellConfig } from './command-util.js'; | ||
export function isGitRepository(path) { | ||
cdIfPresent(path); | ||
const isGitRepo = sh | ||
.exec('git rev-parse --is-inside-work-tree', (0, command_util_1.getShellConfig)({ silent: true })) | ||
.exec('git rev-parse --is-inside-work-tree', getShellConfig({ silent: true })) | ||
.stdout.trim() | ||
@@ -54,13 +28,10 @@ .toLocaleLowerCase() === 'true'; | ||
} | ||
exports.isGitRepository = isGitRepository; | ||
function getGitRoot(path) { | ||
export function getGitRoot(path) { | ||
cdIfPresent(path); | ||
const fileString = sh.exec('git rev-parse --show-toplevel', (0, command_util_1.getShellConfig)()).stdout.trim(); | ||
return (0, path_1.resolve)(fileString); | ||
const fileString = sh.exec('git rev-parse --show-toplevel', getShellConfig()).stdout.trim(); | ||
return resolve(fileString); | ||
} | ||
exports.getGitRoot = getGitRoot; | ||
function hasGitChanges(path) { | ||
export function hasGitChanges(path) { | ||
return getUncommittedChanges(path).length > 0; | ||
} | ||
exports.hasGitChanges = hasGitChanges; | ||
/** | ||
@@ -70,6 +41,6 @@ * Returns the files that have uncommitted changes (staged, not staged and untracked) of a git repository. | ||
*/ | ||
function getUncommittedChanges(path) { | ||
export function getUncommittedChanges(path) { | ||
cdIfPresent(path); | ||
return sh | ||
.exec('git status --porcelain', (0, command_util_1.getShellConfig)()) | ||
.exec('git status --porcelain', getShellConfig()) | ||
.stdout.trim() | ||
@@ -80,5 +51,4 @@ .split('\n') | ||
// Extract relative file path from the info string and convert to absolute path | ||
return (0, path_1.resolve)(path !== null && path !== void 0 ? path : process.cwd(), (_a = fileInfo.trim().split(' ').pop()) !== null && _a !== void 0 ? _a : ''); }); | ||
return resolve(path !== null && path !== void 0 ? path : process.cwd(), (_a = fileInfo.trim().split(' ').pop()) !== null && _a !== void 0 ? _a : ''); }); | ||
} | ||
exports.getUncommittedChanges = getUncommittedChanges; | ||
/** | ||
@@ -88,11 +58,10 @@ * Returns the files tha have been changed with the last commit (also includes currently staged but uncommitted changes) | ||
*/ | ||
function getChangesOfLastCommit(path) { | ||
export function getChangesOfLastCommit(path) { | ||
cdIfPresent(path); | ||
return sh | ||
.exec('git diff --name-only HEAD^', (0, command_util_1.getShellConfig)()) | ||
.exec('git diff --name-only HEAD^', getShellConfig()) | ||
.stdout.trim() | ||
.split('\n') | ||
.map(file => (0, path_1.resolve)(path !== null && path !== void 0 ? path : process.cwd(), file)); | ||
.map(file => resolve(path !== null && path !== void 0 ? path : process.cwd(), file)); | ||
} | ||
exports.getChangesOfLastCommit = getChangesOfLastCommit; | ||
/** | ||
@@ -105,6 +74,6 @@ * Returns the last modification date of a file (or the last commit) in a git repo. | ||
*/ | ||
function getLastModificationDate(filePath, repoRoot, excludeMessage) { | ||
export function getLastModificationDate(filePath, repoRoot, excludeMessage) { | ||
cdIfPresent(repoRoot); | ||
const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : ''; | ||
const result = sh.exec(`git log -1 ${additionalArgs} --pretty="format:%ci" ${filePath !== null && filePath !== void 0 ? filePath : ''}`, (0, command_util_1.getShellConfig)()); | ||
const result = sh.exec(`git log -1 ${additionalArgs} --pretty="format:%ci" ${filePath !== null && filePath !== void 0 ? filePath : ''}`, getShellConfig()); | ||
if (result.code !== 0) { | ||
@@ -115,29 +84,6 @@ return undefined; | ||
} | ||
exports.getLastModificationDate = getLastModificationDate; | ||
/** | ||
* Returns the last modification date of a file in a git repo. | ||
* @param filePath The file | ||
* @param repoRoot The path to the repo root. If undefined the current working directory is used. | ||
* @param excludeMessage Only consider commits that don`t match the excludeMessage | ||
* @returns The date or undefined if the file is outside of the git repo. | ||
*/ | ||
function getFirstModificationDate(filePath, repoRoot, excludeMessage) { | ||
export function getFilesOfCommit(commitHash, repoRoot) { | ||
cdIfPresent(repoRoot); | ||
const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : ''; | ||
const result = sh.exec(`git log ${additionalArgs} --pretty="format:%ci" --follow ${filePath}`, (0, command_util_1.getShellConfig)()); | ||
const result = sh.exec(`git show --pretty="" --name-only ${commitHash}`, getShellConfig()); | ||
if (result.code !== 0) { | ||
return undefined; | ||
} | ||
const datesString = result.stdout.trim(); | ||
if (datesString.length === 0) { | ||
return new Date(); | ||
} | ||
const date = datesString.split('\n').pop(); | ||
return date ? new Date(date) : undefined; | ||
} | ||
exports.getFirstModificationDate = getFirstModificationDate; | ||
function getFilesOfCommit(commitHash, repoRoot) { | ||
cdIfPresent(repoRoot); | ||
const result = sh.exec(`git show --pretty="" --name-only ${commitHash}`, (0, command_util_1.getShellConfig)()); | ||
if (result.code !== 0) { | ||
return []; | ||
@@ -147,56 +93,19 @@ } | ||
} | ||
exports.getFilesOfCommit = getFilesOfCommit; | ||
/** | ||
* Returns the commit hash of the initial commit of the given repository | ||
* @param repoRoot The path to the repo root. If undefined the current working directory is used. | ||
* @returns The commit hash or undefined if something went wrong. | ||
*/ | ||
function getInitialCommit(repoRoot) { | ||
cdIfPresent(repoRoot); | ||
const result = sh.exec('git log --pretty=oneline --reverse', (0, command_util_1.getShellConfig)()); | ||
if (result.code !== 0) { | ||
return undefined; | ||
} | ||
const commits = result.stdout.trim(); | ||
if (commits.length === 0) { | ||
return undefined; | ||
} | ||
return commits.substring(0, commits.indexOf(' ')); | ||
} | ||
exports.getInitialCommit = getInitialCommit; | ||
/** | ||
* Returns the commit hash of the first commit for a given file (across renames). | ||
* @param repoRoot The path to the repo root. If undefined the current working directory is used. | ||
* @returns The commit hash or undefined if something went wrong. | ||
*/ | ||
function getFirstCommit(filePath, repoRoot) { | ||
cdIfPresent(repoRoot); | ||
const result = sh.exec(`git log --follow --pretty=format:"%H" ${filePath}`, (0, command_util_1.getShellConfig)()); | ||
if (result.code !== 0) { | ||
return undefined; | ||
} | ||
return result.stdout.trim().split('\n').pop(); | ||
} | ||
exports.getFirstCommit = getFirstCommit; | ||
function getLatestGithubRelease(path) { | ||
export function getLatestGithubRelease(path) { | ||
cdIfPresent(path); | ||
const release = sh.exec('gh release list --exclude-drafts -L 1', (0, command_util_1.getShellConfig)()).stdout.trim().split('\t'); | ||
const release = sh.exec('gh release list --exclude-drafts -L 1', getShellConfig()).stdout.trim().split('\t'); | ||
return release[release.length - 2]; | ||
} | ||
exports.getLatestGithubRelease = getLatestGithubRelease; | ||
function getLatestTag(path) { | ||
export function getLatestTag(path) { | ||
cdIfPresent(path); | ||
return sh.exec('git describe --abbrev=0 --tags', (0, command_util_1.getShellConfig)()).stdout.trim(); | ||
return sh.exec('git describe --abbrev=0 --tags', getShellConfig()).stdout.trim(); | ||
} | ||
exports.getLatestTag = getLatestTag; | ||
function hasBranch(branch, path) { | ||
export function hasBranch(branch, path) { | ||
cdIfPresent(path); | ||
return sh.exec(`git branch --list ${branch}`, (0, command_util_1.getShellConfig)()).stdout.trim().length !== 0; | ||
return sh.exec(`git branch --list ${branch}`, getShellConfig()).stdout.trim().length !== 0; | ||
} | ||
exports.hasBranch = hasBranch; | ||
function getRemoteUrl(path) { | ||
export function getRemoteUrl(path) { | ||
cdIfPresent(path); | ||
return sh.exec('git config --get remote.origin.url', (0, command_util_1.getShellConfig)()).stdout.trim(); | ||
return sh.exec('git config --get remote.origin.url', getShellConfig()).stdout.trim(); | ||
} | ||
exports.getRemoteUrl = getRemoteUrl; | ||
function cdIfPresent(path) { | ||
@@ -203,0 +112,0 @@ if (path) { |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/******************************************************************************** | ||
@@ -17,4 +16,2 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.configureLogger = exports.LOGGER = void 0; | ||
const levels = { | ||
@@ -27,3 +24,3 @@ error: { threshold: 0, color: '\x1b[31m' }, | ||
let levelThreshold = levels.info.threshold; | ||
exports.LOGGER = { | ||
export const LOGGER = { | ||
info: (...args) => log('info', ...args), | ||
@@ -42,3 +39,3 @@ error: (...args) => log('error', ...args), | ||
} | ||
function configureLogger(levelOrVerbose) { | ||
export function configureLogger(levelOrVerbose) { | ||
if (typeof levelOrVerbose === 'boolean') { | ||
@@ -52,3 +49,2 @@ const level = levelOrVerbose ? 'debug' : 'info'; | ||
} | ||
exports.configureLogger = configureLogger; | ||
//# sourceMappingURL=logger.js.map |
@@ -1,2 +0,1 @@ | ||
export declare const COMMAND_VERSION = "1.1.0-next"; | ||
export declare function validateDirectory(rootDir: string): string; | ||
@@ -3,0 +2,0 @@ export declare function validateFile(filePath: string, hasToExist?: boolean): string; |
@@ -1,27 +0,1 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.validateGitDirectory = exports.validateVersion = exports.validateFile = exports.validateDirectory = exports.COMMAND_VERSION = void 0; | ||
/******************************************************************************** | ||
@@ -42,47 +16,42 @@ * Copyright (c) 2022 EclipseSource and others. | ||
********************************************************************************/ | ||
const commander_1 = require("commander"); | ||
const fs = __importStar(require("fs")); | ||
const path_1 = require("path"); | ||
const semver = __importStar(require("semver")); | ||
const git_util_1 = require("./git-util"); | ||
const logger_1 = require("./logger"); | ||
exports.COMMAND_VERSION = '1.1.0-next'; | ||
function validateDirectory(rootDir) { | ||
const path = (0, path_1.resolve)(rootDir); | ||
import { InvalidArgumentError } from 'commander'; | ||
import * as fs from 'fs'; | ||
import { resolve } from 'path'; | ||
import * as semver from 'semver'; | ||
import { getGitRoot, isGitRepository } from './git-util.js'; | ||
import { LOGGER } from './logger.js'; | ||
export function validateDirectory(rootDir) { | ||
const path = resolve(rootDir); | ||
if (!fs.existsSync(path)) { | ||
throw new commander_1.InvalidArgumentError('Not a valid file path!'); | ||
throw new InvalidArgumentError('Not a valid file path!'); | ||
} | ||
if (!fs.statSync(path).isDirectory()) { | ||
throw new commander_1.InvalidArgumentError('Not a directory!'); | ||
throw new InvalidArgumentError('Not a directory!'); | ||
} | ||
return path; | ||
} | ||
exports.validateDirectory = validateDirectory; | ||
function validateFile(filePath, hasToExist = false) { | ||
const path = (0, path_1.resolve)(filePath); | ||
export function validateFile(filePath, hasToExist = false) { | ||
const path = resolve(filePath); | ||
if (hasToExist && !fs.existsSync(path)) { | ||
throw new commander_1.InvalidArgumentError('Not a valid file path!'); | ||
throw new InvalidArgumentError('Not a valid file path!'); | ||
} | ||
if (!fs.statSync(path).isFile()) { | ||
throw new commander_1.InvalidArgumentError('Not a file!'); | ||
throw new InvalidArgumentError('Not a file!'); | ||
} | ||
return path; | ||
} | ||
exports.validateFile = validateFile; | ||
function validateVersion(version) { | ||
logger_1.LOGGER.debug(`Validate version format of: ${version}`); | ||
export function validateVersion(version) { | ||
LOGGER.debug(`Validate version format of: ${version}`); | ||
if (!semver.valid(version)) { | ||
throw new commander_1.InvalidArgumentError(`Not a valid version: ${version}`); | ||
throw new InvalidArgumentError(`Not a valid version: ${version}`); | ||
} | ||
return version; | ||
} | ||
exports.validateVersion = validateVersion; | ||
function validateGitDirectory(repository) { | ||
export function validateGitDirectory(repository) { | ||
const repoPath = validateDirectory(repository); | ||
if (!(0, git_util_1.isGitRepository)(repoPath)) { | ||
throw new commander_1.InvalidArgumentError('Not a valid git repository'); | ||
if (!isGitRepository(repoPath)) { | ||
throw new InvalidArgumentError('Not a valid git repository'); | ||
} | ||
return (0, git_util_1.getGitRoot)(repository); | ||
return getGitRoot(repository); | ||
} | ||
exports.validateGitDirectory = validateGitDirectory; | ||
//# sourceMappingURL=validation-util.js.map |
{ | ||
"name": "@eclipse-glsp/cli", | ||
"version": "2.1.0-next.e32e40e.153+e32e40e", | ||
"version": "2.2.0-next.063af47.158+063af47", | ||
"description": "CLI Tooling & scripts for GLSP components", | ||
@@ -26,2 +26,3 @@ "keywords": [ | ||
], | ||
"type": "module", | ||
"bin": { | ||
@@ -47,3 +48,5 @@ "glsp": "bin/glsp" | ||
"glob": "^10.3.10", | ||
"globby": "13.2.2", | ||
"node-fetch": "^2.6.11", | ||
"node-jq": "^4.3.1", | ||
"readline-sync": "^1.4.10", | ||
@@ -54,3 +57,3 @@ "semver": "^7.5.1", | ||
"devDependencies": { | ||
"@eclipse-glsp/config": "2.1.0-next.e32e40e.153+e32e40e", | ||
"@eclipse-glsp/config": "2.2.0-next.063af47.158+063af47", | ||
"@types/glob": "^8.1.0", | ||
@@ -65,3 +68,3 @@ "@types/node-fetch": "^2.6.6", | ||
}, | ||
"gitHead": "e32e40e1f6142ca867a8965325269b62f550f930" | ||
"gitHead": "063af47ae70e979d77fc064943aaba51f606a858" | ||
} |
@@ -86,2 +86,42 @@ # Eclipse GLSP - CLI | ||
## updateNext | ||
```console | ||
$ glsp updateNext -h | ||
Usage: glsp updateNext|u [options] [rootDir] | ||
Updates all `next` dependencies in GLSP project to the latest version | ||
Arguments: | ||
rootDir The repository root (default: "<cwd>") | ||
Options: | ||
-v, --verbose Enable verbose (debug) log output (default: false) | ||
-h, --help display help for command | ||
``` | ||
## generateIndex | ||
Use this command to create an index file of all sources for a given directory and all it's sub directories. | ||
```console | ||
$ glsp generateIndex -h | ||
Usage: glsp generateIndex [options] <rootDir> | ||
Generate index files in a given source directory. | ||
Arguments: | ||
rootDir The source directory for index generation. | ||
Options: | ||
-s, --singleIndex Generate a single index file in the source directory instead of indices in each sub-directory (default: false) | ||
-f, --forceOverwrite Overwrite existing index files and remove them if there are no entries (default: false) | ||
-m, --match [match patterns...] File patterns to consider during indexing (default: ["**/*.ts","**/*.tsx"]) | ||
-i, --ignore [ignore patterns...] File patterns to ignore during indexing (default: ["**/*.spec.ts","**/*.spec.tsx","**/*.d.ts"]) | ||
-s, --style <importStyle> Import Style (choices: "commonjs", "esm", default: "commonjs") | ||
--ignoreFile <ignoreFile> The file that is used to specify patterns that should be ignored during indexing (default: ".indexignore") | ||
-v, --verbose Generate verbose output during generation (default: false) | ||
-h, --help display help for command | ||
``` | ||
## More information | ||
@@ -88,0 +128,0 @@ |
@@ -17,6 +17,8 @@ #!/usr/bin/env node | ||
********************************************************************************/ | ||
import { CheckHeaderCommand } from './commands/check-header'; | ||
import { CoverageReportCommand } from './commands/coverage-report'; | ||
import { ReleaseCommand } from './commands/release/release'; | ||
import { baseCommand } from './util/command-util'; | ||
import { CheckHeaderCommand } from './commands/check-header.js'; | ||
import { CoverageReportCommand } from './commands/coverage-report.js'; | ||
import { GenerateIndex } from './commands/generate-index.js'; | ||
import { ReleaseCommand } from './commands/release/release.js'; | ||
import { UpdateNextCommand } from './commands/update-next.js'; | ||
import { baseCommand } from './util/command-util.js'; | ||
@@ -30,4 +32,6 @@ export const COMMAND_VERSION = '1.1.0-next'; | ||
.addCommand(ReleaseCommand) | ||
.addCommand(CheckHeaderCommand); | ||
.addCommand(CheckHeaderCommand) | ||
.addCommand(UpdateNextCommand) | ||
.addCommand(GenerateIndex); | ||
app.parse(process.argv); |
@@ -22,16 +22,10 @@ /******************************************************************************** | ||
import * as readline from 'readline-sync'; | ||
import * as sh from 'shelljs'; | ||
import { baseCommand, configureShell, getShellConfig } from '../util/command-util'; | ||
import { | ||
getChangesOfLastCommit, | ||
getFirstCommit, | ||
getFirstModificationDate, | ||
getInitialCommit, | ||
getLastModificationDate, | ||
getUncommittedChanges | ||
} from '../util/git-util'; | ||
import sh from 'shelljs'; | ||
import { baseCommand, configureShell, getShellConfig } from '../util/command-util.js'; | ||
import { getChangesOfLastCommit, getLastModificationDate, getUncommittedChanges } from '../util/git-util.js'; | ||
import { LOGGER } from '../util/logger'; | ||
import { validateGitDirectory } from '../util/validation-util'; | ||
import path = require('path'); | ||
import * as path from 'path'; | ||
import { LOGGER } from '../util/logger.js'; | ||
import { validateGitDirectory } from '../util/validation-util.js'; | ||
export interface HeaderCheckOptions { | ||
@@ -44,15 +38,10 @@ type: CheckType; | ||
autoFix: boolean; | ||
severity: Severity; | ||
} | ||
const checkTypes = ['full', 'changes', 'lastCommit'] as const; | ||
type CheckType = typeof checkTypes[number]; | ||
type CheckType = (typeof checkTypes)[number]; | ||
const severityTypes = ['error', 'warn', 'ok'] as const; | ||
type Severity = typeof severityTypes[number]; | ||
const DEFAULT_EXCLUDES = ['**/@(node_modules|lib|dist|bundle)/**']; | ||
const YEAR_RANGE_REGEX = /\d{4}(?:-d{4})?/g; | ||
const HEADER_PATTERN = 'Copyright \\([cC]\\) \\d{4}(-d{4})?'; | ||
const YEAR_RANGE_REGEX = /\d{4}/g; | ||
const HEADER_PATTERN = 'Copyright \\([cC]\\) \\d{4}'; | ||
const AUTO_FIX_MESSAGE = 'Fix copyright header violations'; | ||
@@ -62,3 +51,3 @@ | ||
.name('checkHeaders') | ||
.description('Validates the copyright year range of license header files') | ||
.description('Validates the copyright year range (end year) of license header files') | ||
.argument('<rootDir>', 'The starting directory for the check', validateGitDirectory) | ||
@@ -86,7 +75,2 @@ .addOption( | ||
.option('-j, --json', 'Also persist validation results as json file', false) | ||
.addOption( | ||
new Option('-s, --severity <severity>', 'The severity of validation results that should be printed.') | ||
.choices(severityTypes) | ||
.default('error', '"error" (only)') | ||
) | ||
.option('-a, --autoFix', 'Auto apply & commit fixes without prompting the user', false) | ||
@@ -134,13 +118,7 @@ .action(checkHeaders); | ||
function validate(rootDir: string, files: string[], options: HeaderCheckOptions): ValidationResult[] { | ||
// Derives all files with valid headers, their copyright years and all files with no or invalid headers | ||
// Derives all files with valid headers and all files with no or invalid headers | ||
const filesWithHeader = sh.grep('-l', HEADER_PATTERN, files).stdout.trim().split('\n'); | ||
const copyrightYears = sh | ||
.grep(HEADER_PATTERN, files) | ||
.stdout.trim() | ||
.split('\n') | ||
.map(line => line.match(YEAR_RANGE_REGEX)!.map(string => Number.parseInt(string, 10))); | ||
const noHeaders = files.filter(file => !filesWithHeader.includes(file)); | ||
const results: ValidationResult[] = []; | ||
const allFilesLength = files.length; | ||
@@ -155,3 +133,3 @@ | ||
printFileProgress(i + 1, allFilesLength, `Validating ${file}`); | ||
results.push({ file: path.resolve(rootDir, file), violation: 'noOrMissingHeader', severity: 'error' }); | ||
results.push({ file: path.resolve(rootDir, file), violation: 'noOrMissingHeader' }); | ||
}); | ||
@@ -170,19 +148,20 @@ | ||
printFileProgress(i + 1 + noHeadersLength, allFilesLength, `Validating ${file}`); | ||
const result: DateValidationResult = { | ||
currentStartYear: copyrightYears[i].shift()!, | ||
expectedStartYear: getFirstModificationDate(file, rootDir, AUTO_FIX_MESSAGE)!.getFullYear(), | ||
currentEndYear: copyrightYears[i].shift(), | ||
expectedEndYear: defaultEndYear ?? getLastModificationDate(file, rootDir, AUTO_FIX_MESSAGE)!.getFullYear(), | ||
file, | ||
severity: 'ok', | ||
violation: 'none' | ||
}; | ||
if (result.expectedStartYear === result.expectedEndYear) { | ||
validateSingleYear(result); | ||
const copyrightLine = sh.head({ '-n': 2 }, file).stdout.trim().split('\n')[1]; | ||
const copyRightYears = copyrightLine.match(YEAR_RANGE_REGEX)!; | ||
if (!copyRightYears) { | ||
const result: ValidationResult = { file, violation: 'noYear', line: copyrightLine }; | ||
results.push(result); | ||
} else { | ||
validateTimePeriod(result); | ||
const currentStartYear = Number.parseInt(copyRightYears[0], 10); | ||
const currentEndYear = copyRightYears[1] ? Number.parseInt(copyRightYears[1], 10) : undefined; | ||
const result: DateValidationResult = { | ||
currentStartYear, | ||
currentEndYear, | ||
expectedEndYear: defaultEndYear ?? getLastModificationDate(file, rootDir, AUTO_FIX_MESSAGE)!.getFullYear(), | ||
file, | ||
violation: 'none' | ||
}; | ||
validateEndYear(result); | ||
results.push(result); | ||
} | ||
results.push(result); | ||
}); | ||
@@ -196,53 +175,12 @@ | ||
function validateSingleYear(result: DateValidationResult): void { | ||
const { currentStartYear, expectedStartYear, currentEndYear } = result; | ||
result.violation = 'invalidCopyrightYear'; | ||
result.severity = 'error'; | ||
function validateEndYear(result: DateValidationResult): void { | ||
const { currentStartYear, expectedEndYear, currentEndYear } = result; | ||
result.violation = 'invalidEndYear'; | ||
if (!currentEndYear) { | ||
if (currentStartYear === expectedStartYear) { | ||
result.violation = 'none'; | ||
result.severity = 'ok'; | ||
} | ||
return; | ||
} | ||
const valid = currentEndYear ? currentEndYear === expectedEndYear : currentStartYear === expectedEndYear; | ||
// Cornercase: For files of the initial contribution the copyright header predates the first git modification date. | ||
// => declare as warning if not part of the initial contribution. | ||
if (expectedStartYear === currentEndYear && currentStartYear < expectedStartYear) { | ||
if (getFirstCommit(result.file) === getInitialCommit()) { | ||
result.violation = 'none'; | ||
result.severity = 'ok'; | ||
} else { | ||
result.severity = 'warn'; | ||
} | ||
} | ||
} | ||
function validateTimePeriod(result: DateValidationResult): void { | ||
const { currentStartYear, expectedStartYear, expectedEndYear, currentEndYear } = result; | ||
result.violation = 'incorrectCopyrightPeriod'; | ||
result.severity = 'error'; | ||
if (!currentEndYear) { | ||
result.severity = 'error'; | ||
return; | ||
} | ||
if (currentStartYear === expectedStartYear && currentEndYear === expectedEndYear) { | ||
if (valid) { | ||
result.violation = 'none'; | ||
result.severity = 'ok'; | ||
return; | ||
} | ||
// Cornercase: For files of the initial contribution the copyright header predates the first git modification date. | ||
// => declare as warning if not part of the initial contribution. | ||
if (currentEndYear === expectedEndYear && currentStartYear < expectedEndYear) { | ||
if (getFirstCommit(result.file) === getInitialCommit()) { | ||
result.violation = 'none'; | ||
result.severity = 'ok'; | ||
} else { | ||
result.severity = 'warn'; | ||
} | ||
} | ||
} | ||
@@ -264,10 +202,5 @@ | ||
LOGGER.info(`Header validation for ${results.length} files completed`); | ||
const violations = results.filter(result => result.severity === 'error'); | ||
const violations = results.filter(result => result.violation !== 'none'); | ||
// Adjust results to print based on configured severity level | ||
let toPrint = results; | ||
if (options.severity === 'error') { | ||
toPrint = violations; | ||
} else if (options.severity === 'warn') { | ||
toPrint = results.filter(result => result.severity !== 'ok'); | ||
} | ||
const toPrint = violations; | ||
@@ -285,6 +218,7 @@ LOGGER.info(`Found ${toPrint.length} copyright header violations:`); | ||
if (violations.length > 0 && (options.autoFix || readline.keyInYN('Do you want automatically fix copyright year range violations?'))) { | ||
const toFix = violations.filter( | ||
violation => violation.severity === 'error' && isDateValidationResult(violation) | ||
) as DateValidationResult[]; | ||
if ( | ||
violations.length > 0 && | ||
(options.autoFix || readline.keyInYN('Do you want to automatically fix copyright year range violations?')) | ||
) { | ||
const toFix = violations.filter(violation => isDateValidationResult(violation)) as DateValidationResult[]; | ||
fixViolations(rootDir, toFix, options); | ||
@@ -297,24 +231,19 @@ } | ||
function toPrintMessage(result: ValidationResult): string { | ||
const colors: Record<Severity, string> = { | ||
error: '\x1b[31m', | ||
warn: '\x1b[33m', | ||
ok: '\x1b[32m' | ||
} as const; | ||
const error = '\x1b[31m'; | ||
const info = '\x1b[32m'; | ||
if ( | ||
isDateValidationResult(result) && | ||
(result.violation === 'incorrectCopyrightPeriod' || result.violation === 'invalidCopyrightYear') | ||
) { | ||
const expected = | ||
result.expectedStartYear !== result.expectedEndYear | ||
? `${result.expectedStartYear}-${result.expectedEndYear}` | ||
: result.expectedStartYear.toString(); | ||
const actual = result.currentEndYear ? `${result.currentStartYear}-${result.currentEndYear}` : result.currentStartYear.toString(); | ||
const message = result.violation === 'incorrectCopyrightPeriod' ? 'Invalid copyright period' : 'Invalid copyright year'; | ||
return `${colors[result.severity]} ${message}! Expected '${expected}' but is '${actual}'`; | ||
if (isDateValidationResult(result) && result.violation === 'invalidEndYear') { | ||
const expected = result.expectedEndYear.toString(); | ||
const actual = result.currentEndYear | ||
? `${result.currentEndYear} (${result.currentStartYear}-${result.currentEndYear})` | ||
: result.currentStartYear.toString(); | ||
const message = 'Invalid copyright end year'; | ||
return `${error} ${message}! Expected end year '${expected}' but is '${actual}'`; | ||
} else if (result.violation === 'noOrMissingHeader') { | ||
return `${colors[result.severity]} No or invalid copyright header!`; | ||
return `${error} No or invalid copyright header!`; | ||
} else if (result.violation === 'noYear') { | ||
return `${error} No year found!${result.line ? ' (line: ' + result.line + ')' : ''}`; | ||
} | ||
return `${colors[result.severity]} OK`; | ||
return `${info} OK`; | ||
} | ||
@@ -326,12 +255,9 @@ | ||
printFileProgress(i + 1, violations.length, `Fix ${violation.file}`, false); | ||
const fixedStartYear = | ||
violation.currentStartYear < violation.expectedStartYear ? violation.currentStartYear : violation.expectedStartYear; | ||
const currentRange = `${violation.currentStartYear}${violation.currentEndYear ? '-' + violation.currentEndYear : ''}`; | ||
const fixedRange = | ||
violation.currentEndYear || violation.currentStartYear < violation.expectedEndYear | ||
? `${violation.currentStartYear}-${violation.expectedEndYear}` | ||
: `${violation.expectedEndYear}`; | ||
let fixedRange = `${fixedStartYear}`; | ||
if (violation.expectedEndYear !== violation.expectedStartYear || fixedStartYear !== violation.expectedStartYear) { | ||
fixedRange = `${fixedStartYear}-${violation.expectedEndYear}`; | ||
} | ||
sh.sed('-i', RegExp('Copyright \\([cC]\\) ' + currentRange), `Copyright (c) ${fixedRange}`, violation.file); | ||
@@ -352,4 +278,4 @@ }); | ||
file: string; | ||
severity: Severity; | ||
violation: Violation; | ||
line?: string; | ||
} | ||
@@ -359,3 +285,2 @@ | ||
currentStartYear: number; | ||
expectedStartYear: number; | ||
currentEndYear?: number; | ||
@@ -366,5 +291,5 @@ expectedEndYear: number; | ||
function isDateValidationResult(object: ValidationResult): object is DateValidationResult { | ||
return 'currentStartYear' in object && 'expectedStartYear' in object && 'expectedEndYear' in object; | ||
return 'currentStartYear' in object && 'expectedEndYear' in object; | ||
} | ||
type Violation = 'none' | 'noOrMissingHeader' | 'incorrectCopyrightPeriod' | 'invalidCopyrightYear'; | ||
type Violation = 'none' | 'noOrMissingHeader' | 'invalidEndYear' | 'noYear'; |
@@ -19,6 +19,6 @@ /******************************************************************************** | ||
import * as path from 'path'; | ||
import * as sh from 'shelljs'; | ||
import { baseCommand, fatalExec, getShellConfig } from '../util/command-util'; | ||
import { LOGGER } from '../util/logger'; | ||
import { validateDirectory } from '../util/validation-util'; | ||
import sh from 'shelljs'; | ||
import { baseCommand, fatalExec, getShellConfig } from '../util/command-util.js'; | ||
import { LOGGER } from '../util/logger.js'; | ||
import { validateDirectory } from '../util/validation-util.js'; | ||
@@ -25,0 +25,0 @@ export interface CoverageCmdOptions { |
@@ -22,7 +22,7 @@ /******************************************************************************** | ||
import * as semver from 'semver'; | ||
import * as sh from 'shelljs'; | ||
import { fatalExec, getShellConfig } from '../../util/command-util'; | ||
import { getLatestGithubRelease, getLatestTag, hasGitChanges, isGitRepository } from '../../util/git-util'; | ||
import { LOGGER } from '../../util/logger'; | ||
import { validateVersion } from '../../util/validation-util'; | ||
import sh from 'shelljs'; | ||
import { fatalExec, getShellConfig } from '../../util/command-util.js'; | ||
import { getLatestGithubRelease, getLatestTag, hasGitChanges, isGitRepository } from '../../util/git-util.js'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { validateVersion } from '../../util/validation-util.js'; | ||
@@ -29,0 +29,0 @@ export const VERDACCIO_REGISTRY = 'http://localhost:4873/'; |
@@ -17,5 +17,5 @@ /******************************************************************************** | ||
import * as sh from 'shelljs'; | ||
import { getShellConfig } from '../../util/command-util'; | ||
import { LOGGER } from '../../util/logger'; | ||
import { checkoutAndCd, commitAndTag, lernaSetVersion, publish, ReleaseOptions, updateLernaForDryRun, yarnInstall } from './common'; | ||
import { getShellConfig } from '../../util/command-util.js'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { checkoutAndCd, commitAndTag, lernaSetVersion, publish, ReleaseOptions, updateLernaForDryRun, yarnInstall } from './common.js'; | ||
@@ -22,0 +22,0 @@ let REPO_ROOT: string; |
@@ -17,6 +17,8 @@ /******************************************************************************** | ||
import * as sh from 'shelljs'; | ||
import { fatalExec, getShellConfig } from '../../util/command-util'; | ||
import { LOGGER } from '../../util/logger'; | ||
import sh from 'shelljs'; | ||
import { fatalExec, getShellConfig } from '../../util/command-util.js'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { | ||
ReleaseOptions, | ||
ReleaseType, | ||
asMvnVersion, | ||
@@ -28,8 +30,6 @@ checkJavaServerVersion, | ||
publish, | ||
ReleaseOptions, | ||
ReleaseType, | ||
updateLernaForDryRun, | ||
updateVersion, | ||
yarnInstall | ||
} from './common'; | ||
} from './common.js'; | ||
@@ -36,0 +36,0 @@ let REPO_ROOT: string; |
@@ -16,6 +16,6 @@ /******************************************************************************** | ||
********************************************************************************/ | ||
import * as sh from 'shelljs'; | ||
import { fatalExec, getShellConfig } from '../../util/command-util'; | ||
import { LOGGER } from '../../util/logger'; | ||
import { asMvnVersion, checkoutAndCd, commitAndTag, publish, ReleaseOptions } from './common'; | ||
import sh from 'shelljs'; | ||
import { fatalExec, getShellConfig } from '../../util/command-util.js'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { ReleaseOptions, asMvnVersion, checkoutAndCd, commitAndTag, publish } from './common.js'; | ||
@@ -22,0 +22,0 @@ let REPO_ROOT: string; |
@@ -17,4 +17,4 @@ /******************************************************************************** | ||
import * as sh from 'shelljs'; | ||
import { LOGGER } from '../../util/logger'; | ||
import sh from 'shelljs'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { | ||
@@ -29,3 +29,3 @@ checkoutAndCd, | ||
yarnInstall | ||
} from './common'; | ||
} from './common.js'; | ||
@@ -32,0 +32,0 @@ let REPO_ROOT: string; |
@@ -17,4 +17,4 @@ /******************************************************************************** | ||
import * as sh from 'shelljs'; | ||
import { LOGGER } from '../../util/logger'; | ||
import sh from 'shelljs'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { | ||
@@ -29,3 +29,3 @@ checkoutAndCd, | ||
yarnInstall | ||
} from './common'; | ||
} from './common.js'; | ||
@@ -32,0 +32,0 @@ let REPO_ROOT: string; |
@@ -17,4 +17,4 @@ /******************************************************************************** | ||
import * as sh from 'shelljs'; | ||
import { LOGGER } from '../../util/logger'; | ||
import sh from 'shelljs'; | ||
import { LOGGER } from '../../util/logger.js'; | ||
import { | ||
@@ -29,3 +29,3 @@ checkoutAndCd, | ||
yarnInstall | ||
} from './common'; | ||
} from './common.js'; | ||
@@ -56,3 +56,4 @@ let REPO_ROOT: string; | ||
{ name: '@eclipse-glsp-examples/workflow-glsp', version }, | ||
{ name: '@eclipse-glsp-examples/workflow-server', version } | ||
{ name: '@eclipse-glsp-examples/workflow-server', version }, | ||
{ name: '@eclipse-glsp-examples/workflow-server-bundled', version } | ||
); | ||
@@ -59,0 +60,0 @@ } |
@@ -22,6 +22,6 @@ /******************************************************************************** | ||
import * as semver from 'semver'; | ||
import * as sh from 'shelljs'; | ||
import { baseCommand, configureShell, fatalExec, getShellConfig } from '../../util/command-util'; | ||
import { LOGGER, configureLogger } from '../../util/logger'; | ||
import { validateDirectory, validateVersion } from '../../util/validation-util'; | ||
import sh from 'shelljs'; | ||
import { baseCommand, configureShell, fatalExec, getShellConfig } from '../../util/command-util.js'; | ||
import { LOGGER, configureLogger } from '../../util/logger.js'; | ||
import { validateDirectory, validateVersion } from '../../util/validation-util.js'; | ||
import { | ||
@@ -35,9 +35,9 @@ Component, | ||
checkIfNpmVersionIsNew | ||
} from './common'; | ||
import { releaseClient } from './release-client'; | ||
import { releaseEclipseIntegration } from './release-eclipse-integration'; | ||
import { releaseJavaServer } from './release-java-server'; | ||
import { releaseServerNode } from './release-server-node'; | ||
import { releaseTheiaIntegration } from './release-theia-integration'; | ||
import { releaseVscodeIntegration } from './release-vscode-integration'; | ||
} from './common.js'; | ||
import { releaseClient } from './release-client.js'; | ||
import { releaseEclipseIntegration } from './release-eclipse-integration.js'; | ||
import { releaseJavaServer } from './release-java-server.js'; | ||
import { releaseServerNode } from './release-server-node.js'; | ||
import { releaseTheiaIntegration } from './release-theia-integration.js'; | ||
import { releaseVscodeIntegration } from './release-vscode-integration.js'; | ||
@@ -82,5 +82,5 @@ interface ReleaseCmdOptions { | ||
try { | ||
configureLogger(cliOptions.verbose); | ||
LOGGER.debug('Cli options:', cliOptions); | ||
configureShell({ silent: !cliOptions.verbose }); | ||
configureLogger(cliOptions.verbose); | ||
checkGHCli(); | ||
@@ -87,0 +87,0 @@ const version = deriveVersion(releaseType, customVersion); |
@@ -17,3 +17,3 @@ /******************************************************************************** | ||
import { Command } from 'commander'; | ||
import * as sh from 'shelljs'; | ||
import sh from 'shelljs'; | ||
@@ -20,0 +20,0 @@ // Commander.js utils |
@@ -18,4 +18,4 @@ /******************************************************************************** | ||
import { resolve } from 'path'; | ||
import * as sh from 'shelljs'; | ||
import { getShellConfig } from './command-util'; | ||
import sh from 'shelljs'; | ||
import { getShellConfig } from './command-util.js'; | ||
@@ -88,25 +88,3 @@ export function isGitRepository(path?: string): boolean { | ||
} | ||
/** | ||
* Returns the last modification date of a file in a git repo. | ||
* @param filePath The file | ||
* @param repoRoot The path to the repo root. If undefined the current working directory is used. | ||
* @param excludeMessage Only consider commits that don`t match the excludeMessage | ||
* @returns The date or undefined if the file is outside of the git repo. | ||
*/ | ||
export function getFirstModificationDate(filePath: string, repoRoot?: string, excludeMessage?: string): Date | undefined { | ||
cdIfPresent(repoRoot); | ||
const additionalArgs = excludeMessage ? `--grep="${excludeMessage}" --invert-grep` : ''; | ||
const result = sh.exec(`git log ${additionalArgs} --pretty="format:%ci" --follow ${filePath}`, getShellConfig()); | ||
if (result.code !== 0) { | ||
return undefined; | ||
} | ||
const datesString = result.stdout.trim(); | ||
if (datesString.length === 0) { | ||
return new Date(); | ||
} | ||
const date = datesString.split('\n').pop(); | ||
return date ? new Date(date) : undefined; | ||
} | ||
export function getFilesOfCommit(commitHash: string, repoRoot?: string): string[] { | ||
@@ -122,34 +100,2 @@ cdIfPresent(repoRoot); | ||
/** | ||
* Returns the commit hash of the initial commit of the given repository | ||
* @param repoRoot The path to the repo root. If undefined the current working directory is used. | ||
* @returns The commit hash or undefined if something went wrong. | ||
*/ | ||
export function getInitialCommit(repoRoot?: string): string | undefined { | ||
cdIfPresent(repoRoot); | ||
const result = sh.exec('git log --pretty=oneline --reverse', getShellConfig()); | ||
if (result.code !== 0) { | ||
return undefined; | ||
} | ||
const commits = result.stdout.trim(); | ||
if (commits.length === 0) { | ||
return undefined; | ||
} | ||
return commits.substring(0, commits.indexOf(' ')); | ||
} | ||
/** | ||
* Returns the commit hash of the first commit for a given file (across renames). | ||
* @param repoRoot The path to the repo root. If undefined the current working directory is used. | ||
* @returns The commit hash or undefined if something went wrong. | ||
*/ | ||
export function getFirstCommit(filePath: string, repoRoot?: string): string | undefined { | ||
cdIfPresent(repoRoot); | ||
const result = sh.exec(`git log --follow --pretty=format:"%H" ${filePath}`, getShellConfig()); | ||
if (result.code !== 0) { | ||
return undefined; | ||
} | ||
return result.stdout.trim().split('\n').pop(); | ||
} | ||
export function getLatestGithubRelease(path?: string): string { | ||
@@ -156,0 +102,0 @@ cdIfPresent(path); |
@@ -20,5 +20,4 @@ /******************************************************************************** | ||
import * as semver from 'semver'; | ||
import { getGitRoot, isGitRepository } from './git-util'; | ||
import { LOGGER } from './logger'; | ||
export const COMMAND_VERSION = '1.1.0-next'; | ||
import { getGitRoot, isGitRepository } from './git-util.js'; | ||
import { LOGGER } from './logger.js'; | ||
@@ -25,0 +24,0 @@ export function validateDirectory(rootDir: string): string { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 6 instances in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 7 instances in 1 package
284463
89
15
130
Yes
8
3681
6
2
+ Addedglobby@13.2.2
+ Addednode-jq@^4.3.1
+ Added@hapi/hoek@9.3.0(transitive)
+ Added@hapi/topo@5.1.0(transitive)
+ Added@nodelib/fs.scandir@2.1.5(transitive)
+ Added@nodelib/fs.stat@2.0.5(transitive)
+ Added@nodelib/fs.walk@1.2.8(transitive)
+ Added@sideway/address@4.1.5(transitive)
+ Added@sideway/formula@3.0.1(transitive)
+ Added@sideway/pinpoint@2.0.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbin-build@3.0.0(transitive)
+ Addedbl@1.2.3(transitive)
+ Addedbraces@3.0.3(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addedbuffer-alloc@1.2.0(transitive)
+ Addedbuffer-alloc-unsafe@1.1.0(transitive)
+ Addedbuffer-crc32@0.2.13(transitive)
+ Addedbuffer-fill@1.0.0(transitive)
+ Addedcaw@2.0.1(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedconfig-chain@1.1.13(transitive)
+ Addedcontent-disposition@0.5.4(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcross-spawn@5.1.0(transitive)
+ Addeddecompress@4.2.1(transitive)
+ Addeddecompress-response@3.3.0(transitive)
+ Addeddecompress-tar@4.1.1(transitive)
+ Addeddecompress-tarbz2@4.1.1(transitive)
+ Addeddecompress-targz@4.1.1(transitive)
+ Addeddecompress-unzip@4.0.1(transitive)
+ Addeddir-glob@3.0.1(transitive)
+ Addeddownload@6.2.5(transitive)
+ Addedduplexer3@0.1.5(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedexeca@0.7.0(transitive)
+ Addedext-list@2.2.2(transitive)
+ Addedext-name@5.0.0(transitive)
+ Addedfast-glob@3.3.3(transitive)
+ Addedfastq@1.19.0(transitive)
+ Addedfd-slicer@1.1.0(transitive)
+ Addedfile-type@3.9.05.2.06.2.0(transitive)
+ Addedfilename-reserved-regex@2.0.0(transitive)
+ Addedfilenamify@2.1.0(transitive)
+ Addedfill-range@7.1.1(transitive)
+ Addedfs-constants@1.0.0(transitive)
+ Addedget-proxy@2.1.0(transitive)
+ Addedget-stream@2.3.13.0.0(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedglobby@13.2.2(transitive)
+ Addedgot@7.1.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-symbol-support-x@1.4.2(transitive)
+ Addedhas-to-string-tag-x@1.4.1(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedignore@5.3.2(transitive)
+ Addedini@1.3.8(transitive)
+ Addedis-extglob@1.0.02.1.1(transitive)
+ Addedis-glob@2.0.14.0.3(transitive)
+ Addedis-invalid-path@0.1.0(transitive)
+ Addedis-natural-number@4.0.1(transitive)
+ Addedis-number@7.0.0(transitive)
+ Addedis-object@1.0.2(transitive)
+ Addedis-plain-obj@1.1.0(transitive)
+ Addedis-retry-allowed@1.2.0(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedis-valid-path@0.1.1(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisurl@1.0.0(transitive)
+ Addedjoi@17.13.3(transitive)
+ Addedlowercase-keys@1.0.1(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedmake-dir@1.3.0(transitive)
+ Addedmerge2@1.4.1(transitive)
+ Addedmicromatch@4.0.8(transitive)
+ Addedmime-db@1.53.0(transitive)
+ Addedmimic-response@1.0.1(transitive)
+ Addednode-downloader-helper@2.1.9(transitive)
+ Addednode-jq@4.4.0(transitive)
+ Addednpm-conf@1.1.3(transitive)
+ Addednpm-run-path@2.0.2(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedp-cancelable@0.3.0(transitive)
+ Addedp-event@1.3.0(transitive)
+ Addedp-finally@1.0.0(transitive)
+ Addedp-map-series@1.0.0(transitive)
+ Addedp-reduce@1.0.0(transitive)
+ Addedp-timeout@1.2.1(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedpath-type@4.0.0(transitive)
+ Addedpend@1.2.0(transitive)
+ Addedpicomatch@2.3.1(transitive)
+ Addedpify@2.3.03.0.0(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedprepend-http@1.0.4(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedproto-list@1.2.4(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedqueue-microtask@1.2.3(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedreusify@1.0.4(transitive)
+ Addedrun-parallel@1.2.0(transitive)
+ Addedsafe-buffer@5.1.25.2.1(transitive)
+ Addedseek-bzip@1.0.6(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedslash@4.0.0(transitive)
+ Addedsort-keys@1.1.2(transitive)
+ Addedsort-keys-length@1.0.1(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstrip-dirs@2.1.0(transitive)
+ Addedstrip-eof@1.0.0(transitive)
+ Addedstrip-final-newline@2.0.0(transitive)
+ Addedstrip-outer@1.0.1(transitive)
+ Addedtar-stream@1.6.2(transitive)
+ Addedtemp-dir@1.0.02.0.0(transitive)
+ Addedtempfile@2.0.03.0.0(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedtimed-out@4.0.1(transitive)
+ Addedto-buffer@1.1.1(transitive)
+ Addedto-regex-range@5.0.1(transitive)
+ Addedtrim-repeated@1.0.0(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedunbzip2-stream@1.4.3(transitive)
+ Addedurl-parse-lax@1.0.0(transitive)
+ Addedurl-to-options@1.0.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedxtend@4.0.2(transitive)
+ Addedyallist@2.1.2(transitive)
+ Addedyauzl@2.10.0(transitive)