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

Check project directories #70

Merged
merged 3 commits into from
Nov 14, 2024
Merged

Check project directories #70

merged 3 commits into from
Nov 14, 2024

Conversation

rafaelDev0ps
Copy link
Contributor

this pull request is related to the issue #2

  1. check if the project directory matches with project name
func HasModuleFile(path string) bool {
	_, err := os.Stat(path)
	return !os.IsNotExist(err)
}

func CheckProjectDirectories(path string) error {
	pagesPath := filepath.Join(path, "pages")
	_, err := os.Stat(pagesPath)
	if err != nil {
		return fmt.Errorf("The directory pages does not exist.")
	}

	partialsPath := filepath.Join(path, "partials")
	_, err = os.Stat(partialsPath)
	if err != nil {
		return fmt.Errorf("The directory partials does not exist.")
	}

	return nil
}
  1. make sure go.mod file of the project created exists
if HasModuleFile(modPath) == false {
	fmt.Fprintf(os.Stderr, "Module not found: go.mod file does not exist.")
	return ""
}

checkDir := CheckProjectDirectories(wd)
if checkDir != nil {
	fmt.Fprintf(os.Stderr, checkDir.Error())
	return ""
}

@rafaelDev0ps
Copy link
Contributor Author

hey @maddalax do you intend to merge this PR?

@maddalax
Copy link
Owner

hey @maddalax do you intend to merge this PR?

yes sorry, will soon

@maddalax
Copy link
Owner

@rafaelDev0ps would you mind removing the partials check actually? I just released a new feature yesterday to where partials can be anywhere in the project, so partials folder is no longer required

@rafaelDev0ps
Copy link
Contributor Author

Sure, I'll update soon

@rafaelDev0ps
Copy link
Contributor Author

@maddalax done ✅

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 45.00000% with 11 lines in your changes missing coverage. Please review.

Project coverage is 57.06%. Comparing base (971f05c) to head (50bb50b).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cli/htmgo/tasks/astgen/entry.go 45.00% 8 Missing and 3 partials ⚠️

❗ There is a different number of reports uploaded between BASE (971f05c) and HEAD (50bb50b). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (971f05c) HEAD (50bb50b)
2 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master      #70       +/-   ##
===========================================
- Coverage   72.86%   57.06%   -15.80%     
===========================================
  Files          33        5       -28     
  Lines        2797      778     -2019     
===========================================
- Hits         2038      444     -1594     
+ Misses        721      307      -414     
+ Partials       38       27       -11     

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

@maddalax maddalax merged commit a1af01a into maddalax:master Nov 14, 2024
3 of 5 checks passed
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

Successfully merging this pull request may close these issues.

2 participants