mirror of
https://github.com/zebrajr/react.git
synced 2025-12-07 12:20:38 +01:00
* Move build/packages/* to build/node_modules/* This fixes Node resolution in that folder and lets us require() packages in it in Node shell for manual testing. * Link fixtures to packages/node_modules This updates the location and also uses link: instead of file: to avoid Yarn caching the folder contents.
33 lines
644 B
JavaScript
33 lines
644 B
JavaScript
#!/usr/bin/env node
|
|
|
|
'use strict';
|
|
|
|
const chalk = require('chalk');
|
|
const {existsSync} = require('fs');
|
|
const {readJson} = require('fs-extra');
|
|
const {join} = require('path');
|
|
|
|
module.exports = async ({cwd, version}) => {
|
|
const packagePath = join(
|
|
cwd,
|
|
'build',
|
|
'node_modules',
|
|
'react',
|
|
'package.json'
|
|
);
|
|
|
|
if (!existsSync(packagePath)) {
|
|
throw Error('No build found');
|
|
}
|
|
|
|
const packageJson = await readJson(packagePath);
|
|
|
|
if (packageJson.version !== version) {
|
|
throw Error(
|
|
chalk`Expected version {bold.white ${version}} but found {bold.white ${
|
|
packageJson.version
|
|
}}`
|
|
);
|
|
}
|
|
};
|