* Specify if the file is in AMD format. Depending on the answer, have
a way for the client tool to be able to convert to either
Node/CommonJS or AMD format.
* Allow package.json contents to be a comment in a file.
* Allow a single JS file to be registered/used, and do not require
folder structure, separate package.json file, but use that comment as
the package.json contents.
I would also look at what Kris Zyp did with cpm
(https://github.com/kriszyp/cpm) to see what other differences it has
with npm, as they are probably important for AMD modules. Part of that
is probably stamping some sort of config for the web app so that it
can find modules with unusual settings.
So a common approach to modifying an AMD loader's config as part of
the tool might be necessary, but I would really like to have it so
that modules downloaded via the tool are just placed relative to a
baseUrl and that package.json's "main" is not used, so that there
would be no configuration. I'm sure there is a bit of nuance there
though.
In summary: I think an AMD-friendly npm, perhaps just a slightly
tweaked cpm is a nice start. Eventually I would like to see other
tools build on that, to help with initial app scaffolding, but that
can be a second tier goal.
James
I'm not actually sure how you can have one without the other. I suppose you could require that modules be self-hosted, or git-hub hosted (but why limit it to git?), and then the user could specify a complete URL to define where the module should be installed from. This sounds like a simple way around the problem but it means giving up a great deal of control over how the repository is managed. I'd worry that it could lead to a reputation for broken/poor quality modules. What do others think?
Also, James, you mentioned package.json in comments. This is intriguing! Firstly because I wasn't sure if we had decided that the meta format would be the same or an extension/subset of package.json. Would it be confusing to use that established format but then alter it slightly? Or would it be a great benefit to reuse such a familiar standard? And I like the idea of meta data in structured JS comments :)
Michael Mathews
mic...@gmail.com
Agreed, although I think cpm and npm allow just installing from a zip
file. cpm has knowledge of git, and I think that is useful too. In
other words, there should be a distributed option: one that does not
require a registry, it is just that a registry can help make some
things easier.
IIRC, that is how npm works, the registry just tells the client where
to find the bundled code, not necessarily host the bundled code,
although it may allow for that as a bootstrap/helper.
> I'm not actually sure how you can have one without the other. I suppose you could require that modules be self-hosted, or git-hub hosted (but why limit it to git?), and then the user could specify a complete URL to define where the module should be installed from. This sounds like a simple way around the problem but it means giving up a great deal of control over how the repository is managed. I'd worry that it could lead to a reputation for broken/poor quality modules. What do others think?
>
> Also, James, you mentioned package.json in comments. This is intriguing! Firstly because I wasn't sure if we had decided that the meta format would be the same or an extension/subset of package.json. Would it be confusing to use that established format but then alter it slightly? Or would it be a great benefit to reuse such a familiar standard? And I like the idea of meta data in structured JS comments :)
package.json style already has traction, I'm not sure what the other
choice would be. I say use it until we find a problem with it -- it
will allow for easier bootstrapping.
I do not expect to use all of the package.json entries that npm uses,
and we may introduce new properties. I think that is fine. There is
some flexibility in the package.json properties. But I think there are
some properties already in use in a package.json that can just be
picked up and used as-is.
James
On Tue, Oct 11, 2011 at 3:50 PM, Michael Mathews <mic...@gmail.com> wrote:Agreed, although I think cpm and npm allow just installing from a zip
> I think there are two related aspects being discussed here, and both seem important. If I can use CPAN as an analogy, there is (was?) the cpan shell, a command line interface for installing modules, and then there was the CPAN repository, the place where users could search for and distribute modules.
file.
cpm has knowledge of git, and I think that is useful too. In
other words, there should be a distributed option: one that does not
require a registry, it is just that a registry can help make some
things easier.
IIRC, that is how npm works, the registry just tells the client where
to find the bundled code, not necessarily host the bundled code,
although it may allow for that as a bootstrap/helper.
> I'm not actually sure how you can have one without the other. I suppose you could require that modules be self-hosted, or git-hub hosted (but why limit it to git?), and then the user could specify a complete URL to define where the module should be installed from. This sounds like a simple way around the problem but it means giving up a great deal of control over how the repository is managed. I'd worry that it could lead to a reputation for broken/poor quality modules. What do others think?
>package.json style already has traction, I'm not sure what the other
> Also, James, you mentioned package.json in comments. This is intriguing! Firstly because I wasn't sure if we had decided that the meta format would be the same or an extension/subset of package.json. Would it be confusing to use that established format but then alter it slightly? Or would it be a great benefit to reuse such a familiar standard? And I like the idea of meta data in structured JS comments :)
choice would be. I say use it until we find a problem with it -- it
will allow for easier bootstrapping.
I do not expect to use all of the package.json entries that npm uses,
and we may introduce new properties. I think that is fine. There is
some flexibility in the package.json properties. But I think there are
some properties already in use in a package.json that can just be
picked up and used as-is.
James
Right, I wonder if one of the search criteria for a module is also
"environment". I think some version of the commonjs package.json had
an "engine" thing, maybe reuse that. But maybe the query or registry
key should contain module ID + target environment.
> I'd like to get two things out of this:
> * Establish a convention for where resources (including AMD modules) that
> should be exposed to, and used by, browsers go in packages.
> * Make it easy for users to consume AMD modules, whatever server-side
> technology they use. I think it's valuable to take npm modules and make them
> so that all requirejs users can use them in browsers with minimal effort,
> but I also think it would be good for those same people to be able to use
> packages containing only modules authored in AMD. This isn't a goal of NPM
> and I'm not sure if it's a goal of CPM. If not then I'd be up for building
> something that makes the widest range of AMD and CommonJS modules available
> to the widest range of developers.
I think we need to get more familiarity with CPM, I just have not had
time to do so, and expect I will not have time in the near future, but
it is aware of AMD modules. I'm relying more on you all to sort some
of it out.
But I do think it may be as "simple" as:
* take what npm does and how it does its registry, and add a
package.json property that indicates module format, maybe format:
'amd' or moduleFormat: 'amd' (check CPM, it may have something for
this already). Stand up a new registry if the one that CPM uses by
default is not going to work, or work with that registry to work out
the kinks.
* allow the project's package.json to indicate its format, and if
different from the dependency's format, run a conversion.
* Ideally choose modules that work in an "environment" setting in the
project's package.json.
* Look at, and probably tweak, how CPM does the AMD project config
when adding new modules.
It is probably worth reaching out to Kris Zyp at this point, and get
his take on where CPM is at and where it is going. If you like, I can
ask him to join the list, otherwise, feel free to reach out to him
directly.
James
On it.
>
> But I do think it may be as "simple" as:
>
> * take what npm does and how it does its registry, and add a
> package.json property that indicates module format, maybe format:
> 'amd' or moduleFormat: 'amd' (check CPM, it may have something for
> this already). Stand up a new registry if the one that CPM uses by
> default is not going to work, or work with that registry to work out
> the kinks.
> * allow the project's package.json to indicate its format, and if
> different from the dependency's format, run a conversion.
> * Ideally choose modules that work in an "environment" setting in the
> project's package.json.
> * Look at, and probably tweak, how CPM does the AMD project config
> when adding new modules.
I'm in the process of setting up a backlog of requirements, that way we can maintain a list like this more formally.
>
> It is probably worth reaching out to Kris Zyp at this point, and get
> his take on where CPM is at and where it is going. If you like, I can
> ask him to join the list, otherwise, feel free to reach out to him
> directly.
I have already invited Kris to join, about 2 weeks ago, but I'd appreciate if James, you would nudge him. I agree that getting his feedback would be very valuable
* Specify if the file is in AMD format. Depending on the answer, have
a way for the client tool to be able to convert to either
Node/CommonJS or AMD format.
* Allow package.json contents to be a comment in a file.
* Allow a single JS file to be registered/used, and do not require
folder structure, separate package.json file, but use that comment as
the package.json contents.
I'm not sure if I consider the ability to interact with a version control system to be a desirable feature or not. Maybe that's because I expect to perform processing to create a release artefact from the source form (more on that below). Github already exposes urls to get tarballs/zip of tags. How does CPM interact with git?