Skip to content

Commit 7696db8

Browse files
fix validate
1 parent a9540b4 commit 7696db8

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/cli/facade/validate.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,10 @@ const validate = ({
4747
const validateComponentWithRegistry = async (options: {
4848
registryUrl: string;
4949
packageJson: any;
50-
componentName: string;
51-
componentVersion: string;
5250
}): Promise<void> => {
53-
const { registryUrl, packageJson, componentName, componentVersion } =
54-
options;
51+
const { registryUrl, packageJson } = options;
5552
const registryNormalised = registryUrl.replace(/\/$/, '');
56-
const validateUrl = `${registryNormalised}/~registry/validate/${componentName}/${componentVersion}`;
53+
const validateUrl = `${registryNormalised}/~registry/validate`;
5754

5855
logger.warn(
5956
`Validating component against registry: ${registryNormalised}`
@@ -107,19 +104,14 @@ const validate = ({
107104
}
108105
};
109106

110-
const validateWithRegistries = async (
111-
registryLocations: string[],
112-
component: Component
113-
) => {
107+
const validateWithRegistries = async (registryLocations: string[]) => {
114108
const packageJsonPath = path.join(packageDir, 'package.json');
115109
const packageJson = await fs.readJson(packageJsonPath);
116110

117111
for (const registryUrl of registryLocations) {
118112
await validateComponentWithRegistry({
119113
registryUrl,
120-
packageJson,
121-
componentName: component.name,
122-
componentVersion: component.version
114+
packageJson
123115
});
124116
}
125117
};
@@ -136,21 +128,21 @@ const validate = ({
136128
return Promise.reject(err);
137129
});
138130

139-
const component = await packageComponent().catch((err) => {
131+
await packageComponent().catch((err) => {
140132
errorMessage = strings.errors.cli.PACKAGE_CREATION_FAIL(
141133
String(err)
142134
);
143135
logger.err(errorMessage);
144136
return Promise.reject(errorMessage);
145137
});
146-
await validateWithRegistries(registryLocations, component);
138+
await validateWithRegistries(registryLocations);
147139
} else {
148140
if (fs.existsSync(packageDir)) {
149-
const component = await readPackageJson().catch((err) => {
141+
await readPackageJson().catch((err) => {
150142
logger.err(String(err));
151143
return Promise.reject(err);
152144
});
153-
await validateWithRegistries(registryLocations, component);
145+
await validateWithRegistries(registryLocations);
154146
} else {
155147
errorMessage = strings.errors.cli.PACKAGE_FOLDER_MISSING;
156148
logger.err(errorMessage);

0 commit comments

Comments
 (0)