Code Monkey home page Code Monkey logo

generator-jquery's Introduction

Welcome, Friend!

Yeoman is a robust and opinionated set of tools, libraries, and a workflow that can help developers quickly build beautiful, compelling web apps.

image

Code of Conduct

Everyone in this community (from core members to random committers and volunteers) are asked to please act in accordance with the Yeoman Community Contributor Code of Conduct. We encourage you to follow these social rules which help guide our interactions with each other, and ensure we provide a safe environment for everyone. We aim to make Yeoman a positive, welcoming, open and inclusive project and community.

Code of Conduct

Issue Submission

Make sure you've read the issue submission guidelines before you open a new issue.

Yeoman is composed of a number of different sub-projects, most of which have their own dedicated repository. If you are looking for a repo for a particular piece, you'll find it on the organization page.

Feature requests

Feature requests should be submitted to the repo it concerns. Submit to yeoman/yeoman if you're unsure, otherwise the repositories for our officially maintained generators can be found here.

Contribute

See the contributing docs

Support

Need help or have a question?

Please don't use the issue trackers for support/questions.

Links

Team

Yeoman is beautifully crafted by these people and a bunch of awesome contributors

Addy Osmani Sindre Sorhus Pascal Hartig Stephen Sawchuk Simon Boudrias
Addy Osmani Sindre Sorhus Pascal Hartig Stephen Sawchuk Simon Boudrias
Brian Ford Eddie Monge Paul Irish Hemanth.HM Revath S Kumar
Brian Ford Eddie Monge Paul Irish Hemanth.HM Revath S Kumar
Jimmy Moon Frederick Ros Mickael Daniel Eric Bidelman Matija Marohnić
Jimmy Moon Frederick Ros Mickael Daniel Eric Bidelman Matija Marohnić
Kevin Mårtensson Arthur Verschaeve Michael Kühnel Mehdy Dara Ulises Gascon
Kevin Mårtensson Arthur Verschaeve Michael Kühnel Mehdy Dara Ulises Gascon

Backers

Love Yeoman work and community? Help us keep it alive by donating funds to cover project expenses!
[Become a backer]

License

BSD license Copyright (c) Google

generator-jquery's People

Contributors

addyosmani avatar appleboy avatar arthurvr avatar eddiemonge avatar fidel-karsto avatar hakatashi avatar hemanth avatar hueitan avatar jeremyckahn avatar jtt48 avatar kevva avatar passy avatar radkodinev avatar ruyadorno avatar sboudrias avatar sindresorhus avatar tomfuertes avatar zakdoek avatar zenorocha 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

Watchers

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

generator-jquery's Issues

Options in collection method?

Hi!
The generator scaffolds out a collection method, a static method, default options for the static method and a custom selector. In order to use the static method's default options in the collection method, I'm guessing I'd pass an options argument and then do options = $.extend({}, $.myplugin.options, options); like is done in the static method?

