Skip to content

Commit c8169df

Browse files
committed
#4 - Fix UISchema generator
1 parent bb1e88a commit c8169df

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tooling/src/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ export function cloneAndInstall(repo: String, path: string, callback: (result: s
4242
export function generateUISchema(path: string, callback: (result: string, type?: string) => void) {
4343
readFile(path, 'utf8', (err, data) => {
4444
if (err) callback(err.message, 'err');
45-
var content = JSON.parse(data);
46-
var jsonSchema = jsonforms.generateJsonSchema(content);
45+
var jsonSchema = JSON.parse(data);
4746
var jsonUISchema = jsonforms.generateDefaultUISchema(jsonSchema);
48-
var newPath = path.substring(0, path.lastIndexOf("/"));
49-
writeFile(newPath+'/ui-schema.json', JSON.stringify(jsonUISchema,null, 2), (err) => {
47+
if(process.platform === 'win32') {
48+
var newPath = path.substring(0, path.lastIndexOf("\\"))+'\\ui-schema.json';
49+
} else {
50+
var newPath = path.substring(0, path.lastIndexOf("/"))+'/ui-schema.json';
51+
}
52+
writeFile(newPath, JSON.stringify(jsonUISchema,null, 2), (err) => {
5053
if (err) callback(err.message, 'err');
5154
callback('Successfully generated UI schema');
5255
});

0 commit comments

Comments
 (0)