Skip to content
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

Some fixes to get underpin 2.0 working with Nicholas 1.1 #4

Open
josh-tt opened this issue Sep 9, 2022 · 2 comments
Open

Some fixes to get underpin 2.0 working with Nicholas 1.1 #4

josh-tt opened this issue Sep 9, 2022 · 2 comments

Comments

@josh-tt
Copy link

josh-tt commented Sep 9, 2022

After banging my head against the wall all day, I think I was able to finally get Nicholas 1.1 working with Underpin 2.0. It does not work out of the box and there appear to be a few show stoppers.

In Nicholas.php

  1. I think you need the new ::logger
    Header seems to require:
    use Underpin\Loaders\Logger
    Replace the old logger with the new one (not sure if 100% necessary, though was causing errors with other underpin modules like the style loader):
nicholas()->logger()->log_wp_error( 'error', $error, [
			// 	'ref'     => $endpoint,
			// 	'context' => 'endpoint',
			// 	'params'  => $params,
			// ] );

With:
Logger::log_wp_error( 'error', $error, [ 'ref' => $endpoint, 'context' => 'endpoint', 'params' => $params, ] );

  1. The rest endpoints need to have namespace updated to Rest not Rest_Endpoints:
    $this->rest_endpoints()->add( 'page_data', 'Nicholas\**Rest**\Page_Data' );
  2. Not sure, but perhaps use Underpin\Traits\Feature_Extension needs to be in the heade of Rest_Endpoing.php and/or in Nicholas.php? That seemed missing when testing a standard setup based of your demos on the rest_endpoint GitHub page and was throwing an error without it, though I'm not sure if it's required for Nicholas.

Will see tomorrow if that was it or if more fixes required. Cheers.

@alexstandiford
Copy link
Contributor

alexstandiford commented Sep 9, 2022

Okay, so first off I think it’s awesome you have initiated this and I appreciate it!

if you’re interested in working to get Nicholas up-to-date with Underpin, we should talk about 3.0

A lot of the reason why I haven’t moved forward with updating Nicholas is that I made some upgrades in 2.0, but then started development on Underpin 3. 3 is a significant departure, and fixes a lot of the growing pains that I experienced between 1 and 2. Unfortunately, I am but only one mere mortal and only have time to do one thing or the other, so I opted to do 3.0 and leave Nicholas at 1.*.

My intention is to rewrite a lot of Nicholas to use 3.0 at that point, as I have some things that would benefit from this as well.

I’d be interested to hear what’s the motivation for the efforts you’re doing here? Do you see something in 2.0 that you want to use that you can't because of the version of Nicholas you're on? If so, what is it?

@josh-tt
Copy link
Author

josh-tt commented Sep 10, 2022

No worries. I see, that sounds interesting.

Can you please just clarify if v2 of Underpin and Nicholas 1.1 should be working and what show stopper issues there may be with Underpin 2.0 if/any? Or with some minor fixes such as the ones posted above (if they are valid?) should we be solid?

My motivations were simply that after some time I ran a composer update that destroyed things because all the asset deps in the theme repos for Nicholas and Drop C are wrong and I'd forgotten the magic combo to get them fixed and supporting the Nicholas enhancements in v1.0.2. Given that there were some bugs and things I needed to fix and the fact that my package setup was so fragile, I thought perhaps I should just update to v2 of Underpin and Nicholas 1.1 as those seemed to be the most current and try to solve any remaining issues there.

I understand that you're a mere mortal and really appreciate the efforts / work put in to this project:), but you should really try to test things at least once (as a user) before pushing them without at the very least attaching a beta/experimental notice on the pages. Nicholas 1.1 does not work with Underpin 2.0 out of the box, despite the suggestion that it does in git (unless I overlooked something). I've spent a lot of time spent simply trying to sort out installations related to this project, when most of the issues are prob a 5 min fix in the end for you. When you're not a senior dev, it's very hard to know if the problems are due to your lack of understanding or simply bugs. A lot of time can be saved that way and you will get more users behind the project who can help you. Nicholas is a truly clever system with a lot of tricks up its sleeve, it's a shame if something as simple as a lack of testing has held it back. That said, I've learned a lot trying to fix things. :)

My suggestion would be that before moving on to v3, you clean up v2 and v1 (either the docs or the code) if the other projects depend on them. Or, simply put 'experimental/incomplete' flags everywhere to dissuade people from trying to get something working that is broken and to give up at an earlier point and let them know that v3 is in the works. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants