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

Add a safer output directory config option to replace deprecated setting #106

Merged
merged 7 commits into from
Jun 24, 2022

Conversation

caendesilva
Copy link
Member

@caendesilva caendesilva commented Jun 24, 2022

About

The hyde.site_output_path option was recently deprecated. This update adds an alternative which resolves the relative path within the service provider. This makes it safer to set the output directory to something within the project. If one wants to use an absolute path outside the project that must be done in a service provider, which has now been documented.

Warning
Hyde deletes all files in the output directory before compiling the site. Don't set this path to a directory that contains important files!

If you want to store your compiled website in a different directory than the default _pages, you can change the path using the following configuration option in config/hyde.php. The path is expected to be relative to your project root.

// filepath config/hyde.php
return [
    'output_directory' => 'docs',
];

Setting an absolute path

If you want to store the output website outside your project with an absolute path you may do so at your own risk using a service provider. This is not supported or recommended as it may cause unintentional file deletions.

// filepath Boot method of a service provider
StaticPageBuilder::$outputPath = '/var/www/my-project/';

@codecov
Copy link

codecov bot commented Jun 24, 2022

Codecov Report

Merging #106 (e2ea08b) into master (e0636e5) will decrease coverage by 0.10%.
The diff coverage is 60.00%.

@@             Coverage Diff              @@
##             master     #106      +/-   ##
============================================
- Coverage     99.01%   98.91%   -0.11%     
- Complexity      742      743       +1     
============================================
  Files            95       95              
  Lines          1929     1932       +3     
============================================
+ Hits           1910     1911       +1     
- Misses           19       21       +2     
Impacted Files Coverage Δ
packages/framework/src/HydeServiceProvider.php 93.75% <60.00%> (-6.25%) ⬇️

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 e0636e5...e2ea08b. Read the comment docs.

@caendesilva
Copy link
Member Author

Think it's okay that we lost some coverage since the deprecated method will be removed soon

@caendesilva caendesilva marked this pull request as ready for review June 24, 2022 19:08
@caendesilva caendesilva merged commit 1731672 into master Jun 24, 2022
@caendesilva caendesilva deleted the add_output_directory_config_option branch June 24, 2022 19:08
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