From 8c93f2008420ac178b1d41b5ce333509d3da7dee Mon Sep 17 00:00:00 2001 From: Philip Nuzhnyi Date: Mon, 3 Feb 2025 15:27:43 +0000 Subject: [PATCH] rebuild using new version with duplicates removal --- deno.json | 2 +- jurassic/clean.test.ts | 4 ++-- jurassic/clean.ts | 4 ++-- jurassic/config.ts | 4 ++-- jurassic/docs.test.ts | 6 +++--- jurassic/docs.ts | 6 +++--- jurassic/export.test.ts | 5 +++-- jurassic/export.ts | 5 +++-- jurassic/jdawg.ts | 3 +-- jurassic/notebooks.test.ts | 4 ++-- jurassic/notebooks.ts | 4 ++-- jurassic/utils.test.ts | 4 ++-- jurassic/utils.ts | 4 ++-- nbs/export.ipynb | 22 +++++++++++++--------- 14 files changed, 41 insertions(+), 36 deletions(-) diff --git a/deno.json b/deno.json index 836da1e..b10d158 100644 --- a/deno.json +++ b/deno.json @@ -1,6 +1,6 @@ { "name": "@jurassic/jurassic", - "version": "0.1.45", + "version": "0.1.46", "license": "MIT", "tasks": { "build": "deno run -A --reload jsr:@jurassic/jurassic/export . && deno task runnbs && deno check . && deno lint && deno fmt && deno task clean && deno test --allow-all --env-file", diff --git a/jurassic/clean.test.ts b/jurassic/clean.test.ts index 40a99f2..78b3ea6 100644 --- a/jurassic/clean.test.ts +++ b/jurassic/clean.test.ts @@ -1,7 +1,7 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: clean.ipynb - import type { RawCell } from "jurassic/notebooks.ts"; import { loadNb, saveNb } from "jurassic/notebooks.ts"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: clean.ipynb + const reprIdRegex = /(<.*?)( at 0x[0-9a-fA-F]+)(>)/; const skipOrSub = (x: string): string => diff --git a/jurassic/clean.ts b/jurassic/clean.ts index 298ef6c..79327cd 100644 --- a/jurassic/clean.ts +++ b/jurassic/clean.ts @@ -1,7 +1,7 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: clean.ipynb - import type { RawCell } from "jurassic/notebooks.ts"; import { loadNb, saveNb } from "jurassic/notebooks.ts"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: clean.ipynb + const reprIdRegex = /(<.*?)( at 0x[0-9a-fA-F]+)(>)/; const skipOrSub = (x: string): string => diff --git a/jurassic/config.ts b/jurassic/config.ts index 20bd62d..c7fc52b 100644 --- a/jurassic/config.ts +++ b/jurassic/config.ts @@ -1,8 +1,8 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: config.ipynb - import { z } from "zod"; import path from "node:path"; import { getNotebooksToProcess } from "jurassic/utils.ts"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: config.ipynb + const configSchema: z.Schema = z.object({ configPath: z.string(), nbsPath: z.string().default("."), diff --git a/jurassic/docs.test.ts b/jurassic/docs.test.ts index 09a9e95..4272063 100644 --- a/jurassic/docs.test.ts +++ b/jurassic/docs.test.ts @@ -1,11 +1,11 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: docs.ipynb - import path from "node:path"; import type { Config } from "jurassic/config.ts"; import { getExportedDefinitions } from "jurassic/utils.ts"; -import { getCellOutput, getNbTitle, loadNb } from "jurassic/notebooks.ts"; import type { Cell, Nb } from "jurassic/notebooks.ts"; +import { getCellOutput, getNbTitle, loadNb } from "jurassic/notebooks.ts"; import { copySync } from "@std/fs"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: docs.ipynb + const wrapCode = (code: string): string => "```typescript\n" + code + "\n```\n"; const processCell = (cell: Cell): string => { diff --git a/jurassic/docs.ts b/jurassic/docs.ts index 2ce0763..362237d 100644 --- a/jurassic/docs.ts +++ b/jurassic/docs.ts @@ -1,11 +1,11 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: docs.ipynb - import path from "node:path"; import type { Config } from "jurassic/config.ts"; import { getExportedDefinitions } from "jurassic/utils.ts"; -import { getCellOutput, getNbTitle, loadNb } from "jurassic/notebooks.ts"; import type { Cell, Nb } from "jurassic/notebooks.ts"; +import { getCellOutput, getNbTitle, loadNb } from "jurassic/notebooks.ts"; import { copySync } from "@std/fs"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: docs.ipynb + const wrapCode = (code: string): string => "```typescript\n" + code + "\n```\n"; const processCell = (cell: Cell): string => { diff --git a/jurassic/export.test.ts b/jurassic/export.test.ts index 9dddba5..ad93d13 100644 --- a/jurassic/export.test.ts +++ b/jurassic/export.test.ts @@ -1,5 +1,3 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: export.ipynb - import path from "node:path"; import { isDirective, loadNb } from "jurassic/notebooks.ts"; import { @@ -7,6 +5,8 @@ import { removeDuplicateImports, } from "jurassic/utils.ts"; import type { Config } from "jurassic/config.ts"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: export.ipynb + const moduleHeader = (moduleName: string): string => `// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: ${moduleName}\n\n`; @@ -37,6 +37,7 @@ const processNb = async ( : "", ]; }; + export const exportNb = async ( notebookPath: string, config: Config, diff --git a/jurassic/export.ts b/jurassic/export.ts index a8721c5..9f0ec14 100644 --- a/jurassic/export.ts +++ b/jurassic/export.ts @@ -1,5 +1,3 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: export.ipynb - import path from "node:path"; import { isDirective, loadNb } from "jurassic/notebooks.ts"; import { @@ -7,6 +5,8 @@ import { removeDuplicateImports, } from "jurassic/utils.ts"; import type { Config } from "jurassic/config.ts"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: export.ipynb + const moduleHeader = (moduleName: string): string => `// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: ${moduleName}\n\n`; @@ -37,6 +37,7 @@ const processNb = async ( : "", ]; }; + export const exportNb = async ( notebookPath: string, config: Config, diff --git a/jurassic/jdawg.ts b/jurassic/jdawg.ts index c449ab2..fb64c58 100644 --- a/jurassic/jdawg.ts +++ b/jurassic/jdawg.ts @@ -1,8 +1,7 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: jdawg.ipynb - import { loadNb } from "jurassic/notebooks.ts"; import { loadEnv, md } from "jurassic/utils.ts"; import Anthropic from "@anthropic-ai/sdk"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: jdawg.ipynb interface Message { role: "assistant" | "user"; diff --git a/jurassic/notebooks.test.ts b/jurassic/notebooks.test.ts index b265ed5..04fb47f 100644 --- a/jurassic/notebooks.test.ts +++ b/jurassic/notebooks.test.ts @@ -1,8 +1,8 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: notebooks.ipynb - import path from "node:path"; import { z } from "zod"; import { findDenoTests } from "jurassic/utils.ts"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: notebooks.ipynb + const cellOutputSchema = z.object({ data: z.record(z.any()).optional(), text: z.union([z.string(), z.array(z.string())]).optional(), diff --git a/jurassic/notebooks.ts b/jurassic/notebooks.ts index d9e8575..0379225 100644 --- a/jurassic/notebooks.ts +++ b/jurassic/notebooks.ts @@ -1,8 +1,8 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: notebooks.ipynb - import path from "node:path"; import { z } from "zod"; import { findDenoTests } from "jurassic/utils.ts"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: notebooks.ipynb + const cellOutputSchema = z.object({ data: z.record(z.any()).optional(), text: z.union([z.string(), z.array(z.string())]).optional(), diff --git a/jurassic/utils.test.ts b/jurassic/utils.test.ts index 117c704..7759afe 100644 --- a/jurassic/utils.test.ts +++ b/jurassic/utils.test.ts @@ -1,8 +1,8 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: utils.ipynb - import path from "node:path"; import * as ts from "typescript"; import { loadSync } from "@std/dotenv"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: utils.ipynb + export const md = async (content: string) => { await Deno.jupyter.display({ "text/markdown": content }, { raw: true }); }; diff --git a/jurassic/utils.ts b/jurassic/utils.ts index 8671e19..5c13cef 100644 --- a/jurassic/utils.ts +++ b/jurassic/utils.ts @@ -1,8 +1,8 @@ -// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: utils.ipynb - import path from "node:path"; import * as ts from "typescript"; import { loadSync } from "@std/dotenv"; +// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: utils.ipynb + export const md = async (content: string) => { await Deno.jupyter.display({ "text/markdown": content }, { raw: true }); }; diff --git a/nbs/export.ipynb b/nbs/export.ipynb index fab943a..f82990d 100644 --- a/nbs/export.ipynb +++ b/nbs/export.ipynb @@ -142,7 +142,7 @@ "import path from 'node:path';\n", "import { isDirective, loadNb } from 'jurassic/notebooks.ts';\n", "import { getNotebooksToProcess, removeDuplicateImports } from 'jurassic/utils.ts';\n", - "import { Config } from 'jurassic/config.ts';\n", + "import type { Config } from 'jurassic/config.ts';\n", "// 🦕 AUTOGENERATED! DO NOT EDIT! File to edit: export.ipynb\n", "\n", "\n", @@ -167,19 +167,21 @@ " // get rid of directives, we want code only\n", " (acc, cell) =>\n", " acc + cell.source.filter((s) => !isDirective(s)).join(\"\"),\n", - " moduleHeader(moduleName)\n", - " )\n", + " moduleHeader(moduleName),\n", + " ),\n", " ),\n", " testCells.length !== 0\n", " ? removeDuplicateImports(\n", - " testCells.reduce(\n", - " (acc, cell) => acc + cell.source.join(\"\"),\n", - " moduleHeader(moduleName)\n", - " )\n", - " )\n", + " testCells.reduce(\n", + " (acc, cell) => acc + cell.source.join(\"\"),\n", + " moduleHeader(moduleName),\n", + " ),\n", + " )\n", " : \"\",\n", " ];\n", "};\n", + "\n", + "\n", "export const exportNb = async (\n", " notebookPath: string,\n", " config: Config,\n", @@ -251,7 +253,7 @@ "\n", " Deno.copyFileSync(\n", " path.resolve(getProjectRoot(), \"nbs/export.ipynb\"),\n", - " `${td}/nbs/export.ipynb`\n", + " `${td}/nbs/export.ipynb`,\n", " );\n", "\n", " await t.step(\"test export\", async () => {\n", @@ -284,6 +286,8 @@ "source": [ "// | export\n", "\n", + "import path from \"node:path\";\n", + "\n", "export const exportNb = async (\n", " notebookPath: string,\n", " config: Config,\n",