This commit is contained in:
Michael Kriese 2019-05-28 11:21:17 +02:00 коммит произвёл Rhys Arkins
Родитель 9d6d448260
Коммит 0b063aeaa1
19 изменённых файлов: 1011 добавлений и 129 удалений

19
.babelrc Normal file
Просмотреть файл

@ -0,0 +1,19 @@
{
"presets": [
[
"@babel/env",
{
"targets": {
"node": true
}
}
],
"@babel/typescript"
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
],
"sourceMaps": true,
"retainLines": true
}

8
.vscode/launch.json поставляемый
Просмотреть файл

@ -9,12 +9,8 @@
"env": { "LOG_LEVEL": "debug" },
"console": "integratedTerminal",
"disableOptimisticBPs": true,
"runtimeArgs": [
"--nolazy",
"--preserve-symlinks",
"-r",
"ts-node/register"
],
"runtimeExecutable": "${workspaceFolder}/node_modules/.bin/babel-node",
"runtimeArgs": ["--nolazy", "--extensions", ".ts,.js"],
"protocol": "inspector",
"skipFiles": ["<node_internals>/**/*.js"]
},

Просмотреть файл

@ -3,7 +3,7 @@ const azureHelper = require('./azure-helper');
const azureApi = require('./azure-got-wrapper');
const hostRules = require('../../util/host-rules');
const { appSlug } = require('../../config/app-strings');
const GitStorage = require('../git/storage');
const GitStorage = require('../git/storage').Storage;
let config = {};

Просмотреть файл

