Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Standardize filenames #463

Open
eddiemonge opened this issue Nov 14, 2013 · 30 comments · Fixed by #504
Open

Standardize filenames #463

eddiemonge opened this issue Nov 14, 2013 · 30 comments · Fixed by #504

Comments

@eddiemonge
Copy link
Member

Should all filenames be all lower cased? This is one of the last remaining naming issues I think. Lower casing all file names would solve a few problems.

@sindresorhus
Copy link
Member

I prefer lower case names.

@e-oz
Copy link

e-oz commented Dec 27, 2013

It's so ugly... Why just don't let filenames be as they were submitted in CLI? If I want name all my files somethinglikethatandletthembeugly, I just will submit it in CLI...
Can you please make it configurable?

@eddiemonge
Copy link
Member Author

you could always rename them yourself and update the references. Having them be mixed case caused more problems. lower cased file names are better for web stuffs anyway since most servers are lower case/case insensitive and requiring people to remember mixed case urls is mean

@e-oz
Copy link

e-oz commented Dec 27, 2013

Of course I can, but automation tools should not require manual fixes...
Having them be mixed case caused more problems.
Non-declared breaking changes in tool, that's what cause problems. I had never experienced problems with filenames in this tool before.
most servers are lower case/case insensitive
wrong, most servers are on linux, so in most cases filesystems are case sensitive.
and requiring people to remember mixed case urls is mean
remember url of .js file? lol :) they are usually hidden at all, and names are minified to something like 5sdfd35.js, so I doubt somebody will require users to remember it.

In other words, it's really frustrating change and I'm going to fork and freeze 0.6 version for future usage.

@reneolivo
Copy link

Why enforce lower case? if I, as a developer, want to use lower case, I'd just declare them lower case.

I'm in total agreement with @Jamm

@passy
Copy link
Member

passy commented Jan 8, 2014

I think I agree with not touching the case. Could break existing workflows and if people that prefer lower case can still just pass it like that to the generator.

@stephenplusplus
Copy link
Contributor

+1 to leaveMyCasingAlone.

For #462, and yo angular:controller AuthWidget, shouldn't the generator be able to just append Ctrl to the controller name? When given yo angular:controller Auth-Widget-monkey-Man, does a helper not exist to morph that to "AuthWidgetmonkeyMan"?

And if not, writing one would be at least predictable - we can expect a filename to have dots or dashes. (Not an expert in legal file names, but I don't think we should cater to edge cases)

Yet another option would be displaying a prompt with a few suggestions, and letting the user decide.

Just some ideas. I think maintaining some casing, as it originally was, is less jarring/upsetting than turning CamelCase strings into camelcase.

@eddiemonge eddiemonge reopened this Jan 8, 2014
@eddiemonge
Copy link
Member Author

Reopening this and will add behavior so the file name follows the angular:xyz name. Lets see how many bugs that generates 🎱

@ghost ghost assigned eddiemonge Jan 8, 2014
@e-oz
Copy link

e-oz commented Jan 9, 2014

@eddiemonge filenames shouldn't follows any hardcoded rules, developer should be able to declare name of file (and controller, directive, service) exactly as he wants. If user will create name pfxRemoteIP and your "behavior" will change it to PfxRemoteIp - it will be mistake (2 mistakes).

@eddiemonge
Copy link
Member Author

The issue is that this is a scaffold generator. When you say yo angular:something someName, you aren't specifying a filename; you are specifying the name for that component. Since this is an opinionated tool, it is recommending what the component/filenames should be. You are free to change them after that. In the future (after the configuration milestone) we could look at passing flags to specify exactly what/where you want the file (name) to be.

@e-oz
Copy link

e-oz commented Jan 9, 2014

you aren't specifying a filename
but it's exactly what I expect.
Ok, so mine (and not only) opinion is different. Nothing wrong with it, people should be different.
But please, make it at least configurable.

@frapontillo
Copy link

+1 for keeping the original userSpecifiedCase. I am okay with the yeoman defaults as a thumb rule, but every developer in an existing and consolidated workflow should be able to make his/her own decision.

@addyosmani
Copy link
Member

I think I agree with not touching the case.

👍

@antoinebrault
Copy link

+1 for leaving the decision to the developer.

The lowercase commit introduced a bug too.. scripts declaration in my index.html were not lowercased. Just took me 30 mins to find why they weren't loading.

@kevinsalter
Copy link
Contributor

+1 for leaving the decision to the developer.

The lowercase commit introduced a bug too.. scripts declaration in my index.html were not lowercased. Just took me 30 mins to find why they weren't loading.

I experienced this same problem, script references in index.html are still camel case, not good

@agung-wete
Copy link

+1 for leaving the decision to the developer
+1 to leaveMyCasingAlone.

😄

@eddiemonge
Copy link
Member Author

The bug for this in the current implementation is at #526

tlvince added a commit to tlvince/LMIS-Chrome that referenced this issue Mar 9, 2014
generator-angular currently handles filenames strangely. See:
yeoman/generator-angular#463
@notbrain
Copy link

This is of huge annoyance. Just piling on FWIW - it makes it difficult to add yeoman to a team when you have to mention intricacies like this; "Yeah it will do all this stuff for you but you have to edit it". It's an insipid bug too, since it typically will only surface when you publish to prod (linux) and go from a CI system (OSX) to a case-sensitive one. +1 to revert ASAP, not wait for the "configuration system" to be in place. This BUG was ADDED and is not a feature.

All that's needed is to revert this: https://github.com/yeoman/generator-angular/pull/504/files

@reneolivo
Copy link

I can't believe it's been months and they haven't reverted those changes back. It clearly is the source of many bugs.

@eddiemonge
Copy link
Member Author

The source of the many bugs was the bug that the filename didn't get the same treatment. Thats been fixed in the latest release. Long term, choosing what casing you want to use will be a configuration option.

@e-oz
Copy link

e-oz commented Jun 19, 2014

yo angular:service h5mAnimation
create app/scripts/services/h5manimation.js
create test/spec/services/h5manimation.js

-->

angular.module('html5makerApp')
  .service('H5manimation', function H5manimation() {
    // AngularJS will instantiate a singleton by calling "new" on this function
  });

Bug returned after todays update to yeoman 1.2

@eddiemonge eddiemonge added this to the Rewrite: Testing, Gen 0.17 Support milestone Jul 8, 2014
@ilovett
Copy link

ilovett commented Jul 14, 2014

How about optionally providing the filename? When I have similar name service vs. controllers vs. directives vs. views, I like to have the type in the filename so I can quickly type it in and bring it up in my text editor rather than having to look at which subfolder a list of matching filenames are in...

yo angular:controller my-alerts my-alerts-controller.js
yo angular:factory my-alerts my-alerts-service.js
yo angular:factory my-alert my-alert-class.js
yo angular:directive my-alert my-alert-view.js

@guy-mograbi-at-gigaspaces

Any news about this? I am eager to upgrade but reluctant due to this issue for over half a year now..

@eddiemonge
Copy link
Member Author

this really isnt an upgrade blocking issue. nothing new yet. still slowly working on adding these things in

@ghost
Copy link

ghost commented Sep 29, 2014

I'd like to see a way to specify a file naming pattern. We usually name things with "service" = .srv and "controller" = .ctrl, like this:
data.srv.js = dataService
home.ctrl.js = homeController.

Or at least consistent, like:
yo angular:controller home
yields "controllers/home.js"
yet
yo angular:service home
yields "services/homeservice.js" (should be "services/home.js"?)

@dancancro
Copy link
Contributor

My collection of file naming approaches is in the "Naming conventions" section of this spreadsheet , currently starting on row 195. If you would like to contribute just send me a request to share the doc.

@GuyMograbi
Copy link

I beg to differ - I have a project that used this generator when it supported camel case.
if I upgrade now, half my files are all lower case and the other half are camel case.

I have to say I really don't understand this issue.
After I run grunt build all the files are concatenated into modules.js and such..
the camel case is just for development and for convenience.

My IDE for example supports camel case search for file name.

perhaps the only files you should enforce lower case are the html files.. that I would get..

I would love to help speed up the process. what do I need to do in order to help?

I am visiting this page once a week at least just to check if something changed. I am very eager to see a change in the status.

BTW - I am pretty sure it created a bug. if I do yo angular:controller GuyTest it becomes GuytestCtrl. was this intentional? I have never seen a convention like this in any language.

This bug exists since 0.6.0 - I am forced to downgrade even more.

stevemao pushed a commit to stevemao/generator-angular that referenced this issue Nov 6, 2014
Changes:
- Update jshint task in `Gruntfile.js` to include `serverTest`
- Add `server/.jshintrc-spec` that extends `server/.jshintrc` with spec globals
- Use `"latedef": "nofunc"` instead of `"latedef": true` in `server/.jshintrc`
- Add assertion for `jshint` task in generator tests for `defaultOptions`
- Fix pre exsisting lint errors in `server` and `client`
- Change `getEmail()` in `client/app/account/settings/settings.controller` to use `user` arg and not `$scope.user`

Closes yeoman#463, yeoman#486
@end-user
Copy link

With the latest version, I'm still seeing this with the controller generator. Would very much like a way to specify the case pattern used.

@guy-mograbi-at-gigaspaces

Hi, if anyone is still looking for a camel-case version, I have one on my fork.
https://github.com/guy-mograbi-at-gigaspaces/generator-angular

@70853n
Copy link

70853n commented Jul 2, 2015

As I see this the only problem here is the misleading documentation of generator-angular. It obviously shows an old example where myDirective resulted in myDirective.js

But the actual behavior of the subgenerators makes sense, i.e. the directive name is supposed to be entered in lowercase with hypens as delimiters (e.g. as we do within templates to declare an directive).
That means yo angular:directive my-directive results in my-directive.js and .directive('myDirective', function () {}); which is completely fine.

@eddiemonge eddiemonge removed this from the Rewrite: Testing, Gen 0.17 Support milestone Jul 24, 2015
@eddiemonge eddiemonge removed their assignment Aug 27, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.