chore: Moves dirs consts out of .gulp directory.
This commit is contained in:
parent
00b4b0df1e
commit
5913e6a4ba
6 changed files with 19 additions and 25 deletions
|
@ -9,7 +9,8 @@ import { MESSAGE_GENERATED, MESSAGE_ICON_ACCENTS_ERROR } from "../consts/log";
|
||||||
import { CHARSET } from "../consts/files";
|
import { CHARSET } from "../consts/files";
|
||||||
import { IThemeConfigCommons } from '../../extensions/interfaces/icommons';
|
import { IThemeConfigCommons } from '../../extensions/interfaces/icommons';
|
||||||
import { IThemeIconsAccents } from "../interfaces/itheme-icons-accents";
|
import { IThemeIconsAccents } from "../interfaces/itheme-icons-accents";
|
||||||
import PATHS from '../consts/paths'
|
import PATHS from '../../extensions/consts/paths'
|
||||||
|
import accentedThemeName from "../../extensions/accents-setter/accented-theme-name";
|
||||||
|
|
||||||
const BASE_ICON_THEME_PATH: string = path.join(process.cwd(), PATHS.THEMES, './Material-Theme-Icons.json');
|
const BASE_ICON_THEME_PATH: string = path.join(process.cwd(), PATHS.THEMES, './Material-Theme-Icons.json');
|
||||||
const THEME_COMMONS: IThemeConfigCommons = require('../../extensions/accents-setter/commons.json');
|
const THEME_COMMONS: IThemeConfigCommons = require('../../extensions/accents-setter/commons.json');
|
||||||
|
@ -21,24 +22,6 @@ const PACKAGE_JSON_ICON_THEME: IPackageJSONThemeIcons = {
|
||||||
path: "./themes/Material-Theme-Icons.json"
|
path: "./themes/Material-Theme-Icons.json"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets file path
|
|
||||||
* @param {string} filename
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
function getFilepath(filename: string): string {
|
|
||||||
return path.join(PATHS.THEMES, filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Icon theme name
|
|
||||||
* @param {string} accentName
|
|
||||||
* @returns {string}
|
|
||||||
*/
|
|
||||||
function makefileName(accentName: string): string {
|
|
||||||
return `./Material-Theme-Icons-${ accentName }.json`;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Normalizes icon path
|
* Normalizes icon path
|
||||||
* @param {string} iconPath
|
* @param {string} iconPath
|
||||||
|
@ -104,7 +87,11 @@ export default gulp.task('build:icons.accents', cb => {
|
||||||
Object.keys(THEME_COMMONS.accents).forEach(key => {
|
Object.keys(THEME_COMMONS.accents).forEach(key => {
|
||||||
let iconName = replaceWhiteSpaces(key);
|
let iconName = replaceWhiteSpaces(key);
|
||||||
let themecopy: IThemeIconsAccents = JSON.parse(JSON.stringify(basetheme));
|
let themecopy: IThemeIconsAccents = JSON.parse(JSON.stringify(basetheme));
|
||||||
let themePath: string = getFilepath(makefileName(key));
|
let themePath: string = accentedThemeName(key);
|
||||||
|
|
||||||
|
let id: string = `${ PACKAGE_JSON_ICON_THEME.id }-${ key.replace(/\s+/g, '-').toLowerCase() }`;
|
||||||
|
let label: string = `${ PACKAGE_JSON_ICON_THEME.label } - ${ key } accent`;
|
||||||
|
let path: string = `./${ themePath }`;
|
||||||
|
|
||||||
themecopy.iconDefinitions._folder_open.iconPath = replaceNameWithAccent(basetheme.iconDefinitions._folder_open.iconPath, iconName);
|
themecopy.iconDefinitions._folder_open.iconPath = replaceNameWithAccent(basetheme.iconDefinitions._folder_open.iconPath, iconName);
|
||||||
themecopy.iconDefinitions._folder_open_build.iconPath = replaceNameWithAccent(basetheme.iconDefinitions._folder_open_build.iconPath, iconName);
|
themecopy.iconDefinitions._folder_open_build.iconPath = replaceNameWithAccent(basetheme.iconDefinitions._folder_open_build.iconPath, iconName);
|
||||||
|
@ -114,12 +101,12 @@ export default gulp.task('build:icons.accents', cb => {
|
||||||
|
|
||||||
fs.writeFileSync(themePath, JSON.stringify(themecopy));
|
fs.writeFileSync(themePath, JSON.stringify(themecopy));
|
||||||
|
|
||||||
PACKAGE_JSON
|
PACKAGE_JSON.contributes.iconThemes.push({ id, label, path });
|
||||||
|
|
||||||
gutil.log(gutil.colors.green(MESSAGE_GENERATED, themePath));
|
gutil.log(gutil.colors.green(MESSAGE_GENERATED, themePath));
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.writeFileSync(path.join(process.cwd(), './package.test.json'), JSON.stringify(PACKAGE_JSON, null, 2), CHARSET);
|
fs.writeFileSync(path.join(process.cwd(), './package.json'), JSON.stringify(PACKAGE_JSON, null, 2), CHARSET);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// http://ragefaces.memesoftware.com/faces/large/misc-le-fu-l.png
|
// http://ragefaces.memesoftware.com/faces/large/misc-le-fu-l.png
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { HR, MESSAGE_GENERATED, MESSAGE_ICON_ERROR } from './../consts/log';
|
||||||
import { CHARSET } from '../consts/files';
|
import { CHARSET } from '../consts/files';
|
||||||
import { IIcon } from './../interfaces/iicon';
|
import { IIcon } from './../interfaces/iicon';
|
||||||
import { IPlainObject } from '../interfaces/iplain-object';
|
import { IPlainObject } from '../interfaces/iplain-object';
|
||||||
import paths from '../consts/paths';
|
import paths from '../../extensions/consts/paths';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an object implementing the IIcon interface
|
* Returns an object implementing the IIcon interface
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { HR, MESSAGE_GENERATED, MESSAGE_THEME_VARIANT_PARSE_ERROR } from './../c
|
||||||
|
|
||||||
import { CHARSET } from '../consts/files';
|
import { CHARSET } from '../consts/files';
|
||||||
import { IThemeVariant } from './../interfaces/itheme-variant';
|
import { IThemeVariant } from './../interfaces/itheme-variant';
|
||||||
import paths from '../consts/paths';
|
import paths from '../../extensions/consts/paths';
|
||||||
|
|
||||||
let commons = require('../../extensions/accents-setter/commons.json');
|
let commons = require('../../extensions/accents-setter/commons.json');
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import * as gulp from "gulp";
|
import * as gulp from "gulp";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
|
||||||
import Paths from "../consts/paths";
|
import Paths from "../../extensions/consts/paths";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* > Watcher
|
* > Watcher
|
||||||
|
|
7
extensions/accents-setter/accented-theme-name.ts
Normal file
7
extensions/accents-setter/accented-theme-name.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
import PATHS from '../consts/paths'
|
||||||
|
|
||||||
|
export default function accentedThemeName(accentName: string): string {
|
||||||
|
return path.join(PATHS.THEMES, `./Material-Theme-Icons-${ accentName }.json`);
|
||||||
|
}
|
Loading…
Reference in a new issue