mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-07 12:33:36 +09:00
## Description Using ChatGPT, this scripts generates descriptions for CSS properties and declarations (property-value). It uses `keywordValues` from [`src/__generated__/keyword-values.ts`](https://github.com/webstudio-is/webstudio-builder/blob/css-data-descriptions/packages/css-data/src/__generated__/keyword-values.ts) to get a list of all the properties and values. The result is a TS module located at `./src/__generated__/property-value-descriptions.ts` which exports: - properties - declarations By default it generates descriptions only for new properties/values, however you can use the `--forceRegenerate` flag to regenerate everything. When it comes to generating descriptions for declarations whose value is a color eg. `background-color: orange` we generate a description for a generic `property: {color}` declaration (e.g. `background-color: {color}`) and GPT will generate a description template with a placeholder `{color}`. The script then repeats the template for every color value, replacing `{color}`. This is to avoid generating a ton of similar description and wasting GPT tokens. The script needs two env variables: - process.env.OPENAI_KEY - Your OpenAI API key https://platform.openai.com/account/api-keys - process.env.OPENAI_ORG - Your OpenAI Org ID https://platform.openai.com/account/org-settings ## Steps for reproduction Run it ``` OPENAI_KEY=your-key OPENAI_ORG=your-org pnpm build:descriptions ``` ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - review sample descriptions ## Before merging - [x] Get approval on sample descriptions - [x] Generate all the descriptions - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory --------- Co-authored-by: Giuseppe Gurgone <ggurgone@users.noreply.github.com> Co-authored-by: Oleg Isonen <oleg008@gmail.com>
59 lines
1.6 KiB
JSON
59 lines
1.6 KiB
JSON
{
|
|
"name": "@webstudio-is/css-data",
|
|
"version": "0.72.0",
|
|
"description": "CSS Data",
|
|
"author": "Webstudio <github@webstudio.is>",
|
|
"homepage": "https://webstudio.is",
|
|
"type": "module",
|
|
"scripts": {
|
|
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
|
|
"checks": "pnpm typecheck && pnpm lint",
|
|
"dev": "build-package --watch",
|
|
"build": "build-package",
|
|
"build:mdn-data": "tsx ./bin/mdn-data.ts ./src/__generated__ && prettier --write \"./src/__generated__/**/*.ts\"",
|
|
"build:descriptions": "tsx ./bin/property-value-descriptions.ts",
|
|
"dts": "tsc --declarationDir lib/types",
|
|
"lint": "eslint ./src --ext .ts,.tsx --max-warnings 0",
|
|
"test": "NODE_OPTIONS=--experimental-vm-modules jest"
|
|
},
|
|
"devDependencies": {
|
|
"@types/css-tree": "^2.3.1",
|
|
"@webstudio-is/jest-config": "workspace:^",
|
|
"@webstudio-is/scripts": "workspace:^",
|
|
"@webstudio-is/tsconfig": "workspace:^",
|
|
"camelcase": "^6.3.0",
|
|
"html-tags": "^3.2.0",
|
|
"jest": "^29.3.1",
|
|
"mdn-data": "2.0.30",
|
|
"tsx": "^3.12.6",
|
|
"type-fest": "^3.7.1",
|
|
"typescript": "5.1.3",
|
|
"zod": "^3.21.4"
|
|
},
|
|
"peerDependencies": {
|
|
"zod": "^3.19.1"
|
|
},
|
|
"exports": {
|
|
"source": "./src/index.ts",
|
|
"import": "./lib/index.js",
|
|
"require": "./lib/cjs/index.js",
|
|
"types": "./lib/types/index.d.ts"
|
|
},
|
|
"files": [
|
|
"lib/*",
|
|
"src/*",
|
|
"!*.test.*"
|
|
],
|
|
"license": "MIT",
|
|
"private": false,
|
|
"sideEffects": false,
|
|
"dependencies": {
|
|
"colord": "^2.9.3",
|
|
"css-tree": "^2.3.1",
|
|
"hyphenate-style-name": "^1.0.4",
|
|
"openai": "^3.2.1",
|
|
"undici": "^5.22.1",
|
|
"warn-once": "^0.1.1"
|
|
}
|
|
}
|