This commit is contained in:
Elizabeth Craig 2021-07-22 15:54:04 -07:00 коммит произвёл GitHub
Родитель d8057acccf
Коммит 45d18e57dd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
23 изменённых файлов: 140 добавлений и 52 удалений

7
.github/dependabot.yml поставляемый
Просмотреть файл

@ -1,4 +1,3 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
@ -6,9 +5,9 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: "daily"
interval: 'daily'
# Disable version updates for npm dependencies
open-pull-requests-limit: 0

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

@ -1,2 +1,12 @@
CHANGELOG.md
*.snap
*.styl
*.svg
.*ignore
.nojekyll
docs/.vuepress/dist
change
CHANGELOG.*
lib
LICENSE
node_modules
yarn.lock

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

@ -2,5 +2,6 @@
"trailingComma": "es5",
"tabWidth": 2,
"singleQuote": true,
"printWidth": 120
"printWidth": 120,
"arrowParens": "avoid"
}

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

@ -1,4 +1,3 @@
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a

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

@ -0,0 +1,7 @@
{
"type": "none",
"comment": "Update prettier",
"packageName": "beachball",
"email": "elcraig@microsoft.com",
"dependentChangeType": "none"
}

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

@ -21,7 +21,7 @@
"checkchange": "node ./lib/cli.js check",
"docs": "vuepress dev docs --host localhost",
"docs:build": "vuepress build docs",
"prettier": "prettier --write --config ../../.prettierrc --ignore-path ../../.prettierignore 'src/**/*'",
"format": "prettier --write '**/*'",
"pub": "node ./lib/cli.js publish",
"release": "node ./lib/cli.js publish -y",
"release:docs": "yarn docs:build && yarn gh-pages -d docs/.vuepress/dist --dotfiles",
@ -67,7 +67,7 @@
"gh-pages": "^3.1.0",
"jest": "^24.8.0",
"ncp": "^2.0.0",
"prettier": "^1.19.0",
"prettier": "~2.3.2",
"rimraf": "^3.0.0",
"tmp": "^0.1.0",
"ts-jest": "^24.0.2",

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

