How to use the octicons/package.json.version function in octicons

To help you get started, we’ve selected a few octicons examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rhysd / react-component-octicons / scripts / generate.ts View on Github external
aria: ${attr['aria-hidden']},
    path: ${o.path.replace('fill-rule', 'fillRule')},
  }`;

    elems.push(`  '${o.symbol}': ${icon},`);
}

const template = fs.readFileSync(path.join(__dirname, 'template.tsx'), 'utf8');
const constant = `const OCTICONS: {[T in OcticonSymbol]: IconInfo} = {
${elems.join('\n')}
};

export type OcticonSymbol =
  ${symbols.map(s => `'${s}'`).join(' |\n  ')};

export const OCTICONS_VERSION = '${require('octicons/package.json').version}';
`;

fs.writeFileSync('index.tsx', template + constant, 'utf8');