Giter VIP home page Giter VIP logo

starwars-names's Introduction

starwars-names

travis build codecov coverage version downloads MIT License semantic-release

Get random names from Star Wars characters.

Sponsor

starwars-names

Installation

This package is distributed via npm:

npm install starwars-names

Usage

var names = require('starwars-names');
var allNames = names.all;
var randomName = names.random();
var threeRandomNames = names.random(3);

Other

This library was developed by me as part of an egghead.io series called "How to Write a JavaScript Library."

I'm now also using it to give a workshop for Frontend Masters.

Project Setup

This project assumes you have NodeJS v6 or greater installed. You should also have npm v3 or greater installed as well (this comes packaged with Node 6). You'll also need a recent version of git installed as well.

You may have come to this project from different varying sources. There are a different series of branches for each workshop/course I've done. To get started with the project, start with this:

  1. Sign up for a GitHub Account (if you don't already have one)
  2. Fork this repo
  3. Clone your fork
  4. In the directory you cloned the repository, run git fetch --all

If you need help with these steps, you might check out this free Egghead.io course which can help you get things going.

Finally, based on which version of the project you're looking for (workshop, egghead, or Frontend Masters) you'll run one of the following commands in the cloned directory:

  • Frontend Masters Workshop: npm run setup:fem
  • Egghead Course: npm run setup:egghead

If you get any failures at this point something is wrong and needs to be fixed. Remember, Google and StackOverflow are your friends.

You might find it helpful to see a list of the available branches. Run: git branch for that.

starwars-names's People

Contributors

fetz avatar greenkeeperio-bot avatar sneas avatar z11h 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar

starwars-names's Issues

FEM - Setup Email

Email for the workshop on Tues says:

Then run these commands:
git clone https://github.com/kentcdodds/starwars-names.git
cd starwars-names
npm run setup:fem

Now, open your browser to http://localhost:8080 and you should be looking at a Todo app. If that happens without any issues, then you're good to go. If not, please report them here!

Just following up on this:

Am I doing something wrong or .... when I checkout via the npm run setup:fem that hits this branch
https://github.com/kentcdodds/starwars-names/tree/FEM/00-scratch

Which only contains a .gitattributes

Thinking the 'open your browser part of the e-mail' which references Todo app is from a different course?

Install after local no TODO site

On second install I have install the Node js version as required but still getting multiple npm warnings and no TODO app on localhost:8080
node version: Your environment has been set up for using Node.js 6.3.1 (x64) and npm.

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]

TypeError: array.every is not a function

When running npm t i get the "TypeError: array.every is not a function" error. My code is very similar to yours.

var expect = require('chai').expect;
var dogBreedNames = require('./index');

describe('Dog breeds?', function () {

    describe('all', function () {

        it('should be a array of strings', function () {
            expect(dogBreedNames.all).to.satisfy(isArrayOfStrings);
            function isArrayOfStrings(array) {
                return array.every(function(item){
                    return typeof item === 'string'
                });
            }
        });

    });

});

and the index.js is the following:

var uniqueRandomArray = require('unique-random-array');
var dogBreedNames = require('./dogs.json');

var getRandomItem = uniqueRandomArray(dogBreedNames);

module.exports = {
    all: dogBreedNames,
    random: uniqueRandomArray(dogBreedNames)
};

function random(number) {
  if (number === undefined) {
    return getRandomItem();
  } else {
    var randomItems = [];
    for (var i = 0; i < number; i++) {
      randomItems.push(getRandomItem());
    }
    return randomItems;
  }
}

Thanks,
-Sohail

Code coverage None

Is not the code coverage badge working properly for Codecov, as I am also getting the same status.

brgds
Sohail

semantic-release fails to install

When I run npm intstall on in starwars-names folder I receive an error message:

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8

npm ERR! Invalid name: "@semantic-release/commit-analyzer"
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/dimasnisarenko/Documents/starwars-names/npm-debug.log

Deprecated ghooks ๐Ÿ‘ด

Hey Kent,

I was following along with the egghead.io course on this and have used husky in place of ghooks

image

image

I also ran into issues with using mocha and chai with istanbul

So decided to try use jest, which didn't go to plan either, I just have a bunch of empty tests I'm skipping now

Is there any chance this will be updated in the future?

badge issue

I saw that your codecov badge from shields.io is working properly now. Min works in the browser and on the shields.io page but github shows it as a broken link :(

This is my shields.io code:

[![Codecov](https:/codecov.io/github/mig-25/Canis-familiaris/badge.svg?style=flat-square)](https://codecov.io/gh/mig-25/Canis-familiaris)

Update repo

Hey, Im trying to follow along from egghead, but the latest versions of babel and istanbul are major changes and cause your egghead series not to work.

starwars-names-FEM-07.0-transpile-source : Cannot use import statement outside a module

python: 3.10.0
node: 16.20.2
branch: starwars-names-FEM-07.0-transpile-source

npx mocha

import uniqueRandomArray from 'unique-random-array'
^^^^^^

SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (/Users/dc/dodds/starwars-names-FEM-07.0-transpile-source/src/index.test.js:4:21)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at /Users/dc/dodds/starwars-names-FEM-07.0-transpile-source/node_modules/mocha/lib/mocha.js:220:27
at Array.forEach ()
at Mocha.loadFiles (/Users/dc/dodds/starwars-names-FEM-07.0-transpile-source/node_modules/mocha/lib/mocha.js:217:14)
at Mocha.run (/Users/dc/dodds/starwars-names-FEM-07.0-transpile-source/node_modules/mocha/lib/mocha.js:485:10)
at Object. (/Users/dc/dodds/starwars-names-FEM-07.0-transpile-source/node_modules/mocha/bin/_mocha:405:18)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47

styleguide

Which do you prefer? .eslint or .jshint single or double quotes etc etc.

Git workflow

I would love to know which git workflow do you use with semantic-release, and basically how do you do this...

Thanks in advance! ๐Ÿ˜„

Course cheat sheet

Hey, @kentcdodds !

First, many thanks for that awesome course!

I'm creating an article based on your course with some reminders for my next open-source projects.

Do you see some problems with this? Can I create this type of material based on your course?

I'm writing the article here, so if you don't agree with this, I'll remove it from my repo.

Thanks in advance!

๐Ÿ˜„

missing prepublish build

Hey I noticed, that you run semantic-release/publish without running npm build first.
Thus if you require the starwars-names npm package somewhere and try to use it, it will not work and tell you Cannot find module 'starwars-names', since the main file defined in the package.json dist/index.js is not there.
I guess adding "prepublish": "npm run build" to the package.json would be sufficient. If you agree I could provide a PR for this.

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.