Skip to content

Instantly share code, notes, and snippets.

View rznewswav's full-sized avatar
🎯
Focusing

rznewswav

🎯
Focusing
View GitHub Profile
@rznewswav
rznewswav / esbuild.config.mjs
Created June 23, 2023 08:39
build from single entrypoint
import * as esbuild from "esbuild";
import esbuildPluginTsc from "esbuild-plugin-tsc";
import path from "path";
import { stat } from "fs/promises";
import ora from "ora";
const main = process.argv.slice(2).find(e => e) ?? "src/main.ts";
const currentFileLocation = import.meta.url.substring("file://".length);
await esbuild.build({
mutation CreateArticle(
# $id: ID!
# "id": "227",
$title: String!
$description: String!
$content: String!
$language: LanguageType!
$topicId: Int!
# $pubTime: DateTime
# "pubTime": "2022-12-01T16:00:00.000Z",
@rznewswav
rznewswav / README.md
Created January 5, 2023 03:16
Local docker cache with base/package.json strategy

When building for the first time, the following build layer will be executed and cached into the local docker build cache. The sample build output can be seen at first-time-build.out

COPY base/* /usr/src/app/
RUN npm install --no-audit

typeof c !== 'undefined' && await c.disconnect(); c = redis.createClient({ socket: { host: process.env.REDIS_HOST }, password: process.env.REDIS_PASSWORD }); await c.connect()
<body style="width: 80%; min-height: 100vh; margin: auto">
<div id="textarea">
<textarea style="resize:vertical; width: 100%;" rows="12" id="colour-space-textarea" oninput="onTextAreaInput()">
</textarea>
<button onclick="onFormat()">Format</button>
</div>
<div id="colour-space-error" style="color: maroon">
</div>
import { mkdirSync, readFileSync, writeFileSync } from 'fs';
import glob from 'glob';
import path from 'path';
const globAsync = (pattern: string): Promise<string[]> =>
new Promise<string[]>((res, rej) =>
glob(pattern, (err, matches) => (err ? rej(err) : res(matches))),
);
const paths = await globAsync('src/**/*.ts');