Skip to content

Commit

Permalink
feat(codegen): add codegen skeleton package
Browse files Browse the repository at this point in the history
contains just the infrastructure for a new package for codegen
application
  • Loading branch information
sgulseth committed Mar 12, 2024
1 parent 908577e commit dff8b1b
Show file tree
Hide file tree
Showing 14 changed files with 189 additions and 0 deletions.
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.
12 changes: 12 additions & 0 deletions packages/@sanity/codegen/babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
["@babel/preset-env", {"targets": "maintained node versions"}],
[
"@babel/preset-react",
{
"runtime": "automatic"
}
],
"@babel/preset-typescript"
]
}
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)
64 changes: 64 additions & 0 deletions packages/@sanity/codegen/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "@sanity/codegen",
"version": "3.30.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"
},
"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
15 changes: 15 additions & 0 deletions packages/@sanity/codegen/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "../../../tsconfig.settings",
"include": ["./src/**/*"],
"compilerOptions": {
"composite": true,
"lib": ["ES2022.Error"],
"rootDir": ".",
"outDir": "./lib/dts",
"declarationDir": "./lib/dts"
},
"references": [
{"path": "../../@sanity/types/tsconfig.lib.json"},
{"path": "../../groq/tsconfig.lib.json"}
]
}
15 changes: 15 additions & 0 deletions packages/@sanity/codegen/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "../../../tsconfig.settings",
"include": ["./src/**/*"],
"compilerOptions": {
"composite": true,
"lib": ["ES2022.Error"],
"rootDir": ".",
"outDir": "./lib/dts",
"declarationDir": "./lib/dts"
},
"references": [
{"path": "../../@sanity/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

0 comments on commit dff8b1b

Please sign in to comment.