Skip to content

Instantly share code, notes, and snippets.

View Quramy's full-sized avatar
👾

Yosuke Kurami Quramy

👾
View GitHub Profile
@Quramy
Quramy / README.md
Created February 2, 2024 01:42
Next.js の Experimental Test Mode は何をしているのか

先週に同僚と会話していたときに気になっていた Experimental Test Proxy について。

https://github.com/vercel/next.js/blob/canary/packages/next/src/experimental/testmode/playwright/README.md

mugi さんの素振りメモこの機能が実装された際の PR のコードを読んで、ようやく何が行われているかを理解した。

まず、README にある以下のコードがどこをスタブしているかであるが、

import { test, expect } from "next/experimental/testmode/playwright";
@Quramy
Quramy / index.tsx
Last active April 11, 2024 15:34
Analogy RSC and GraphQL resolver
import { cache } from "react";
import DataLoader from "dataloader";
// backend service clients
import { getPopularPosts, getUserById, getUsers } from "@/services";
const memoizedGetUserById = cache(getUserById);
const getUserLoader = () =>
@Quramy
Quramy / README.md
Created August 3, 2022 08:49
Thinking GraphQL Client cache
@Quramy
Quramy / index.ts
Created June 16, 2021 05:03
Remove unused GraphQL fragment
import assert from "assert";
import { parse, print, DocumentNode, visit } from "graphql";
function removeUnusedFragment(document: DocumentNode) {
const usedFragmentSet = new Set<string>();
// mark used
visit(document, {
FragmentSpread(node) {
usedFragmentSet.add(node.name.value);
@Quramy
Quramy / README.md
Last active March 4, 2021 02:45
TS 4.2
@Quramy
Quramy / mini_calc_interpreter.ts
Last active September 2, 2020 01:03
Mini calc compiler with TS template string types
/**
*
* Mini calc with TypeScript template string types
*
* EBNF
*
* ```
* expr = mul ("+" mul)*
* mul = primary ("*" primary)*
* primary = num | "(" expr ")"
import { Rule } from "eslint";
const rule: Rule.RuleModule = {
create: (context) => {
return {
['NewExpression:not(:has(*.arguments)) > Identifier[name="Date"], CallExpression > MemberExpression:has(Identifier.object[name="Date"]) > Identifier.property[name="now"]']: (node: any) => {
context.report({
message: "Don't use side-effective Date function.",
node,
});
@Quramy
Quramy / main.ts
Last active July 18, 2019 18:29
How to get ESLint result from TypeScript AST using @typescript-eslint/typescript-estree
import * as ts from "typescript";
import { SourceCode, Linter, AST } from "eslint";
import { Extra } from "@typescript-eslint/typescript-estree/dist/parser-options";
import convert from "@typescript-eslint/typescript-estree/dist/ast-converter";
function initExtra() {
return {
tokens: null,
range: false,
loc: false,
@Quramy
Quramy / ama_answers.md
Last active May 20, 2019 02:06
InsideFE2019 A-5のAMAで時間内にできなかった質問に対する回答

実際にBFFの開発向けUIは、開発者以外に使ってもらってどのようなコメントがありましたか?

「便利」と言ってもらえたのがやはり一番うれしかったですね。 別の事例だと、社外のシステムへの外接部分について、必ずしもテスト環境から接続可能とは限らないケースで、API呼び出しをフックできる機能としても使えた、というのが好評でした。

フロントエンドが使いやすいように API を定義することで、バックエンド側の実装に影響を与えてしまうことはありましたか?

BFFの存在意義の1つに「マイクロサービスを開発しやすく」がある以上、なるべくそういうケースとならないように注意はしていますが、満足にできているかはわからないですね。。。 もしかしたら、より良いAPI粒度が存在するのに、バックエンドがある程度我慢してくれている部分もあるかもしれませんね。。。