Skip to content

Commit 7b32086

Browse files
committed
Fixed config name TypeError
1 parent 5bc4a49 commit 7b32086

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "polyapi",
3-
"version": "0.24.3",
3+
"version": "0.24.4",
44
"description": "Poly is a CLI tool to help create and manage your Poly definitions.",
55
"license": "MIT",
66
"repository": {

src/commands/prepare.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ const getAllDeployables = async (
9393
baseUrl,
9494
gitRevision,
9595
);
96+
if (deployable === null) {
97+
continue;
98+
}
9699
const fullName = `${deployable.context}.${deployable.name}`;
97100
if (found.has(fullName)) {
98101
console.error(
@@ -160,15 +163,15 @@ export const prepareDeployables = async (
160163
writeUpdatedDeployable(deployable, disableDocs),
161164
),
162165
);
163-
const staged = shell.exec('git diff --name-only --cached')
166+
const staged = shell.exec('git diff --name-only --cached', {silent:true})
164167
.toString().split('\n').filter(Boolean);
165168
const rootPath: string = shell.exec('git rev-parse --show-toplevel', {silent:true})
166169
.toString('utf8').replace('\n', '');
167170
for (const deployable of dirtyDeployables) {
168171
try{
169172
const deployableName = deployable.file.replace(`${rootPath}/`, '');
170173
if (staged.includes(deployableName)) {
171-
shell.echo(`Staging ${deployableName}`);
174+
console.log(`Staging ${deployableName}`);
172175
shell.exec(`git add ${deployableName}`);
173176
}
174177
}

src/transpiler.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,10 @@ const getPolyConfig = (types: string[], sourceFile: ts.SourceFile): any => {
259259
};
260260

261261
visit(sourceFile);
262+
263+
if (config === null) {
264+
return null;
265+
}
262266
const { name, context, type, description, ...other } = config;
263267
if (!name) throw new Error("polyConfig is missing 'name'.");
264268
if (!context) throw new Error("polyConfig is missing 'context'.");
@@ -471,6 +475,9 @@ export const parseDeployable = async (
471475
DeployableTypeEntries.map((e) => e[0]),
472476
sourceFile,
473477
);
478+
if (polyConfig === null) {
479+
return [null, null];
480+
}
474481
polyConfig.type = DeployableTsTypeToName[polyConfig.type];
475482
const fileContents = sourceFile.getFullText();
476483
const fileRevision = getDeployableFileRevision(fileContents);

0 commit comments

Comments
 (0)