Coder Social home page Coder Social logo

dsebastien / modernwebdevgenerator Goto Github PK

View Code? Open in Web Editor NEW
72.0 10.0 13.0 234 KB

A Yeoman generator for Modern Web development projects

License: MIT License

JavaScript 69.59% HTML 3.74% TypeScript 3.50% CSS 23.16%
yeoman-generator yeoman angular

modernwebdevgenerator's Introduction

Modern Web Dev Generator

NPM version Downloads Build Status Coverage Status Dependency Status devDependency Status Gitter License

About

ModernWebDevGenerator is a Yeoman generator that will help you quickly get up and running with ModernWebDevBuild.

Projects created with this Yeoman Generator will be able to directly leverage the awesome Gulp-based build provided by the ModernWebDevBuild project, which includes many tasks and features out of the box (e.g., transpilation of TypeScript/ES2015 to ES5, SASS transpilation to CSS, Minification, Bundling, Code quality & code style checks, Sourcemaps, support for unit testing, ...).

This project comes with a fully working Angular 2 configuration.

This generator includes all the folders & files listed by ModernWebDevBuild as mandatory as well as the recommended ones so as to promote good practices. README.md files are placed in multiple locations to describe what to put where, provide some guidance/design guidelines, ...

The generated projects also include:

  • a working setup of Angular 2 (this might later move to a separate sub-generator)
    • a root component (app/core/boot.ts)
    • a home page (app/pages/home.ts)
    • a basic component router configuration
  • a good HTML5 boilerplate
  • a good SASS & styling starting point
  • an embedded folder structure and design guidelines (componentization, separation of concerns, naming conventions, ...)
  • a set of TypeScript code style/quality rules (tshint.json)
  • a set of ES2015 compliant code style/quality rules (.jscsrc and .jshintrc)
  • ...

The general idea is that you can remove anything you don't need assuming it's not in the list of mandatory folders/files of ModernWebDevBuild (otherwise you'll break the build ^^).

Any feedback/contributions are welcome to improve the project so don't hesitate!

This project is available as an NPM package; check out the usage instructions below.

Demo

Click on this link to see a demo of how to install & use this project and the modern web dev build: ModernWebDev Build and Generator Demo

Background

Please note that this project is heavily inspired from:

Status & roadmap

Check out the issues/labels & milestones to get an idea of what's next. For existing features, refer to the previous sections.

Check out the change log

Usage

In order to use this generator you first need to install Yeoman:

npm install --global yo

Once Yeoman is installed, you can install this generator:

npm install --global generator-modern-web-dev

You will also need to install gulp globally:

npm install --global gulp

Create a new folder, go into it then invoke the generator by running the following command:

yo modern-web-dev

Once you've answered all the questions, the generator will do its thing. Once done, you'll be able to run the development web server and start hacking away using:

npm start

Enjoy!

Note that the ModernWebDevBuild project has other tricks in store for you; be sure to check out the docs.

Options

There are two main approaches to use this generator:

  • interactive mode: the generator asks you all the questions
  • batch mode: you provide the information directly to the generator

In practice nothing prevents you from mixing both though :) If you pass a setting directly to the generator, it will not prompt you for that value.

You can list all the options with a brief description using yo modern-web-dev --help.

By default, the generator will install all project dependencies (not the global requirements listed in the 'Usage' section!). You can skip the installation of the project dependencies by passing the --skip-install option.

The generator will check for updates once in a while but you can disable the update check by passing the following flag: --no-update-notifier.

Generated projects dev dependencies

  • gulp: JavaScript task runner
  • babel: ES2015 to ES5 transpiler. Needed so that the Gulp configuration file can be written using ES2015 (gulpfile.babel.js)
  • nodemon: monitoring of certain files (used by npm scripts defined in package.json): https://www.npmjs.com/package/nodemon

Generated projects runtime dependencies

The following dependencies are managed by JSPM (in the JSPM section of the package.json file):

Generated projects configuration files

The project includes multiple configuration files.

For more details about the configuration files, check out the ModernWebDevBuild's documentation.

Here's some high level information about these:

Adding project dependencies

As you go along, you'll surely need to add new dependencies for your application. If the dependency you want to add is required at runtime, then you should use JSPM to add it. Installing a dependency with JSPM is as simple as jspm install x. For more information about JSPM, check out the official site: http://jspm.io/

Contributing

Take a look at the project's open issues and milestones.

If you know what to do then:

  • Fork the project
  • Create a feature branch in your fork
  • Rebase if needed to keep the project history clean
  • Commit your changes & push to GitHub
  • Try and flood me with pull requests :)

Building from source

If you want to build from source, you need to:

  • install NodeJS (4.2+) and npm (3+)
  • clone this git repository
  • install gulp: npm install --global gulp
  • run npm run setup
  • start hacking :)

Releasing a version

  • commit all changes to include in the release
  • edit the version in package.json
    • respect semver
  • update CHANGELOG.MD
  • commit
  • git tag
  • git push --tags
  • draft the release on GitHub (add description, etc)
  • npm publish

Authors

Sebastien Dubois

License

This project and all associated source code is licensed under the terms of the MIT License.

modernwebdevgenerator's People

Contributors

almex avatar astronaut1712 avatar dsebastien avatar greenkeeperio-bot 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modernwebdevgenerator's Issues

Add sinon.js support

  • add sinon.js support (might be better in the generator along with jasmine & karma-jasmine): better stubbing/spying support
  • check/add/list all required typings (e.g., jasmine, sinon.js)

Add tests

  • generated project content
  • options

angular2-polyfills.js bundle is not available with the dist version

Given that angular2-polyfills is loaded through a script tag:
https://github.com/dsebastien/modernWebDevGenerator/blob/master/app/templates/applicationTemplates/app/index.html#L48

We load it that way as recommended by the Angular team: angular/angular#5980

The issue is that this breaks the current way the build creates the bundle. When the build creates the bundle it uses JSPM and the boot.ts file of the application as entrypoint and loads/bundles dependencies from there.

This way of building eliminated the need to copy files around (fragile) but given the current situation with a2 beta 0, it's broken on our end.

Possible solutions:

  • add an option to the build to specify specific files that should be copied (src/dst)
  • always copy the whole node_modules fs tree (yuck)
  • ?

Improve user experience - project generation speed

Currently, generating a project takes a lot of time because of the large number of dependencies to pull down.

How to limit this?

Some ideas:

  • reorganize the build and how it is installed
  • use npm link assuming a correct version of the build is globally installed (could be part of a pre-req/initial check during project generation)

Rename folders to get closer to the Maven world

To make it easier to incorporate this build within a Java maven build, the folders should be renamed:

  • .tmp -> target
  • app -> src

It doesn't fundamentally change anything in the JS world..

Travis should not run tests twice

When travis starts, we instruct it to run "npm run setup" in the before_install phase.
When that is done, because of the npm install, the prepublish npm script is executed, which builds and tests.

After that travis runs npm test, which builds & runs the unit tests again.

Related: npm/npm#10074

Enable noImplicitAny by default

TypeScript's noImplicitAny should probably be enabled by default to push best practices forward.
Projects can still decide to disable it if it's too much of a burden for them .. :)

Add meta keywords

Add meta name="keywords" and adapt contents based on the section currently displayed (e.g., keywords of the current post)

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.