git diff > patch.diff
patch -p1 < patch.diff
import type { ServerBuild } from "@remix-run/node"; | |
import { createRequestHandler } from "@remix-run/server-runtime"; | |
import { serve } from "bun"; | |
import { resolve } from "node:path"; | |
process.env.REMIX_DEV_ORIGIN = "https://localhost"; | |
// @see https://remix.run/docs/en/main/future/vite#migrating-a-custom-server | |
const viteDevServer = | |
process.env.NODE_ENV === "production" |
/** | |
* Main source of cyclic dependencies is previous step where graph is created | |
* Often top-level task has same owner as children tasks | |
* Since we create edge in graph also by same owner that's why there is cyclic deps | |
* | |
* IDEA: mitigate the issue by starting DFS walk from top-level (source) tasks! | |
*/ | |
export const removeCyclicDependencies = ( | |
graph: Graph, | |
tasks: Array<Task> |
const result = (function () { | |
switch (step) { | |
case Step.One: | |
return {one: 1}; | |
case Step.Two: | |
return {two: 2}; | |
case Step.Three: | |
return {three: 4}; | |
} | |
})(); |
export const scheduleTasks = ( | |
inputTasks: Array<Task>, | |
today: Date = getNowDate() | |
): Array<Task> => { | |
const dayBeforeToday = subtractDays(today, 1); | |
const tasks: Array<Task> = inputTasks.map((t) => ({ ...t })); | |
const tasksById: TasksById = Object.fromEntries(tasks.map((t) => [t.id, t])); | |
const graph = makeGraphFromTasks(tasks); | |
let cyclesToFullyUpdateDates = 1; |
export const makeReverseGraph = (graph: Graph): Graph => { | |
const reverseGraph: Graph = new Map(); | |
for (const [id, parentId] of dfs(graph, { withParentId: true })) { | |
const prerequesitions = reverseGraph.get(id) ?? new Set(); | |
if (parentId) { | |
prerequesitions.add(parentId); | |
} | |
reverseGraph.set(id, prerequesitions); | |
} |
export type Task = { | |
id: ID; | |
title: string; | |
start: Date; | |
end: Date; | |
duration: number; | |
/** | |
* Approximation of priority | |
*/ |
/** | |
* Graph respects explicit dependencies | |
* and implicit by resources (via positions) | |
*/ | |
export const makeGraphFromTasks = (tasks: Array<Task>): Graph => { | |
// task and blockedBy | |
const graph: Graph = new Map(); | |
const resourcesTasks = new Map<ID, Array<Task>>(); | |
// Create graphs |
{ | |
"compileOnSave": true, | |
"compilerOptions": { | |
"skipLibCheck": true, | |
/* Basic Options */ | |
"target": "es2018" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */, | |
"module": "es2015" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, | |
"lib": ["es2018", "dom"] /* Specify library files to be included in the compilation. */, | |
// "allowJs": true, /* Allow javascript files to be compiled. */ | |
// "checkJs": true, /* Report errors in .js files. */ |
function DraggableComponent() { | |
const draggableDivRef = useRef<HTMLDivElement>(); | |
const drag$ = useDraggable(draggableDivRef); | |
useEffect(() => { | |
if (!drag$.current) { | |
return () => {}; | |
} | |
const dragSubscription = drag$.current.subscribe(e => { |