diff --git a/demo/generate.ts b/demo/generate.ts index b13ef21..0ab3e4c 100644 --- a/demo/generate.ts +++ b/demo/generate.ts @@ -44,9 +44,9 @@ const settings: ISchemeSetting = { }; generateScheme( - 'Scheme Example', + 'Moonlight', 'Mauro Reis Vieira ', - 'Scheme-Example', + 'Moonlight', settings, 'schemes' ); diff --git a/schemes/Scheme-Example.sublime-color-scheme b/schemes/Moonlight.sublime-color-scheme similarity index 99% rename from schemes/Scheme-Example.sublime-color-scheme rename to schemes/Moonlight.sublime-color-scheme index fc117f8..617d82e 100644 --- a/schemes/Scheme-Example.sublime-color-scheme +++ b/schemes/Moonlight.sublime-color-scheme @@ -1,5 +1,5 @@ { - "name": "Scheme Example", + "name": "Moonlight", "author": "Mauro Reis Vieira ", "variables": { "cursor": "#67d2ff", diff --git a/src/schemeGenerator.ts b/src/schemeGenerator.ts index 04a0003..ef1afbb 100644 --- a/src/schemeGenerator.ts +++ b/src/schemeGenerator.ts @@ -23,10 +23,10 @@ export function generateScheme( item.scope.forEach((i: string) => { if (allScopes.has(i)) { log( - chalk.bold.red('‼DUPLICATED‼') + - ' - Scope [' + + chalk.bold.bgRed(' ‼ERROR‼ ') + + ' - Duplicated scope [' + chalk.bold.green(i) + - '] overwrite by: ' + + '] overwrite by ' + chalk.yellow(item.name) ); } @@ -43,19 +43,30 @@ export function generateScheme( }); fs.mkdir(dist, () => { - fs.writeFileSync( - `${dist}/${schemeName}.sublime-color-scheme`, - JSON.stringify( - { - name, - author, - variables: colors, - globals: Object.assign(defaultGlobals, ui), - rules: allRules, - }, - null, - 4 - ) - ); + try { + fs.writeFileSync( + `${dist}/${schemeName}.sublime-color-scheme`, + JSON.stringify( + { + name, + author, + variables: colors, + globals: Object.assign(defaultGlobals, ui), + rules: allRules, + }, + null, + 4 + ) + ); + log( + chalk.bold.bgGreen(' SUCCESS ') + + ' - Scheme ' + + chalk.bold.cyan(`${schemeName}.sublime-color-scheme`) + + ' created in ' + + chalk.underline.yellow(dist) + ' folder' + ); + } catch (e) { + log(chalk.bold.red(e)); + } }); }