Skip to content

Commit

Permalink
✨ feat(radar): big commit
Browse files Browse the repository at this point in the history
radar update, commit and release tooling, ds tooling, rust cli adr tool
  • Loading branch information
alanpcurrie committed Nov 29, 2023
1 parent 7df3688 commit ed58112
Show file tree
Hide file tree
Showing 39 changed files with 3,674 additions and 2,126 deletions.
1 change: 1 addition & 0 deletions .eslintrc.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
extends: [
"plugin:astro/recommended",
"prettier"
],
overrides: [
{
Expand Down
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,14 @@ pnpm-debug.log*

# env files
*.env

# Compiled files
/target/

# Rustdoc documentation
/doc/
/build/

# Debugger configuration
/.vscode/
/.idea/
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test
1 change: 1 addition & 0 deletions .prettierrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/** @type {import("prettier").Config} */
export default {
plugins: ['prettier-plugin-astro'],
printWidth: 140,
overrides: [
{
files: '*.astro',
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
{
}
"typescript.tsdk": "node_modules/typescript/lib"
}
34 changes: 23 additions & 11 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,36 @@ import { defineConfig } from 'astro/config';
import tailwind from "@astrojs/tailwind";
import { vanillaExtractPlugin } from "@vanilla-extract/vite-plugin";
import react from '@astrojs/react';
import solid from '@astrojs/solid-js';
import mdx from "@astrojs/mdx";
import remarkToc from 'remark-toc';
import rehypePresetMinify from 'rehype-preset-minify'

// https://astro.build/config
export default defineConfig({
output: 'static',
integrations: [tailwind(), react(), mdx(
{
optimize: true,
syntaxHighlight: 'shiki',
shikiConfig: { theme: 'dracula' },
remarkPlugins: [remarkToc],
rehypePlugins: [rehypePresetMinify],
remarkRehype: { footnoteLabel: 'Footnotes' },
gfm: false,
}
)],
integrations: [
tailwind(),
mdx(
{
optimize: true,
syntaxHighlight: 'shiki',
shikiConfig: { theme: 'dracula' },
remarkPlugins: [remarkToc],
rehypePlugins: [rehypePresetMinify],
remarkRehype: { footnoteLabel: 'Footnotes' },
gfm: false,
}
),
// react(),
react({
include: ['**/react/*'],
}),
solid({
include: ['**/solid/*'],
})
]
,
vite: {
plugins: [vanillaExtractPlugin()]
}
Expand Down
3 changes: 3 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
94 changes: 94 additions & 0 deletions create_markdown.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#!/usr/bin/env rust-script
//! This is a regular crate doc comment, but it also contains a partial
//! Cargo manifest. Note the use of a *fenced* code block, and the
//! `cargo` "language".
//!
//! ```cargo
//! [dependencies]
//! chrono = "0.4"
//! colored = "2.0"
//! indoc = "2"
//! ```
use chrono::Utc;
use colored::*;
use dialoguer::Input;
use indoc::indoc;
use std::env;
use std::fs;
use std::io::Write;
use std::path::PathBuf;

fn main() {
let current_dir = env::current_dir().unwrap();
println!("Current directory: {}", current_dir.display());

let file_name = env::args().nth(1).unwrap_or_else(|| {
eprintln!("{}", "Error: Please specify a file name".red());
std::process::exit(1);
});

let adrs_dir = match env::var("ADRS_DIR") {
Ok(val) => PathBuf::from(val),
Err(_) => PathBuf::from("../src/pages/adrs"),
};

let file_path = adrs_dir.join(format!("{}.mdx", &file_name));

fs::create_dir_all(&adrs_dir).unwrap_or_else(|e| {
eprintln!("{}", format!("Failed to create directory: {}", e).red());
std::process::exit(1);
});

let context = Input::<String>::new()
.with_prompt("Enter Context")
.interact_text()
.unwrap_or_else(|e| handle_error_and_exit(format!("Failed to read Context: {}", e)));

let decision = Input::<String>::new()
.with_prompt("Enter Decision")
.interact_text()
.unwrap_or_else(|e| handle_error_and_exit(format!("Failed to read Decision: {}", e)));

let consequences = Input::<String>::new()
.with_prompt("Enter Consequences")
.interact_text()
.unwrap_or_else(|e| handle_error_and_exit(format!("Failed to read Consequences: {}", e)));

let content = format!(
indoc! {"
---
title: \"{}\"
date: \"{}\"
---
# {}
## Context
## Decision
## Consequences
"},
file_name,
Utc::now().format("%Y-%m-%dT%H:%M:%S%.3fZ"),
file_name,
context,
decision,
consequences
);

let mut file = fs::File::create(&file_path).unwrap_or_else(|e| {
eprintln!("{}", format!("Failed to create file: {}", e).red());
std::process::exit(1);
});
file.write_all(content.as_bytes()).unwrap_or_else(|e| {
eprintln!("{}", format!("Failed to write to file: {}", e).red());
std::process::exit(1);
});

println!(
"ADR MDX file created at {}",
file_path.display().to_string().green()
);
}
54 changes: 50 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,37 @@
"start": "astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"prettier": "prettier --write . --plugin=prettier-plugin-astro",
"astro": "astro",
"test": "vitest",
"create:adr": "node createAdr.js"
"test": "vitest --run",
"test:watch": "vitest",
"create:adr": "node createAdr.js",
"prepare": "husky install",
"commit": "cz",
"cargo:build": "cd rust_adr_gen && cargo build",
"cargo:run": "cd rust_adr_gen && cargo run"
},
"dependencies": {
"@apollo/client": "^3.8.6",
"@astrojs/check": "^0.3.1",
"@astrojs/mdx": "^1.1.4",
"@astrojs/react": "^3.0.4",
"@astrojs/solid-js": "^3.0.2",
"@astrojs/tailwind": "^5.0.2",
"@astrojs/ts-plugin": "^1.2.0",
"@capsizecss/core": "^3.1.1",
"@capsizecss/metrics": "^1.2.0",
"@capsizecss/vanilla-extract": "^1.0.0",
"@dessert-box/react": "^0.7.5",
"@nanostores/logger": "^0.2.4",
"@nanostores/persistent": "^0.9.1",
"@nanostores/react": "^0.7.1",
"@radix-ui/themes": "^2.0.0",
"@observablehq/plot": "^0.6.11",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"@vanilla-extract/css": "^1.13.0",
"@vanilla-extract/css-utils": "^0.1.3",
"@vanilla-extract/dynamic": "^2.1.0",
"@vanilla-extract/recipes": "^0.5.1",
"@vanilla-extract/sprinkles": "^1.6.1",
"@vanilla-extract/vite-plugin": "^3.9.0",
Expand All @@ -46,28 +56,64 @@
"@visx/zoom": "^3.3.0",
"astro": "^3.5.2",
"chalk": "^5.3.0",
"chroma-js": "^2.4.2",
"d3-scale-chromatic": "^3.0.0",
"fp-ts": "^2.16.1",
"nanostores": "^0.9.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rehype-preset-minify": "^7.0.0",
"remark-toc": "^9.0.0",
"solid-js": "^1.8.5",
"tailwindcss": "^3.3.5",
"ts-pattern": "^5.0.5",
"typescript": "^5.2.2",
"typescript": "^5.3.2",
"vitest": "^0.34.6"
},
"devDependencies": {
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@tailwindcss/typography": "^0.5.10",
"@types/chroma-js": "^2.4.3",
"@types/d3-scale-chromatic": "^3.0.2",
"@typescript-eslint/parser": "^6.9.0",
"commitizen": "^4.3.0",
"commitlint-config-git-commit-emoji": "^1.0.0",
"cz-conventional-changelog": "3.3.0",
"cz-emoji": "1.3.2-canary.2",
"cz-emoji-conventional": "^1.0.2",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-astro": "^0.29.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"husky": "^8.0.0",
"prettier": "^3.0.3",
"prettier-plugin-astro": "^0.12.1"
},
"engines": {
"node": ">=18.0.0"
},
"config": {
"commitizen": {
"path": "node_modules/cz-emoji-conventional"
}
},
"release": {
"analyzeCommits": "semantic-release-conventional-commits",
"path": "semantic-release-conventional-commits",
"majorTypes": [
"major",
"breaking"
],
"minorTypes": [
"feat",
"minor"
],
"patchTypes": [
"fix",
"patch"
],
"mergePattern": "/^Merge pull request #(\\d+) from (.*)$/",
"mergeCorrespondence": "['id', 'source']"
}
}
Loading

0 comments on commit ed58112

Please sign in to comment.