My config for using twind/shim
with next.js
, as used for rake.red
Github Gists don't like slashes in names, so be sure to move .twind.config.js
out of the pages
folder.
./twind.config.js
./pages/_app.js
./pages/_document.js
function CommentButtons({ user }) { | |
return ( | |
<div> | |
<Button disabled={user?.can?.edit}>edit</Button> | |
<Button disabled={user?.can?.delete}>delete</Button> | |
<Button disabled={user?.can?.reply}>reply</Button> | |
</div> | |
) | |
} |
const fs = require('fs'); | |
const getModules = projectDir => | |
fs | |
.readdirSync(`${projectDir}/node_modules`) | |
.map(ns => { | |
if (ns[0] === '@') { | |
return fs | |
.readdirSync(`${projectDir}/node_modules/${ns}`) | |
.map(name => `${projectDir}/node_modules/${ns}/${name}/package.json`); |
My config for using twind/shim
with next.js
, as used for rake.red
Github Gists don't like slashes in names, so be sure to move .twind.config.js
out of the pages
folder.
./twind.config.js
./pages/_app.js
./pages/_document.js
import { json } from "next-runtime"; | |
import jwt from "jsonwebtoken"; | |
const SESSION_KEY = "some-secret"; | |
export function readSession(cookies) { | |
const sessionCookie = cookies.get("session"); | |
let data = {}; |
/* eslint-disable @typescript-eslint/no-var-requires */ | |
import { transform } from '@babel/core'; | |
import { exec } from 'child_process'; | |
import { readFileSync } from 'fs'; | |
import { promisify } from 'util'; | |
const execAsync = promisify(exec); | |
const pkg = require('../../package.json'); | |
function importBundle(filepath: string) { |
diff --git a/node_modules/@remix-run/server-runtime/dist/serialize.d.ts b/node_modules/@remix-run/server-runtime/dist/serialize.d.ts | |
index 70ed67b..c77e90b 100644 | |
--- a/node_modules/@remix-run/server-runtime/dist/serialize.d.ts | |
+++ b/node_modules/@remix-run/server-runtime/dist/serialize.d.ts | |
@@ -1,17 +1,31 @@ | |
-import type { Jsonify } from "type-fest"; | |
import type { AppData } from "./data"; | |
import type { TypedDeferredData, TypedResponse } from "./responses"; | |
-type Fn = (...args: any[]) => any; | |
+type JsonPrimitive = string | number | boolean | String | Number | Boolean | null; |
function get(path, obj, fb = `$\{${path}}`) { | |
return path.split('.').reduce((res, key) => res[key] || fb, obj); | |
} | |
function parseTpl(template, map, fallback) { | |
return template.replace(/\$\{.+?}/g, (match) => { | |
const path = match.substr(2, match.length - 3).trim(); | |
return get(path, map, fallback); | |
}); | |
} |
#! /usr/bin/env node | |
import fs from 'fs'; | |
import { promisify } from 'util'; | |
import path from 'path'; | |
import { spawn } from 'child_process'; | |
const fsExists = promisify(fs.exists); | |
if (!process.env.GITHUB_TOKEN) throw new Error("process.env.GITHUB_TOKEN is required"); | |
if (!process.env.GITHUB_USER) throw new Error("process.env.GITHUB_USER is required"); |