Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(codegen): add codegen skeleton package #5979

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/@sanity/codegen/.depcheckrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignores": ["@sanity/pkg-utils"]
}
11 changes: 11 additions & 0 deletions packages/@sanity/codegen/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict'

const path = require('path')

const ROOT_PATH = path.resolve(__dirname, '../../..')

module.exports = {
rules: {
'import/no-extraneous-dependencies': ['error', {packageDir: [ROOT_PATH, __dirname]}],
},
}
12 changes: 12 additions & 0 deletions packages/@sanity/codegen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Logs
/logs
*.log

# Coverage directory used by tools like istanbul
/coverage

# Dependency directories
/node_modules

# Compiled code
/lib
3 changes: 3 additions & 0 deletions packages/@sanity/codegen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @sanity/codegen

Codegen toolkit for Sanity.io. This package is currently in an experimental state, and subject to change.
8 changes: 8 additions & 0 deletions packages/@sanity/codegen/jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict'

const {createJestConfig} = require('../../../test/config.cjs')

module.exports = createJestConfig({
displayName: require('./package.json').name,
testEnvironment: 'node',
})
5 changes: 5 additions & 0 deletions packages/@sanity/codegen/package.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {defineConfig} from '@sanity/pkg-utils'

import baseConfig from '../../../package.config'

export default defineConfig(baseConfig)
67 changes: 67 additions & 0 deletions packages/@sanity/codegen/package.json
sgulseth marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name": "@sanity/codegen",
"version": "3.33.0",
"description": "Codegen toolkit for Sanity.io",
"keywords": [
"sanity",
"cms",
"headless",
"realtime",
"content",
"codegen"
],
"homepage": "https://www.sanity.io/",
"bugs": {
"url": "https://github.com/sanity-io/sanity/issues"
},
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/sanity-io/sanity.git",
"directory": "packages/@sanity/codegen"
},
"license": "MIT",
"author": "Sanity.io <[email protected]>",
"exports": {
".": {
"types": "./lib/dts/src/_exports/index.d.ts",
"source": "./src/_exports/index.ts",
"require": "./lib/_exports/index.js",
"node": {
"module": "./lib/_exports/index.esm.js",
"import": "./lib/_exports/index.cjs.mjs"
},
"import": "./lib/_exports/index.esm.js",
"default": "./lib/_exports/index.esm.js"
},
"./package.json": "./package.json"
},
"main": "./lib/_exports/index.js",
"module": "./lib/_exports/index.esm.js",
"source": "./src/_exports/index.ts",
"types": "./lib/dts/src/_exports/index.d.ts",
"files": [
"lib",
"src",
"!**/__tests__/**"
],
"scripts": {
"prebuild": "run-s clean",
"build": "pkg-utils build --tsconfig tsconfig.lib.json",
"postbuild": "run-s check:package",
"check:package": "pkg-utils --strict --tsconfig tsconfig.lib.json",
"clean": "rimraf lib coverage",
"lint": "eslint .",
"watch": "pkg-utils watch --tsconfig tsconfig.lib.json",
"test": "jest"
},
"dependencies": {},
"devDependencies": {
"rimraf": "^3.0.2"
},
"engines": {
"node": ">=18"
}
}
1 change: 1 addition & 0 deletions packages/@sanity/codegen/src/_exports/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const TODO = 1
12 changes: 12 additions & 0 deletions packages/@sanity/codegen/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../../tsconfig.settings",
"include": ["./src/**/*"],
"compilerOptions": {
"composite": true,
"lib": ["ES2022.Error"],
"rootDir": ".",
"outDir": "./lib/dts",
"declarationDir": "./lib/dts"
},
"references": [{"path": "../types/tsconfig.lib.json"}, {"path": "../../groq/tsconfig.lib.json"}]
}
12 changes: 12 additions & 0 deletions packages/@sanity/codegen/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../../tsconfig.settings",
"include": ["./src/**/*"],
"compilerOptions": {
"composite": true,
"lib": ["ES2022.Error"],
"rootDir": ".",
"outDir": "./lib/dts",
"declarationDir": "./lib/dts"
},
"references": [{"path": "../types/tsconfig.lib.json"}, {"path": "../../groq/tsconfig.lib.json"}]
}
33 changes: 33 additions & 0 deletions packages/@sanity/codegen/tsdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
"tagDefinitions": [
{
"tagName": "@hidden",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@todo",
"syntaxKind": "block",
"allowMultiple": true
}
],
"supportForTags": {
"@hidden": true,
"@beta": true,
"@internal": true,
"@public": true,
"@experimental": true,
"@see": true,
"@link": true,
"@example": true,
"@deprecated": true,
"@alpha": true,
"@param": true,
"@returns": true,
"@remarks": true,
"@throws": true,
"@defaultValue": true,
"@todo": true
}
}
6 changes: 6 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{"path": "./packages/@sanity/mutator"},
{"path": "./packages/@sanity/portable-text-editor"},
{"path": "./packages/@sanity/schema"},
{"path": "./packages/@sanity/codegen"},
{"path": "./packages/@sanity/types"},
{"path": "./packages/@sanity/util"},
{"path": "./packages/@sanity/vision"},
Expand Down
Loading