MeteorPackaging / discussions

Ask for Meteor integration help, or discuss Meteor 3rd party library packaging
5 stars 1 forks source link

Package react-router #38

Open eXon opened 8 years ago

eXon commented 8 years ago

@dandv @splendido

I would love to start a repo for an official react-router package (already got the reactrouter MD). I would love to use autopublish and make sure it is solid. I think when the official React.js integration will be released, it will be in huge demand :)

splendido commented 8 years ago

@eXon, is the "react-router" a new project or there's something already existing you'd like to wrap as a Meteor package?

eXon commented 8 years ago

@splendido I would like to wrap it as a Meteor package. It is widely used in the React.js community (more than 150k download last month on NPM alone)

splendido commented 8 years ago

the wrapper could look something like jspdf-core-wrapper. Would you like me to create a repository for you to wrap to original repo?

eXon commented 8 years ago

@splendido

I would rather use the official build on NPM (it's what everybody on React.js is using) instead of building it myself. It is really simple.

I've tested it with a Meteor app I was already using react-router and after a lot of testing, it works perfectly. I would love to publish this ASAP so everybody can have a simple package to use the react-router instead of using tricks.

Here is how I did it:

package.js

Package.describe({
  name: 'reactrouter:react-router',
  version: '0.1.2',
  summary: 'react-router (official): A complete routing solution for React.js',
  git: 'https://github.com/thereactivestack/meteor-react-router.git',
  documentation: 'README.md'
});

Npm.depends({
  'exposify': '0.4.3',
  'react-router': '1.0.0-beta3'
});

Package.onUse(function(api) {
  api.use(['react@0.1.4', 'cosmos:browserify@0.5.0']);

  api.add_files([
    'react-router.browserify.options.json',
    'react-router.browserify.js'
  ]);

  api.export('ReactRouter');
});

react-router.browserify.js

ReactRouter = require('react-router');

ReactRouter.lib = {
  MemoryHistory: require('react-router/lib/MemoryHistory'),
  Location: require('react-router/lib/Location')
};

if (Meteor.isClient) {
  ReactRouter.lib.BrowserHistory = require('react-router/lib/BrowserHistory');
  ReactRouter.lib.HashHistory = require('react-router/lib/HashHistory');
}

client.browserify.options.json

{
  "transforms": {
    "exposify": {
      "global": true,
      "expose": {
        "react": "React"
      }
    }
  }
}

Maybe I can find a way to plug autopublish with that. It would be awesome.

eXon commented 8 years ago

I've pushed a recent version on GitHub https://github.com/thereactivestack/meteor-react-router

All I need is to figure out the autopublish stuff and I think we can make it an official MeteorPackaging repo soon.

splendido commented 8 years ago

Please feel free to prepare a repository following the latest trend as explained here (WIP)

Make sure you get an organization namespace reserved for the new official package and add @dandv, @splendido, @zimme, and whoever else you think should be in among its members.

Once you think you're good to go (which means tests pass...) feel free to publish the package and transfer ownership of your repository to MeteorPackaging. We'll then organize teams and permissions. ...or write a comment here when you think you're ready to get a final review before actual publish.