From 1a1006e4b4aedeb0271b547cbbb66e76afdcffbe Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Fri, 26 Oct 2018 11:42:39 -0400 Subject: Integrate vscode-theme-generator --- .gitignore | 3 ++ clean.js | 7 ++++ generate.js | 48 ++++++++++++++++++++++ package.json | 127 +++++++++++++++++++++++++++++++++++----------------------- tsconfig.json | 10 +++++ 5 files changed, 144 insertions(+), 51 deletions(-) create mode 100644 clean.js create mode 100644 generate.js create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index 001a2c1..e3f7ea2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Files generated from TypeScript source +themes/ts-built + ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. diff --git a/clean.js b/clean.js new file mode 100644 index 0000000..46d1826 --- /dev/null +++ b/clean.js @@ -0,0 +1,7 @@ +var glob = require('glob'); +var fs = require('fs'); +var path = require('path'); + +glob.sync('./themes/ts-built/**/*.js').forEach(function(file) { + fs.unlinkSync(path.resolve(file)); +}); \ No newline at end of file diff --git a/generate.js b/generate.js new file mode 100644 index 0000000..6f7a867 --- /dev/null +++ b/generate.js @@ -0,0 +1,48 @@ +var glob = require('glob'); +var fs = require('fs'); +var path = require('path'); +var childProcess = require('child_process'); + +// Run compiled theme generators +glob.sync('./themes/ts-built/**/*.js').forEach(function(file) { + childProcess.spawnSync('node', [ path.resolve(file) ]); +}); + +// Move generated themes to the correct folders +glob.sync('./themes/ts-built/dark/*.json').forEach(function(file) { + fs.renameSync(file, path.join(__dirname, 'themes', 'dark', path.basename(file))); +}); + +glob.sync('./themes/ts-built/light/*.json').forEach(function(file) { + fs.renameSync(file, path.join(__dirname, 'themes', 'light', path.basename(file))); +}); + +// Populate the "contributes" property in package.json +var themes = []; + +glob.sync('./themes/dark/*.json').forEach(function(file) { + var theme = require(file); + themes.push({ + label: theme.name, + uiTheme: 'vs-dark', + path: file + }); +}); + +glob.sync('./themes/light/*.json').forEach(function(file) { + var theme = require(file); + themes.push({ + label: theme.name, + uiTheme: 'vs', + path: file + }); +}); + +var package = require('./package.json'); + +package.contributes.themes = themes; + +fs.writeFile('./package.json', JSON.stringify(package, null, 2), function(err) { + if (err) return console.log(err); + console.log('package.json updated'); +}); \ No newline at end of file diff --git a/package.json b/package.json index 073ffcb..d70e8aa 100644 --- a/package.json +++ b/package.json @@ -1,53 +1,78 @@ { - "name": "linux-themes", - "displayName": "Linux Themes for VS Code", - "description": "Color themes designed to match the popular Ubuntu themes.", - "version": "1.0.1", - "publisher": "SolarLiner", - "icon": "icon.png", - "license": "MIT", - "repository": { - "type": "GitHub", - "url": "https://github.com/SolarLiner/vscode-arc-theme" - }, - "engines": { - "vscode": "^1.12.0" - }, - "categories": [ - "Themes" - ], - "contributes": { - "themes": [ - { - "label": "Arc Dark", - "uiTheme": "vs-dark", - "path": "./themes/arc-dark.json" - }, - { - "label": "Arc", - "uiTheme": "vs", - "path": "./themes/arc.json" - }, - { - "label": "Adapta Nokto", - "uiTheme": "vs-dark", - "path": "./themes/adapta-nokto.json" - }, - { - "label": "Pocillo Dark", - "uiTheme": "vs-dark", - "path": "./themes/pocillo-dark.json" - }, - { - "label": "United Ubuntu", - "uiTheme": "vs-dark", - "path": "./themes/united-gnome.json" - }, - { - "label": "Ambiance [beta]", - "uiTheme": "vs-dark", - "path": "./themes/ambiance.json" - } - ] - } + "name": "linux-themes", + "displayName": "Linux Themes for VS Code", + "description": "Color themes designed to match the popular Ubuntu themes.", + "version": "1.0.1", + "publisher": "SolarLiner", + "icon": "icon.png", + "license": "MIT", + "scripts": { + "clean": "node clean.js", + "build": "tsc", + "prerebuild": "npm run clean", + "rebuild": "npm run build", + "pregenerate": "npm run rebuild", + "generate": "node generate.js", + "start": "npm run generate" + }, + "repository": { + "type": "GitHub", + "url": "https://github.com/rdnlsmith/vscode-arc-theme" + }, + "engines": { + "vscode": "^1.12.0" + }, + "categories": [ + "Themes" + ], + "contributes": { + "themes": [ + { + "label": "Adapta Nokto", + "uiTheme": "vs-dark", + "path": "./themes/dark/adapta-nokto.json" + }, + { + "label": "Ambiance [beta]", + "uiTheme": "vs-dark", + "path": "./themes/dark/ambiance.json" + }, + { + "label": "Arc Dark", + "uiTheme": "vs-dark", + "path": "./themes/dark/arc-dark.json" + }, + { + "label": "Communitheme", + "uiTheme": "vs-dark", + "path": "./themes/dark/communitheme.json" + }, + { + "label": "Flat-Plat [beta]", + "uiTheme": "vs-dark", + "path": "./themes/dark/flat-plat.json" + }, + { + "label": "Pocillo Dark [beta]", + "uiTheme": "vs-dark", + "path": "./themes/dark/pocillo-dark.json" + }, + { + "label": "United Ubuntu", + "uiTheme": "vs-dark", + "path": "./themes/dark/united-gnome.json" + }, + { + "label": "Arc", + "uiTheme": "vs", + "path": "./themes/light/arc.json" + } + ] + }, + "devDependencies": { + "@types/node": "^10.12.0", + "glob": "^7.1.3", + "typescript": "^3.1.3", + "vscode-theme-generator": "0.0.20" + } } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..c82bc72 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "outDir": "./themes/ts-built", + "rootDir": "./themes/src", + "strict": true, + "esModuleInterop": true + } +} \ No newline at end of file -- cgit v1.2.3