From 6eb7f91b099363263ec8e71303778e7da97cb91e Mon Sep 17 00:00:00 2001 From: OctoD Date: Tue, 23 May 2017 18:41:56 +0200 Subject: [PATCH 1/6] chore: Essentials for TS coding --- .gitignore | 1 + .vscode/tasks.json | 54 ++++++++++++------- package.json | 9 ++++ themes/Material-Theme-Icons.json | 2 +- tsconfig.json | 21 ++++++++ typings/gulp-bump/gulp-bump.d.ts | 7 +++ .../gulp-conventional-changelog.d.ts | 5 ++ typings/gulp-stats/gulp-stats.d.ts | 5 ++ 8 files changed, 85 insertions(+), 19 deletions(-) create mode 100644 tsconfig.json create mode 100644 typings/gulp-bump/gulp-bump.d.ts create mode 100644 typings/gulp-conventional-changelog/gulp-conventional-changelog.d.ts create mode 100644 typings/gulp-stats/gulp-stats.d.ts diff --git a/.gitignore b/.gitignore index fd5ee6a..46fb5c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.log *.~lock +*.js dist/ node_modules/ \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 427a85b..e89c89b 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -7,22 +7,40 @@ // ${cwd}: the current working directory of the spawned process // A task runner that calls a custom npm script that compiles the extension. { - "version": "0.1.0", - // we want to run npm - "command": "npm", - // the command is a shell script - "isShellCommand": true, - // show the output window only if unrecognized errors occur. - "showOutput": "silent", - // we run the custom script "compile" as defined in package.json - "args": [ - "run", - "compile", - "--loglevel", - "silent" - ], - // The tsc compiler is started in watching mode - "isWatching": true, - // use the standard tsc in watch mode problem matcher to find compile problems in the output. - "problemMatcher": "$tsc-watch" + "version": "2.0.0", + // tasks list (build, build-theme, semver etc) + "tasks": [ + { + "args": [ + "run" + , "build" + ], + "isBuildCommand": true, + "command": "npm", + "dependsOn": "tsc", + "echoCommand": true, + "isShellCommand": true, + "taskName": "build" + }, + { + "args": [ + "run" + , "changelog" + ], + "command": "npm", + "echoCommand": true, + "isShellCommand": true, + "taskName": "changelog" + }, + { + "args": [ + "-p" + , "." + ], + "command": "tsc", + "echoCommand": true, + "isShellCommand": true, + "taskName": "tsc" + } + ] } \ No newline at end of file diff --git a/package.json b/package.json index a728c57..26da429 100644 --- a/package.json +++ b/package.json @@ -77,6 +77,15 @@ } ], "devDependencies": { + "@types/chalk": "^0.4.31", + "@types/gulp": "^4.0.3", + "@types/gulp-if": "0.0.31", + "@types/gulp-util": "^3.0.31", + "@types/mustache": "^0.8.29", + "@types/run-sequence": "0.0.29", + "@types/through2": "^2.0.33", + "@types/yamljs": "^0.2.30", + "@types/yargs": "^6.6.0", "babel-core": "^6.24.1", "babel-preset-es2015": "^6.24.1", "babel-root-import": "^4.1.8", diff --git a/themes/Material-Theme-Icons.json b/themes/Material-Theme-Icons.json index b32832d..5f85db4 100644 --- a/themes/Material-Theme-Icons.json +++ b/themes/Material-Theme-Icons.json @@ -1 +1 @@ -{"iconDefinitions":{"_folder_dark":{"iconPath":"../icons/folder.svg"},"_folder_dark_build":{"iconPath":"../icons/folder-build.svg"},"_folder_light":{"iconPath":"../icons/folder-light.svg"},"_folder_light_build":{"iconPath":"../icons/folder-light-build.svg"},"_folder_open":{"iconPath":"../icons/folder-outline.svg"},"_folder_open_build":{"iconPath":"../icons/folder-outline-build.svg"},"_file_dark":{"iconPath":"../icons/file.svg"},"_file_":{"iconPath":"../icons/.svg"},"_file_actionscript":{"iconPath":"../icons/actionscript.svg"},"_file_ai":{"iconPath":"../icons/ai.svg"},"_file_android":{"iconPath":"../icons/android.svg"},"_file_angular":{"iconPath":"../icons/angular.svg"},"_file_arduino":{"iconPath":"../icons/arduino.svg"},"_file_assembly":{"iconPath":"../icons/assembly.svg"},"_file_autohotkey":{"iconPath":"../icons/autohotkey.svg"},"_file_bower":{"iconPath":"../icons/bower.svg"},"_file_c":{"iconPath":"../icons/c.svg"},"_file_certificate":{"iconPath":"../icons/certificate.svg"},"_file_changelog":{"iconPath":"../icons/changelog.svg"},"_file_clojure":{"iconPath":"../icons/clojure.svg"},"_file_cmake":{"iconPath":"../icons/cmake.svg"},"_file_cmd":{"iconPath":"../icons/cmd.svg"},"_file_coffee":{"iconPath":"../icons/coffee.svg"},"_file_console":{"iconPath":"../icons/console.svg"},"_file_contributing":{"iconPath":"../icons/contributing.svg"},"_file_cpp":{"iconPath":"../icons/cpp.svg"},"_file_credits":{"iconPath":"../icons/credits.svg"},"_file_csharp":{"iconPath":"../icons/csharp.svg"},"_file_css-map":{"iconPath":"../icons/css-map.svg"},"_file_css":{"iconPath":"../icons/css.svg"},"_file_dart":{"iconPath":"../icons/dart.svg"},"_file_database":{"iconPath":"../icons/database.svg"},"_file_dlang":{"iconPath":"../icons/dlang.svg"},"_file_docker":{"iconPath":"../icons/docker.svg"},"_file_document":{"iconPath":"../icons/document.svg"},"_file_email":{"iconPath":"../icons/email.svg"},"_file_exe":{"iconPath":"../icons/exe.svg"},"_file_favicon":{"iconPath":"../icons/favicon.svg"},"_file_file":{"iconPath":"../icons/file.svg"},"_file_flash":{"iconPath":"../icons/flash.svg"},"_file_flow":{"iconPath":"../icons/flow.svg"},"_file_folder-build":{"iconPath":"../icons/folder-build.svg"},"_file_folder-light-build":{"iconPath":"../icons/folder-light-build.svg"},"_file_folder-light":{"iconPath":"../icons/folder-light.svg"},"_file_folder-outline-build":{"iconPath":"../icons/folder-outline-build.svg"},"_file_folder-outline":{"iconPath":"../icons/folder-outline.svg"},"_file_folder":{"iconPath":"../icons/folder.svg"},"_file_font":{"iconPath":"../icons/font.svg"},"_file_fsharp":{"iconPath":"../icons/fsharp.svg"},"_file_git":{"iconPath":"../icons/git.svg"},"_file_github":{"iconPath":"../icons/github.svg"},"_file_gopher":{"iconPath":"../icons/gopher.svg"},"_file_gradle":{"iconPath":"../icons/gradle.svg"},"_file_graphql":{"iconPath":"../icons/graphql.svg"},"_file_groovy":{"iconPath":"../icons/groovy.svg"},"_file_grunt":{"iconPath":"../icons/grunt.svg"},"_file_gulp":{"iconPath":"../icons/gulp.svg"},"_file_haskell":{"iconPath":"../icons/haskell.svg"},"_file_html":{"iconPath":"../icons/html.svg"},"_file_image":{"iconPath":"../icons/image.svg"},"_file_ionic":{"iconPath":"../icons/ionic.svg"},"_file_java":{"iconPath":"../icons/java.svg"},"_file_javascript-map":{"iconPath":"../icons/javascript-map.svg"},"_file_js":{"iconPath":"../icons/js.svg"},"_file_json":{"iconPath":"../icons/json.svg"},"_file_key":{"iconPath":"../icons/key.svg"},"_file_kotlin":{"iconPath":"../icons/kotlin.svg"},"_file_less":{"iconPath":"../icons/less.svg"},"_file_lib":{"iconPath":"../icons/lib.svg"},"_file_license":{"iconPath":"../icons/license.svg"},"_file_lua":{"iconPath":"../icons/lua.svg"},"_file_markdown":{"iconPath":"../icons/markdown.svg"},"_file_markup":{"iconPath":"../icons/markup.svg"},"_file_movie":{"iconPath":"../icons/movie.svg"},"_file_music":{"iconPath":"../icons/music.svg"},"_file_mustache":{"iconPath":"../icons/mustache.svg"},"_file_mxml":{"iconPath":"../icons/mxml.svg"},"_file_nodejs":{"iconPath":"../icons/nodejs.svg"},"_file_npm":{"iconPath":"../icons/npm.svg"},"_file_ocaml":{"iconPath":"../icons/ocaml.svg"},"_file_pdf":{"iconPath":"../icons/pdf.svg"},"_file_php":{"iconPath":"../icons/php.svg"},"_file_polymer":{"iconPath":"../icons/polymer.svg"},"_file_postcss":{"iconPath":"../icons/postcss.svg"},"_file_powerpoint":{"iconPath":"../icons/powerpoint.svg"},"_file_pp":{"iconPath":"../icons/pp.svg"},"_file_procfile":{"iconPath":"../icons/procfile.svg"},"_file_pug":{"iconPath":"../icons/pug.svg"},"_file_python":{"iconPath":"../icons/python.svg"},"_file_r":{"iconPath":"../icons/r.svg"},"_file_rails":{"iconPath":"../icons/rails.svg"},"_file_raml":{"iconPath":"../icons/raml.svg"},"_file_react":{"iconPath":"../icons/react.svg"},"_file_readme":{"iconPath":"../icons/readme.svg"},"_file_ruby":{"iconPath":"../icons/ruby.svg"},"_file_rust":{"iconPath":"../icons/rust.svg"},"_file_sass":{"iconPath":"../icons/sass.svg"},"_file_settings":{"iconPath":"../icons/settings.svg"},"_file_sketch":{"iconPath":"../icons/sketch.svg"},"_file_star":{"iconPath":"../icons/star.svg"},"_file_stylus":{"iconPath":"../icons/stylus.svg"},"_file_sublime":{"iconPath":"../icons/sublime.svg"},"_file_svg":{"iconPath":"../icons/svg.svg"},"_file_swc":{"iconPath":"../icons/swc.svg"},"_file_swift":{"iconPath":"../icons/swift.svg"},"_file_swig":{"iconPath":"../icons/swig.svg"},"_file_table":{"iconPath":"../icons/table.svg"},"_file_tex":{"iconPath":"../icons/tex.svg"},"_file_todo":{"iconPath":"../icons/todo.svg"},"_file_tune":{"iconPath":"../icons/tune.svg"},"_file_twig":{"iconPath":"../icons/twig.svg"},"_file_typescript":{"iconPath":"../icons/typescript.svg"},"_file_typescript_def":{"iconPath":"../icons/typescript_def.svg"},"_file_url":{"iconPath":"../icons/url.svg"},"_file_virtual":{"iconPath":"../icons/virtual.svg"},"_file_visualstudio":{"iconPath":"../icons/visualstudio.svg"},"_file_vue":{"iconPath":"../icons/vue.svg"},"_file_webpack":{"iconPath":"../icons/webpack.svg"},"_file_word":{"iconPath":"../icons/word.svg"},"_file_xaml":{"iconPath":"../icons/xaml.svg"},"_file_xml":{"iconPath":"../icons/xml.svg"},"_file_yaml":{"iconPath":"../icons/yaml.svg"},"_file_yarn":{"iconPath":"../icons/yarn.svg"},"_file_zip":{"iconPath":"../icons/zip.svg"}},"fileExtensions":{"cmd":"_file_cmd","mustache":"_file_mustache","rails":"_file_rails","styl":"_file_stylus","twig":"_file_twig","swig":"_file_swig","sketch":"_file_sketch","do":"_file_todo","sublime-settings":"_file_sublime","sublime-theme":"_file_sublime","sublime-commands":"_file_sublime","sublime-menu":"_file_sublime","html":"_file_html","jade":"_file_pug","pug":"_file_pug","md":"_file_markdown","md.rendered":"_file_markdown","markdown":"_file_markdown","markdown.rendered":"_file_markdown","css":"_file_css","postcss":"_file_postcss","scss":"_file_sass","sass":"_file_sass","less":"_file_less","json":"_file_json","yaml":"_file_yaml","YAML-tmLanguage":"_file_yaml","yml":"_file_yaml","xml":"_file_xml","plist":"_file_xml","xsd":"_file_xml","dtd":"_file_xml","xsl":"_file_xml","xslt":"_file_xml","resx":"_file_xml","iml":"_file_xml","xquery":"_file_xml","tmLanguage":"_file_xml","png":"_file_image","jpeg":"_file_image","jpg":"_file_image","gif":"_file_image","svg":"_file_svg","eps":"_file_svg","ai":"_file_ai","ico":"_file_image","tif":"_file_image","tiff":"_file_image","psd":"_file_image","psb":"_file_image","ami":"_file_image","apx":"_file_image","bmp":"_file_image","bpg":"_file_image","brk":"_file_image","cur":"_file_image","dds":"_file_image","dng":"_file_image","exr":"_file_image","fpx":"_file_image","gbr":"_file_image","img":"_file_image","jbig2":"_file_image","jb2":"_file_image","jng":"_file_image","jxr":"_file_image","pbm":"_file_image","pgf":"_file_image","pic":"_file_image","raw":"_file_image","webp":"_file_image","php":"_file_php","js":"_file_js","ejs":"_file_js","jsx":"_file_react","ini":"_file_settings","dlc":"_file_settings","dll":"_file_settings","config":"_file_settings","conf":"_file_settings","esx":"_file_js","ts":"_file_typescript","tsx":"_file_react","d.ts":"_file_typescript_def","pdf":"_file_pdf","xlsx":"_file_table","xls":"_file_table","csv":"_file_table","vscodeignore":"_file_vs","vsixmanifest":"_file_vs","suo":"_file_vs","sln":"_file_vs","pdb":"_file_database","cs":"_file_csharp","csproj":"_file_vs","zip":"_file_zip","tar":"_file_zip","gz":"_file_zip","xz":"_file_zip","bzip2":"_file_zip","gzip":"_file_zip","7z":"_file_zip","7zip":"_file_zip","pzip":"_file_zip","wim":"_file_zip","rar":"_file_zip","tgz":"_file_zip","exe":"_file_exe","msi":"_file_exe","java":"_file_java","jar":"_file_java","jsp":"_file_java","c":"_file_c","h":"_file_c","m":"_file_c","cc":"_file_cpp","cpp":"_file_cpp","c++":"_file_cpp","hpp":"_file_cpp","mm":"_file_cpp","cxx":"_file_cpp","go":"_file_go","py":"_file_python","url":"_file_url","sh":"_file_console","bat":"_file_console","ps1":"_file_console","fish":"_file_console","bash":"_file_console","gradle":"_file_gradle","doc":"_file_word","docx":"_file_word","rtf":"_file_word","properties":"_file_settings","prop":"_file_settings","settings":"_file_settings","sql":"_file_database","accdb":"_file_database","mdb":"_file_database","cer":"_file_certificate","cert":"_file_certificate","crt":"_file_certificate","pub":"_file_key","key":"_file_key","pem":"_file_key","asc":"_file_key","woff":"_file_font","woff2":"_file_font","ttf":"_file_font","eot":"_file_font","suit":"_file_font","otf":"_file_font","bmap":"_file_font","fnt":"_file_font","odttf":"_file_font","ttc":"_file_font","font":"_file_font","fonts":"_file_font","sui":"_file_font","ntf":"_file_font","mrf":"_file_font","lib":"_file_lib","rb":"_file_ruby","erb":"_file_ruby","fs":"_file_fsharp","fsx":"_file_fsharp","fsi":"_file_fsharp","fsproj":"_file_fsharp","manifest":"_file_xml","swift":"_file_swift","ino":"_file_arduino","dockerignore":"_file_docker","tex":"_file_tex","bib":"_file_lib","pptx":"_file_powerpoint","ppt":"_file_powerpoint","pptm":"_file_powerpoint","potx":"_file_powerpoint","pot":"_file_powerpoint","potm":"_file_powerpoint","ppsx":"_file_powerpoint","ppsm":"_file_powerpoint","pps":"_file_powerpoint","ppam":"_file_powerpoint","ppa":"_file_powerpoint","webm":"_file_movie","mkv":"_file_movie","flv":"_file_movie","vob":"_file_movie","ogv":"_file_movie","ogg":"_file_movie","gifv":"_file_movie","avi":"_file_movie","mov":"_file_movie","qt":"_file_movie","wmv":"_file_movie","yuv":"_file_movie","rm":"_file_movie","rmvb":"_file_movie","mp4":"_file_movie","m4v":"_file_movie","mpg":"_file_movie","mp2":"_file_movie","mpeg":"_file_movie","mpe":"_file_movie","mpv":"_file_movie","m2v":"_file_movie","vdi":"_file_virtual","vbox":"_file_virtual","vbox-prev":"_file_virtual","ics":"_file_email","mp3":"_file_music","flac":"_file_music","m4a":"_file_music","wma":"_file_music","aiff":"_file_music","coffee":"_file_coffee","txt":"_file_document","sqlite":"_file_database","graphql":"_file_graphql","gql":"_file_graphql","props":"_file_settings","toml":"_file_settings","rs":"_file_rust","raml":"_file_raml","xaml":"_file_xaml","prefs":"_file_settings","hs":"_file_haskell","kt":"_file_kotlin","project":"_file_xml","patch":"_file_git","dockerfile":"_file_docker","vb":"_file_vs","lua":"_file_lua","clj":"_file_clojure","groovy":"_file_groovy","r":"_file_r","rst":"_file_markdown","dart":"_file_dart","as":"_file_actionscript","mxml":"_file_mxml","ahk":"_file_autohotkey","swf":"_file_flash","swc":"_file_swc","cmake":"_file_cmake","asm":"_file_assembly","a51":"_file_assembly","inc":"_file_assembly","nasm":"_file_assembly","s":"_file_assembly","ms":"_file_assembly","agc":"_file_assembly","ags":"_file_assembly","aea":"_file_assembly","argus":"_file_assembly","mitigus":"_file_assembly","binsource":"_file_assembly","vue":"_file_vue","ml":"_file_ocaml","mli":"_file_ocaml","cmx":"_file_ocaml","js.map":"_file_jsmap","css.map":"_file_cssmap","tmTheme":"_file_markup","pp":"_file_pp"},"fileNames":{"gruntfile.js":"_file_grunt","bower.json":"_file_bower",".bowerrc":"_file_bower","webpack.js":"_file_webpack","webpack.config.js":"_file_webpack","webpack.dev.js":"_file_webpack","webpack.prod.js":"_file_webpack","webpack.common.js":"_file_webpack","webpackfile.js":"_file_webpack","ionic.config.json":"_file_ionic",".io-config.json":"_file_ionic","gulpfile.js":"_file_gulp","gulpfile.babel.js":"_file_gulp","package.json":"_file_npm","gradle.properties":"_file_gradle","gradlew":"_file_gradle",".jscsrc":"_file_json",".jshintrc":"_file_json",".jshintignore":"_file_settings",".npmignore":"_file_npm","tsconfig.json":"_file_json","tslint.json":"_file_json","androidmanifest.xml":"_file_android","gradle-wrapper.properties":"_file_gradle",".editorconfig":"_file_settings","procfile":"_file_procfile",".env":"_file_tune","dockerfile":"_file_docker","license":"_file_license","license.md":"_file_license","license.md.rendered":"_file_license","license.txt":"_file_license",".babelrc":"_file_json",".eslintrc":"_file_yaml",".buildignore":"_file_settings",".htaccess":"_file_xml","composer.lock":"_file_json",".gitignore":"_file_git",".gitconfig":"_file_git",".gitattributes":"_file_git",".gitmodules":"_file_git",".gitkeep":"_file_git","yarn.lock":"_file_yarn",".yarnclean":"_file_yarn",".yarn-integrity":"_file_yarn","yarn-error.log":"_file_yarn","contributing.md":"_file_contributing","contributing.md.rendered":"_file_contributing","readme.md":"_file_readme","readme.md.rendered":"_file_readme",".mailmap":"_file_email","makefile":"_file_settings","changelog":"_file_changelog","changelog.md":"_file_changelog","changelog.md.rendered":"_file_changelog","CREDITS":"_file_credits","credits.txt":"_file_credits","credits.md":"_file_credits","credits.md.rendered":"_file_credits",".flowconfig":"_file_flow",".jsbeautifyrc":"_file_json","git-history":"_file_git","angular-cli.json":"_file_angular","app.module.ts":"_file_angular","favicon.ico":"_file_favicon"},"file":"_file_dark","folder":"_folder_dark","folderExpanded":"_folder_open","languageIds":{"git":"_file_git"},"light":{"folderExpanded":"_folder_open","folder":"_folder_light","folderNames":{"node_modules":"_file_nodejs",".git":"_file_git",".github":"_file_github",".gulp":"_file_gulp","bower_components":"_file_bower","build":"_folder_light_build","dist":"_folder_light_build"},"folderNamesExpanded":{"node_modules":"_file_nodejs",".git":"_file_git",".github":"_file_github",".gulp":"_file_gulp","bower_components":"_file_bower","build":"_folder_light_build","dist":"_folder_light_build"}},"folderNames":{"node_modules":"_file_nodejs",".git":"_file_git",".github":"_file_github",".gulp":"_file_gulp","bower_components":"_file_bower","build":"_folder_dark_build","dist":"_folder_dark_build"},"folderNamesExpanded":{"node_modules":"_file_nodejs",".git":"_file_git",".github":"_file_github",".gulp":"_file_gulp","bower_components":"_file_bower","build":"_folder_open_build","dist":"_folder_open_build"}} +{"iconDefinitions":{"_folder_dark":{"iconPath":"../icons/folder.svg"},"_folder_dark_build":{"iconPath":"../icons/folder-build.svg"},"_folder_light":{"iconPath":"../icons/folder-light.svg"},"_folder_light_build":{"iconPath":"../icons/folder-light-build.svg"},"_folder_open":{"iconPath":"../icons/folder-outline.svg"},"_folder_open_build":{"iconPath":"../icons/folder-outline-build.svg"},"_file_dark":{"iconPath":"../icons/file.svg"},"_file_actionscript":{"iconPath":"../icons/actionscript.svg"},"_file_ai":{"iconPath":"../icons/ai.svg"},"_file_android":{"iconPath":"../icons/android.svg"},"_file_angular":{"iconPath":"../icons/angular.svg"},"_file_arduino":{"iconPath":"../icons/arduino.svg"},"_file_assembly":{"iconPath":"../icons/assembly.svg"},"_file_autohotkey":{"iconPath":"../icons/autohotkey.svg"},"_file_bower":{"iconPath":"../icons/bower.svg"},"_file_c":{"iconPath":"../icons/c.svg"},"_file_certificate":{"iconPath":"../icons/certificate.svg"},"_file_changelog":{"iconPath":"../icons/changelog.svg"},"_file_clojure":{"iconPath":"../icons/clojure.svg"},"_file_cmake":{"iconPath":"../icons/cmake.svg"},"_file_cmd":{"iconPath":"../icons/cmd.svg"},"_file_coffee":{"iconPath":"../icons/coffee.svg"},"_file_console":{"iconPath":"../icons/console.svg"},"_file_contributing":{"iconPath":"../icons/contributing.svg"},"_file_cpp":{"iconPath":"../icons/cpp.svg"},"_file_credits":{"iconPath":"../icons/credits.svg"},"_file_csharp":{"iconPath":"../icons/csharp.svg"},"_file_css-map":{"iconPath":"../icons/css-map.svg"},"_file_css":{"iconPath":"../icons/css.svg"},"_file_dart":{"iconPath":"../icons/dart.svg"},"_file_database":{"iconPath":"../icons/database.svg"},"_file_dlang":{"iconPath":"../icons/dlang.svg"},"_file_docker":{"iconPath":"../icons/docker.svg"},"_file_document":{"iconPath":"../icons/document.svg"},"_file_email":{"iconPath":"../icons/email.svg"},"_file_exe":{"iconPath":"../icons/exe.svg"},"_file_favicon":{"iconPath":"../icons/favicon.svg"},"_file_file":{"iconPath":"../icons/file.svg"},"_file_flash":{"iconPath":"../icons/flash.svg"},"_file_flow":{"iconPath":"../icons/flow.svg"},"_file_folder-build":{"iconPath":"../icons/folder-build.svg"},"_file_folder-light-build":{"iconPath":"../icons/folder-light-build.svg"},"_file_folder-light":{"iconPath":"../icons/folder-light.svg"},"_file_folder-outline-build":{"iconPath":"../icons/folder-outline-build.svg"},"_file_folder-outline":{"iconPath":"../icons/folder-outline.svg"},"_file_folder":{"iconPath":"../icons/folder.svg"},"_file_font":{"iconPath":"../icons/font.svg"},"_file_fsharp":{"iconPath":"../icons/fsharp.svg"},"_file_git":{"iconPath":"../icons/git.svg"},"_file_github":{"iconPath":"../icons/github.svg"},"_file_gopher":{"iconPath":"../icons/gopher.svg"},"_file_gradle":{"iconPath":"../icons/gradle.svg"},"_file_graphql":{"iconPath":"../icons/graphql.svg"},"_file_groovy":{"iconPath":"../icons/groovy.svg"},"_file_grunt":{"iconPath":"../icons/grunt.svg"},"_file_gulp":{"iconPath":"../icons/gulp.svg"},"_file_haskell":{"iconPath":"../icons/haskell.svg"},"_file_html":{"iconPath":"../icons/html.svg"},"_file_image":{"iconPath":"../icons/image.svg"},"_file_ionic":{"iconPath":"../icons/ionic.svg"},"_file_java":{"iconPath":"../icons/java.svg"},"_file_javascript-map":{"iconPath":"../icons/javascript-map.svg"},"_file_js":{"iconPath":"../icons/js.svg"},"_file_json":{"iconPath":"../icons/json.svg"},"_file_key":{"iconPath":"../icons/key.svg"},"_file_kotlin":{"iconPath":"../icons/kotlin.svg"},"_file_less":{"iconPath":"../icons/less.svg"},"_file_lib":{"iconPath":"../icons/lib.svg"},"_file_license":{"iconPath":"../icons/license.svg"},"_file_lua":{"iconPath":"../icons/lua.svg"},"_file_markdown":{"iconPath":"../icons/markdown.svg"},"_file_markup":{"iconPath":"../icons/markup.svg"},"_file_movie":{"iconPath":"../icons/movie.svg"},"_file_music":{"iconPath":"../icons/music.svg"},"_file_mustache":{"iconPath":"../icons/mustache.svg"},"_file_mxml":{"iconPath":"../icons/mxml.svg"},"_file_nodejs":{"iconPath":"../icons/nodejs.svg"},"_file_npm":{"iconPath":"../icons/npm.svg"},"_file_ocaml":{"iconPath":"../icons/ocaml.svg"},"_file_pdf":{"iconPath":"../icons/pdf.svg"},"_file_php":{"iconPath":"../icons/php.svg"},"_file_polymer":{"iconPath":"../icons/polymer.svg"},"_file_postcss":{"iconPath":"../icons/postcss.svg"},"_file_powerpoint":{"iconPath":"../icons/powerpoint.svg"},"_file_pp":{"iconPath":"../icons/pp.svg"},"_file_procfile":{"iconPath":"../icons/procfile.svg"},"_file_pug":{"iconPath":"../icons/pug.svg"},"_file_python":{"iconPath":"../icons/python.svg"},"_file_r":{"iconPath":"../icons/r.svg"},"_file_rails":{"iconPath":"../icons/rails.svg"},"_file_raml":{"iconPath":"../icons/raml.svg"},"_file_react":{"iconPath":"../icons/react.svg"},"_file_readme":{"iconPath":"../icons/readme.svg"},"_file_ruby":{"iconPath":"../icons/ruby.svg"},"_file_rust":{"iconPath":"../icons/rust.svg"},"_file_sass":{"iconPath":"../icons/sass.svg"},"_file_settings":{"iconPath":"../icons/settings.svg"},"_file_sketch":{"iconPath":"../icons/sketch.svg"},"_file_star":{"iconPath":"../icons/star.svg"},"_file_stylus":{"iconPath":"../icons/stylus.svg"},"_file_sublime":{"iconPath":"../icons/sublime.svg"},"_file_svg":{"iconPath":"../icons/svg.svg"},"_file_swc":{"iconPath":"../icons/swc.svg"},"_file_swift":{"iconPath":"../icons/swift.svg"},"_file_swig":{"iconPath":"../icons/swig.svg"},"_file_table":{"iconPath":"../icons/table.svg"},"_file_tex":{"iconPath":"../icons/tex.svg"},"_file_todo":{"iconPath":"../icons/todo.svg"},"_file_tune":{"iconPath":"../icons/tune.svg"},"_file_twig":{"iconPath":"../icons/twig.svg"},"_file_typescript":{"iconPath":"../icons/typescript.svg"},"_file_typescript_def":{"iconPath":"../icons/typescript_def.svg"},"_file_url":{"iconPath":"../icons/url.svg"},"_file_virtual":{"iconPath":"../icons/virtual.svg"},"_file_visualstudio":{"iconPath":"../icons/visualstudio.svg"},"_file_vue":{"iconPath":"../icons/vue.svg"},"_file_webpack":{"iconPath":"../icons/webpack.svg"},"_file_word":{"iconPath":"../icons/word.svg"},"_file_xaml":{"iconPath":"../icons/xaml.svg"},"_file_xml":{"iconPath":"../icons/xml.svg"},"_file_yaml":{"iconPath":"../icons/yaml.svg"},"_file_yarn":{"iconPath":"../icons/yarn.svg"},"_file_zip":{"iconPath":"../icons/zip.svg"}},"fileExtensions":{"cmd":"_file_cmd","mustache":"_file_mustache","rails":"_file_rails","styl":"_file_stylus","twig":"_file_twig","swig":"_file_swig","sketch":"_file_sketch","do":"_file_todo","sublime-settings":"_file_sublime","sublime-theme":"_file_sublime","sublime-commands":"_file_sublime","sublime-menu":"_file_sublime","html":"_file_html","jade":"_file_pug","pug":"_file_pug","md":"_file_markdown","md.rendered":"_file_markdown","markdown":"_file_markdown","markdown.rendered":"_file_markdown","css":"_file_css","postcss":"_file_postcss","scss":"_file_sass","sass":"_file_sass","less":"_file_less","json":"_file_json","yaml":"_file_yaml","YAML-tmLanguage":"_file_yaml","yml":"_file_yaml","xml":"_file_xml","plist":"_file_xml","xsd":"_file_xml","dtd":"_file_xml","xsl":"_file_xml","xslt":"_file_xml","resx":"_file_xml","iml":"_file_xml","xquery":"_file_xml","tmLanguage":"_file_xml","png":"_file_image","jpeg":"_file_image","jpg":"_file_image","gif":"_file_image","svg":"_file_svg","eps":"_file_svg","ai":"_file_ai","ico":"_file_image","tif":"_file_image","tiff":"_file_image","psd":"_file_image","psb":"_file_image","ami":"_file_image","apx":"_file_image","bmp":"_file_image","bpg":"_file_image","brk":"_file_image","cur":"_file_image","dds":"_file_image","dng":"_file_image","exr":"_file_image","fpx":"_file_image","gbr":"_file_image","img":"_file_image","jbig2":"_file_image","jb2":"_file_image","jng":"_file_image","jxr":"_file_image","pbm":"_file_image","pgf":"_file_image","pic":"_file_image","raw":"_file_image","webp":"_file_image","php":"_file_php","js":"_file_js","ejs":"_file_js","jsx":"_file_react","ini":"_file_settings","dlc":"_file_settings","dll":"_file_settings","config":"_file_settings","conf":"_file_settings","esx":"_file_js","ts":"_file_typescript","tsx":"_file_react","d.ts":"_file_typescript_def","pdf":"_file_pdf","xlsx":"_file_table","xls":"_file_table","csv":"_file_table","vscodeignore":"_file_vs","vsixmanifest":"_file_vs","suo":"_file_vs","sln":"_file_vs","pdb":"_file_database","cs":"_file_csharp","csproj":"_file_vs","zip":"_file_zip","tar":"_file_zip","gz":"_file_zip","xz":"_file_zip","bzip2":"_file_zip","gzip":"_file_zip","7z":"_file_zip","7zip":"_file_zip","pzip":"_file_zip","wim":"_file_zip","rar":"_file_zip","tgz":"_file_zip","exe":"_file_exe","msi":"_file_exe","java":"_file_java","jar":"_file_java","jsp":"_file_java","c":"_file_c","h":"_file_c","m":"_file_c","cc":"_file_cpp","cpp":"_file_cpp","c++":"_file_cpp","hpp":"_file_cpp","mm":"_file_cpp","cxx":"_file_cpp","go":"_file_go","py":"_file_python","url":"_file_url","sh":"_file_console","bat":"_file_console","ps1":"_file_console","fish":"_file_console","bash":"_file_console","gradle":"_file_gradle","doc":"_file_word","docx":"_file_word","rtf":"_file_word","properties":"_file_settings","prop":"_file_settings","settings":"_file_settings","sql":"_file_database","accdb":"_file_database","mdb":"_file_database","cer":"_file_certificate","cert":"_file_certificate","crt":"_file_certificate","pub":"_file_key","key":"_file_key","pem":"_file_key","asc":"_file_key","woff":"_file_font","woff2":"_file_font","ttf":"_file_font","eot":"_file_font","suit":"_file_font","otf":"_file_font","bmap":"_file_font","fnt":"_file_font","odttf":"_file_font","ttc":"_file_font","font":"_file_font","fonts":"_file_font","sui":"_file_font","ntf":"_file_font","mrf":"_file_font","lib":"_file_lib","rb":"_file_ruby","erb":"_file_ruby","fs":"_file_fsharp","fsx":"_file_fsharp","fsi":"_file_fsharp","fsproj":"_file_fsharp","manifest":"_file_xml","swift":"_file_swift","ino":"_file_arduino","dockerignore":"_file_docker","tex":"_file_tex","bib":"_file_lib","pptx":"_file_powerpoint","ppt":"_file_powerpoint","pptm":"_file_powerpoint","potx":"_file_powerpoint","pot":"_file_powerpoint","potm":"_file_powerpoint","ppsx":"_file_powerpoint","ppsm":"_file_powerpoint","pps":"_file_powerpoint","ppam":"_file_powerpoint","ppa":"_file_powerpoint","webm":"_file_movie","mkv":"_file_movie","flv":"_file_movie","vob":"_file_movie","ogv":"_file_movie","ogg":"_file_movie","gifv":"_file_movie","avi":"_file_movie","mov":"_file_movie","qt":"_file_movie","wmv":"_file_movie","yuv":"_file_movie","rm":"_file_movie","rmvb":"_file_movie","mp4":"_file_movie","m4v":"_file_movie","mpg":"_file_movie","mp2":"_file_movie","mpeg":"_file_movie","mpe":"_file_movie","mpv":"_file_movie","m2v":"_file_movie","vdi":"_file_virtual","vbox":"_file_virtual","vbox-prev":"_file_virtual","ics":"_file_email","mp3":"_file_music","flac":"_file_music","m4a":"_file_music","wma":"_file_music","aiff":"_file_music","coffee":"_file_coffee","txt":"_file_document","sqlite":"_file_database","graphql":"_file_graphql","gql":"_file_graphql","props":"_file_settings","toml":"_file_settings","rs":"_file_rust","raml":"_file_raml","xaml":"_file_xaml","prefs":"_file_settings","hs":"_file_haskell","kt":"_file_kotlin","project":"_file_xml","patch":"_file_git","dockerfile":"_file_docker","vb":"_file_vs","lua":"_file_lua","clj":"_file_clojure","groovy":"_file_groovy","r":"_file_r","rst":"_file_markdown","dart":"_file_dart","as":"_file_actionscript","mxml":"_file_mxml","ahk":"_file_autohotkey","swf":"_file_flash","swc":"_file_swc","cmake":"_file_cmake","asm":"_file_assembly","a51":"_file_assembly","inc":"_file_assembly","nasm":"_file_assembly","s":"_file_assembly","ms":"_file_assembly","agc":"_file_assembly","ags":"_file_assembly","aea":"_file_assembly","argus":"_file_assembly","mitigus":"_file_assembly","binsource":"_file_assembly","vue":"_file_vue","ml":"_file_ocaml","mli":"_file_ocaml","cmx":"_file_ocaml","js.map":"_file_jsmap","css.map":"_file_cssmap","tmTheme":"_file_markup","pp":"_file_pp"},"fileNames":{"gruntfile.js":"_file_grunt","bower.json":"_file_bower",".bowerrc":"_file_bower","webpack.js":"_file_webpack","webpack.config.js":"_file_webpack","webpack.dev.js":"_file_webpack","webpack.prod.js":"_file_webpack","webpack.common.js":"_file_webpack","webpackfile.js":"_file_webpack","ionic.config.json":"_file_ionic",".io-config.json":"_file_ionic","gulpfile.js":"_file_gulp","gulpfile.babel.js":"_file_gulp","package.json":"_file_npm","gradle.properties":"_file_gradle","gradlew":"_file_gradle",".jscsrc":"_file_json",".jshintrc":"_file_json",".jshintignore":"_file_settings",".npmignore":"_file_npm","tsconfig.json":"_file_json","tslint.json":"_file_json","androidmanifest.xml":"_file_android","gradle-wrapper.properties":"_file_gradle",".editorconfig":"_file_settings","procfile":"_file_procfile",".env":"_file_tune","dockerfile":"_file_docker","license":"_file_license","license.md":"_file_license","license.md.rendered":"_file_license","license.txt":"_file_license",".babelrc":"_file_json",".eslintrc":"_file_yaml",".buildignore":"_file_settings",".htaccess":"_file_xml","composer.lock":"_file_json",".gitignore":"_file_git",".gitconfig":"_file_git",".gitattributes":"_file_git",".gitmodules":"_file_git",".gitkeep":"_file_git","yarn.lock":"_file_yarn",".yarnclean":"_file_yarn",".yarn-integrity":"_file_yarn","yarn-error.log":"_file_yarn","contributing.md":"_file_contributing","contributing.md.rendered":"_file_contributing","readme.md":"_file_readme","readme.md.rendered":"_file_readme",".mailmap":"_file_email","makefile":"_file_settings","changelog":"_file_changelog","changelog.md":"_file_changelog","changelog.md.rendered":"_file_changelog","CREDITS":"_file_credits","credits.txt":"_file_credits","credits.md":"_file_credits","credits.md.rendered":"_file_credits",".flowconfig":"_file_flow",".jsbeautifyrc":"_file_json","git-history":"_file_git","angular-cli.json":"_file_angular","app.module.ts":"_file_angular","favicon.ico":"_file_favicon"},"file":"_file_dark","folder":"_folder_dark","folderExpanded":"_folder_open","languageIds":{"git":"_file_git"},"light":{"folderExpanded":"_folder_open","folder":"_folder_light","folderNames":{"node_modules":"_file_nodejs",".git":"_file_git",".github":"_file_github",".gulp":"_file_gulp","bower_components":"_file_bower","build":"_folder_light_build","dist":"_folder_light_build"},"folderNamesExpanded":{"node_modules":"_file_nodejs",".git":"_file_git",".github":"_file_github",".gulp":"_file_gulp","bower_components":"_file_bower","build":"_folder_light_build","dist":"_folder_light_build"}},"folderNames":{"node_modules":"_file_nodejs",".git":"_file_git",".github":"_file_github",".gulp":"_file_gulp","bower_components":"_file_bower","build":"_folder_dark_build","dist":"_folder_dark_build"},"folderNamesExpanded":{"node_modules":"_file_nodejs",".git":"_file_git",".github":"_file_github",".gulp":"_file_gulp","bower_components":"_file_bower","build":"_folder_open_build","dist":"_folder_open_build"}} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..3697e5d --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "lib": [ + "es2015" + ], + "module": "commonjs", + "allowUnreachableCode": false, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitAny": true, + "target": "es6" + }, + "include": [ + "./**/*", + "./.gulp/**/*" + ], + "exclude": [ + "node_modules", + "out" + ] +} \ No newline at end of file diff --git a/typings/gulp-bump/gulp-bump.d.ts b/typings/gulp-bump/gulp-bump.d.ts new file mode 100644 index 0000000..2ddc86a --- /dev/null +++ b/typings/gulp-bump/gulp-bump.d.ts @@ -0,0 +1,7 @@ +declare module "gulp-bump" { + function gulpBump (... args: any[]): any; + + namespace gulpBump {} + + export = gulpBump; +} \ No newline at end of file diff --git a/typings/gulp-conventional-changelog/gulp-conventional-changelog.d.ts b/typings/gulp-conventional-changelog/gulp-conventional-changelog.d.ts new file mode 100644 index 0000000..5718744 --- /dev/null +++ b/typings/gulp-conventional-changelog/gulp-conventional-changelog.d.ts @@ -0,0 +1,5 @@ +declare module "gulp-conventional-changelog" { + function changelog(... args: any[]): any; + namespace changelog {} + export = changelog; +} \ No newline at end of file diff --git a/typings/gulp-stats/gulp-stats.d.ts b/typings/gulp-stats/gulp-stats.d.ts new file mode 100644 index 0000000..4622b92 --- /dev/null +++ b/typings/gulp-stats/gulp-stats.d.ts @@ -0,0 +1,5 @@ +declare module "gulp-stats" { + function gulpStats(... args: any[]): any; + namespace gulpStats {} + export = gulpStats; +} \ No newline at end of file From d32be8bc3987228043b4b99bc9dd9153d460b5d6 Mon Sep 17 00:00:00 2001 From: OctoD Date: Tue, 23 May 2017 18:44:31 +0200 Subject: [PATCH 2/6] chore: TS tasks (draft). Devs now can use the build command task in VSCode. --- .gitignore | 1 + .gulp/consts/files.ts | 5 ++++ .gulp/index.ts | 9 ++++++ .gulp/paths.ts | 11 +++++++ .gulp/tasks/bump.ts | 35 ++++++++++++++++++++++ .gulp/tasks/changelog.ts | 15 ++++++++++ .gulp/tasks/icons.ts | 58 ++++++++++++++++++++++++++++++++++++ .gulp/tasks/themes.ts | 63 ++++++++++++++++++++++++++++++++++++++++ .gulp/tasks/watcher.ts | 11 +++++++ gulpfile.babel.ts | 9 ++++++ 10 files changed, 217 insertions(+) create mode 100644 .gulp/consts/files.ts create mode 100644 .gulp/index.ts create mode 100644 .gulp/paths.ts create mode 100644 .gulp/tasks/bump.ts create mode 100644 .gulp/tasks/changelog.ts create mode 100644 .gulp/tasks/icons.ts create mode 100644 .gulp/tasks/themes.ts create mode 100644 .gulp/tasks/watcher.ts create mode 100644 gulpfile.babel.ts diff --git a/.gitignore b/.gitignore index 46fb5c3..fddf126 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.log *.~lock *.js +*.gulp/**.js dist/ node_modules/ \ No newline at end of file diff --git a/.gulp/consts/files.ts b/.gulp/consts/files.ts new file mode 100644 index 0000000..ccde74c --- /dev/null +++ b/.gulp/consts/files.ts @@ -0,0 +1,5 @@ +/** + * File charset + * @type {string} + */ +export const CHARSET: string = 'utf-8'; \ No newline at end of file diff --git a/.gulp/index.ts b/.gulp/index.ts new file mode 100644 index 0000000..1787a2f --- /dev/null +++ b/.gulp/index.ts @@ -0,0 +1,9 @@ +// import the tasks +export * from './tasks/changelog'; +export * from './tasks/bump'; +export * from './tasks/icons'; +export * from './tasks/themes'; +export * from './tasks/watcher'; + +// export default script +export default ['build:themes']; diff --git a/.gulp/paths.ts b/.gulp/paths.ts new file mode 100644 index 0000000..f547d5b --- /dev/null +++ b/.gulp/paths.ts @@ -0,0 +1,11 @@ +// const infos = require('../package.json'); +// const today = new Date(); + +const paths = { + dist: './dist', + icons: './icons', + src: './src', + themes: './themes', +}; + +export default paths; diff --git a/.gulp/tasks/bump.ts b/.gulp/tasks/bump.ts new file mode 100644 index 0000000..1870c4c --- /dev/null +++ b/.gulp/tasks/bump.ts @@ -0,0 +1,35 @@ +/* + * > Bump + */ + +import * as Gulp from 'gulp'; +import * as Gulpif from 'gulp-if'; +import * as bump from 'gulp-bump'; +import * as gutil from 'gulp-util'; +import * as runSequence from 'run-sequence'; +import * as yrgv from 'yargs'; + +var argv = (yrgv as any).argv; + +export var taskBump = Gulp.task('bump', (cb) => { + runSequence( + 'bump-pkg-version', + (error) => { + if (error) { + console.log(gutil.colors.magenta.bold('[bump]'), gutil.colors.red.bold(' There was an issue bumping version:\n'), error); + } else { + console.log(gutil.colors.magenta.bold('\n[bump]'), gutil.colors.green.bold(' Finished successfully\n')); + } + cb(error); + } + ); +}); + +export var taskVersioning = Gulp.task('bump-pkg-version', () => { + return Gulp.src(['./package.json']) + .pipe(Gulpif((Object.keys(argv).length === 2), bump())) + .pipe(Gulpif(argv.patch, bump())) + .pipe(Gulpif(argv.minor, bump({ type: 'minor' }))) + .pipe(Gulpif(argv.major, bump({ type: 'major' }))) + .pipe(Gulp.dest('./')); +}); \ No newline at end of file diff --git a/.gulp/tasks/changelog.ts b/.gulp/tasks/changelog.ts new file mode 100644 index 0000000..380a59e --- /dev/null +++ b/.gulp/tasks/changelog.ts @@ -0,0 +1,15 @@ +/* + * > Changelog + */ + +import * as Gulp from 'gulp'; +import * as conventionalChangelog from 'gulp-conventional-changelog'; + +export var task = Gulp.task('changelog', () => { + return Gulp.src('CHANGELOG.md') + .pipe(conventionalChangelog({ + preset: 'angular', + releaseCount: 0 + })) + .pipe(Gulp.dest('./')); +}); \ No newline at end of file diff --git a/.gulp/tasks/icons.ts b/.gulp/tasks/icons.ts new file mode 100644 index 0000000..7e55ac6 --- /dev/null +++ b/.gulp/tasks/icons.ts @@ -0,0 +1,58 @@ +/* + * > Build Icons + */ + +import * as Gulp from 'gulp'; +import * as Mustache from 'mustache'; +import * as fs from 'fs'; +import * as gutil from 'gulp-util'; +import * as path from 'path'; + +import { CHARSET } from "../consts/files"; +import Paths from '../paths'; + +export var taskIcons = Gulp.task('build:icons', cb => { + const partials = fs.readdirSync(path.join(Paths.src, `./icons/partials`)); + const partialData: any = {}; + const files = fs.readdirSync(path.join(Paths.src, `./icons/svgs`)); + const icons = files.map(file => ({ name: file.split('.')[0], last: false })); + const pathTemp = './themes/.material-theme-icons.tmp'; + + icons[icons.length - 1].last = true; + + partials.forEach(partial => { + partialData[partial.split('.')[0]] = fs.readFileSync( + path.join(Paths.src, `./icons/partials`, `./${partial}`), + 'utf-8' + ); + }); + + let contents = Mustache.render( + fs.readFileSync(path.join(Paths.src, `./icons/icons-theme.json`), CHARSET), + { icons }, + partialData + ); + + try { + contents = JSON.stringify(JSON.parse(contents), null, 2); + } catch (err) { + gutil.log( + gutil.colors['red']('There is an error with JSON generated for icons'), + err + ); + cb(err); + return; + } + + fs.writeFileSync(pathTemp, contents, CHARSET); + + gutil.log( + gutil.colors['gray']('\n———————————————————————————————————————————————————————————————\n') + ); + gutil.log('Generated', gutil.colors['green'](pathTemp)); + gutil.log( + gutil.colors['gray']('\n———————————————————————————————————————————————————————————————\n') + ); + + cb(); +}); diff --git a/.gulp/tasks/themes.ts b/.gulp/tasks/themes.ts new file mode 100644 index 0000000..5525ebd --- /dev/null +++ b/.gulp/tasks/themes.ts @@ -0,0 +1,63 @@ +import * as Gulp from 'gulp'; +import * as Mustache from 'mustache'; +// import * as YAML from 'yamljs'; +/* + * > Build Themes + */ +import * as fs from 'fs'; +import * as gutil from 'gulp-util'; + +import { CHARSET } from "../consts/files"; +import Paths from '../paths'; + +const themeCommons = require('../../src/themes/settings/commons.json'); +const themeVariants: any[] = []; +const themeTemplateFile = fs.readFileSync( + `${Paths.src}/themes/theme-template-color-theme.json`, + CHARSET +); + +const files = fs.readdirSync(`${Paths.src}/themes/settings/specific`); + +// build theme variants for later use in templating +files.forEach(file => { + // const name: string = file.split('.')[0]; + const filepath = `${Paths.src}/themes/settings/specific/${file}`; + const contents = fs.readFileSync(filepath, 'utf-8'); + + try { + themeVariants.push(JSON.parse(contents)); + } catch (err) { + gutil.log('Error when parsing json for theme variants', err); + } +}); + +export var taskThemes = Gulp.task('build:themes', () => { + gutil.log( + gutil.colors.gray('\n———————————————————————————————————————————————————————————————\n') + ); + themeVariants.forEach(variant => { + const templateData = { + 'commons': themeCommons, + variant + }; + + const templateJson = JSON.parse( + Mustache.render(themeTemplateFile, templateData) + ); + + const path = `${Paths.themes}/${variant.name}.json`; + + fs.writeFileSync( + path, + JSON.stringify(templateJson, null, 2), + CHARSET + ); + + gutil.log('Generate', gutil.colors['green'](path)); + }); + + gutil.log( + gutil.colors.gray('\n———————————————————————————————————————————————————————————————\n') + ); +}); diff --git a/.gulp/tasks/watcher.ts b/.gulp/tasks/watcher.ts new file mode 100644 index 0000000..2616538 --- /dev/null +++ b/.gulp/tasks/watcher.ts @@ -0,0 +1,11 @@ +/* + * > Watcher + */ + +import * as Gulp from 'gulp'; + +import Paths from '../paths'; + +export var taskWatch = Gulp.task('watch', () => { + Gulp.watch(`${Paths.src}/themes/**/*.json`, ['build:themes']); +}); \ No newline at end of file diff --git a/gulpfile.babel.ts b/gulpfile.babel.ts new file mode 100644 index 0000000..7925e68 --- /dev/null +++ b/gulpfile.babel.ts @@ -0,0 +1,9 @@ +import * as Gulp from 'gulp'; +import * as GulpStats from 'gulp-stats'; +import * as tasks from './.gulp'; + +// Use gulp-stats +GulpStats(Gulp); + +// set default task +Gulp.task('default', tasks.default); \ No newline at end of file From c035644fa6eb34969f521efe94dfa96023fc6e9b Mon Sep 17 00:00:00 2001 From: OctoD Date: Tue, 23 May 2017 18:49:21 +0200 Subject: [PATCH 3/6] chore: Removed track from .git --- .gulp/index.js | 9 ------ .gulp/paths.js | 11 ------- .gulp/tasks/bump.js | 37 ----------------------- .gulp/tasks/changelog.js | 18 ----------- .gulp/tasks/icons.js | 55 ---------------------------------- .gulp/tasks/themes.js | 65 ---------------------------------------- .gulp/tasks/watcher.js | 12 -------- gulpfile.babel.js | 9 ------ test/source.js | 58 ----------------------------------- 9 files changed, 274 deletions(-) delete mode 100644 .gulp/index.js delete mode 100644 .gulp/paths.js delete mode 100644 .gulp/tasks/bump.js delete mode 100644 .gulp/tasks/changelog.js delete mode 100644 .gulp/tasks/icons.js delete mode 100644 .gulp/tasks/themes.js delete mode 100644 .gulp/tasks/watcher.js delete mode 100644 gulpfile.babel.js delete mode 100644 test/source.js diff --git a/.gulp/index.js b/.gulp/index.js deleted file mode 100644 index 117146c..0000000 --- a/.gulp/index.js +++ /dev/null @@ -1,9 +0,0 @@ -// import the tasks -import './tasks/changelog'; -import './tasks/bump'; -import './tasks/icons'; -import './tasks/themes'; -import './tasks/watcher'; - -// export default script -export default ['build:themes']; diff --git a/.gulp/paths.js b/.gulp/paths.js deleted file mode 100644 index 986493f..0000000 --- a/.gulp/paths.js +++ /dev/null @@ -1,11 +0,0 @@ -import infos from '../package.json'; - -const today = new Date() - , paths = { - 'icons': './icons', - 'themes': './themes', - 'src': './src', - 'dist': './dist' - }; - -export default paths; diff --git a/.gulp/tasks/bump.js b/.gulp/tasks/bump.js deleted file mode 100644 index 91c404a..0000000 --- a/.gulp/tasks/bump.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -/* - * > Bump - */ - -import Gulp from 'gulp'; -import runSequence from 'run-sequence'; -import gutil from 'gulp-util'; -import yrgv from 'yargs'; -import bump from 'gulp-bump'; -import Gulpif from 'gulp-if'; - -var argv = yrgv.argv; - -Gulp.task('bump', (cb) => { - runSequence( - 'bump-pkg-version', - (error) => { - if (error) { - console.log(gutil.colors.magenta.bold('[bump]'), gutil.colors.red.bold(' There was an issue bumping version:\n'), error.message); - } else { - console.log(gutil.colors.magenta.bold('\n[bump]'), gutil.colors.green.bold(' Finished successfully\n')); - } - cb(error); - } - ); -}); - -Gulp.task('bump-pkg-version', () => { - return Gulp.src(['./package.json']) - .pipe(Gulpif((Object.keys(argv).length === 2), bump())) - .pipe(Gulpif(argv.patch, bump())) - .pipe(Gulpif(argv.minor, bump({ type: 'minor' }))) - .pipe(Gulpif(argv.major, bump({ type: 'major' }))) - .pipe(Gulp.dest('./')); -}); \ No newline at end of file diff --git a/.gulp/tasks/changelog.js b/.gulp/tasks/changelog.js deleted file mode 100644 index bc8c075..0000000 --- a/.gulp/tasks/changelog.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -/* - * > Changelog - */ - -import Gulp from 'gulp'; -import conventionalChangelog from 'gulp-conventional-changelog'; - - -Gulp.task('changelog', () => { - return Gulp.src('CHANGELOG.md') - .pipe(conventionalChangelog({ - preset: 'angular', - releaseCount: 0 - })) - .pipe(Gulp.dest('./')); -}); \ No newline at end of file diff --git a/.gulp/tasks/icons.js b/.gulp/tasks/icons.js deleted file mode 100644 index 9c1bef8..0000000 --- a/.gulp/tasks/icons.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -/* - * > Build Icons - */ - -import fs from 'fs'; -import Gulp from 'gulp'; -import Mustache from 'mustache'; -import gutil from 'gulp-util'; -import Paths from '../paths'; - -Gulp.task('build:icons', cb => { - const partials = fs.readdirSync(`${Paths.src}/icons/partials`); - const partialData = {}; - const files = fs.readdirSync(`${Paths.src}/icons/svgs`); - const icons = files.map(file => ({ name: file.split('.')[0], last: false })); - icons[icons.length - 1].last = true; - - partials.forEach(partial => { - partialData[partial.split('.')[0]] = fs.readFileSync( - `${Paths.src}/icons/partials/${partial}`, - 'utf-8' - ); - }); - - let contents = Mustache.render( - fs.readFileSync(`${Paths.src}/icons/icons-theme.json`, 'utf-8'), - { icons }, - partialData - ); - - try { - contents = JSON.stringify(JSON.parse(contents), null, 2); - } catch (err) { - gutil.log( - gutil.colors.red('There is an error with JSON generated for icons'), - err - ); - cb(err); - return; - } - - const path = './themes/.material-theme-icons.tmp'; - fs.writeFileSync(path, contents, 'utf-8'); - gutil.log( - gutil.colors.gray('\n———————————————————————————————————————————————————————————————\n') - ); - gutil.log('Generated', gutil.colors.green(path)); - gutil.log( - gutil.colors.gray('\n———————————————————————————————————————————————————————————————\n') - ); - - cb(); -}); diff --git a/.gulp/tasks/themes.js b/.gulp/tasks/themes.js deleted file mode 100644 index 553c33d..0000000 --- a/.gulp/tasks/themes.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; - -/* - * > Build Themes - */ - -import fs from 'fs'; -import Gulp from 'gulp'; -import gutil from 'gulp-util'; -import Mustache from 'mustache'; -import YAML from 'yamljs'; - -import Paths from '../paths'; - -const themeCommons = require('../../src/themes/settings/commons.json'); -const themeVariants = []; -const themeTemplateFile = fs.readFileSync( - `${Paths.src}/themes/theme-template-color-theme.json`, - 'utf-8' -); - -const files = fs.readdirSync(`${Paths.src}/themes/settings/specific`); - -// build theme variants for later use in templating -files.forEach(file => { - const name = file.split('.')[0]; - const filepath = `${Paths.src}/themes/settings/specific/${file}`; - const contents = fs.readFileSync(filepath, 'utf-8'); - - try { - themeVariants.push(JSON.parse(contents)); - } catch (err) { - gutil.log('Error when parsing json for theme variants', err); - } -}); - -Gulp.task('build:themes', cb => { - gutil.log( - gutil.colors.gray('\n———————————————————————————————————————————————————————————————\n') - ); - themeVariants.forEach(variant => { - const templateData = { - 'commons': themeCommons, - variant - }; - - const templateJson = JSON.parse( - Mustache.render(themeTemplateFile, templateData) - ); - - const path = `${Paths.themes}/${variant.name}.json`; - - fs.writeFileSync( - path, - JSON.stringify(templateJson, null, 2), - 'utf-8' - ); - - gutil.log('Generate', gutil.colors.green(path)); - }); - - gutil.log( - gutil.colors.gray('\n———————————————————————————————————————————————————————————————\n') - ); -}); diff --git a/.gulp/tasks/watcher.js b/.gulp/tasks/watcher.js deleted file mode 100644 index d08fbad..0000000 --- a/.gulp/tasks/watcher.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -/* - * > Watcher - */ - -import Gulp from 'gulp'; -import Paths from '../paths'; - -Gulp.task('watch', () => { - Gulp.watch(`${Paths.src}/themes/**/*.json`, ['build:themes']); -}); \ No newline at end of file diff --git a/gulpfile.babel.js b/gulpfile.babel.js deleted file mode 100644 index 2869b44..0000000 --- a/gulpfile.babel.js +++ /dev/null @@ -1,9 +0,0 @@ -import Gulp from 'gulp'; -import GulpStats from 'gulp-stats'; -import tasks from './.gulp'; - -// Use gulp-stats -GulpStats(Gulp); - -// set default task -Gulp.task('default', tasks); \ No newline at end of file diff --git a/test/source.js b/test/source.js deleted file mode 100644 index 4a8d015..0000000 --- a/test/source.js +++ /dev/null @@ -1,58 +0,0 @@ -var parseXML = function (data) { - var xml, tmp; - if (!data || typeof data !== "string") { - return null; - } - try { - if (window.DOMParser) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString(data, "text/xml"); - } else { // IE - xml = new ActiveXObject("Microsoft.XMLDOM"); - xml.async = false; - xml.loadXML(data); - } - } catch (e) { - xml = undefined; - } - if (!xml || !xml.documentElement || xml.getElementsByTagName("parsererror").length) { - jQuery.error("Invalid XML: " + data); - } - return xml; -}; - -// Bind a function to a context, optionally partially applying any arguments. -var proxy = function (fn, context) { - var tmp, args, proxy; - - if (typeof context === "string") { - tmp = fn[context]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if (!jQuery.isFunction(fn)) { - return undefined; - } - - // Simulated bind - args = core_slice.call(arguments, 2); - proxy = function () { - return fn.apply(context || this, args.concat(core_slice.call(arguments))); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; -}; - -Sound.play = function () { } -Sound.prototype = { something; } -Sound.prototype.play = function () { } -Sound.prototype.play = myfunc -var parser = document.createElement('a'); -parser.href = "http://example.com:3000/pathname/?search=test#hash"; -parser.hostname; // => "example.com" \ No newline at end of file From 4a653772d54bec83d9a56a9c7827d148b40fbc94 Mon Sep 17 00:00:00 2001 From: OctoD roth Date: Tue, 23 May 2017 23:25:24 +0200 Subject: [PATCH 4/6] chore: Generated sourcemaps and excludes them from workspace --- .vscode/settings.json | 3 ++- tsconfig.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 5d257d7..5be41fd 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,7 +10,8 @@ "node_modules": true, "**/*.js": { "when": "$(basename).ts" - } + }, + "**/*.js.map": true }, "files.associations": { "*.template": "json" diff --git a/tsconfig.json b/tsconfig.json index 3697e5d..7c6e2b7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "noUnusedLocals": true, "noUnusedParameters": true, "noImplicitAny": true, + "sourceMap": true, "target": "es6" }, "include": [ From 5087a0880d1eebbc44ddcc7d0f409fbe15e94188 Mon Sep 17 00:00:00 2001 From: OctoD roth Date: Tue, 23 May 2017 23:27:36 +0200 Subject: [PATCH 5/6] chore: Adds sourcemaps to ignored files list --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index fddf126..e2a1c79 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.log *.~lock *.js +**/*.map *.gulp/**.js dist/ node_modules/ \ No newline at end of file From bb7e3db86f40e22b6f90e65c7511d6da10cd0d8c Mon Sep 17 00:00:00 2001 From: OctoD roth Date: Wed, 24 May 2017 00:46:34 +0200 Subject: [PATCH 6/6] chore: add a clean project task (removes js files) and improve ts tasks --- .gulp/consts/log.ts | 6 +++ .gulp/consts/paths.ts | 10 ++++ .gulp/index.ts | 2 +- .gulp/interfaces/iicon.ts | 14 ++++++ .gulp/interfaces/ipaths.ts | 26 ++++++++++ .gulp/interfaces/iplain-object.ts | 3 ++ .gulp/interfaces/itheme-variant.ts | 42 ++++++++++++++++ .gulp/paths.ts | 11 ----- .gulp/tasks/bump.ts | 42 ++++++++-------- .gulp/tasks/changelog.ts | 12 ++--- .gulp/tasks/icons.ts | 77 +++++++++++++++-------------- .gulp/tasks/themes.ts | 78 +++++++++++++----------------- .gulp/tasks/watcher.ts | 15 +++--- .vscode/tasks.json | 48 ++++++++++++++++++ 14 files changed, 260 insertions(+), 126 deletions(-) create mode 100644 .gulp/consts/log.ts create mode 100644 .gulp/consts/paths.ts create mode 100644 .gulp/interfaces/iicon.ts create mode 100644 .gulp/interfaces/ipaths.ts create mode 100644 .gulp/interfaces/iplain-object.ts create mode 100644 .gulp/interfaces/itheme-variant.ts delete mode 100644 .gulp/paths.ts diff --git a/.gulp/consts/log.ts b/.gulp/consts/log.ts new file mode 100644 index 0000000..d9bada2 --- /dev/null +++ b/.gulp/consts/log.ts @@ -0,0 +1,6 @@ +export const HR: string = '\n———————————————————————————————————————————————————————————————\n'; +export const MESSAGE_BUMP_ERROR: string = ' There was an issue bumping version:\n'; +export const MESSAGE_BUMP_SUCCESS: string = ' Finished successfully\n'; +export const MESSAGE_ICON_ERROR: string = 'There is an error with JSON generated for icons'; +export const MESSAGE_GENERATED: string = 'Generated'; +export const MESSAGE_THEME_VARIANT_PARSE_ERROR: string = 'Error when parsing json for theme variants'; \ No newline at end of file diff --git a/.gulp/consts/paths.ts b/.gulp/consts/paths.ts new file mode 100644 index 0000000..1fcf397 --- /dev/null +++ b/.gulp/consts/paths.ts @@ -0,0 +1,10 @@ +import { IPaths } from '../interfaces/ipaths'; + +const PATHS: IPaths = { + DIST: './dist', + ICONS: './icons', + SRC: './src', + THEMES: './themes', +}; + +export default PATHS; diff --git a/.gulp/index.ts b/.gulp/index.ts index 1787a2f..2c2d4bb 100644 --- a/.gulp/index.ts +++ b/.gulp/index.ts @@ -1,4 +1,4 @@ -// import the tasks +// export the tasks export * from './tasks/changelog'; export * from './tasks/bump'; export * from './tasks/icons'; diff --git a/.gulp/interfaces/iicon.ts b/.gulp/interfaces/iicon.ts new file mode 100644 index 0000000..3d269c0 --- /dev/null +++ b/.gulp/interfaces/iicon.ts @@ -0,0 +1,14 @@ +export interface IIcon { + /** + * If set to true, the icon is marked as last + * @type {boolean} + * @memberof IIcon + */ + last: boolean; + /** + * Icon's name + * @type {string} + * @memberof IIcon + */ + name: string; +} \ No newline at end of file diff --git a/.gulp/interfaces/ipaths.ts b/.gulp/interfaces/ipaths.ts new file mode 100644 index 0000000..0bb68f0 --- /dev/null +++ b/.gulp/interfaces/ipaths.ts @@ -0,0 +1,26 @@ +export interface IPaths { + /** + * Dist dir + * @type {string} + * @memberof IPaths + */ + DIST: string; + /** + * Icons dir + * @type {string} + * @memberof IPaths + */ + ICONS: string; + /** + * Src dir + * @type {string} + * @memberof IPaths + */ + SRC: string; + /** + * Themes dir + * @type {string} + * @memberof IPaths + */ + THEMES: string; +} \ No newline at end of file diff --git a/.gulp/interfaces/iplain-object.ts b/.gulp/interfaces/iplain-object.ts new file mode 100644 index 0000000..91df42d --- /dev/null +++ b/.gulp/interfaces/iplain-object.ts @@ -0,0 +1,3 @@ +export interface IPlainObject { + [index: string]: string; +} \ No newline at end of file diff --git a/.gulp/interfaces/itheme-variant.ts b/.gulp/interfaces/itheme-variant.ts new file mode 100644 index 0000000..3f74e6c --- /dev/null +++ b/.gulp/interfaces/itheme-variant.ts @@ -0,0 +1,42 @@ +export interface IThemeVariant { + id: string; + name: string; + scheme: { + background: string; + base: { + black: string; + blue: string; + brown: string; + cyan: string; + green: string; + orange: string; + paleblue: string; + pink: string; + purple: string; + red: string; + violet: string; + white: string; + yellow: string; + } + caret: string; + comments: string; + findHighlight: string; + focusBorder: string; + foreground: string; + guides: string; + inputBackground: string; + inputBorder: string; + inputForeground: string; + invisibles: string; + lineHighlight: string; + lineNumbers: string; + listHoverForeground: string; + scrollbars: string; + scrollbarsHover: string; + selection: string; + shadow: string; + sidebarForeground: string; + statusbarForeground: string; + } + type: string; +} \ No newline at end of file diff --git a/.gulp/paths.ts b/.gulp/paths.ts deleted file mode 100644 index f547d5b..0000000 --- a/.gulp/paths.ts +++ /dev/null @@ -1,11 +0,0 @@ -// const infos = require('../package.json'); -// const today = new Date(); - -const paths = { - dist: './dist', - icons: './icons', - src: './src', - themes: './themes', -}; - -export default paths; diff --git a/.gulp/tasks/bump.ts b/.gulp/tasks/bump.ts index 1870c4c..a8007e4 100644 --- a/.gulp/tasks/bump.ts +++ b/.gulp/tasks/bump.ts @@ -1,35 +1,35 @@ -/* - * > Bump - */ - -import * as Gulp from 'gulp'; -import * as Gulpif from 'gulp-if'; import * as bump from 'gulp-bump'; -import * as gutil from 'gulp-util'; +import * as gulp from 'gulp'; +import * as gulpIf from 'gulp-if'; +import * as gulpUtil from 'gulp-util'; import * as runSequence from 'run-sequence'; -import * as yrgv from 'yargs'; +import * as yargs from 'yargs'; -var argv = (yrgv as any).argv; +import { MESSAGE_BUMP_ERROR, MESSAGE_BUMP_SUCCESS } from "../consts/log"; -export var taskBump = Gulp.task('bump', (cb) => { +var argv = yargs.argv; + +export var taskBump = gulp.task('bump', (cb) => { runSequence( 'bump-pkg-version', - (error) => { + error => { if (error) { - console.log(gutil.colors.magenta.bold('[bump]'), gutil.colors.red.bold(' There was an issue bumping version:\n'), error); + console.log(gulpUtil.colors.magenta.bold('[bump]'), gulpUtil.colors.red.bold(MESSAGE_BUMP_ERROR), error); } else { - console.log(gutil.colors.magenta.bold('\n[bump]'), gutil.colors.green.bold(' Finished successfully\n')); + console.log(gulpUtil.colors.magenta.bold('\n[bump]'), gulpUtil.colors.green.bold(MESSAGE_BUMP_SUCCESS)); } cb(error); } ); }); -export var taskVersioning = Gulp.task('bump-pkg-version', () => { - return Gulp.src(['./package.json']) - .pipe(Gulpif((Object.keys(argv).length === 2), bump())) - .pipe(Gulpif(argv.patch, bump())) - .pipe(Gulpif(argv.minor, bump({ type: 'minor' }))) - .pipe(Gulpif(argv.major, bump({ type: 'major' }))) - .pipe(Gulp.dest('./')); -}); \ No newline at end of file +export var taskVersioning = gulp.task('bump-pkg-version', () => { + return gulp.src(['./package.json']) + .pipe(gulpIf((Object.keys(argv).length === 2), bump())) + .pipe(gulpIf(argv.patch, bump())) + .pipe(gulpIf(argv.minor, bump({ type: 'minor' }))) + .pipe(gulpIf(argv.major, bump({ type: 'major' }))) + .pipe(gulp.dest('./')); +}); + +export default { taskBump, taskVersioning }; \ No newline at end of file diff --git a/.gulp/tasks/changelog.ts b/.gulp/tasks/changelog.ts index 380a59e..176780e 100644 --- a/.gulp/tasks/changelog.ts +++ b/.gulp/tasks/changelog.ts @@ -2,14 +2,14 @@ * > Changelog */ -import * as Gulp from 'gulp'; -import * as conventionalChangelog from 'gulp-conventional-changelog'; +import * as gulp from 'gulp'; +import * as gulpConventionalChangelog from 'gulp-conventional-changelog'; -export var task = Gulp.task('changelog', () => { - return Gulp.src('CHANGELOG.md') - .pipe(conventionalChangelog({ +export var task = gulp.task('changelog', () => { + return gulp.src('CHANGELOG.md') + .pipe(gulpConventionalChangelog({ preset: 'angular', releaseCount: 0 })) - .pipe(Gulp.dest('./')); + .pipe(gulp.dest('./')); }); \ No newline at end of file diff --git a/.gulp/tasks/icons.ts b/.gulp/tasks/icons.ts index 7e55ac6..6d486a4 100644 --- a/.gulp/tasks/icons.ts +++ b/.gulp/tasks/icons.ts @@ -1,58 +1,65 @@ -/* - * > Build Icons - */ - -import * as Gulp from 'gulp'; -import * as Mustache from 'mustache'; import * as fs from 'fs'; +import * as gulp from 'gulp'; import * as gutil from 'gulp-util'; +import * as mustache from 'mustache'; import * as path from 'path'; -import { CHARSET } from "../consts/files"; -import Paths from '../paths'; +import { HR, MESSAGE_GENERATED, MESSAGE_ICON_ERROR } from './../consts/log'; -export var taskIcons = Gulp.task('build:icons', cb => { - const partials = fs.readdirSync(path.join(Paths.src, `./icons/partials`)); - const partialData: any = {}; - const files = fs.readdirSync(path.join(Paths.src, `./icons/svgs`)); - const icons = files.map(file => ({ name: file.split('.')[0], last: false })); - const pathTemp = './themes/.material-theme-icons.tmp'; +import { CHARSET } from '../consts/files'; +import { IIcon } from './../interfaces/iicon'; +import { IPlainObject } from '../interfaces/iplain-object'; +import paths from '../consts/paths'; + +/** + * Returns an object implementing the IIcon interface + * @param {string} fileName + * @returns {IIcon} + */ +function iconFactory(fileName: string): IIcon { + let name: string = path.basename(fileName, path.extname(fileName)); + let last: boolean = false; + + return { name, last } as IIcon; +} + +/** + * > Build Icons + * @returns {gulp.Gulp} + */ +export default gulp.task('build:icons', cb => { + let contents: string; + let fileNames: string[] = fs.readdirSync(path.join(paths.SRC, `./icons/svgs`)); + let icons: IIcon[] = fileNames.map(fileName => iconFactory(fileName)); + let partials: string[] = fs.readdirSync(path.join(paths.SRC, `./icons/partials`)); + let partialsData: IPlainObject = {}; + let pathTemp: string = './themes/.material-theme-icons.tmp'; icons[icons.length - 1].last = true; partials.forEach(partial => { - partialData[partial.split('.')[0]] = fs.readFileSync( - path.join(Paths.src, `./icons/partials`, `./${partial}`), - 'utf-8' - ); + partialsData[path.basename(partial, path.extname(partial))] = fs.readFileSync(path.join(paths.SRC, `./icons/partials`, `./${partial}`), CHARSET); }); - let contents = Mustache.render( - fs.readFileSync(path.join(Paths.src, `./icons/icons-theme.json`), CHARSET), - { icons }, - partialData + contents = mustache.render( + fs.readFileSync(path.join(paths.SRC, `./icons/icons-theme.json`), CHARSET) + , { icons } + , partialsData ); try { contents = JSON.stringify(JSON.parse(contents), null, 2); - } catch (err) { - gutil.log( - gutil.colors['red']('There is an error with JSON generated for icons'), - err - ); - cb(err); + } catch (error) { + gutil.log(gutil.colors.red(MESSAGE_ICON_ERROR), error); + cb(error); return; } fs.writeFileSync(pathTemp, contents, CHARSET); - gutil.log( - gutil.colors['gray']('\n———————————————————————————————————————————————————————————————\n') - ); - gutil.log('Generated', gutil.colors['green'](pathTemp)); - gutil.log( - gutil.colors['gray']('\n———————————————————————————————————————————————————————————————\n') - ); + gutil.log(gutil.colors.gray(HR)); + gutil.log(MESSAGE_GENERATED, gutil.colors.green(pathTemp)); + gutil.log(gutil.colors.gray(HR)); cb(); }); diff --git a/.gulp/tasks/themes.ts b/.gulp/tasks/themes.ts index 5525ebd..09b9979 100644 --- a/.gulp/tasks/themes.ts +++ b/.gulp/tasks/themes.ts @@ -1,63 +1,51 @@ -import * as Gulp from 'gulp'; -import * as Mustache from 'mustache'; -// import * as YAML from 'yamljs'; -/* - * > Build Themes - */ import * as fs from 'fs'; -import * as gutil from 'gulp-util'; +import * as gulp from 'gulp'; +import * as gulpUtil from 'gulp-util'; +import * as mustache from 'mustache'; +import * as path from 'path'; -import { CHARSET } from "../consts/files"; -import Paths from '../paths'; +import { HR, MESSAGE_GENERATED, MESSAGE_THEME_VARIANT_PARSE_ERROR } from './../consts/log'; -const themeCommons = require('../../src/themes/settings/commons.json'); -const themeVariants: any[] = []; -const themeTemplateFile = fs.readFileSync( - `${Paths.src}/themes/theme-template-color-theme.json`, - CHARSET -); +import { CHARSET } from '../consts/files'; +import { IThemeVariant } from './../interfaces/itheme-variant'; +import paths from '../consts/paths'; -const files = fs.readdirSync(`${Paths.src}/themes/settings/specific`); +let commons = require('../../src/themes/settings/commons.json'); + +let themeTemplateFileContent: string = fs.readFileSync(path.join(paths.SRC, `/themes/theme-template-color-theme.json`), CHARSET); +let themeVariants: IThemeVariant[] = []; + +let fileNames: string[] = fs.readdirSync(path.join(paths.SRC, `./themes/settings/specific`)); // build theme variants for later use in templating -files.forEach(file => { - // const name: string = file.split('.')[0]; - const filepath = `${Paths.src}/themes/settings/specific/${file}`; - const contents = fs.readFileSync(filepath, 'utf-8'); +fileNames.forEach(fileName => { + let filePath: string = path.join(paths.SRC, `./themes/settings/specific`, `./${fileName}`); + let contents: string = fs.readFileSync(filePath, CHARSET); try { themeVariants.push(JSON.parse(contents)); - } catch (err) { - gutil.log('Error when parsing json for theme variants', err); + } catch (error) { + gulpUtil.log(MESSAGE_THEME_VARIANT_PARSE_ERROR, error); } }); -export var taskThemes = Gulp.task('build:themes', () => { - gutil.log( - gutil.colors.gray('\n———————————————————————————————————————————————————————————————\n') - ); +/** + * Themes task + * Builds Themes + */ +export default gulp.task('build:themes', () => { + gulpUtil.log(gulpUtil.colors.gray(HR)); + themeVariants.forEach(variant => { - const templateData = { - 'commons': themeCommons, - variant - }; + let filePath = path.join(paths.THEMES, `./${variant.name}.json`); + let templateData = { commons, variant }; + let templateJSON: any = JSON.parse(mustache.render(themeTemplateFileContent, templateData)); + let templateJSONStringified: string = JSON.stringify(templateJSON, null, 2); - const templateJson = JSON.parse( - Mustache.render(themeTemplateFile, templateData) - ); + fs.writeFileSync(filePath, templateJSONStringified, CHARSET); - const path = `${Paths.themes}/${variant.name}.json`; - - fs.writeFileSync( - path, - JSON.stringify(templateJson, null, 2), - CHARSET - ); - - gutil.log('Generate', gutil.colors['green'](path)); + gulpUtil.log(MESSAGE_GENERATED, gulpUtil.colors.green(filePath)); }); - gutil.log( - gutil.colors.gray('\n———————————————————————————————————————————————————————————————\n') - ); + gulpUtil.log(gulpUtil.colors.gray(HR)); }); diff --git a/.gulp/tasks/watcher.ts b/.gulp/tasks/watcher.ts index 2616538..0cd75e3 100644 --- a/.gulp/tasks/watcher.ts +++ b/.gulp/tasks/watcher.ts @@ -1,11 +1,12 @@ +import * as gulp from "gulp"; +import * as path from "path"; + +import Paths from "../consts/paths"; + /* * > Watcher + * Watches files and build the themes */ - -import * as Gulp from 'gulp'; - -import Paths from '../paths'; - -export var taskWatch = Gulp.task('watch', () => { - Gulp.watch(`${Paths.src}/themes/**/*.json`, ['build:themes']); +export default gulp.task('watch', () => { + gulp.watch(path.join(Paths.SRC, `./themes/**/*.json`), ['build:themes']); }); \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e89c89b..9dd62b1 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -22,6 +22,53 @@ "isShellCommand": true, "taskName": "build" }, + { + "linux": { + "args": [ + "." + , "-name" + , "\"*.js\"" + , "-not" + , "-path" + , "\"./node_modules/*\"" + , "-not" + , "-path" + , "\"./src/*\"" + , "-not" + , "-path" + , "\"./test/*\"" + , "-type" + , "f" + , "-delete" + ], + "command": "find", + "isShellCommand": true + }, + "osx": { + "args": [ + "." + , "-name" + , "\"*.js\"" + , "-not" + , "-path" + , "\"./node_modules/*\"" + , "-not" + , "-path" + , "\"./src/*\"" + , "-not" + , "-path" + , "\"./test/*\"" + , "-type" + , "f" + , "-delete" + ], + "command": "find", + "isShellCommand": true + }, + "command": "", + "echoCommand": true, + "taskName": "clean project" + }, { "args": [ "run" @@ -38,6 +85,7 @@ , "." ], "command": "tsc", + "dependsOn": "clean project", "echoCommand": true, "isShellCommand": true, "taskName": "tsc"