mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-31 09:44:21 +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}`);
|
console.log(`Publishing react-native-web@${version}`);
|
||||||
|
|
||||||
// Collect 'react-native-web' workspaces and package manifests
|
// Collect 'react-native-web' workspaces and package manifests
|
||||||
const workspacePaths = require('../package.json').workspaces;
|
const workspacePaths = require('../package.json').workspaces.reduce((acc, w) => {
|
||||||
const workspaces = workspacePaths.reduce((acc, curr) => {
|
const resolvedPaths = glob.sync(w);
|
||||||
const packageDirectories = glob.sync(curr);
|
resolvedPaths.forEach((p) => {
|
||||||
const subsetOfpackageDirectories = packageDirectories.filter((dir) => {
|
// Remove duplicates and unrelated packages
|
||||||
return dir.includes('react-native-web');
|
if (p.includes('react-native-web') && acc.indexOf(p) === -1) {
|
||||||
});
|
acc.push(p);
|
||||||
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 });
|
|
||||||
});
|
});
|
||||||
return acc;
|
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
|
// Update each package version and its dependencies
|
||||||
const workspaceNames = workspaces.map(({ packageJson }) => packageJson.name);
|
const workspaceNames = workspaces.map(({ packageJson }) => packageJson.name);
|
||||||
workspaces.forEach(({ directory, packageJson, packageJsonPath }) => {
|
workspaces.forEach(({ directory, packageJson, packageJsonPath }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user