Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI/release scripts #5364

Merged
merged 3 commits into from Dec 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions bin/check-build-version.js
@@ -0,0 +1,42 @@
import fs from 'fs';
import assert from 'assert';
import axios from '../index.js';
import axiosBuild from '../dist/node/axios.cjs';
import inquirer from 'inquirer';

const {version, name} = JSON.parse(fs.readFileSync('./package.json'));

console.log('Checking versions...\n----------------------------')

Check notice

Code scanning / CodeQL

Semicolon insertion

Avoid automated semicolon insertion (90% of all statements in [the enclosing script](1) have an explicit semicolon).

console.log(`Package version: v${version}`);
console.log(`Axios version: v${axios.VERSION}`);
console.log(`Axios build version: v${axiosBuild.VERSION}`);
console.log(`----------------------------`);

assert.strictEqual(version, axios.VERSION, `Version mismatch between package and Axios`);
assert.strictEqual(version, axiosBuild.VERSION, `Version mismatch between package and build`);

console.log('PASSED\n');

const choices = [
`Yes, let's release Axios v${version} to npm`,
`No, don't do an npm release - I'll do it myself`
];

inquirer
.prompt([
{
type: 'list',
name: 'release',
message: `You have requested an npm release for ${name.toUpperCase()} v${version}. Are you sure?`,
choices
}
])
.then((answers) => {
if (choices.indexOf(answers.release)) {
console.warn('terminate...');
process.exit(1);
}
});