mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-22 06:18:41 +00:00
Fix package publishing script
074861623e changed the workspace
configuration with the result that 'react-native-web' appeared twice in
the array of workspaces, causing an attempt to republish the package
during the release task.
This commit is contained in:
@@ -18,21 +18,24 @@ const oneTimeCode = argv.otp;
|
||||
console.log(`Publishing react-native-web@${version}`);
|
||||
|
||||
// Collect 'react-native-web' workspaces and package manifests
|
||||
const workspacePaths = require('../package.json').workspaces;
|
||||
const workspaces = workspacePaths.reduce((acc, curr) => {
|
||||
const packageDirectories = glob.sync(curr);
|
||||
const subsetOfpackageDirectories = packageDirectories.filter((dir) => {
|
||||
return dir.includes('react-native-web');
|
||||
});
|
||||
subsetOfpackageDirectories.forEach((dir) => {
|
||||
const directory = path.resolve(dir);
|
||||
const packageJsonPath = path.join(directory, 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
|
||||
acc.push({ directory, packageJson, packageJsonPath });
|
||||
const workspacePaths = require('../package.json').workspaces.reduce((acc, w) => {
|
||||
const resolvedPaths = glob.sync(w);
|
||||
resolvedPaths.forEach((p) => {
|
||||
// Remove duplicates and unrelated packages
|
||||
if (p.includes('react-native-web') && acc.indexOf(p) === -1) {
|
||||
acc.push(p);
|
||||
}
|
||||
});
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
const workspaces = workspacePaths.map((dir) => {
|
||||
const directory = path.resolve(dir);
|
||||
const packageJsonPath = path.join(directory, 'package.json');
|
||||
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
|
||||
return { directory, packageJson, packageJsonPath };
|
||||
});
|
||||
|
||||
// Update each package version and its dependencies
|
||||
const workspaceNames = workspaces.map(({ packageJson }) => packageJson.name);
|
||||
workspaces.forEach(({ directory, packageJson, packageJsonPath }) => {
|
||||
|
||||
Reference in New Issue
Block a user