Skip to content

Instantly share code, notes, and snippets.

@bm-vs
bm-vs / _ts-fragment-gen.ts
Created April 19, 2024 11:29
sanity.types post processing with fragment generation
import {readFileSync, writeFileSync} from 'fs';
import path from 'path';
type TsAlias = string;
type OriginalFragment = string;
type ClosureMap = Map<TsAlias, OriginalFragment>;
const main = () => {
console.info('Minimizing Sanity types...');
const inputFile = '../sanity/sanity.types.ts';
@bm-vs
bm-vs / internal-reference.groq.ts
Last active April 2, 2024 09:38
Sanity schema and groq queries
import {
Article,
DocumentGroup,
DoorType,
GlassFunction,
GlassOption,
Guide,
GuideArticle,
GuideStep,
InspirationalStory,
@bm-vs
bm-vs / draft.tsx
Last active July 17, 2023 14:07
ArticleListAll RSC
'use client';
// imports
interface Props {
section: ArticleListAllType;
articlesQuery: string;
isDraft: boolean;
}
'use client';
import type {FC} from 'react';
import {usePreview} from 'utils/sanity';
import {PreviewSuspense} from 'next-sanity/preview';
import {ArticleListAllRender} from './render';
import type {ArticleListAllType} from 'schema/page-sections/article-list-all.zod';
interface Props {
section: ArticleListAllType;
@bm-vs
bm-vs / comp.sh
Last active February 19, 2017 13:20
#!/bin/bash
file=$1
if [ ${file: -1} == "t" ]; then
jjtree $file
file=${file%t}
fi
javacc $file
javac *.java
name=${file%.*}
echo "________________________________________________________________________________"