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

Feature/cli #308

Merged
merged 52 commits into from
Jul 8, 2022
Merged

Feature/cli #308

merged 52 commits into from
Jul 8, 2022

Conversation

iruzevic
Copy link
Member

@iruzevic iruzevic commented Jul 5, 2022

Description

  • WP CLI update, adding parent command names, adding examples, fixing resources, etc.
  • Updating internal links to use helper for paths so it can be used in tests and on real project
  • Fixing tests

Screenshots / Videos

Screenshot 2022-07-05 at 09 23 24 (2)
Screenshot 2022-07-05 at 09 23 24 (3)
Screenshot 2022-07-05 at 09 24 46
Screenshot 2022-07-05 at 10 18 06

iruzevic and others added 2 commits July 5, 2022 11:56
@iruzevic iruzevic added improvement Small improvement fixes, either readability or performance improvements tests Issue regarding tests wpcli Issues regarding WP-CLI labels Jul 5, 2022
@iruzevic iruzevic added this to the Major milestone Jul 5, 2022
@iruzevic iruzevic self-assigned this Jul 5, 2022
@codecov
Copy link

codecov bot commented Jul 5, 2022

Codecov Report

Merging #308 (134bff5) into develop (7bfae64) will increase coverage by 1.46%.
The diff coverage is 84.19%.

@@              Coverage Diff              @@
##             develop     #308      +/-   ##
=============================================
+ Coverage      81.12%   82.58%   +1.46%     
- Complexity      1195     1233      +38     
=============================================
  Files            131      130       -1     
  Lines           3602     3859     +257     
