Coder Social home page Coder Social logo

hiendv / octicons-modular Goto Github PK

View Code? Open in Web Editor NEW
24.0 3.0 10.0 6.11 MB

GitHub Octicons with tree-shaking support and icon-per-file style.

License: MIT License

JavaScript 99.61% CSS 0.07% EJS 0.32%
icon icons octicons modular vuejs react component tree-shaking

octicons-modular's People

Contributors

dacsang97 avatar dependabot[bot] avatar hiendv avatar mdew192837 avatar mistereo avatar peterblazejewicz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

octicons-modular's Issues

Development script

I'm planning on a dev script npm run dev which should perform

  • File watching within ./src, ./build, ./test directories
  • Dispatching lint script when files are changed

The dependencies should be minimal. You may want to use nodemon.

More icon tests

The current code coverage

----------------------------|----------|----------|----------|----------|----------------|
File                        |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------------------------|----------|----------|----------|----------|----------------|
All files                   |     24.6 |     0.73 |    13.06 |     24.6 |                |
 lib                        |      100 |       80 |      100 |      100 |                |
  main.common.js            |      100 |       80 |      100 |      100 |              5 |
 lib/icons                  |    18.98 |     0.51 |    12.99 |    18.98 |                |
  alert.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  arrow-down.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  arrow-left.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  arrow-right.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  arrow-small-down.js       |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  arrow-small-left.js       |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  arrow-small-right.js      |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  arrow-small-up.js         |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  arrow-up.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  beaker.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  bell.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  bold.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  book.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  bookmark.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  briefcase.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  broadcast.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  browser.js                |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  bug.js                    |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  calendar.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  check.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  checklist.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  chevron-down.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  chevron-left.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  chevron-right.js          |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  chevron-up.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  circle-slash.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  circuit-board.js          |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  clippy.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  clock.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  cloud-download.js         |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  cloud-upload.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  code.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  comment-discussion.js     |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  comment.js                |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  credit-card.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  dash.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  dashboard.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  database.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  desktop-download.js       |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  device-camera-video.js    |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  device-camera.js          |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  device-desktop.js         |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  device-mobile.js          |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  diff-added.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  diff-ignored.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  diff-modified.js          |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  diff-removed.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  diff-renamed.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  diff.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  ellipsis.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  eye.js                    |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file-binary.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file-code.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file-directory.js         |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file-media.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file-pdf.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file-submodule.js         |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file-symlink-directory.js |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file-symlink-file.js      |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file-text.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file-zip.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  file.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  flame.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  fold.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  gear.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  gift.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  gist-secret.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  gist.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  git-branch.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  git-commit.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  git-compare.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  git-merge.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  git-pull-request.js       |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  globe.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  grabber.js                |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  graph.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  heart.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  history.js                |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  home.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  horizontal-rule.js        |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  hubot.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  inbox.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  info.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  issue-closed.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  issue-opened.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  issue-reopened.js         |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  italic.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  jersey.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  kebab-horizontal.js       |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  kebab-vertical.js         |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  key.js                    |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  keyboard.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  law.js                    |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  light-bulb.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  link-external.js          |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  link.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  list-ordered.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  list-unordered.js         |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  location.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  lock.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  logo-gist.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  logo-github.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  mail-read.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  mail-reply.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  mail.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  mark-github.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  markdown.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  megaphone.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  mention.js                |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  milestone.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  mirror.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  mortar-board.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  mute.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  no-newline.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  note.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  octoface.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  organization.js           |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  package.js                |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  paintcan.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  pencil.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  person.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  pin.js                    |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  plug.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  plus-small.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  plus.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  primitive-dot.js          |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  primitive-square.js       |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  project.js                |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  pulse.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  question.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  quote.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  radio-tower.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  reply.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  repo-clone.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  repo-force-push.js        |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  repo-forked.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  repo-pull.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  repo-push.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  repo.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  rocket.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  rss.js                    |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  ruby.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  screen-full.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  screen-normal.js          |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  search.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  server.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  settings.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  shield.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  sign-in.js                |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  sign-out.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  smiley.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  squirrel.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  star.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  stop.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  sync.js                   |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  tag.js                    |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  tasklist.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  telescope.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  terminal.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  text-size.js              |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  three-bars.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  thumbsdown.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  thumbsup.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  tools.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  trashcan.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  triangle-down.js          |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  triangle-left.js          |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  triangle-right.js         |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  triangle-up.js            |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  unfold.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  unmute.js                 |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  unverified.js             |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  verified.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  versions.js               |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  watch.js                  |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  x.js                      |    18.52 |        0 |     12.5 |    18.52 |... 51,52,53,56 |
  zap.js                    |      100 |       90 |      100 |      100 |             34 |
