diff --git a/rojo-schema.json b/rojo-schema.json index e3a8306..e57c1ce 100644 --- a/rojo-schema.json +++ b/rojo-schema.json @@ -1,6 +1,6 @@ { "$schema": "http://json-schema.org/draft-07/schema#", - "required": ["name", "tree"], + "required": ["tree"], "type": "object", "properties": { "name": { diff --git a/src/RojoResolver.ts b/src/RojoResolver.ts index 093b2c2..10774d8 100644 --- a/src/RojoResolver.ts +++ b/src/RojoResolver.ts @@ -33,7 +33,7 @@ interface RojoTreeMembers { interface RojoFile { servePort?: number; - name: string; + name?: string; tree: RojoTree; } @@ -219,7 +219,9 @@ export class RojoResolver { configJson = JSON.parse(fs.readFileSync(realPath).toString()); } finally { if (isValidRojoConfig(configJson)) { - this.parseTree(path.dirname(rojoConfigFilePath), configJson.name, configJson.tree, doNotPush); + const folderName = path.dirname(rojoConfigFilePath); + const name = configJson.name ?? folderName; + this.parseTree(folderName, name, configJson.tree, doNotPush); } else { this.warn(`RojoResolver: Invalid configuration! ${ajv.errorsText(validateRojo.get().errors)}`); }