@ -176,8 +176,9 @@ export async function setBaseBranch(branchName: string = config.defaultBranch) {
await config.storage.setBaseBranch(branchName);
}
// istanbul ignore next
export function setBranchPrefix(branchPrefix: string) {
export /* istanbul ignore next */ function setBranchPrefix(
branchPrefix: string
) {
return config.storage.setBranchPrefix(branchPrefix);
}
@ -275,8 +276,7 @@ export function getBranchLastCommitTime(branchName: string) {
return config.storage.getBranchLastCommitTime(branchName);
}
// istanbul ignore next
export function getRepoStatus() {
export /* istanbul ignore next */ function getRepoStatus() {
return config.storage.getRepoStatus();
}
@ -405,8 +405,7 @@ export async function setBranchStatus(
// return [];
// }
// istanbul ignore next
export function findIssue(title: string) {
export /* istanbul ignore next */ function findIssue(title: string) {
logger.debug(`findIssue(${title})`);
// TODO: Needs implementation
// This is used by Renovate when creating its own issues, e.g. for deprecated package warnings, config error notifications, or "masterIssue"
@ -414,8 +413,10 @@ export function findIssue(title: string) {
return null;
}
// istanbul ignore next
export function ensureIssue(title: string, body: string) {
export /* istanbul ignore next */ function ensureIssue(
title: string,
body: string
) {
logger.debug(`ensureIssue(${title}, body={${body}})`);
// TODO: Needs implementation
// This is used by Renovate when creating its own issues, e.g. for deprecated package warnings, config error notifications, or "masterIssue"
@ -423,15 +424,13 @@ export function ensureIssue(title: string, body: string) {
return null;
}
// istanbul ignore next
export function getIssueList() {
export /* istanbul ignore next */ function getIssueList() {
logger.debug(`getIssueList()`);
// TODO: Needs implementation
return [];
}
// istanbul ignore next
export function ensureIssueClosing(title: string) {
export /* istanbul ignore next */ function ensureIssueClosing(title: string) {
logger.debug(`ensureIssueClosing(${title})`);
// TODO: Needs implementation
// This is used by Renovate when creating its own issues, e.g. for deprecated package warnings, config error notifications, or "masterIssue"
@ -622,10 +621,10 @@ export async function ensureCommentRemoval(prNo: number, topic: string) {
}
// TODO: coverage
// istanbul ignore next
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export async function getPrList(_args?: any) {
logger.debug(`getPrList()`);
// istanbul ignore next
if (!config.prList) {
const values = await utils.accumulateValues(
`./rest/api/1.0/projects/${config.projectKey}/repos/${

Просмотреть файл

@ -133,8 +133,9 @@ export async function setBaseBranch(branchName = config.baseBranch) {
await getFileList(branchName);
}
// istanbul ignore next
export function setBranchPrefix(branchPrefix: string) {
export /* istanbul ignore next */ function setBranchPrefix(
branchPrefix: string
) {
return config.storage.setBranchPrefix(branchPrefix);
}
@ -381,8 +382,7 @@ export async function ensureIssue(title: string, body: string) {
return null;
}
// istanbul ignore next
export function getIssueList() {
export /* istanbul ignore next */ function getIssueList() {
logger.debug(`getIssueList()`);
// TODO: Needs implementation
return [];
@ -416,8 +416,7 @@ export async function addReviewers(prId: number, reviewers: string[]) {
});
}
// istanbul ignore next
export function deleteLabel() {
export /* istanbul ignore next */ function deleteLabel() {
throw new Error('deleteLabel not implemented');
}

Просмотреть файл

@ -59,8 +59,7 @@ export async function accumulateValues(
return accumulator;
}
// istanbul ignore next
export function isConflicted(files: any) {
export /* istanbul ignore next */ function isConflicted(files: any) {
for (const file of files) {
for (const chunk of file.chunks) {
for (const change of chunk.changes) {

Просмотреть файл

@ -23,7 +23,7 @@ interface ILocalConfig extends IStorageConfig {
branchPrefix: string;
}
class Storage {
export class Storage {
private _config: ILocalConfig = {} as any;
private _git: Git.SimpleGit | undefined;
@ -445,4 +445,4 @@ function localName(branchName: string) {
return branchName.replace(/^origin\//, '');
}
export = Storage;
export default Storage;

Просмотреть файл

@ -4,7 +4,7 @@ const URL = require('url');
const get = require('./gh-got-wrapper');
const hostRules = require('../../util/host-rules');
const GitStorage = require('../git/storage');
const GitStorage = require('../git/storage').Storage;
const {
appName,

Просмотреть файл

@ -3,7 +3,7 @@ const is = require('@sindresorhus/is');
const get = require('./gl-got-wrapper');
const hostRules = require('../../util/host-rules');
const GitStorage = require('../git/storage');
const GitStorage = require('../git/storage').Storage;
let config = {};
const defaults = {

Просмотреть файл

@ -1,7 +1,7 @@
#!/usr/bin/env node
require('./proxy');
const globalWorker = require('./workers/global');
import './proxy';
import * as globalWorker from './workers/global';
(async () => {
await globalWorker.start();

Просмотреть файл

@ -12,7 +12,7 @@
"clean-cache": "node bin/clean-cache.js",
"copy-static-files": "copyfiles -u 1 lib/**/*.json lib/**/*.py dist/",
"create-json-schema": "node bin/create-json-schema.js && prettier --write \"renovate-schema.json\"",
"debug": "node -r ts-node/register/transpile-only --inspect-brk lib/renovate.ts",
"debug": "babel-node --inspect-brk --extensions \".ts,.js\" -- lib/renovate.ts",
"eslint": "run-s eslint:*",
"eslint:js": "eslint lib test --ext .js",
"eslint:ts": "eslint -c .tslintrc.js lib test --ext .ts",
@ -26,7 +26,7 @@
"lint-fix": "yarn eslint-fix && yarn prettier-fix",
"prettier": "prettier --list-different \"**/*.{ts,js,json,md}\"",
"prettier-fix": "prettier --write \"**/*.{ts,js,json,md}\"",
"start": "node -r ts-node/register/transpile-only lib/renovate.ts",
"start": "babel-node --extensions \".ts,.js\" -- lib/renovate.ts",
"test-dirty": "git diff --exit-code",
"test-e2e": "npm pack && cd e2e && yarn install --no-lockfile && yarn test",
"test-schema": "bash test/json-schema.sh",
@ -154,6 +154,13 @@
"yarn": "1.16.0"
},
"devDependencies": {
"@babel/cli": "7.4.4",
"@babel/core": "7.4.5",
"@babel/node": "7.4.5",
"@babel/plugin-proposal-class-properties": "7.4.4",
"@babel/plugin-proposal-object-rest-spread": "7.4.4",
"@babel/preset-env": "7.4.5",
"@babel/preset-typescript": "7.3.3",
"@types/bunyan": "1.8.6",
"@types/convert-hrtime": "2.0.0",
"@types/fs-extra": "7.0.0",
@ -163,6 +170,7 @@
"@types/tmp": "0.1.0",
"@typescript-eslint/eslint-plugin": "1.9.0",
"@typescript-eslint/parser": "1.9.0",
"babel-jest": "24.8.0",
"chai": "4.2.0",
"copyfiles": "2.1.0",
"cross-env": "5.2.0",
@ -183,8 +191,6 @@
"rimraf": "2.6.3",
"semantic-release": "15.13.12",
"tmp-promise": "2.0.1",
"ts-jest": "24.0.2",
"ts-node": "8.1.0",
"typescript": "3.4.5"
},
"resolutions": {
@ -197,17 +203,11 @@
"dist"
],
"jest": {
"globals": {
"ts-jest": {
"isolatedModules": true
}
},
"cacheDirectory": ".cache/jest",
"coverageDirectory": "./coverage",
"collectCoverage": true,
"collectCoverageFrom": [
"lib/**/*.{js,ts}",
"!lib/platform/bitbucket-server/bb-got-wrapper.js",
"!lib/versioning/maven/index.js",
"!lib/proxy.js"
],
@ -226,7 +226,9 @@
"snapshotSerializers": [
"./test/newline-snapshot-serializer.js"
],
"preset": "ts-jest/presets/js-with-ts"
"transform": {
"^.+\\.(j|t)s$": "babel-jest"
}
},
"publishConfig": {
"tag": "next"
@ -238,19 +240,19 @@
},
"release": {
"branch": "master",
"analyzeCommits": {
"preset": "angular",
"releaseRules": [
{
"type": "docs",
"scope": "readme.md",
"release": "patch"
},
{
"type": "build",
"release": "patch"
}
]
"analyzeCommits": {
"preset": "angular",
"releaseRules": [
{
"type": "docs",
"scope": "readme.md",
"release": "patch"
},
{
"type": "build",
"release": "patch"
}
]
},
"tagFormat": "${version}"
}

Просмотреть файл

@ -15,7 +15,7 @@ describe('platform/azure', () => {
azure = require('../../../lib/platform/azure');
azureApi = require('../../../lib/platform/azure/azure-got-wrapper');
azureHelper = require('../../../lib/platform/azure/azure-helper');
GitStorage = require('../../../lib/platform/git/storage');
GitStorage = require('../../../lib/platform/git/storage').Storage;
GitStorage.mockImplementation(() => ({
initRepo: jest.fn(),
cleanRepo: jest.fn(),

Просмотреть файл

@ -41,7 +41,7 @@ describe('platform/bitbucket-server', () => {
jest.spyOn(api, 'put');
jest.spyOn(api, 'delete');
bitbucket = require('../../../lib/platform/bitbucket-server');
GitStorage = require('../../../lib/platform/git/storage');
GitStorage = require('../../../lib/platform/git/storage').Storage;
GitStorage.mockImplementation(
() =>
({

Просмотреть файл

@ -7,7 +7,7 @@ describe('platform/bitbucket', () => {
let api: jest.Mocked<IGotApi>;
let hostRules: jest.Mocked<typeof import('../../../lib/util/host-rules')>;
let GitStorage: jest.Mocked<
typeof import('../../../lib/platform/git/storage')
import('../../../lib/platform/git/storage').Storage
> &
jest.Mock;
beforeEach(() => {
@ -19,7 +19,7 @@ describe('platform/bitbucket', () => {
hostRules = require('../../../lib/util/host-rules');
api = require('../../../lib/platform/bitbucket/bb-got-wrapper').api;
bitbucket = require('../../../lib/platform/bitbucket');
GitStorage = require('../../../lib/platform/git/storage');
GitStorage = require('../../../lib/platform/git/storage').Storage;
GitStorage.mockImplementation(() => ({
initRepo: jest.fn(),
cleanRepo: jest.fn(),

Просмотреть файл

@ -16,7 +16,7 @@ describe('platform/github', () => {
github = require('../../../lib/platform/github');
hostRules = require('../../../lib/util/host-rules');
jest.mock('../../../lib/platform/git/storage');
GitStorage = require('../../../lib/platform/git/storage');
GitStorage = require('../../../lib/platform/git/storage').Storage;
GitStorage.mockImplementation(() => ({
initRepo: jest.fn(),
cleanRepo: jest.fn(),

Просмотреть файл

@ -12,7 +12,7 @@ describe('platform/gitlab', () => {
jest.mock('../../../lib/util/host-rules');
hostRules = require('../../../lib/util/host-rules');
jest.mock('../../../lib/platform/git/storage');
GitStorage = require('../../../lib/platform/git/storage');
GitStorage = require('../../../lib/platform/git/storage').Storage;
GitStorage.mockImplementation(() => ({
initRepo: jest.fn(),
cleanRepo: jest.fn(),

Просмотреть файл

@ -2,6 +2,7 @@
"extends": "./tsconfig",
"compilerOptions": {
"resolveJsonModule": false,
"isolatedModules": false,
"sourceMap": false,
"types": ["node"]
},

Просмотреть файл

@ -10,6 +10,7 @@
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"isolatedModules": true,
"lib": ["es2018"],
"types": ["node", "jest"]
},

996
yarn.lock

Разница между файлами не показана из-за своего большого размера Загрузить разницу