How to modify/edit a Meteor package?

后端 未结 3 825
北恋
北恋 2021-01-04 02:37

I want to run two different Meteor apps on the same server (on different ports) but I want to change something in one of Meteor\'s core packages and I want one app to use th

相关标签:
3条回答
  • 2021-01-04 02:59

    You can get the package's files at the github repo : https://github.com/meteor/meteor/tree/master/packages

    Fetch the files you want except the package.js files and add them to your project. Of note is you need to ensure their loading order sometimes so you might have to modify the file names, to have a look at the loading order have a look at package.js. By default meteor orders file by name but packages don't necessarily use that.

    You can avoid renaming the files if you just mod the package and add it back using meteorite : https://github.com/oortcloud/meteorite

    Full instructions on how to make a smart.json : https://atmosphere.meteor.com/wtf/package. If its anything nice please consider adding it to atmosphere too!

    0 讨论(0)
  • 2021-01-04 03:02

    I have my packages in my user folder at its root as a hidden folder called .meteor.

    Perhaps you can check there? On a mac it would be under:

    ~/.meteor/packages/your package name

    You must also now go into a file there os.json, and change the "length" variable for the file you changed to match the new byte file size. Otherwise it might not compile, but try compiling first and see if its an issue that you changed some package code.

    0 讨论(0)
  • 2021-01-04 03:06

    A bit more straightforward answer, based on answer from here :

    1. Create packages folder in your project and change location to that folder ('cd yourproject' && 'mkdir packages' && 'cd packages')
    2. Fetch files from git ('git clone https://github.com/YOUR_PACKAGE_ADDRESS' - you need to have git installed)
    3. Inside fetched package folder find package.js and edit inside 'Package.describe' name value, for example by adding '-manually-modified'
    4. Edit files you need to modify inside fetched package folder.
    5. Add package to project (meteor add package-name-manually-modified)
    0 讨论(0)
提交回复
热议问题