If so, this should maybe be clarified (or options passed to the collection method as they're currently done to the static method). I'm not a total neophyte in terms of writing jQuery plugins, but I found the scaffolded code confusing enough to stop me for a moment...

Add method types question

Right now, due to its really basic usage of grunt-jquery-init, it seems generator-jquery doesn't fully leverage the power of Yeoman to scaffold out the desired plugin.

For instance, if all you want to build is a collection-based plugin, the static method and selector methods will be unpopulated and probably ultimately removed. In fact, if you've never coded a jQuery plugin and are looking to the generator with the intent of learning best practices, the extra methods might even be confusing.

One solution would be to add a prompt asking which scaffolds the user wants added to name.js. If this is desirable, let me know and I'll write a pull request later.

Thanks!

Path to qunit.(css|js) has changed (again?)

In the generator template for the .html file, the path to qunit resources are set to "../bower_components/qunit/qunit.js" and "../bower_components/qunit/qunit.css"

This seems to have changed. QUnit (v1.11.0) now contains three subfolders addons, qunit and test.
So the path needs to be updated to:

"../bower_components/qunit/qunit/qunit.js"
"../bower_components/qunit/qunit/qunit.css"

No big deal, but not easy to spot when it's late at night. ;)

Error in Uglify configuration

In the generated Gruntfile the configuration for uglify is as follows:

uglify: { options: { banner: '<%= banner %>' }, dist: { src: '<%= concat.dist.dest %>', dest: 'dist/jquery.<%= pkg.name %>.min.js' } },

I believe uglify.dist.src should be <%= concat.dist.src %>

Integrate some good practises from jQuery Boilerplate

According to the docs for jQuery Boilerplate, there're two simple changes that could be added to improve performance and compatibility:

  1. Add a semicolon before the enclosure to prevent issues with script minification and concatenation
  2. Pass window and undefined to the enclosure, improving resolution time slightly.

Any thoughts? Will write a pull request if this is thought to be desirable.

Broken syntax in generated script

By default, the generated source JavaScript has syntax errors.

yo jquery vanilla
// ...
grunt

And I get this output:

Running "jshint:gruntfile" (jshint) task

✔ No problems


Running "jshint:src" (jshint) task

src/yo-jquery-vanilla.js
  line 10  col 9   Expected an identifier and instead saw '='.
  line 18  col 6   Expected an identifier and instead saw '='.
  line 20  col 30  Expected an identifier and instead saw '.'.
  line 26  col 5   Expected an identifier and instead saw '.'.
  line 31  col 16  Expected an identifier and instead saw '='.

  ✖  5 errors  ⚠  0 warnings

Warning: Task "jshint:src" failed. Use --force to continue.

Aborted due to warnings.

because

cat src/yo-jquery-vanilla.js

/*
 * 
 * 
 *
 * Copyright (c) 2015 
 * Licensed under the MIT license.
 */
(function ($) {
  // Collection method.
  $.fn. = function () {
    return this.each(function (i) {
      // Do something to each selected element.
      $(this).html('' + i);
    });
  };

  // Static method.
  $. = function (options) {
    // Override default options with passed-in options.
    options = $.extend({}, $..options, options);
    // Return the name of your plugin plus a punctuation character.
    return '' + options.punctuation;
  };

  // Static method default options.
  $..options = {
    punctuation: '.'
  };

  // Custom selector.
  $.expr[':']. = function (el) {
    return $(el).text() === 'awesome test markup';
  };
}(jQuery));

Tests w/ jQuery ~> 1.11: ReferenceError: Can't find variable: jQuery

Not sure what the best way to fix this in context is, but if you bower install jQuery ~> 1.11, jquery.js is moved into a dist subdir and causes the default install tests to fail

$ yo jquery -v
1.1.2

$ npm list -g | grep generator-jquery
├─┬ [email protected]

# SNIPPED: `yo jquery` # fill out form w/ 1.10.2

$ grunt test
# ... snip / success ...

$ find bower_components | grep /jquery.js$
bower_components/jquery/jquery.js
bower_components/jquery/test/jquery.js

$ bower install jquery#1.11.0
# ... snip success ...

$ find bower_components | grep /jquery.js$
bower_components/jquery/dist/jquery.js
bower_components/jquery/src/jquery.js

$ grunt test
# ... snip successes ...

Running "qunit:all" (qunit) task
Testing http://localhost:9000/test/a.html FFF
>> global failure
>> Message: ReferenceError: Can't find variable: jQuery
>> http://localhost:9000/src/a.js:38

>> global failure
>> Message: ReferenceError: Can't find variable: jQuery
>> http://localhost:9000/test/a_test.js:62

>> global failure
>> Message: ReferenceError: Can't find variable: jQuery
>> http://localhost:9000/test/a.html:17

Warning: 3/3 assertions failed (21ms) Use --force to continue.

Aborted due to warnings.

grunt default error

the default grunt task shows an error with phantomjs because connect is missing (compare to "test" task):

wrong:

grunt.registerTask('default', ['jshint', 'qunit', 'clean', 'concat', 'uglify']);

correct:

grunt.registerTask('default', ['jshint', 'connect', 'qunit', 'clean', 'concat', 'uglify']);

Gracefully handle offline

I get this error when i'm trying to install using "yo jquery"

/usr/lib/node_modules/generator-jquery/app/index.js:52
if (!available.bower && !available.npm) {
^
TypeError: Cannot read property 'bower' of undefined
at /usr/lib/node_modules/generator-jquery/app/index.js:52:23
at /usr/lib/node_modules/generator-jquery/node_modules/pkg-name/index.js:25:4
at callback (/usr/lib/node_modules/generator-jquery/node_modules/pkg-name/node_modules/each-async/each-async.js:54:12)
at /usr/lib/node_modules/generator-jquery/node_modules/pkg-name/node_modules/each-async/each-async.js:23:7
at /usr/lib/node_modules/generator-jquery/node_modules/pkg-name/index.js:16:5
at /usr/lib/node_modules/generator-jquery/node_modules/pkg-name/node_modules/npm-name/index.js:14:5
at ClientRequest. (/usr/lib/node_modules/generator-jquery/node_modules/pkg-name/node_modules/npm-name/node_modules/got/index.js:47:5)
at ClientRequest.g (events.js:180:16)
at ClientRequest.emit (events.js:95:17)
at HTTPParser.parserOnIncomingClient as onIncoming

Test plugin against multiple jQuery versions?

(my first contribution to open source, hope I'm doing everything right. Sorry if I don't!)

When testing my plugin using the basic QUnit testcase I get, I feel like I'm not really testing well. My plugin is only getting tested against the jQuery version I gave up although it should test on every supported version. For example if I say my plugin supports 1.9 and later, I want it to be tested on:

  • 1.9 and all its patch releases
  • 1.10 and all its patch releases
  • 1.11 and all its patch releases
  • 2 and all its patch releases
  • 2.1 and all its patch releases
  • jQuery 3.0 via the git cdn they have, so I'm sure my plugin doesn't break when they release.
  • jQuery 3.0 compat via the git cdn they have, so I'm sure my plugin doesn't break when they release.

I know that jQuery UI and jQuery Mobile have CI setup to test this, but I have not dug into how they do that. Sorry therefor but I'm not that of a grunt pro.

If I'm going way too in here or am just asking for way to complicated stuff sorry. If you don't want to integrate this into the main templates, maybe consider a recipe similar to other generators? Thank you for this generator and thanks for building Yeoman.

Dependency to generator-generator version ~0.12.2 causes error since yo 1.0.3

This is just for documentation if anyone stumbles upon this error:

TypeError: Cannot read property 'bold' of undefined
    at Object.<anonymous> (/usr/local/lib/node_modules/generator-jquery/node_modules/yeoman-generator/lib/util/common.js:5:56)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/generator-jquery/node_modules/yeoman-generator/lib/base.js:91:26)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)

The cause was fixed in yeoman-generator 0.13.3, and dependency to that version was updated in generator-jquery 0.0.4, which isn't published yet.

Workaorund until then is to clone the latest version locally and do a

git clone https://github.com/yeoman/generator-jquery.git
cd generator-jquery
npm link

see also yeoman/generator-webapp#137

Status

Where are we in terms of the rewrite's completeness compared to grunt-init-jquery? Are we currently still waiting to land the new prompts system before making changes? I've been holding off on making changes for this latter part otherwise I think we could work on wrapping and testing all of these ports up next week. Sound good?

`yo jquery` error.

Generator version: 1.1.0
I'm using proxy.

Run yo jquery, always press ENTER, got an undefined before the welcome message:

undefined"Project Name" should not contain "jquery" or "js" and should be a unique ID not already in use at plugins.jquery.com. "Project title" should be a human-readable title, and doesn't need to contain the word "jQuery", although it may. For example, a plugin titled "Awesome Plugin" might have the name "awesome-plugin".

Then got the ERROR:

/usr/local/lib/node_modules/generator-jquery/app/index.js:47
          if (!available.npm || !available.bower) {
                        ^
TypeError: Cannot read property 'npm' of undefined
    at /usr/local/lib/node_modules/generator-jquery/app/index.js:47:25
    at /usr/local/lib/node_modules/generator-jquery/node_modules/pkg-name/index.js:25:4
    at callback (/usr/local/lib/node_modules/generator-jquery/node_modules/pkg-name/node_modules/each-async/index.js:33:4)

After canceled the proxy, the ERROR gone, but this.yeoman still got undefined, before the welcome message.

Make it less awesome

As nice and straight-forward as the example code generated is, everything is "awesome". This thus requires the user to go through and replace every instance of "awesome" with whatever they called their plugin.

Without changing anything else in the generated code, changing "awesome" to whatever the user enters into the initial prompt would greatly improve the utility and ease-of-use of this generator.

Let me know if you want a pull request... Thanks!

Can't Install Generator Properly, Always got some error.

Running "qunit:all" (qunit) task
Testing http://localhost:9000/test/jquery.html FFFF

jQuery#awesome - is chainable
Message: Died on test #1 at http://localhost:9000/bower_components/qunit/qunit/qunit.js:425
at http://localhost:9000/test/jquery_test.js:34
at http://localhost:9000/test/jquery_test.js:62: 'undefined' is not a function (evaluating 'this.elems.awesome()')
TypeError: 'undefined' is not a function (evaluating 'this.elems.awesome()')

jQuery#awesome - is awesome
Message: Died on test #1 at http://localhost:9000/bower_components/qunit/qunit/qunit.js:425
at http://localhost:9000/test/jquery_test.js:39
at http://localhost:9000/test/jquery_test.js:62: 'undefined' is not a function (evaluating 'this.elems.awesome()')
TypeError: 'undefined' is not a function (evaluating 'this.elems.awesome()')

jQuery.awesome - is awesome
Message: Died on test #1 at http://localhost:9000/bower_components/qunit/qunit/qunit.js:425
at http://localhost:9000/test/jquery_test.js:47
at http://localhost:9000/test/jquery_test.js:62: 'undefined' is not a function (evaluating '$.awesome()')
TypeError: 'undefined' is not a function (evaluating '$.awesome()')

jQuery.awesome - is awesome
Message: Expected 2 assertions, but 1 were run
at http://localhost:9000/bower_components/qunit/qunit/qunit.js:425
at http://localhost:9000/test/jquery_test.js:47
at http://localhost:9000/test/jquery_test.js:62

:awesome selector - is awesome
Message: Died on test #1 at http://localhost:9000/bower_components/qunit/qunit/qunit.js:425
at http://localhost:9000/test/jquery_test.js:60
at http://localhost:9000/test/jquery_test.js:62: Syntax error, unrecognized expression: unsupported pseudo: awesome
Error: Syntax error, unrecognized expression: unsupported pseudo: awesome

Warning: 5/5 assertions failed (243ms) Use --force to continue.

Aborted due to warnings.

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.