beachball
Advanced tools
Comparing version 1.13.1 to 1.13.2
@@ -5,3 +5,17 @@ { | ||
{ | ||
"date": "Tue, 10 Sep 2019 19:37:12 GMT", | ||
"date": "Mon, 16 Sep 2019 22:57:34 GMT", | ||
"tag": "beachball_v1.13.2", | ||
"version": "1.13.2", | ||
"comments": { | ||
"patch": [ | ||
{ | ||
"comment": "adding fetching for specific remote instead of all", | ||
"author": "kchau@microsoft.com", | ||
"commit": "7513d7ec192a5ddfc9e802a382fd4667bdb2b53d" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"date": "Tue, 10 Sep 2019 19:37:18 GMT", | ||
"tag": "beachball_v1.13.1", | ||
@@ -8,0 +22,0 @@ "version": "1.13.1", |
# Change Log - beachball | ||
This log was last generated on Tue, 10 Sep 2019 19:37:12 GMT and should not be manually modified. | ||
This log was last generated on Mon, 16 Sep 2019 22:57:34 GMT and should not be manually modified. | ||
## 1.13.2 | ||
Mon, 16 Sep 2019 22:57:34 GMT | ||
### Patches | ||
- adding fetching for specific remote instead of all (kchau@microsoft.com) | ||
## 1.13.1 | ||
Tue, 10 Sep 2019 19:37:12 GMT | ||
Tue, 10 Sep 2019 19:37:18 GMT | ||
@@ -8,0 +14,0 @@ ### Patches |
@@ -18,2 +18,3 @@ "use strict"; | ||
registry = new registry_1.Registry(); | ||
jest.setTimeout(30000); | ||
}); | ||
@@ -20,0 +21,0 @@ afterAll(() => { |
@@ -11,6 +11,8 @@ import * as tmp from 'tmp'; | ||
readonly rootPath: string; | ||
cloneFrom(path: string): Promise<void>; | ||
cloneFrom(path: string, originName?: string): Promise<void>; | ||
commitChange(newFilename: string): Promise<void>; | ||
branch(branchName: string): Promise<void>; | ||
push(remote: string, branch: string): Promise<void>; | ||
cleanUp(): Promise<void>; | ||
} | ||
//# sourceMappingURL=repository.d.ts.map |
@@ -17,2 +17,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -22,8 +25,10 @@ const child_process_1 = require("child_process"); | ||
const tmp = __importStar(require("tmp")); | ||
const fs_1 = require("fs"); | ||
const path_1 = __importDefault(require("path")); | ||
const fs_extra_1 = require("fs-extra"); | ||
const util_1 = require("util"); | ||
const writeFileAsync = util_1.promisify(fs_1.writeFile); | ||
const writeFileAsync = util_1.promisify(fs_extra_1.writeFile); | ||
const removeAsync = util_1.promisify(fs_extra_1.remove); | ||
const packageJson = JSON.stringify({ | ||
name: 'foo', | ||
version: '1.0.0' | ||
version: '1.0.0', | ||
}); | ||
@@ -50,3 +55,3 @@ function dirAsync(options) { | ||
stdout, | ||
status | ||
status, | ||
}; | ||
@@ -93,11 +98,10 @@ if (status) { | ||
process.chdir(this.root.name); | ||
yield runCommands([ | ||
'git init', | ||
'git config user.email ci@example.com', | ||
'git config user.name CIUSER', | ||
'touch README', | ||
'git add README' | ||
]); | ||
yield writeFileAsync('package.json', packageJson); | ||
yield runCommands(['git add package.json', 'git commit -m README']); | ||
yield runCommands(['git init --bare']); | ||
const tmpRepo = new Repository(); | ||
yield tmpRepo.initialize(); | ||
yield tmpRepo.cloneFrom(this.root.name); | ||
yield tmpRepo.commitChange('README'); | ||
yield writeFileAsync(path_1.default.join(tmpRepo.rootPath, 'package.json'), packageJson); | ||
yield tmpRepo.commitChange('package.json'); | ||
yield tmpRepo.push('origin', 'HEAD:master'); | ||
process.chdir(originalDirectory); | ||
@@ -131,3 +135,3 @@ }); | ||
} | ||
cloneFrom(path) { | ||
cloneFrom(path, originName) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -137,3 +141,7 @@ if (!this.root) { | ||
} | ||
yield runInDirectory(this.root.name, [`git clone ${path} .`, 'git config user.email ci@example.com', 'git config user.name CIUSER']); | ||
yield runInDirectory(this.root.name, [ | ||
`git clone ${originName ? '-o ' + originName + ' ' : ''}${path} .`, | ||
'git config user.email ci@example.com', | ||
'git config user.name CIUSER', | ||
]); | ||
}); | ||
@@ -146,3 +154,7 @@ } | ||
} | ||
yield runInDirectory(this.root.name, [`touch ${newFilename}`, `git add ${newFilename}`, `git commit -m '${newFilename}'`]); | ||
yield runInDirectory(this.root.name, [ | ||
`touch ${newFilename}`, | ||
`git add ${newFilename}`, | ||
`git commit -m '${newFilename}'`, | ||
]); | ||
}); | ||
@@ -158,3 +170,19 @@ } | ||
} | ||
push(remote, branch) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!this.root) { | ||
throw new Error('Must initialize before push'); | ||
} | ||
yield runInDirectory(this.root.name, [`git push ${remote} ${branch}`]); | ||
}); | ||
} | ||
cleanUp() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!this.root) { | ||
throw new Error('Must initialize before clean up'); | ||
} | ||
yield removeAsync(this.root.name); | ||
}); | ||
} | ||
} | ||
exports.Repository = Repository; |
@@ -48,3 +48,4 @@ "use strict"; | ||
console.log('fetching latest from remotes'); | ||
git_1.fetchAll(cwd); | ||
const { remote } = git_1.parseRemoteBranch(branch); | ||
git_1.fetchRemote(remote, cwd); | ||
} | ||
@@ -51,0 +52,0 @@ const changedPackages = getAllChangedPackages(branch, cwd); |
@@ -22,3 +22,3 @@ /** | ||
export declare function getUntrackedChanges(cwd: string): string[] | undefined; | ||
export declare function fetchAll(cwd: string): void; | ||
export declare function fetchRemote(remote: string, cwd: string): void; | ||
export declare function getChanges(branch: string, cwd: string): string[] | undefined; | ||
@@ -25,0 +25,0 @@ export declare function getStagedChanges(branch: string, cwd: string): string[] | undefined; |
@@ -77,10 +77,10 @@ "use strict"; | ||
exports.getUntrackedChanges = getUntrackedChanges; | ||
function fetchAll(cwd) { | ||
const results = git(['fetch', '-a'], { cwd }); | ||
function fetchRemote(remote, cwd) { | ||
const results = git(['fetch', remote], { cwd }); | ||
if (!results.success) { | ||
console.error('Cannot fetch all remotes'); | ||
console.error(`Cannot fetch remote: ${remote}`); | ||
throw new Error('Cannot fetch'); | ||
} | ||
} | ||
exports.fetchAll = fetchAll; | ||
exports.fetchRemote = fetchRemote; | ||
function getChanges(branch, cwd) { | ||
@@ -87,0 +87,0 @@ try { |
{ | ||
"name": "beachball", | ||
"version": "1.13.1", | ||
"version": "1.13.2", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -10,2 +10,3 @@ import { Registry } from '../fixtures/registry'; | ||
registry = new Registry(); | ||
jest.setTimeout(30000); | ||
}); | ||
@@ -12,0 +13,0 @@ |
import { exec as nativeExec } from 'child_process'; | ||
import * as process from 'process'; | ||
import * as tmp from 'tmp'; | ||
import { writeFile } from 'fs'; | ||
import path from 'path'; | ||
import { writeFile, remove } from 'fs-extra'; | ||
import { promisify } from 'util'; | ||
const writeFileAsync = promisify(writeFile); | ||
const removeAsync = promisify(remove); | ||
const packageJson = JSON.stringify({ | ||
name: 'foo', | ||
version: '1.0.0' | ||
version: '1.0.0', | ||
}); | ||
@@ -38,3 +40,3 @@ | ||
stdout, | ||
status | ||
status, | ||
}; | ||
@@ -80,11 +82,13 @@ if (status) { | ||
process.chdir(this.root!.name); | ||
await runCommands([ | ||
'git init', | ||
'git config user.email ci@example.com', | ||
'git config user.name CIUSER', | ||
'touch README', | ||
'git add README' | ||
]); | ||
await writeFileAsync('package.json', packageJson); | ||
await runCommands(['git add package.json', 'git commit -m README']); | ||
await runCommands(['git init --bare']); | ||
const tmpRepo = new Repository(); | ||
await tmpRepo.initialize(); | ||
await tmpRepo.cloneFrom(this.root.name); | ||
await tmpRepo.commitChange('README'); | ||
await writeFileAsync(path.join(tmpRepo.rootPath, 'package.json'), packageJson); | ||
await tmpRepo.commitChange('package.json'); | ||
await tmpRepo.push('origin', 'HEAD:master'); | ||
process.chdir(originalDirectory); | ||
@@ -118,3 +122,3 @@ } | ||
async cloneFrom(path: string): Promise<void> { | ||
async cloneFrom(path: string, originName?: string): Promise<void> { | ||
if (!this.root) { | ||
@@ -124,3 +128,7 @@ throw new Error('Must initialize before cloning'); | ||
await runInDirectory(this.root.name, [`git clone ${path} .`, 'git config user.email ci@example.com', 'git config user.name CIUSER']); | ||
await runInDirectory(this.root.name, [ | ||
`git clone ${originName ? '-o ' + originName + ' ' : ''}${path} .`, | ||
'git config user.email ci@example.com', | ||
'git config user.name CIUSER', | ||
]); | ||
} | ||
@@ -132,3 +140,7 @@ | ||
} | ||
await runInDirectory(this.root.name, [`touch ${newFilename}`, `git add ${newFilename}`, `git commit -m '${newFilename}'`]); | ||
await runInDirectory(this.root.name, [ | ||
`touch ${newFilename}`, | ||
`git add ${newFilename}`, | ||
`git commit -m '${newFilename}'`, | ||
]); | ||
} | ||
@@ -142,2 +154,18 @@ | ||
} | ||
async push(remote: string, branch: string) { | ||
if (!this.root) { | ||
throw new Error('Must initialize before push'); | ||
} | ||
await runInDirectory(this.root.name, [`git push ${remote} ${branch}`]); | ||
} | ||
async cleanUp() { | ||
if (!this.root) { | ||
throw new Error('Must initialize before clean up'); | ||
} | ||
await removeAsync(this.root.name); | ||
} | ||
} |
import { ChangeInfo } from './ChangeInfo'; | ||
import { findPackageRoot, getChangePath } from './paths'; | ||
import { getChanges, getStagedChanges, git, fetchAll } from './git'; | ||
import { getChanges, getStagedChanges, git, fetchRemote, parseRemoteBranch } from './git'; | ||
import fs from 'fs'; | ||
@@ -49,3 +49,4 @@ import path from 'path'; | ||
console.log('fetching latest from remotes'); | ||
fetchAll(cwd); | ||
const { remote } = parseRemoteBranch(branch); | ||
fetchRemote(remote, cwd); | ||
} | ||
@@ -52,0 +53,0 @@ |
@@ -78,6 +78,6 @@ import { spawnSync } from 'child_process'; | ||
export function fetchAll(cwd: string) { | ||
const results = git(['fetch', '-a'], { cwd }); | ||
export function fetchRemote(remote: string, cwd: string) { | ||
const results = git(['fetch', remote], { cwd }); | ||
if (!results.success) { | ||
console.error('Cannot fetch all remotes'); | ||
console.error(`Cannot fetch remote: ${remote}`); | ||
throw new Error('Cannot fetch'); | ||
@@ -84,0 +84,0 @@ } |
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
164147
4000