2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-02 16:04:10 +03:00
Files
axios/bin/check-build-version.js
T
Dmitriy Mozgovoy f2547d0e03 CI/release scripts (#5364)
* chore(ci): add release scripts;
2022-12-12 00:50:11 +02:00

43 lines
1.2 KiB
JavaScript

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----------------------------')
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);
}
});