material-icon-generator 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/commands.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { generateMasterComponentOnDisk, icons } from './icon.js';
2
- import { getSvigConfig, saveSvigConfig, svigConfigPath } from './config.js';
2
+ import { getMiConfig, saveMiConfig, miConfigPath } from './config.js';
3
3
  import { getSvelteComponentPath } from './utils.js';
4
4
  export function addIconsCommand(iconNames, props) {
5
5
  const { dirpath } = props;
@@ -7,7 +7,7 @@ export function addIconsCommand(iconNames, props) {
7
7
  console.log(`Please provide icons to add!`);
8
8
  return;
9
9
  }
10
- const config = getSvigConfig();
10
+ const config = getMiConfig();
11
11
  for (const iconName of iconNames) {
12
12
  const icon = icons.find(ic => ic.name === iconName);
13
13
  if (icon) {
@@ -17,7 +17,7 @@ export function addIconsCommand(iconNames, props) {
17
17
  else {
18
18
  console.log(`Icon was added: '${iconName}'`);
19
19
  config.icons.push(iconName);
20
- saveSvigConfig(config);
20
+ saveMiConfig(config);
21
21
  }
22
22
  }
23
23
  else {
@@ -32,15 +32,15 @@ export function removeIconsCommand(iconNames, props) {
32
32
  console.log(`Please provide icons to remove!`);
33
33
  return;
34
34
  }
35
- const config = getSvigConfig();
35
+ const config = getMiConfig();
36
36
  if (!config.icons || config.icons.length === 0) {
37
- console.log(`No icons found in config: '${svigConfigPath}'`);
37
+ console.log(`No icons found in config: '${miConfigPath}'`);
38
38
  return;
39
39
  }
40
40
  for (const iconName of iconNames) {
41
41
  if (config.icons.includes(iconName)) {
42
42
  config.icons = config.icons.filter(ic => ic !== iconName);
43
- saveSvigConfig(config);
43
+ saveMiConfig(config);
44
44
  console.log(`Icon was removed: '${iconName}'`);
45
45
  }
46
46
  else {
@@ -51,9 +51,9 @@ export function removeIconsCommand(iconNames, props) {
51
51
  }
52
52
  export function generateIconsCommand(props, overwrite) {
53
53
  const { dirpath } = props;
54
- const config = getSvigConfig();
54
+ const config = getMiConfig();
55
55
  if (config.icons.length === 0) {
56
- console.log(`No icons found in config: '${svigConfigPath}'`);
56
+ console.log(`No icons found in config: '${miConfigPath}'`);
57
57
  return;
58
58
  }
59
59
  generateMasterComponentOnDisk(config.icons, dirpath);
@@ -68,7 +68,7 @@ export function generateMasterComponentCommand(props, overwrite) {
68
68
  const { dirpath } = props;
69
69
  const outputFilePath = getSvelteComponentPath("", dirpath);
70
70
  try {
71
- const config = getSvigConfig();
71
+ const config = getMiConfig();
72
72
  generateMasterComponentOnDisk(config.icons, dirpath);
73
73
  }
74
74
  catch (error) {
package/dist/config.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import fs from 'fs';
2
- export const svigConfigPath = "svig.config.json";
3
- export function getSvigConfig() {
2
+ export const miConfigPath = "mi.config.json";
3
+ export function getMiConfig() {
4
4
  try {
5
- const data = fs.readFileSync(svigConfigPath, 'utf8');
5
+ const data = fs.readFileSync(miConfigPath, 'utf8');
6
6
  const config = JSON.parse(data);
7
7
  return config;
8
8
  }
@@ -13,11 +13,11 @@ export function getSvigConfig() {
13
13
  return config;
14
14
  }
15
15
  }
16
- export function saveSvigConfig(config) {
16
+ export function saveMiConfig(config) {
17
17
  try {
18
18
  config.icons = config.icons.sort();
19
19
  const jsonString = JSON.stringify(config, null, 2); // Indented with 2 spaces
20
- fs.writeFileSync(svigConfigPath, jsonString);
20
+ fs.writeFileSync(miConfigPath, jsonString);
21
21
  }
22
22
  catch (error) {
23
23
  console.log(`Error while writing json: ${error}`);