MCPcopy Create free account
hub / github.com/ReactiveX/rxjs / assertRepositoryReady

Function assertRepositoryReady

scripts/release/beta.mjs:145–162  ·  view source on GitHub ↗
(root, { live, command = run })

Source from the content-addressed store, hash-verified

143}
144
145export function assertRepositoryReady(root, { live, command = run }) {
146 const status = command('git', ['status', '--porcelain', '--untracked-files=normal'], { cwd: root, encoding: 'utf8' }).stdout.trim();
147 assert.equal(status, '', 'The release checkout must be clean. Commit or discard every change first.');
148 if (!live) return;
149
150 const branch = command('git', ['branch', '--show-current'], { cwd: root, encoding: 'utf8' }).stdout.trim();
151 assert.equal(branch, 'master', `Live beta publication must run from master, not ${branch || 'a detached checkout'}.`);
152 const upstream = command('git', ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}'], {
153 cwd: root,
154 encoding: 'utf8',
155 }).stdout.trim();
156 assert.match(upstream, /(?:^|\/)master$/, `master must track a remote master branch; found ${upstream}.`);
157 const divergence = command('git', ['rev-list', '--left-right', '--count', 'HEAD...@{upstream}'], {
158 cwd: root,
159 encoding: 'utf8',
160 }).stdout.trim();
161 assert.match(divergence, /^0\s+0$/, `master must exactly match ${upstream}; divergence was ${divergence}. Fetch and update first.`);
162}
163
164export function assertInteractivePublishingEnvironment({ dryRun, env, stdin, stdout }) {
165 if (dryRun) return;

Callers 2

beta.test.mjsFile · 0.90
mainFunction · 0.85

Calls 2

commandFunction · 0.85
matchMethod · 0.80

Tested by

no test coverage detected