-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make package.js as tool-agnostic as possible #17
Comments
Another good reason to remove all the webpack stuff, and instead document it, is because all those dependencies add platform-specific build processes that might be unnecessary if the end user isn't using Webpack. I'm getting it running in my Meteor setup using my |
What we can do next is make a react-famous-webpack repo showing how to use react with Webpack, react-famous-browserify, react-famous-jspm, etc. |
@trusktr The way
For your |
Sounds good. So it seems like one of the first things we need to do is move a bunch of the dependencies that you use for development into the "dependencies": {
"famous": "^0.6.0",
"lodash": "^3.4.0",
"react": "^0.13.1"
} and basically everything else will go in |
|
I see you had separated the publish package.json into it's separate folder in tools/publish/cjs. An alternative would be to just put index.js // built
foo.js // built
bar.js // built
src/
index.js // original
foo.js // original
bar.js // original |
JSPM and Webpack users, can then have more flexibility to choose how to process ES6 files, for example. JSPM users can specify that I think the best practice for a cross-build-system structure would be like I've done in infamous, with a single package.json at the root. It might not look as clean inside, but it's build-system agnostic (i.e. tries to accommodate the most build systems in the smallest way possible). |
You'll notice in the infamous package.json the prepublish script that build CommonJS for publishing to npm. I also included the build-* scripts in case anyone else wants a different format. In the README I've set instructions for JSPM, Browserify, and Webpack. |
Another advantage of having the root of the github repo be the root of the react-famous package is that when people want to install your package from git, using npm, then it'll work. It's not possible to specify sub-folders with npm, so when they install react-famous from git, it will install all those dev-dependencies that you have, and they'll have the original sources in the src folder. |
Another thing you could do, if you want to keep a higher-level folder for react-famous, for development, would be to create a separate repo, react-famous-dev, then you can import react-famous as a sub-module. You can also make a folder on your filesystem and just use |
Well, anyways, this weekend or after I'll propose a format to make the package as consumable as possible, via bower, npm, jspm, with webpack, browserify, jspm, etc. If you could make a new repo, react-famous-example, that'd be great. We'll move the examples there and use react-famous as a dependency there. |
👍 On mixed-mode I hope :) |
@jpdesigndev Yep, I'm working on the mixed-mode branch in my fork. PRs soon. :) |
I'm gonna send a PR. The general idea is that the package.json should be agnostic of which tool the user uses. For example, see this package.json file. It is as minimal as possible and aims to support browserify, jspm, webpack. We could even add a description for RequireJS usage, but I think RequireJS is reaching the end of it's days.
That package.json is slightly outdated (using 6to5 instead of babel, old famous, etc) but we can get an idea from it. Basically, the only dependencies are
The only tool specific dependency listed there is
famousify
which was needed for browserify, due to the way browserify works we have no option but to place that independencies
. As for Webpack, we can list the steps needed for the developer to configure Webpack instead of including all the dependencies/loaders in package.json. For example, this README describes how to get up and running with each tooling environment.The text was updated successfully, but these errors were encountered: