theme creation + git



  • Hello,

    I try to build a very light child-theme for persona.
    I would like to use git for child-theme versioning.

    So i create a folder nodebb-theme-persona-child in node_modules and init git in it qs i use to do with apache.
    On local, i configure a remote server to push to the folder.

    As i was removing other plugins, i notice lots of error relative to my git folder.
    I understand, we have to use npm to install package. As i am new on node.js, i don't understand how to make it work: use git for versioning and to deploy in production for test.

    Thank you in advance for any help to find the good way to work.
    jb


  • Community Rep

    npm is rather simple, you just need a valid package.json file in your theme folder, then do npm publish inside the theme folder. You'll need to create a new user before the first time you use it, using npm adduser

    Everything in the package.json is published to npm, so you'll want to change the fields related to your new theme. The most important ones are the name and the version.

    Choose these carefully, because once you npm publish, these things can never be undone or even changed.

      "name": "nodebb-theme-yourthemename",
      "version": "4.0.65",
    

    When you need to update your package, change the version number, following semver, and npm publish again.

    Once your package is published, it will take about an hour, and your plugin will be visible on the Download Plugins page in nodebb for you to use in production.



  • @yariplus thank you for this clear answer. I understand better how the package works

    As i understand i have to publish again each time i would like to test a modification. If it takes about one hour, it's not a very efficient workflow, is it? You should not test a lot before publishing.


  • Community Rep

    @j.b.-o. good point.

    The automated process takes about an hour. However, you can update nodebb immediately by running this curl command after you do npm publish

    curl -X PUT https://packages.nodebb.org/api/v1/plugins/nodebb-plugin-yourplugin


  • GNU/Linux

    Normally you don't work directly within the node_modules/ directory. You instead set up your project via npm link (see docs) (or simply use the node_modules/xyz/ as your deployment directory if you have compile steps anyways - grunt/gulp/etc.).

    @j.b.-o. said:

    As i understand i have to publish again each time i would like to test a modification. If it takes about one hour, it's not a very efficient workflow, is it? You should not test a lot before publishing.

    You're always supposed to test locally before publishing.
    When you're done testing you publish and can now update manually on your production device to latest (using npm install nodebb-plugin-your-plugin).
    The update interval of the NodeBB Package Manager (NBBPM) is set to 1 hour, so it might take up to one hour until you're able to install the latest via your Admin Control Panel.
    As @yariplus mentioned you can speed up that step.
    But this should not have anything to do with your development workflow and thus the testing.



  • @yariplus @frissdiegurke thank you very much for these informations. Now i have to test it.


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.