DEV Community

WangGithub0
WangGithub0

Posted on

Learn and first try on ChatCraft

What is Cloudflare

image

Cloudflare is a global network of servers. When you add your application to Cloudflare, we use this network to sit in between requests and your origin server.

Cloudflare pages - similar to Heroku, Vercel

image
image

How to deploy your website to the Pages platform

  1. Connecting your Git provider to Pages.
  2. Deploying your prebuilt assets right to Pages with Direct Upload.
  3. Using Wrangler from the command line

Image description

  • Wrangler is a command-line tool for building with Cloudflare developer products.
  • Use Wrangler to deploy projects that use the Workers Browser Rendering API.

Using Cloudflare Pages in ChatCraft

image

image

image

image

What's PNpM

Fast, disk space efficient package manager

  • Fast. Up to 2x faster than the alternatives (see benchmark).
  • Efficient. Files inside node_modules are linked from a single content-addressable storage.
  • Great for monorepos.
  • Strict. A package can access only dependencies that are specified in its package.json.
  • Deterministic. Has a lockfile called pnpm-lock.yaml.
  • Works as a Node.js version manager. See pnpm env use.
  • Works everywhere. Supports Windows, Linux, and macOS.
  • Battle-tested. Used in production by teams of all sizes since 2016.
  • See the full feature comparison with npm and Yarn. image image

Motivation

image

image

image

Installation

image

Using PNpM in ChatCraft

image

Reivew PR

I am acquainting myself with the review step and delving into the code of ChatCraft to enhance my understanding of its functionalities. I reviewed Removed non-functioning code from README.sops.md and test small cases about Add Latex Rendering with remark-math and Katex Plugins

Package and ship typescript2openai on npm

In order to produce both ESM and CommonJS versions, as well as TypeScript types, I learned and tried unbuild and used complete example in unjs/template package.json

  "type": "module",
  "exports": {
    ".": {
      "types": "./dist/index.d.ts",
      "import": "./dist/index.mjs",
      "require": "./dist/index.cjs"
    }
  },
  "main": "./dist/index.cjs",
  "module": "./dist/index.mjs",
  "types": "./dist/index.d.ts",
  "files": [
    "dist"
  ],
Enter fullscreen mode Exit fullscreen mode

then I got all builds:

dist
├── index.cjs
├── index.d.cts
├── index.d.mts
├── index.d.ts
└── index.mjs
Enter fullscreen mode Exit fullscreen mode

after run the test workflow, I got fail to install node, so I changed it to directly install pnpm action-setup, at last it ran successfully, need to be reviewed and merged.

Image description

Top comments (0)