Skip to content

Commit

Permalink
feat(prettier-config): improve bundled config (#658)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusrbrown authored Nov 28, 2024
1 parent 779d16d commit 2683964
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 26 deletions.
6 changes: 6 additions & 0 deletions .changeset/five-buttons-play.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bfra.me/prettier-config": minor
---

Move `prettier.config.js` to `index.js`

6 changes: 6 additions & 0 deletions .changeset/little-wolves-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bfra.me/prettier-config": patch
---

Add banner to improve CJS compatibility

2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
* text=auto eol=lf

packages/prettier-config/prettier.config.js -diff linguist-generated=true
packages/prettier-config/index.js -diff linguist-generated=true
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
packages/api-core/test-utils/sdks/
packages/eslint-config/.eslint-config-inspector
packages/eslint-config/src/*.d.ts
packages/prettier-config/prettier.config.js
packages/prettier-config/index.js
2 changes: 1 addition & 1 deletion packages/prettier-config/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test/fixtures/
prettier.config.js
index.js
2 changes: 1 addition & 1 deletion packages/prettier-config/eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import config from '../../eslint.config'

export default composeConfig(config, {
name: '@bfra.me/prettier-config/bundled',
ignores: ['prettier.config.js'],
ignores: ['index.js'],
})
10 changes: 10 additions & 0 deletions packages/prettier-config/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/prettier-config/index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"prettier.config.js"
"index.js"
20 changes: 10 additions & 10 deletions packages/prettier-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,34 @@
"type": "module",
"exports": {
".": {
"types": "./lib/prettier.config.d.ts",
"source": "./src/prettier.config.ts",
"import": "./prettier.config.js"
"types": "./lib/index.d.ts",
"source": "./src/index.ts",
"default": "./index.js"
},
"./*": {
"types": "./lib/*.d.ts",
"source": "./src/*.ts",
"import": "./lib/*.js"
"default": "./lib/*.js"
},
"./100-proof": "./lib/prettier.config.js",
"./100-proof": "./lib/index.js",
"./120-proof": "./lib/120-proof.js",
"./semi/*": "./lib/*.js?semi=true",
"./semi": "./lib/prettier.config.js?semi=true",
"./semi": "./lib/index.js?semi=true",
"./*/semi": "./lib/*.js?semi=true",
"./package.json": "./package.json"
},
"main": "./prettier.config.js",
"types": "./lib/prettier.config.d.ts",
"main": "./index.js",
"types": "./lib/index.d.ts",
"files": [
"lib",
"src",
"index.json",
"prettier.config.js",
"index.js",
"!**/*.map"
],
"scripts": {
"build": "tsup",
"postbuild": "prettier --config ./prettier.config.js --ignore-path .prettierignore --log-level warn --write .",
"postbuild": "prettier --config ./index.js --ignore-path .prettierignore --log-level warn --write .",
"prepack": "pnpm --filter-prod=\"{.}...\" --loglevel error run build",
"test": "pnpm --filter-prod=\"{.}...\" --loglevel error run build && vitest"
},
Expand Down
9 changes: 0 additions & 9 deletions packages/prettier-config/prettier.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/prettier-config/src/120-proof.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import defaultConfig, {type Writable} from './prettier.config.js'
import defaultConfig, {type Writable} from './index.js'

const $120ProofConfig = {
...defaultConfig,
Expand Down
File renamed without changes.
5 changes: 4 additions & 1 deletion packages/prettier-config/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export default defineConfig([
target: 'es2022',
},
{
entry: ['./src/prettier.config.ts'],
banner: {
js: "import {createRequire}from'node:module';const require=createRequire(import.meta.url);",
},
entry: ['./src/index.ts'],
format: ['esm'],
minify: true,
// Bundle the config and dependencies into a single file.
Expand Down

0 comments on commit 2683964

Please sign in to comment.