GithubHelp home page GithubHelp logo

js-seed's Introduction

js-seed

Dependency Status devDependency Status

JS-Seed is a starter project for JavaScript apps and packages that you can use to bootstrap new JavaScript projects quickly.

This project contains a sample application with the following features:

  • SASS for CSS templating
  • JavaScript ES6 example module
  • React example module
  • Gulp 4 for builds
  • Uglify for JavaScript compression
  • Mocha for unit tests and E2E tests

Our goal is to help developers build JavaScript apps and packages from the ground up using current best practices. If you have suggestions for how to improve js-seed please create a GitHub issue or submit a pull request.

Directory structure

js-seed
├── README.md
├── build-targets
│   ├── e2e-tests.js
│   ├── seed-react.js
│   └── seed.js
├── dist
│   ├── css
│   │   ├── seed.css
│   │   └── seed.min.css
│   ├── js
│   │   ├── seed.js
│   │   └── seed.min.js
│   └── react
│       ├── seed-react.js
│       └── seed-react.min.js
├── e2e-tests
│   ├── index.html
│   └── tests.js
├── examples
│   ├── assets
│   │   ├── js-seed
│   │   │   ├── css
│   │   │   │   ├── seed.css
│   │   │   │   └── seed.min.css
│   │   │   ├── js
│   │   │   │   ├── seed.js
│   │   │   │   └── seed.min.js
│   │   │   └── react
│   │   │       ├── seed-react.js
│   │   │       └── seed-react.min.js
│   │   └── vendor
│   │       ├── babel-standalone
│   │       │   └── 7.2.0
│   │       │       ├── babel.js
│   │       │       └── babel.min.js
│   │       └── react
│   │           └── 16.6.3
│   │               ├── react-dom.js
│   │               └── react.js
│   ├── js.html
│   └── react.html
├── gulpfile.js
├── main.js
├── package-lock.json
├── package.json
├── src
│   ├── js
│   │   └── button.js
│   ├── react
│   │   └── button.jsx
│   └── sass
│       ├── _variables.scss
│       └── style.scss
└── test
    ├── js-tests
    │   └── test-button.js
    ├── lib
    │   └── react-helpers.js
    ├── mocha.opts
    └── react-tests
        └── test-button.js

Dependencies

Quickstart

  1. Download a copy of js-seed

    $ wget https://github.com/amorey/js-seed/archive/master.zip
    $ unzip master.zip
    $ cd js-seed-master
  2. Install nodejs dependencies

    $ npm install
  3. Build examples

    $ ./node_modules/.bin/gulp examples

To view the example you can use any static file server. To use the nodejs http-server module:

$ npm install http-server
$ ./node_modules/.bin/http-server -p 8081

Then visit http://localhost:8081/examples/.

example

If everything worked properly, when you click on the button an alert message will pop up.

  1. Watch for changes

    $ ./node_modules/.bin/gulp watch

Re-build the examples anytime a sass file a js file changes.

Creating production builds

To create a production build of the app, run gulp dist:

$ ./node_modules/.bin/gulp dist

The build will be located in the dist directory:

dist/
|-- css
|   |-- js-seed.css
|   `-- js-seed.min.css
`-- js
    |-- js-seed.js
    `-- js-seed.min.js

To deploy the app just copy the dist directory to a location of your choosing.

Node.js entrypoint

The skeleton is configured to export a nodejs module via the main.js file. The file can be modified to expose other functionality. Here's an example of how to download js-seed from GitHub and use it as a nodejs module:

$ npm install git@amorey/js-seed
$ nodejs
> var jsSeed = require('js-seed');
> jsSeed.message();
js-seeeeed!

Unit tests

The skeleton is configured to use Jest (https://facebook.github.io/jest/) for unit testing. To run the unit tests install jest-cli then run jest:

$ npm install jest-cli
$ ./node_modules/.bin/jest
Found 1 matching test...
PASS  __tests__/lib-test.js (0.017s)
1 test passed (1 total)
Run time: 0.784s

js-seed's People

Contributors

amorey avatar

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.