thegreenwebfoundation / developer-docs

The developer documentation site for The Green Web Foundations open source libraries.
https://developers.thegreenwebfoundation.org
Apache License 2.0
5 stars 13 forks source link

[WIP] add tutorial on how to use CO2.js within IF #61

Open alexzurbonsen opened 4 months ago

alexzurbonsen commented 4 months ago

Triage

Related issue/s

Please list below any issues this pull request is related to.

Describe the changes made in this pull request

As clearly as possible, describe the changes made in the pull request. You should at least detail "what changes have been made" and "what the results of these changes will be".

alexzurbonsen commented 4 months ago

@fershad This one is not really finished yet, but I want to open it up for review as early as possible.

E.g. I have never used gitpod before and I am wondering if you want to include this here as well? Also there is already a bunch of explanations that can already be reviewed.

But:

fershad commented 2 months ago

Hi @alexzurbonsen thanks for this. I've merged in some redesign work we did on the site late last month.

I'll go through the documentation tomorrow, but:

fershad commented 2 months ago

Hi @alexzurbonsen. I made a few text changes to the tutorial, and tried to run through it myself. I was getting a warning that I need to update to the latest manifest format, however when I tried this I got some errors around "green-web-host" parameter is required.

Could you please help update the example manifest to the latest version.

Once that's done I'm happy to merge this tutorial.

alexzurbonsen commented 2 months ago

Hi @fershad thanks for going over the text! Looks good. Pushed some minor changes.

I think the issue you are getting is because you used the co2js plugin from the if-unofficial-plugins repo. They haven't come around with another release as far as I can see. Currently, the necessary change that deals with the green-web-host parameter is only available on main.

To make it work you would have to uninstall the globally installed version

# verify it is there
npm -g list
# uninstall
npm uninstall -g @grnsft/if-unofficial-plugins

and then get an installation of current main:

git clone https://github.com/Green-Software-Foundation/if-unofficial-plugins.git

and inside the cloned repo

npm install
npm link

This should fix the issue.

But I am not sure that is the state we want it to be when you publish the tutorial? We could also ask the IF folks if they are planning to do another release soon.

alexzurbonsen commented 2 months ago

I am not sure about the version conflicts of the manifest file. I had that as well previously but cannot reproduce it now. What did you do to fix it?

alexzurbonsen commented 1 month ago

Hi @fershad and @mrchrisadams ,

I was playing around with the plugins again and realized that the plugin interface changed substantially in the latest version of IF.

  1. I will need to refactor the plugins a lot.
  2. Who is owning the co2js plugin now? The if-unofficial-plugins repo has been deprecated. There is an info text saying that the plugins have been handed over to external owners. (I need a refactored version of that as well, for the pipeline to work. If it didn't happen yet, I guess I will refactor it sooner or later.)
alexzurbonsen commented 4 weeks ago

@fershad, @mrchrisadams Good news: I refactored the plugins, including the co2js plugin.

There is a new and little bit improved co2js plugin at https://github.com/TNG/if-webpage-plugins/tree/main/src/lib/co2js It now supports the latest co2js version and the SWD model v4.

But I believe this does not need to be owned by our org. Would you be open to owning it in a if-co2js-plugin repo in your org?

fershad commented 3 weeks ago

Hi @alexzurbonsen, thanks for this. There were some conversations a while back about the ownership of the plugins and stuff. I'm not sure what the resolution to that was, I'll check with @mrchrisadams and we'll get back to you.

I think those updates might also help unblock some of the issues I was having running through the tutorial. I'll set aside some time to try again later on this week.

fershad commented 3 weeks ago

@alexzurbonsen I spoke to @mrchrisadams about this, and we'd be able to own the repo. If there's still some things in the readme or code that need tidying up for the new spec, then could you take care of that before transferring ownership to our org?

fershad commented 2 weeks ago

Hi @alexzurbonsen I'm still struggling to get this working on my end as I walk through the tutorial.

After going through the steps, when I run the if-run command I get an output file generated with a status: success value. However, there are no dependencies listed in the output, and there's not outputs block either. It gives the impression that the script is executing but not performing any steps.

When I go into the @tngtech/if-webpage-plugins repo though and run one of the example manifest files, everything works okay.

Are there some more steps that need to be updated in the instructions for this guide?

alexzurbonsen commented 2 weeks ago

Hi @fershad, I didn't touch the tutorial yet. But I guess something will have to be updated there as well. I am about to publish the if-webpage-plugins on npm. That would simplify installation instructions a bit. Thus, I am waiting for that.

As for the co2js plugin: that's nice. I have cleaned everything up to the best of my knowledge. Also added a note, that it was tested with IF v0.7.