=============================================
+ Hits            2922     3187     +265     
+ Misses           680      672       -8     
Flag Coverage Δ
unittests 82.58% <84.19%> (+1.46%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/CustomPostType/PostTypeExample.php 100.00% <ø> (ø)
src/CustomTaxonomy/TaxonomyExample.php 100.00% <ø> (ø)
src/Geolocation/GeolocationExample.php 85.71% <ø> (ø)
src/Init/InitAllCli.php 0.00% <0.00%> (ø)
src/Media/UseWebPMediaCli.php 0.00% <0.00%> (-28.58%) ⬇️
src/Rest/Routes/LoadMore/LoadMoreRouteCli.php 0.00% <0.00%> (-22.23%) ⬇️
src/WpCli/WpCliExample.php 44.44% <ø> (ø)
src/Db/DbImport.php 46.87% <13.51%> (+30.20%) ⬆️
src/Manifest/AbstractManifest.php 57.14% <50.00%> (-19.05%) ⬇️
src/Init/InitBlocksCli.php 55.55% <55.55%> (ø)
... and 89 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7bfae64...134bff5. Read the comment docs.

@iruzevic iruzevic requested a review from a team July 5, 2022 11:39
src/Build/BuildExample.php Outdated Show resolved Hide resolved
src/Cli/README.md Outdated Show resolved Hide resolved
tests/WpCli/WpCliTest.php Outdated Show resolved Hide resolved
src/Build/BuildCli.php Outdated Show resolved Hide resolved
src/Blocks/UseAssetsCli.php Outdated Show resolved Hide resolved
Copy link
Contributor

@dadadavorin dadadavorin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, amazing work! 🤩 Found few typos/grammar improvements...

src/Cli/Cli.php Outdated Show resolved Hide resolved
src/Cli/Cli.php Outdated Show resolved Hide resolved
src/Cli/ParentGroups/CliBoilerplate.php Outdated Show resolved Hide resolved
src/GitIgnore/GitIgnoreCli.php Outdated Show resolved Hide resolved
src/Helpers/StoreTrait.php Outdated Show resolved Hide resolved
src/Init/InitThemeCli.php Outdated Show resolved Hide resolved
src/Init/InitThemeCli.php Outdated Show resolved Hide resolved
src/Init/InitThemeCli.php Outdated Show resolved Hide resolved
src/Init/InitThemeCli.php Outdated Show resolved Hide resolved
tests/Helpers.php Outdated Show resolved Hide resolved
iruzevic and others added 2 commits July 6, 2022 09:02
Co-authored-by: Denis Žoljom <[email protected]>
Co-authored-by: Davorin Prislin <[email protected]>
@iruzevic iruzevic requested a review from dingo-d July 7, 2022 10:56
Copy link
Contributor

@iobrado iobrado left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most impressive PR 👏 I left suggestions to fix some typos I stumbled upon.

src/Blocks/AbstractBlocksCli.php Outdated Show resolved Hide resolved
src/Blocks/AbstractBlocksCli.php Outdated Show resolved Hide resolved
src/Blocks/AbstractBlocksCli.php Outdated Show resolved Hide resolved
src/Blocks/AbstractBlocksCli.php Outdated Show resolved Hide resolved
src/Blocks/AbstractBlocksCli.php Outdated Show resolved Hide resolved
src/Cli/AbstractCli.php Outdated Show resolved Hide resolved
src/Cli/README.md Outdated Show resolved Hide resolved
src/Init/InitBlocksCli.php Outdated Show resolved Hide resolved
src/Init/InitBlocksCli.php Outdated Show resolved Hide resolved
tests/Init/InitBlocksCliTest.php Outdated Show resolved Hide resolved
@iruzevic iruzevic requested a review from iobrado July 7, 2022 13:19
dadadavorin
dadadavorin previously approved these changes Jul 7, 2022
Copy link
Contributor

@dadadavorin dadadavorin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍 Just found a few typos..

src/Blocks/AbstractBlocksCli.php Outdated Show resolved Hide resolved
'longdesc' => "
'longdesc' => $this->prepareLongDesc("
## USAGE

This file is a main entrypoint for all our block editor setup.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This file is a main entrypoint for all our block editor setup.
This file is a main entry point for all our block editor setup.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"for all our block editor setup" also doesn't tell much, maybe rephrase that part as well

src/Blocks/UseAssetsCli.php Outdated Show resolved Hide resolved
class UseAssetsCli extends AbstractBlocksCli
{
/**
* Get WPCLI command parent name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Get WPCLI command parent name
* Get WP-CLI command parent name

}

/**
* Get WPCLI command name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Get WPCLI command name
* Get WP-CLI command name

}

/**
* Paths join
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Paths join
* Paths join.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Paths join
* Join paths.

#wordOrderMatters

<?php

/**
* Class that registers WPCLI command initial setup for all.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Class that registers WPCLI command initial setup for all.
* Class that registers WP-CLI command initial setup for all.

];

/**
* Get WPCLI command parent name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Get WPCLI command parent name.
* Get WP-CLI command parent name.

}

/**
* Get WPCLI command name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Get WPCLI command name.
* Get WP-CLI command name.

}

/**
* Get WPCLI command doc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Get WPCLI command doc.
* Get WP-CLI command doc.

Copy link
Collaborator

@mbmjertan mbmjertan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed files changed, apart from tests, as it's been quite a task to review this. Congratulations, this was an amazing endeavor. I've left some comments about phrasing, and some tips for a potentially better approach in some places, but I don't take issue with this code. Great work.

$sep = \DIRECTORY_SEPARATOR;
$pathName = self::PATH_WRAPPER;
$manifestPath = "{$this->getBlocksFolderPath()}{$pathName}{$sep}manifest.json";
$path = Components::getProjectPaths('blocksDestinationWrapper', "manifest.json");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I know this is a pet peeve, but let's be consistent 😄

Suggested change
$path = Components::getProjectPaths('blocksDestinationWrapper', "manifest.json");
$path = Components::getProjectPaths('blocksDestinationWrapper', 'manifest.json');


$root = $this->getProjectRootPath();
$rootNode = $this->getFrontendLibsBlockPath();
$isFile = \strpos($name, '.') !== false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a valid assumption to have on UNIX systems, e.g. /etc/hosts is a file. All files that'll be moved probably have an extension, but this is not a valid way to check whether something is a file.

Rather use is_file and pass the file path to it.

self::cliError(
\sprintf(
// translators: %s will be replaced with type of item, and shorten cli path.
"%s files exist on this path: `%s`. If you want to override the destination folder please use --skip_existing='true' argument.",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does skip_existing=true imply you want to override the existing files? I would assume the opposite to be the case (skip_existing=false to override them, skip_existing=true to... well, skip them)

$this->cliLog(
\sprintf(
// translators: %s will be replaced with type of item.
\esc_html__("We have found that this %s has dependencies, please run these commands also if you don't have it in your project:", 'eightshift-libs'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
\esc_html__("We have found that this %s has dependencies, please run these commands also if you don't have it in your project:", 'eightshift-libs'),
\esc_html__("This %s has dependencies. To resolve dependencies, if they aren't already resolved, run:", 'eightshift-libs'),

'longdesc' => "
'longdesc' => $this->prepareLongDesc("
## USAGE

This file is a main entrypoint for all our block editor setup.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"for all our block editor setup" also doesn't tell much, maybe rephrase that part as well

Comment on lines +126 to +127
$this->cliLog('We have moved everything we have to your project. Please type `npm start` in your terminal to kickstart your assets bundle process.', "M");
$this->cliLog('Happy developing!', "M");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like this?

Suggested change
$this->cliLog('We have moved everything we have to your project. Please type `npm start` in your terminal to kickstart your assets bundle process.', "M");
$this->cliLog('Happy developing!', "M");
$this->cliLog('It\'s done! All of the initial setup for Eightshift Development Kit has finished. Please run `npm start` in your terminal to kickstart your asset bundling process.', "M");
$this->cliLog('Happy development!', "M");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have created an issue for this #310

src/Init/InitBlocksCli.php Outdated Show resolved Hide resolved
Comment on lines +183 to +186
if (!$groupOutput) {
$this->cliLog('--------------------------------------------------');
$this->cliLog('We have moved everything you need to start creating WordPress blocks. Please type `npm start` in your terminal to kickstart your assets bundle process.', "M");
$this->cliLog('Happy developing!', "M");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As previously

Comment on lines +128 to +132
if (!$groupOutput) {
$this->cliLog('--------------------------------------------------');
$this->cliLog('We have moved everything you need to start creating your awesome WordPress project. Please type `npm start` in your terminal to kickstart your assets bundle process.', "M");
$this->cliLog('Happy developing!', "M");
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

Comment on lines +134 to +140

if (!$groupOutput) {
$this->cliLog('We have moved everything you need to start creating your awesome WordPress theme. Please type `npm start` in your terminal to kickstart your assets bundle process.', "M");
$this->cliLog('Happy developing!', "M");
}
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

iruzevic and others added 6 commits July 8, 2022 08:50
Co-authored-by: Mario Borna Mjertan <[email protected]>
Co-authored-by: Mario Borna Mjertan <[email protected]>
Co-authored-by: Mario Borna Mjertan <[email protected]>
Co-authored-by: Mario Borna Mjertan <[email protected]>
Co-authored-by: Mario Borna Mjertan <[email protected]>
@iruzevic iruzevic merged commit 579221d into develop Jul 8, 2022
@iruzevic iruzevic deleted the feature/cli branch July 8, 2022 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Small improvement fixes, either readability or performance improvements tests Issue regarding tests wpcli Issues regarding WP-CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants