ibm-js / ecma402

ECMA-402 JavaScript Internationalization API "shim"
Other
34 stars 21 forks source link

Test requires sibling projects using specific file names or it fails #73

Open rxaviers opened 9 years ago

rxaviers commented 9 years ago

See PR #74

Test requires installing sibling projects (i.e., it leaks files outside of its root) with specific names or it fails (e.g., if you name your local ecma402 directory my-ecma402, tests will fail).

The suggestion is to use AMD paths mappings, which is more a flexible approach (and less error prone).

cjolif commented 9 years ago

@rxaviers I understand your concern here. However this structure outside of the root is common to all our ibm-js projects in order to avoid projects duplication and works with the overall build system. As far as I know even if not ideal the default paths are working (I mean if you do bower install everything should went fine). And obviously if one wants to install the dependencies differently he can always do using AMD mapping himself? So we should be ok with what we have?

rxaviers commented 9 years ago

So we should be ok with what we have?

  1. Except for the cldr paths that are currently relative and need to be changed to allow AMD path mapping (e.g., from ../cldr/sup... to cldr/sup...). I can reduce this PR to that.
  2. Unless your ibm-js projects use different versions of the same dependency.
cjolif commented 9 years ago
  1. Yes for cldr, as this is a pre-requesite for using cldr-data I guess.
  2. Yep, this is a constraint we indeed have to deal with
clmath commented 9 years ago

For 1) my testing shows that there is no need for a module id to be absolute in order to use paths configuration in requirejs. You can use the following configuration:

requirejs.config({
    paths: {
        "ecma402/cldr": "any/path/to/cldr"
    }
}):

So I am not sure this PR still make sense. Obviously, when we have a solution using cldr-data, we will have to update the path to cldr data so no additional configuration is required but in the meantime I don't see a reason to change that.

rxaviers commented 9 years ago

I'm ok with whatever preference you like here. Although, this is not what I commonly see elsewhere.

In my opinion, libraries should make decisions targeting developers convenience. For example, the simplification of their configuration files.

requirejs.config({
    paths: {
        "cldr": "any/path/to/cldr"
    }
}):

I don't think we want advocate the below.

requirejs.config({
    paths: {
        "ecma402/cldr": "any/path/to/cldr",
        "globalize/cldr": "any/path/to/cldr",
        "foo/cldr": "any/path/to/cldr",
        ...
    }
}):
cjolif commented 9 years ago

@rxaviers I think we agree with you we just say let's wait for the common CLDR problem (cld-data) being solved first?

rxaviers commented 9 years ago

Ok, so we're going to land this together with #66 (and not before as I've initially proposed).

cjolif commented 9 years ago

sounds good.