----------------------------|----------|----------|----------|----------|----------------|

VueJS component

Here is a quick draft

<template>
  <span v-html="icon.svg({ scale: scale })"></span>
</template>
<script>
export default {
  name: 'Octicon',
  props: {
    icon: {
      type: Object,
      default () {
        return {
          svg () {
            return
          }
        }
      },
      validator (value) {
        return typeof value.svg === 'function'
      }
    },
    scale: {
      type: Number,
      default () {
        return 1
      }
    }
  }
}
</script>

The component should be rolled using rollup-plugin-vue with the help from the transform-require module

const transformRequire = require('vue-loader/lib/template-compiler/modules/transform-require')
vue({
  compileOptions: {
    modules: [transformRequire({})]
  }
  ...
})

Missing dev dependency to `babel-cli` [babel-node: command not found]

The build process expects babel-cli to be available:

npm run build

> [email protected] build /Users/piotrblazejewicz/git/octicons-modular
> npm run clean && babel-node --presets env build/modulize.js && npm run lint && babel-node --presets env build/build.js && npm test


> [email protected] clean /Users/piotrblazejewicz/git/octicons-modular
> rimraf lib/* && rimraf src/icons/* && rimraf src/octicons.js

sh: babel-node: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] build: `npm run clean && babel-node --presets env build/modulize.js && npm run lint && babel-node --presets env build/build.js && npm test

This can be fixed by adding babel-cli as dev dependency, unless there is an expectation that users have babel-cli installed globally.

node --version
v8.4.0
npm --version
5.4.1
macOS

Octicon additional class test fails

> jest

 FAIL  test/icons.test.js
  ● octicons › zap › svg › returns a svg with an addional class

    expect(received).toBe(expected)
    
    Expected value to be (using ===):
      "<svg version=\"1.1\" width=\"10\" height=\"16\" viewBox=\"0 0 10 16\" class=\"octicon octicon-zap an-additional-class\" aria-hidden=\"true\" ><path fill-rule=\"evenodd\" d=\"M10 7H6l3-7-9 9h4l-3 7z\"/></svg>"
    Received:
      "<svg version=\"1.1\" width=\"10\" height=\"16\" viewBox=\"0 0 10 16\" class=\"an-additional-class an-additional-class\" aria-hidden=\"true\" ><path fill-rule=\"evenodd\" d=\"M10 7H6l3-7-9 9h4l-3 7z\"/></svg>"
      
      at Object.<anonymous> (test/icons.test.js:22:59)

ES module tests

We need more tests with the ES module. For now, only alert icon is tested.

describe('es bundle', () => {
test('has alert', () => {
expect(octicons.alert).toEqual(expect.objectContaining({
name: 'alert',
svg: expect.any(Function)
}))
})
test('exports named alert', () => {
expect(alert).toEqual(expect.objectContaining({
name: 'alert',
svg: expect.any(Function)
}))
})

See commonjs module tests for the first test case of each icon.

Known Vulnerabilities badge

Known Vulnerabilities

[![Known Vulnerabilities](https://snyk.io/test/github/hiendv/octicons-modular/badge.svg)](https://snyk.io/test/github/hiendv/octicons-modular)

Allow to set float number as scale value

Icon scales to the default value when I set scale between 0 and 1.

alert.svg({ scale: .5 })

I think, the issue is here:

  // any icon source file generated from icon.hbs template
  ...
  attrScale (attrs, scale) {
    let actualScale = scale === 0 ? 0 : parseInt(scale) || 1 // ?
    attrs['width'] = actualScale * parseInt(attrs['width'])
    attrs['height'] = actualScale * parseInt(attrs['height'])
    delete attrs['scale']
  },
  ...

For example:

parseInt(.6) // returns 0
parseInt(1.99) // returns 1

I'm already fix it in my forked repository: link
If my solution is right, it may be able to pull request. All icon sources was rebuilt using the new template on fix-float-sclae branch.

Icon test refactoring

Expected Behavior

Effortless tests with icons

Current Behavior

There are 6374 lines of code in icons.test.js

Possible Solution

We could create another fixture containing paths exported from octicons/build/data because the path is the only variable.

Factory elimination over pure-object icons for better tree-shaking

Expected Behavior

Icons should be pure objects instead of a result from the factory call.

module.exports = {
  //
};

Current Behavior

var icon = factory(name, data);
module.exports = icon;

Possible Solution

Eliminate factory and improve icon template.

Steps to Reproduce (for bugs)

Context

I'm trying to accomplish tree-shaking but it doesn't work.

Your Environment

{ 'octicons-modular': '0.3.1',
  npm: '5.4.2',
  ares: '1.10.1-DEV',
  http_parser: '2.7.0',
  icu: '57.1',
  modules: '48',
  node: '6.9.4',
  openssl: '1.0.2j',
  uv: '1.9.1',
  v8: '5.1.281.89',
  zlib: '1.2.8' }

Stack trace

Readme outdated

npm run dev command not found

git clone https://github.com/hiendv/octicons-modular.git && cd octicons-modular
npm install
npm run dev

# Build?
npm run build

# Patch and release?
npm run version-patch && npm run publish
"scripts": {
    "test": "jest",
    "lint": "eslint --ext .js *.js ./src ./build ./test",
    "clean": "rimraf lib/* && rimraf src/icons/* && rimraf src/octicons.js",
    "build": "npm run clean && babel-node build/modulize.js && npm run lint && babel-node build/build.js && npm test",
    "publish-meta": "cp -rf package.json lib/package.json && cp -rf README.md lib/README.md && cp -rf LICENSE lib/LICENSE",
    "publish": "npm test && npm run publish-meta && cd lib && npm publish",
    "version-patch": "rimraf package-lock.json && npm version patch"
  },
➜  octicons-modular (master) ✗ npm run dev
npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v6.11.3
npm ERR! npm  v3.10.10

npm ERR! missing script: dev
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/george/Desktop/Projects/octicons-modular/npm-debug.log
➜  octicons-modular (master) ✗

Icon tests with different scales

We need tests with

  • 0 scale
  • invalid scale

test(`returns a svg which scales to 0`, () => {
expect(alert.svg({ scale: 0 })).toBe('<svg version="1.1" width="0" height="0" viewBox="0 0 16 16" class="octicon octicon-alert" aria-hidden="true" ><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>')
})
test(`returns a svg which scales to 1 with invalid parameter`, () => {
expect(alert.svg({ scale: 'invalid integer' })).toBe('<svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-alert" aria-hidden="true" ><path fill-rule="evenodd" d="M8.865 1.52c-.18-.31-.51-.5-.87-.5s-.69.19-.87.5L.275 13.5c-.18.31-.18.69 0 1 .19.31.52.5.87.5h13.7c.36 0 .69-.19.86-.5.17-.31.18-.69.01-1L8.865 1.52zM8.995 13h-2v-2h2v2zm0-3h-2V6h2v4z"/></svg>')
})

For now, only alert icon is tested.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.