-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
92 additions
and
90 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[build] | ||
path_prefix = "oranda" | ||
|
||
[styles] | ||
theme = "axodark" | ||
favicon = "https://www.axo.dev/favicon.ico" | ||
|
||
[marketing] | ||
analytics = { plausible = { domain = "opensource.axo.dev" }} | ||
|
||
[marketing.social] | ||
image = "https://www.axo.dev/meta_small.jpeg" | ||
image_alt = "axo" | ||
twitter_account = "@axodotdev" | ||
|
||
|
||
|
||
[components] | ||
changelog = true | ||
|
||
[components.artifacts.package_managers.preferred] | ||
npm = "npm install @axodotdev/oranda --save-dev" | ||
cargo = "cargo install oranda --locked --profile=dist" | ||
|
||
[components.artifacts.package_managers.additional] | ||
npx = "npx @axodotdev/oranda" | ||
binstall = "cargo binstall oranda" | ||
nix-env = "nix-env -i oranda" | ||
"nix flake" = "nix profile install github:axodotdev/oranda" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,61 @@ | ||
use axoasset::SourceFile; | ||
use camino::Utf8PathBuf; | ||
use schemars::JsonSchema; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::errors::*; | ||
|
||
use super::{BuildLayer, ComponentLayer, MarketingLayer, ProjectLayer, StyleLayer, WorkspaceLayer}; | ||
|
||
/// Configuration for `oranda` (typically stored in oranda.json) | ||
#[derive(Debug, Serialize, Deserialize, JsonSchema)] | ||
#[serde(deny_unknown_fields)] | ||
pub struct OrandaLayer { | ||
/// Info about the project/application you're making a site for | ||
/// | ||
/// All of these values should automatically be sourced from your Cargo.toml or package.json | ||
/// whenever possible. You should only need to set these if you want to override the value. | ||
pub project: Option<ProjectLayer>, | ||
/// Settings for the build/output of the site | ||
pub build: Option<BuildLayer>, | ||
/// Settings for social/marketing/analytics | ||
pub marketing: Option<MarketingLayer>, | ||
/// Settings for themes/styles of the site | ||
pub styles: Option<StyleLayer>, | ||
/// Additional optional components | ||
pub components: Option<ComponentLayer>, | ||
/// Workspace configuration | ||
pub workspace: Option<WorkspaceLayer>, | ||
/// Field that text-editors can use to fetch the schema for this struct | ||
/// | ||
/// We never use this, but we don't want to error out if its set. | ||
#[serde(rename = "$schema")] | ||
pub _schema: Option<String>, | ||
} | ||
|
||
impl OrandaLayer { | ||
pub fn load(config_path: &Utf8PathBuf) -> Result<Option<OrandaLayer>> { | ||
let config_result = SourceFile::load_local(config_path.as_path()); | ||
|
||
match config_result { | ||
Ok(config) => { | ||
let data: OrandaLayer = config.deserialize_json()?; | ||
Ok(Some(data)) | ||
} | ||
Err(_) => { | ||
tracing::debug!("No config found, using default values"); | ||
Ok(None) | ||
} | ||
} | ||
} | ||
} | ||
use axoasset::SourceFile; | ||
use camino::Utf8PathBuf; | ||
use schemars::JsonSchema; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::errors::*; | ||
|
||
use super::{BuildLayer, ComponentLayer, MarketingLayer, ProjectLayer, StyleLayer, WorkspaceLayer}; | ||
|
||
/// Configuration for `oranda` (typically stored in oranda.json) | ||
#[derive(Debug, Serialize, Deserialize, JsonSchema)] | ||
#[serde(deny_unknown_fields)] | ||
pub struct OrandaLayer { | ||
/// Info about the project/application you're making a site for | ||
/// | ||
/// All of these values should automatically be sourced from your Cargo.toml or package.json | ||
/// whenever possible. You should only need to set these if you want to override the value. | ||
pub project: Option<ProjectLayer>, | ||
/// Settings for the build/output of the site | ||
pub build: Option<BuildLayer>, | ||
/// Settings for social/marketing/analytics | ||
pub marketing: Option<MarketingLayer>, | ||
/// Settings for themes/styles of the site | ||
pub styles: Option<StyleLayer>, | ||
/// Additional optional components | ||
pub components: Option<ComponentLayer>, | ||
/// Workspace configuration | ||
pub workspace: Option<WorkspaceLayer>, | ||
/// Field that text-editors can use to fetch the schema for this struct | ||
/// | ||
/// We never use this, but we don't want to error out if its set. | ||
#[serde(rename = "$schema")] | ||
pub _schema: Option<String>, | ||
} | ||
|
||
impl OrandaLayer { | ||
pub fn load(config_path: &Utf8PathBuf) -> Result<Option<OrandaLayer>> { | ||
let mut config_path = config_path.to_owned(); | ||
if config_path.extension() == Some("json") { | ||
if config_path.exists() { | ||
let config = SourceFile::load_local(config_path.as_path())?; | ||
return Ok(Some(config.deserialize_json()?)); | ||
} else { | ||
// Temporary hack | ||
config_path.set_extension("toml"); | ||
} | ||
} | ||
if !config_path.exists() { | ||
tracing::debug!("No config found, using default values"); | ||
return Ok(None); | ||
} | ||
if config_path.extension() == Some("toml") { | ||
tracing::warn!("!!!Using toml config!!!!"); | ||
let config = SourceFile::load_local(config_path.as_path())?; | ||
return Ok(Some(config.deserialize_toml()?)); | ||
} | ||
|
||
tracing::debug!("No config found, using default values"); | ||
Ok(None) | ||
} | ||
} |