Skip to content

Commit

Permalink
build: use @sanity/pkg-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
mariuslundgard authored and rexxars committed Sep 23, 2022
1 parent e38e2d7 commit 2778e0c
Show file tree
Hide file tree
Showing 211 changed files with 1,132 additions and 3,664 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js → .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/* eslint-disable strict */

'use strict'

module.exports = {
root: true,
parser: '@typescript-eslint/parser',
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/etl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
CYPRESS_INSTALL_BINARY: '0'
run: yarn install

- name: Build TypeScript definitions
run: yarn type-check
- name: Build packages
run: yarn build

- name: Extract API docs
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/exports-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
id: buildResolver
run: yarn build

- name: ES check
id: esCheck
run: yarn exports:check
- name: Check package integrity
id: checkPackages
run: yarn check:packages

# - name: Notify Slack about build failure
# if: failure() && github.ref == 'refs/heads/ui/main'
Expand Down
3 changes: 2 additions & 1 deletion babel.config.js → babel.config.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable no-sync, strict */
/* eslint-disable no-sync */
/* eslint-disable strict */

'use strict'

Expand Down
5 changes: 0 additions & 5 deletions bin/.eslintrc

This file was deleted.

3 changes: 0 additions & 3 deletions bin/pkg-utils

This file was deleted.

2 changes: 0 additions & 2 deletions dev/design-studio/.eslintignore

This file was deleted.

2 changes: 1 addition & 1 deletion dev/design-studio/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"jsx": "react",
"outDir": "./lib/dev"
},
"references": [{"path": "../../packages/sanity"}]
"references": [{"path": "../../packages/sanity/tsconfig.lib.json"}]
}
1 change: 1 addition & 0 deletions dev/test-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"devDependencies": {
"@sanity/cli": "3.0.0-dev-preview.20",
"@types/history": "^4.7.9",
"chokidar": "^3.5.3",
"http-server": "^14.0.0",
"vite": "^3.0.0"
}
Expand Down
4 changes: 2 additions & 2 deletions dev/test-studio/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"isolatedModules": false
},
"references": [
{"path": "../../packages/@sanity/types"},
{"path": "../../packages/@sanity/vision"},
{"path": "../../packages/@sanity/types/tsconfig.lib.json"},
{"path": "../../packages/@sanity/vision/tsconfig.lib.json"},
{"path": "../../packages/sanity/tsconfig.lib.json"}
]
}
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/* eslint-disable strict */
/* eslint-disable tsdoc/syntax */

'use strict'

