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

Install Theme no matter if the user run the npx create-wp-project command in the wrong folder #820

Conversation

DjidjaleskaSandra
Copy link

@DjidjaleskaSandra DjidjaleskaSandra commented Apr 25, 2024

Description

The task aims to create a Node.js function that identifies the root directory of a WordPress project by searching for the presence of the wp-config.php file. This functionality will facilitate automated processes within the project setup or maintenance scripts, ensuring they execute from the correct directory.

Screenshots / Videos

Screen.Recording.2024-04-25.at.11.09.27.mov

Productive

https://app.productive.io/1-infinum/tasks/7791999

// Check if you are in the required folder.
const { path: requiredPath, isCorrectFolder } = await installPath('themes');

if (!isCorrectFolder) {
Copy link
Member

Choose a reason for hiding this comment

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

The goal is to allow users to set up the project from the root directory, without being required to be inside the theme folder. The installation process will ensure that the theme is placed in the correct location.

So if they setup the project from the root, wp-content, wp-content/plugins no mater the setup should go to the root of the project where the WP-config is set add add the theme to the correct place.

The same thing should work with the plugin flag used for the plugin setup

@codecov-commenter
Copy link

codecov-commenter commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 25.04%. Comparing base (d0906ed) to head (85a6078).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #820   +/-   ##
========================================
  Coverage    25.04%   25.04%           
========================================
  Files           36       36           
  Lines         1206     1206           
  Branches       305      305           
========================================
  Hits           302      302           
  Misses         631      631           
  Partials       273      273           
Flag Coverage Δ
unittests 25.04% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@DjidjaleskaSandra DjidjaleskaSandra changed the title Warn the user if they run the npx create-wp-project command in the wrong folder Install Theme no matter if the user if they run the npx create-wp-project command in the wrong folder Apr 25, 2024
@DjidjaleskaSandra DjidjaleskaSandra changed the title Install Theme no matter if the user if they run the npx create-wp-project command in the wrong folder Install Theme no matter if the user run the npx create-wp-project command in the wrong folder Apr 25, 2024
@@ -36,6 +36,39 @@ exports.handler = async (argv) => {
await clearConsole();
await writeIntro();

const fs = require('fs');

const findProjectRoot = (currentDir) => {
Copy link
Member

Choose a reason for hiding this comment

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

how will this work with the plugin flag?

Copy link
Author

Choose a reason for hiding this comment

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

I think Plugins to be in a separate task, but putting everything together into one PR can also work, especially when the changes are closely connected and won't get confusing. So, we can go ahead with that approach :).

Copy link
Member

@iruzevic iruzevic left a comment

Choose a reason for hiding this comment

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

looking good, please wait for the review from @goranalkovic-infinum

@iruzevic
Copy link
Member

I have used parts of your PR for the new release so I will not merge this but parts of this is in the new release. tnx

@iruzevic iruzevic closed this May 15, 2024
@iruzevic iruzevic deleted the feature/warn-the-user-for-wrong-folder-location branch June 5, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] - Warn the user if they run the npx create-wp-project command in the wrong folder
4 participants