mirror of
https://github.com/zebrajr/react.git
synced 2025-12-07 12:20:38 +01:00
* Enable Yarn workspaces for packages/* * Move src/isomorphic/* into packages/react/src/* * Create index.js stubs for all packages in packages/* This makes the test pass again, but breaks the build because npm/ folders aren't used yet. I'm not sure if we'll keep this structure--I'll just keep working and fix the build after it settles down. * Put FB entry point for react-dom into packages/* * Move src/renderers/testing/* into packages/react-test-renderer/src/* Note that this is currently broken because Jest ignores node_modules, and so Yarn linking makes Jest skip React source when transforming. * Remove src/node_modules It is now unnecessary. Some tests fail though. * Add a hacky workaround for Jest/Workspaces issue Jest sees node_modules and thinks it's third party code. This is a hacky way to teach Jest to still transform anything in node_modules/react* if it resolves outside of node_modules (such as to our packages/*) folder. I'm not very happy with this and we should revisit. * Add a fake react-native package * Move src/renderers/art/* into packages/react-art/src/* * Move src/renderers/noop/* into packages/react-noop-renderer/src/* * Move src/renderers/dom/* into packages/react-dom/src/* * Move src/renderers/shared/fiber/* into packages/react-reconciler/src/* * Move DOM/reconciler tests I previously forgot to move * Move src/renderers/native-*/* into packages/react-native-*/src/* * Move shared code into packages/shared It's not super clear how to organize this properly yet. * Add back files that somehow got lost * Fix the build * Prettier * Add missing license headers * Fix an issue that caused mocks to get included into build * Update other references to src/ * Re-run Prettier * Fix lint * Fix weird Flow violation I didn't change this file but Flow started complaining. Caleb said this annotation was unnecessarily using $Abstract though so I removed it. * Update sizes * Fix stats script * Fix packaging fixtures Use file: instead of NODE_PATH since NODE_PATH. NODE_PATH trick only worked because we had no react/react-dom in root node_modules, but now we do. file: dependency only works as I expect in Yarn, so I moved the packaging fixtures to use Yarn and committed lockfiles. Verified that the page shows up. * Fix art fixture * Fix reconciler fixture * Fix SSR fixture * Rename native packages
72 lines
2.2 KiB
JavaScript
72 lines
2.2 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
'use strict';
|
|
|
|
const chalk = require('chalk');
|
|
const {exec} = require('child-process-promise');
|
|
const {readFileSync, writeFileSync} = require('fs');
|
|
const {readJson, writeJson} = require('fs-extra');
|
|
const {join} = require('path');
|
|
const semver = require('semver');
|
|
const {projects} = require('../config');
|
|
const {execUnlessDry, logPromise} = require('../utils');
|
|
|
|
const update = async ({cwd, dry, version}) => {
|
|
try {
|
|
// Update root package.json
|
|
const packagePath = join(cwd, 'package.json');
|
|
const rootPackage = await readJson(packagePath);
|
|
rootPackage.version = version;
|
|
await writeJson(packagePath, rootPackage, {spaces: 2});
|
|
|
|
// Update ReactVersion source file
|
|
const reactVersionPath = join(cwd, 'packages/shared/src/ReactVersion.js');
|
|
const reactVersion = readFileSync(reactVersionPath, 'utf8').replace(
|
|
/module\.exports = '[^']+';/,
|
|
`module.exports = '${version}';`
|
|
);
|
|
writeFileSync(reactVersionPath, reactVersion);
|
|
|
|
// Update renderer versions and peer dependencies
|
|
const updateProjectPackage = async project => {
|
|
const path = join(cwd, 'packages', project, 'package.json');
|
|
const json = await readJson(path);
|
|
|
|
// Unstable packages (eg version < 1.0) are treated differently.
|
|
// In order to simplify DX for the release engineer,
|
|
// These packages are auto-incremented by a minor version number.
|
|
if (semver.lt(json.version, '1.0.0')) {
|
|
json.version = `0.${semver.minor(json.version) + 1}.0`;
|
|
} else {
|
|
json.version = version;
|
|
}
|
|
|
|
if (project !== 'react') {
|
|
json.peerDependencies.react = `^${version}`;
|
|
}
|
|
await writeJson(path, json, {spaces: 2});
|
|
};
|
|
await Promise.all(projects.map(updateProjectPackage));
|
|
|
|
// Version sanity check
|
|
await exec('yarn version-check', {cwd});
|
|
|
|
await execUnlessDry(
|
|
`git commit -am "Updating package versions for release ${version}"`,
|
|
{cwd, dry}
|
|
);
|
|
} catch (error) {
|
|
throw Error(
|
|
chalk`
|
|
Failed while updating package versions
|
|
|
|
{white ${error.message}}
|
|
`
|
|
);
|
|
}
|
|
};
|
|
|
|
module.exports = async params => {
|
|
return logPromise(update(params), 'Updating package versions');
|
|
};
|