Fix npm publishing script
Summary: Npm publishing script should not attempt to publish plugin packages Reviewed By: mweststrate Differential Revision: D21721175 fbshipit-source-id: 0bf9808339c1177bc9d263ac34d40aa30df08d11
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6005d039f7
commit
8473bc9ecf
@@ -20,6 +20,7 @@ const glob = promisify(globImport);
|
||||
export interface Package {
|
||||
dir: string;
|
||||
json: any;
|
||||
isPlugin: boolean;
|
||||
}
|
||||
|
||||
export interface Workspaces {
|
||||
@@ -27,10 +28,6 @@ export interface Workspaces {
|
||||
packages: Package[];
|
||||
}
|
||||
|
||||
function isPlugin(dir: string) {
|
||||
return dir.startsWith(pluginsDir);
|
||||
}
|
||||
|
||||
export async function getWorkspaces(): Promise<Workspaces> {
|
||||
const rootPackageJson = await fs.readJson(path.join(rootDir, 'package.json'));
|
||||
const packageGlobs = rootPackageJson.workspaces.packages as string[];
|
||||
@@ -48,6 +45,7 @@ export async function getWorkspaces(): Promise<Workspaces> {
|
||||
return {
|
||||
dir,
|
||||
json,
|
||||
isPlugin: dir.startsWith(pluginsDir),
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -55,6 +53,7 @@ export async function getWorkspaces(): Promise<Workspaces> {
|
||||
rootPackage: {
|
||||
dir: rootDir,
|
||||
json: rootPackageJson,
|
||||
isPlugin: false,
|
||||
},
|
||||
packages,
|
||||
};
|
||||
@@ -109,14 +108,14 @@ async function bumpWorkspaceVersions(
|
||||
newVersion = newVersion || (rootPackage.json.version as string);
|
||||
const allPackages = [rootPackage, ...packages];
|
||||
const localPackageNames = packages
|
||||
.filter((pkg) => !isPlugin(pkg.dir))
|
||||
.filter((pkg) => !pkg.isPlugin)
|
||||
.map(({json}) => json.name as string);
|
||||
for (const pkg of allPackages) {
|
||||
const {dir, json} = pkg;
|
||||
const {json} = pkg;
|
||||
let changed = false;
|
||||
if (json.version !== newVersion && !isPlugin(dir)) {
|
||||
if (json.version !== newVersion && !pkg.isPlugin) {
|
||||
console.log(
|
||||
`Bumping version of ${pkg.json.name} from ${json.version} to ${newVersion}`,
|
||||
`Bumping version of ${json.name} from ${json.version} to ${newVersion}`,
|
||||
);
|
||||
json.version = newVersion;
|
||||
changed = true;
|
||||
@@ -180,7 +179,9 @@ export async function publishPackages({
|
||||
if (proxy) {
|
||||
cmd += ` --http-proxy ${proxy} --https-proxy ${proxy}`;
|
||||
}
|
||||
const publicPackages = workspaces.packages.filter((pkg) => !pkg.json.private);
|
||||
const publicPackages = workspaces.packages.filter(
|
||||
(pkg) => !pkg.json.private && !pkg.isPlugin,
|
||||
);
|
||||
for (const pkg of publicPackages) {
|
||||
if (dryRun) {
|
||||
console.log(`DRYRUN: Skipping npm publishing for ${pkg.json.name}`);
|
||||
|
||||
Reference in New Issue
Block a user