@ -184,7 +184,11 @@ describe('version bumping', () => {
git(['push', 'origin', 'master'], { cwd: repo.rootPath });
await bump({ path: repo.rootPath, bumpDeps: false, fromRef: revParseOutput.stdout } as BeachballOptions);
await bump({
path: repo.rootPath,
bumpDeps: false,
fromRef: revParseOutput.stdout,
} as BeachballOptions);
const packageInfos = getPackageInfos(repo.rootPath);
@ -335,7 +339,10 @@ describe('version bumping', () => {
git(['push', 'origin', 'master'], { cwd: repo.rootPath });
await bump({ path: repo.rootPath, groups: [{ include: 'packages/*', name: 'testgroup' }] } as BeachballOptions);
await bump({
path: repo.rootPath,
groups: [{ include: 'packages/*', name: 'testgroup' }],
} as BeachballOptions);
const packageInfos = getPackageInfos(repo.rootPath);
@ -461,7 +468,11 @@ describe('version bumping', () => {
git(['push', 'origin', 'master'], { cwd: repo.rootPath });
await bump({ path: repo.rootPath, bumpDeps: true, scope: ['!packages/foo'] } as BeachballOptions);
await bump({
path: repo.rootPath,
bumpDeps: true,
scope: ['!packages/foo'],
} as BeachballOptions);
const packageInfos = getPackageInfos(repo.rootPath);
expect(packageInfos['foo'].version).toBe('1.0.0');
@ -491,7 +502,11 @@ describe('version bumping', () => {
git(['push', 'origin', 'master'], { cwd: repo.rootPath });
await bump({ path: repo.rootPath, bumpDeps: true, scope: ['!packages/foo'] } as BeachballOptions);
await bump({
path: repo.rootPath,
bumpDeps: true,
scope: ['!packages/foo'],
} as BeachballOptions);
const packageInfos = getPackageInfos(repo.rootPath);
expect(packageInfos['foo'].version).toBe('1.0.0');

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

@ -27,7 +27,7 @@ it('--config overrides configuration path', async () => {
const repo = await repositoryFactory.cloneRepository();
const config = await inDirectory(repo.root!, async () => {
await writeConfig('module.exports = { branch: "origin/main" };');
await writeFileAsync('alternate.config.js', 'module.exports = { branch: "origin/foo" };')
await writeFileAsync('alternate.config.js', 'module.exports = { branch: "origin/foo" };');
return getOptions([...baseArgv, '--config', 'alternate.config.js']);
});
expect(config.branch).toEqual('origin/foo');

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

@ -59,7 +59,12 @@ describe('packageManager', () => {
it('publish package with defaultNpmTag publishes as defaultNpmTag', () => {
const testPackageInfoWithDefaultNpmTag = {
...testPackageInfo,
combinedOptions: { gitTags: true, tag: null, defaultNpmTag: testTag, disallowedChangeTypes: null },
combinedOptions: {
gitTags: true,
tag: null,
defaultNpmTag: testTag,
disallowedChangeTypes: null,
},
};
const publishResult = packagePublish(testPackageInfoWithDefaultNpmTag, registry.getUrl(), '', '');
expect(publishResult.success).toBeTruthy();
@ -83,7 +88,12 @@ describe('packageManager', () => {
it('publish with specified tag overrides defaultNpmTag', () => {
const testPackageInfoWithDefaultNpmTag = {
...testPackageInfo,
combinedOptions: { gitTags: true, tag: testTag, defaultNpmTag: 'thisShouldNotBeUsed', disallowedChangeTypes: null },
combinedOptions: {
gitTags: true,
tag: testTag,
defaultNpmTag: 'thisShouldNotBeUsed',
disallowedChangeTypes: null,
},
};
const publishResult = packagePublish(testPackageInfoWithDefaultNpmTag, registry.getUrl(), '', '');
expect(publishResult.success).toBeTruthy();

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

@ -4,7 +4,7 @@ import _ from 'lodash';
import { ChangeInfo } from '../../types/ChangeInfo';
describe('updateRelatedChangeType', () => {
const bumpInfoFixture: BumpInfo = ({
const bumpInfoFixture: BumpInfo = {
changeFileChangeInfos: new Map(),
dependents: {},
calculatedChangeInfos: {},
@ -30,7 +30,7 @@ describe('updateRelatedChangeType', () => {
newPackages: new Set(),
packageGroups: {},
groupOptions: {},
} as unknown) as BumpInfo;
} as unknown as BumpInfo;
const changeInfoFixture: ChangeInfo = {
dependentChangeType: 'none',

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

@ -44,7 +44,10 @@ describe('mergeChangelogs', () => {
},
];
const mergedChangelog = mergeChangelogs(changelogs, { name: 'master', version: '1.2.3' } as PackageInfo);
const mergedChangelog = mergeChangelogs(changelogs, {
name: 'master',
version: '1.2.3',
} as PackageInfo);
expect(mergedChangelog).toBeDefined();
expect(mergedChangelog!.name).toBe('master');
expect(mergedChangelog!.version).toBe('1.2.3');
@ -72,7 +75,10 @@ describe('mergeChangelogs', () => {
},
];
const mergedChangelog = mergeChangelogs(changelogs, { name: 'master', version: '1.2.3' } as PackageInfo);
const mergedChangelog = mergeChangelogs(changelogs, {
name: 'master',
version: '1.2.3',
} as PackageInfo);
expect(mergedChangelog).toBeDefined();
expect(mergedChangelog!.name).toBe('master');
expect(mergedChangelog!.version).toBe('1.2.3');

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

@ -21,8 +21,18 @@ describe('renderChangelog', () => {
comments: {
major: [],
minor: [
{ comment: 'Awesome change', author: 'user1@example.com', commit: 'sha1', package: 'foo' },
{ comment: 'Boring change', author: 'user2@example.com', commit: 'sha2', package: 'foo' },
{
comment: 'Awesome change',
author: 'user1@example.com',
commit: 'sha1',
package: 'foo',
},
{
comment: 'Boring change',
author: 'user2@example.com',
commit: 'sha2',
package: 'foo',
},
],
patch: [
{ comment: 'Fix', author: 'user1@example.com', commit: 'sha3', package: 'foo' },

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

@ -18,8 +18,18 @@ describe('changelog renderers -', () => {
comments: {
major: [],
minor: [
{ comment: 'Awesome change', author: 'user1@example.com', commit: 'sha1', package: 'foo' },
{ comment: 'Boring change', author: 'user2@example.com', commit: 'sha2', package: 'foo' },
{
comment: 'Awesome change',
author: 'user1@example.com',
commit: 'sha1',
package: 'foo',
},
{
comment: 'Boring change',
author: 'user2@example.com',
commit: 'sha2',
package: 'foo',
},
],
patch: [
{ comment: 'Fix', author: 'user1@example.com', commit: 'sha3', package: 'foo' },

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

@ -19,7 +19,12 @@ describe('perform publishConfig overrides', () => {
const packageInfos: PackageInfos = {
foo: {
combinedOptions: { defaultNpmTag: 'latest', disallowedChangeTypes: [], gitTags: true, tag: 'latest' },
combinedOptions: {
defaultNpmTag: 'latest',
disallowedChangeTypes: [],
gitTags: true,
tag: 'latest',
},
name: 'foo',
packageJsonPath: path.join(tmpDir, 'package.json'),
packageOptions: {},

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

@ -11,7 +11,7 @@ const createTagParameters = (tag: string, cwd: string) => {
return [['tag', '-a', '-f', tag, '-m', tag], { cwd }];
};
const noTagBumpInfo = ({
const noTagBumpInfo = {
calculatedChangeInfos: {
foo: 'minor',
bar: 'major',
@ -34,9 +34,9 @@ const noTagBumpInfo = ({
},
modifiedPackages: new Set(['foo', 'bar']),
newPackages: new Set(),
} as unknown) as BumpInfo;
} as unknown as BumpInfo;
const oneTagBumpInfo = ({
const oneTagBumpInfo = {
calculatedChangeInfos: {
foo: 'minor',
bar: 'major',
@ -59,7 +59,7 @@ const oneTagBumpInfo = ({
},
modifiedPackages: new Set(['foo', 'bar']),
newPackages: new Set(),
} as unknown) as BumpInfo;
} as unknown as BumpInfo;
beforeEach(() => {
(gitFailFast as jest.Mock).mockReset();

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

@ -12,7 +12,7 @@ describe('toposortPackages', () => {
});
it('sort packages with dependencies', () => {
const packageInfos = ({
const packageInfos = {
foo: {
dependencies: {
foo3: '1.0.0',
@ -25,13 +25,13 @@ describe('toposortPackages', () => {
},
},
foo2: {},
} as any) as PackageInfos;
} as any as PackageInfos;
expect(toposortPackages(['foo', 'foo2', 'foo3'], packageInfos)).toEqual(['foo2', 'foo3', 'foo']);
});
it('sort packages with different kinds of dependencies', () => {
const packageInfos = ({
const packageInfos = {
foo: {
dependencies: {
foo3: '1.0.0',
@ -54,13 +54,13 @@ describe('toposortPackages', () => {
foo2: '1.0.0',
},
},
} as any) as PackageInfos;
} as any as PackageInfos;
expect(toposortPackages(['foo', 'foo2', 'foo3', 'foo4'], packageInfos)).toEqual(['foo2', 'foo3', 'foo4', 'foo']);
});
it('do not sort packages if it is not included', () => {
const packageInfos = ({
const packageInfos = {
foo: {
dependencies: {
foo3: '1.0.0',
@ -73,13 +73,13 @@ describe('toposortPackages', () => {
foo2: '1.0.0',
},
},
} as any) as PackageInfos;
} as any as PackageInfos;
expect(toposortPackages(['foo', 'foo3'], packageInfos)).toEqual(['foo3', 'foo']);
});
it('throws if contains circular dependencies', () => {
const packageInfos = ({
const packageInfos = {
foo: {
dependencies: {
bar: '1.0.0',
@ -91,7 +91,7 @@ describe('toposortPackages', () => {
foo: '1.0.0',
},
},
} as any) as PackageInfos;
} as any as PackageInfos;
expect(() => {
toposortPackages(['foo', 'bar'], packageInfos);
@ -99,7 +99,7 @@ describe('toposortPackages', () => {
});
it('throws if package info is missing', () => {
const packageInfos = ({} as any) as PackageInfos;
const packageInfos = {} as any as PackageInfos;
expect(() => {
toposortPackages(['foo'], packageInfos);

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

@ -3,7 +3,7 @@ import { BumpInfo } from '../../types/BumpInfo';
import _ from 'lodash';
describe('validatePackageDependencies', () => {
const bumpInfoFixture = ({
const bumpInfoFixture = {
changes: new Map(),
dependents: {},
calculatedChangeInfos: {},
@ -23,7 +23,7 @@ describe('validatePackageDependencies', () => {
scopedPackages: new Set(['foo', 'bar']),
packageGroups: {},
groupOptions: {},
} as unknown) as BumpInfo;
} as unknown as BumpInfo;
it('invalid when dependencies contains private package', () => {
const bumpInfo = _.merge(_.cloneDeep(bumpInfoFixture), {

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

@ -87,7 +87,11 @@ export function updateRelatedChangeType(
if (bumpDeps && dependentPackages && dependentPackages.length > 0) {
for (const dependentPackage of dependentPackages) {
queue.push({ subjectPackage: dependentPackage, changeType: dependentChangeType, baseChangeInfo });
queue.push({
subjectPackage: dependentPackage,
changeType: dependentChangeType,
baseChangeInfo,
});
}
}
@ -100,7 +104,11 @@ export function updateRelatedChangeType(
!groupOptions[groupName] ||
!groupOptions[groupName]?.disallowedChangeTypes?.includes(dependentChangeType)
) {
queue.push({ subjectPackage: packageNameInGroup, changeType: baseChangeInfo.type, baseChangeInfo });
queue.push({
subjectPackage: packageNameInGroup,
changeType: baseChangeInfo.type,
baseChangeInfo,
});
}
}
}

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

@ -90,7 +90,10 @@ export async function promptForChange(options: BeachballOptions) {
};
if (questions.length > 0) {
response = (await prompts(questions as prompts.PromptObject[])) as { comment: string; type: ChangeType };
response = (await prompts(questions as prompts.PromptObject[])) as {
comment: string;
type: ChangeType;
};
if (Object.keys(response).length === 0) {
console.log('Cancelled, no change files are written');

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

@ -1,7 +1,7 @@
import { git } from 'workspace-tools';
export const defaultBranchName = "master";
export const defaultRemoteBranchName = "origin/" + defaultBranchName;
export const defaultBranchName = 'master';
export const defaultRemoteBranchName = 'origin/' + defaultBranchName;
export function gitInitWithDefaultBranchName(cwd: string) {
git(['init', '--bare'], { cwd });
@ -15,5 +15,5 @@ export function gitInitWithDefaultBranchName(cwd: string) {
*/
export function setDefaultBranchName(cwd: string) {
git(['symbolic-ref', 'HEAD', 'refs/heads/' + defaultBranchName], { cwd });
git(['config', 'init.defaultBranch', defaultBranchName], { cwd })
git(['config', 'init.defaultBranch', defaultBranchName], { cwd });
}

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

@ -4,11 +4,11 @@
const startServer = require('verdaccio').default;
const store = require('verdaccio-memory').default;
const arguments = {
const args = {
port: process.argv[2],
};
const port = arguments.port;
const port = args.port;
if (!port) {
console.error('Please provide a port');

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

@ -8823,11 +8823,16 @@ prepend-http@^2.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-2.0.0.tgz#e92434bfa5ea8c19f41cdfd401d741a3c819d897"
integrity sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=
prettier@^1.18.2, prettier@^1.19.0:
prettier@^1.18.2:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
prettier@~2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.3.2.tgz#ef280a05ec253712e486233db5c6f23441e7342d"
integrity sha512-lnJzDfJ66zkMy58OL5/NY5zp70S7Nz6KqcKkXYzn2tMVrNxvbqaBpg7H3qHaLxCJ5lNMsGuM8+ohS7cZrthdLQ==
pretty-error@^2.0.2:
version "2.1.1"
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3"