const JEST_PROJECTS = [
'sanity',
'@sanity/block-tools',
Expand Down
16 changes: 16 additions & 0 deletions package.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {defineConfig} from '@sanity/pkg-utils'

export default defineConfig({
dist: 'lib',
extract: {
rules: {
// Disable this rule until `@microsoft/api-extractor` properly supports multiple exports
'ae-forgotten-export': 'off',

'ae-incompatible-release-tags': 'warn',
'ae-internal-missing-underscore': 'warn',
'ae-missing-release-tag': 'warn',
},
},
minify: false,
})
41 changes: 8 additions & 33 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
"private": true,
"isSanityMonorepo": true,
"name": "sanity-root",
"bin": {
"sanity-pkg-bundle": "./bin/pkg-utils bundle",
"sanity-pkg-transpile": "./bin/pkg-utils transpile"
},
"workspaces": [
"dev/*",
"examples/*",
Expand All @@ -16,11 +12,12 @@
],
"scripts": {
"bootstrap": "yarn install && yarn build:dts && yarn build:cli",
"build": "yarn build:dts && lerna run --scope '{@sanity/*,sanity}' build",
"build:cli": "lerna run --scope '@sanity/{cli,export,import,mutator,server,types,util}' --scope sanity build",
"build:dts": "tsc --build",
"build": "lerna run --scope '{@sanity/*,groq,sanity}' build",
"build:cli": "run-s build",
"build:dts": "tsc --build tsconfig.lib.json",
"check:packages": "lerna run check:package",
"clean": "lerna run --scope '{@sanity/*,groq,sanity}' clean",
"clean:deps": "rimraf packages/@sanity/*/node_modules packages/sanity/node_modules node_modules",
"clean:deps": "rimraf packages/@sanity/*/node_modules packages/*/node_modules node_modules",
"check:versions": "node scripts/normalizeDependencyVersions.js",
"cypress:open": "cypress open --config-file cypress/cypress.json",
"cypress:run": "cypress run --config-file cypress/cypress.json",
Expand All @@ -40,9 +37,6 @@
"dev:test-studio": "yarn --cwd dev/test-studio dev",
"eslint": "eslint --ext=.js,.jsx,.mjs,.ts,.tsx --quiet",
"etl": "cd scripts/etl && node -r dotenv-flow/config -r esbuild-register main",
"exports:check": "lerna run exports:check",
"exports:clean": "lerna run exports:clean",
"exports:generate": "lerna run exports:generate",
"init": "lerna clean --yes && run-s bootstrap build",
"lerna:clean": "lerna clean",
"lint": "yarn eslint .",
Expand Down Expand Up @@ -73,22 +67,12 @@
"watch": "lerna run --parallel --scope '{@sanity/*,sanity}' watch"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/parser": "^7.17.7",
"@babel/plugin-proposal-class-properties": "^7.16.0",
"@babel/preset-env": "^7.16.4",
"@babel/preset-react": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@babel/register": "^7.16.0",
"@babel/runtime": "7.16.3",
"@babel/preset-env": "^7.19.0",
"@babel/preset-typescript": "^7.18.6",
"@rexxars/babel-plugin-inline-json-import": "^0.3.4",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.1.1",
"@sanity/client": "^3.4.1",
"@sanity/pkg-utils": "^1.7.2",
"@sanity/tsdoc-to-portable-text": "^0.4.1",
"@types/cpx": "^1.5.2",
"@types/jest": "^27.0.3",
"@types/mkdirp": "^1.0.2",
"@types/node": "^14.18.9",
Expand All @@ -99,17 +83,11 @@
"@typescript-eslint/eslint-plugin": "^5.5.0",
"@typescript-eslint/parser": "^5.5.0",
"@vercel/node": "^1.12.1",
"babel-eslint": "^10.1.0",
"babel-jest": "^27.4.2",
"babel-loader": "^8.2.3",
"babel-plugin-istanbul": "^6.1.1",
"babel-plugin-lodash": "^3.3.4",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"boxen": "^4.1.0",
"cac": "^6.7.12",
"chalk": "^4.1.2",
"chokidar": "^3.5.3",
"cpx": "^1.5.0",
"cypress": "^9.1.1",
"cypress-dotenv": "^2.0.0",
"deepmerge": "^4.2.2",
Expand Down Expand Up @@ -139,7 +117,6 @@
"history-server": "^1.3.1",
"husky": "^7.0.4",
"jest": "^27.4.3",
"jsonc-parser": "^3.1.0",
"lerna": "^4.0.0",
"lint-staged": "^12.1.2",
"lodash": "^4.17.21",
Expand All @@ -151,8 +128,6 @@
"prettier": "^2.5.1",
"puppeteer": "^12.0.1",
"rimraf": "^3.0.2",
"rollup": "^2.61.1",
"rollup-plugin-typescript2": "^0.31.1",
"semver": "^7.3.5",
"start-server-and-test": "^1.14.0",
"tmp": "^0.2.1",
Expand Down
4 changes: 0 additions & 4 deletions packages/@sanity/block-tools/.babelrc

This file was deleted.

3 changes: 3 additions & 0 deletions packages/@sanity/block-tools/.depcheckignore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore": ["@sanity/pkg-utils"]
}
11 changes: 0 additions & 11 deletions packages/@sanity/block-tools/.npmignore

This file was deleted.

5 changes: 5 additions & 0 deletions packages/@sanity/block-tools/package.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import {defineConfig} from '@sanity/pkg-utils'
import baseConfig from '../../../package.config'

export default defineConfig({...baseConfig})
18 changes: 9 additions & 9 deletions packages/@sanity/block-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
"source": "./src/index.ts",
"main": "./lib/index.cjs",
"module": "./lib/index.js",
"exports": {
".": {
"source": "./src/index.ts",
"require": "./lib/index.cjs",
"default": "./lib/index.js"
}
},
"types": "./lib/dts/src/index.d.ts",
"files": [
"lib",
"src"
],
"scripts": {
"build": "../../../bin/pkg-utils bundle --tsconfig tsconfig.lib.json",
"build": "pkg-utils build --tsconfig tsconfig.lib.json",
"check:package": "pkg-utils --strict --tsconfig tsconfig.lib.json",
"clean": "rimraf lib",
"coverage": "NODE_ENV=test jest --coverage",
"postbuild": "run-s check:package",
"prebuild": "run-s clean",
"test": "NODE_ENV=test jest",
"watch": "../../../bin/pkg-utils bundle --tsconfig tsconfig.lib.json --watch"
"watch": "pkg-utils watch --tsconfig tsconfig.lib.json"
},
"publishConfig": {
"access": "public"
Expand Down
12 changes: 6 additions & 6 deletions packages/@sanity/block-tools/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"include": ["./src", "./test"],
"compilerOptions": {
"composite": true,
// --
"jsx": "react",
"declarationDir": "./lib/dts/",
"rootDir": "./",
"outDir": "./lib/dts/"
"declarationDir": "./lib/dts",
"rootDir": ".",
"outDir": "./lib/dts",

"jsx": "react"
},
"references": [{"path": "../schema"}]
"references": [{"path": "../schema/tsconfig.lib.json"}]
}
19 changes: 10 additions & 9 deletions packages/@sanity/block-tools/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
"extends": "../../../tsconfig.settings",
"include": ["./src"],
"exclude": [
"./src/**/__fixtures__/*",
"./src/**/__mocks__/*",
"./src/**/__workshop__/*",
"./src/**/__fixtures__",
"./src/**/__mocks__",
"./src/**/__workshop__",
"./src/**/*.test.ts",
"./src/**/*.test.tsx"
],
"compilerOptions": {
"composite": true,
// --
"jsx": "react",
"declarationDir": "./lib/dts/",
"rootDir": "./",
"outDir": "./lib/dts/"
}
"rootDir": ".",
"outDir": "./lib/dts",
"declarationDir": "./lib/dts",

"jsx": "react"
},
"references": [{"path": "../schema/tsconfig.lib.json"}]
}
3 changes: 0 additions & 3 deletions packages/@sanity/cli/.babelrc

This file was deleted.

4 changes: 3 additions & 1 deletion packages/@sanity/cli/.depcheckignore.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"//": "these are used by template projects and doesn't need to be project dependencies",
"ignore": [
"@babel/parser",
"@sanity/base",
"@sanity/color",
"@sanity/desk-tool",
"@sanity/eslint-config-studio",
"@sanity/form-builder",
"@sanity/icons",
"@sanity/pkg-utils",
"@sanity/types",
"@sanity/ui",
"@sanity/uuid",
"babylon",
"lodash.get",
"pluralize-esm",
"prop-types",
Expand Down
4 changes: 0 additions & 4 deletions packages/@sanity/cli/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@
# Dependency directories
/node_modules

# Packed version of Sanity binary
/bin/sanity-cli.js
/bin/sanity-cli.js.map

# Dependency of `open` module
/bin/xdg-open
16 changes: 0 additions & 16 deletions packages/@sanity/cli/.npmignore

This file was deleted.

6 changes: 0 additions & 6 deletions packages/@sanity/cli/bin/entry.js

This file was deleted.

0 comments on commit 2778e0c

Please sign in to comment.