Skip to content

Commit

Permalink
Merge pull request #1078 from tailwindlabs/improve-build
Browse files Browse the repository at this point in the history
Improve build files
  • Loading branch information
RobinMalfait authored Jan 31, 2022
2 parents fbaa1ae + 47756e2 commit b3e7302
Show file tree
Hide file tree
Showing 14 changed files with 36 additions and 43 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve controlled Tabs behaviour ([#1050](https://github.com/tailwindlabs/headlessui/pull/1050))
- Improve typeahead search logic ([#1051](https://github.com/tailwindlabs/headlessui/pull/1051))
- Improve overal codebase, use modern tech like `esbuild` and TypeScript 4! ([#1055](https://github.com/tailwindlabs/headlessui/pull/1055))
- Improve build files ([#1078](https://github.com/tailwindlabs/headlessui/pull/1078))

### Added

Expand All @@ -25,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Ensure correct order when conditionally rendering `MenuItem`, `ListboxOption` and `RadioGroupOption` ([#1045](https://github.com/tailwindlabs/headlessui/pull/1045))
- Improve typeahead search logic ([#1051](https://github.com/tailwindlabs/headlessui/pull/1051))
- Improve overal codebase, use modern tech like `esbuild` and TypeScript 4! ([#1055](https://github.com/tailwindlabs/headlessui/pull/1055))
- Improve build files ([#1078](https://github.com/tailwindlabs/headlessui/pull/1078))

### Added

Expand Down
3 changes: 3 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
projects: ['<rootDir>/packages/*/jest.config.cjs'],
}
3 changes: 0 additions & 3 deletions jest.config.js

This file was deleted.

File renamed without changes.
7 changes: 7 additions & 0 deletions packages/@headlessui-react/build/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict'

if (process.env.NODE_ENV === 'production') {
module.exports = require('./headlessui.prod.cjs')
} else {
module.exports = require('./headlessui.dev.cjs')
}
7 changes: 0 additions & 7 deletions packages/@headlessui-react/build/index.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
const create = require('../../jest/create-jest-config.js')

let create = require('../../jest/create-jest-config.cjs')
module.exports = create(__dirname, { displayName: 'React' })
13 changes: 5 additions & 8 deletions packages/@headlessui-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@headlessui/react",
"version": "1.4.3",
"description": "A set of completely unstyled, fully accessible UI components for React, designed to integrate beautifully with Tailwind CSS.",
"main": "dist/index.js",
"main": "dist/index.cjs",
"typings": "dist/index.d.ts",
"module": "dist/headlessui.esm.js",
"license": "MIT",
Expand All @@ -11,14 +11,11 @@
"dist"
],
"exports": {
".": {
"import": {
"default": "./dist/headlessui.esm.js"
},
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
"import": "./dist/headlessui.esm.js",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
},
"type": "module",
"sideEffects": false,
"engines": {
"node": ">=10"
Expand Down
7 changes: 7 additions & 0 deletions packages/@headlessui-vue/build/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict'

if (process.env.NODE_ENV === 'production') {
module.exports = require('./headlessui.prod.cjs')
} else {
module.exports = require('./headlessui.dev.cjs')
}
7 changes: 0 additions & 7 deletions packages/@headlessui-vue/build/index.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
const create = require('../../jest/create-jest-config.js')

let create = require('../../jest/create-jest-config.cjs')
module.exports = create(__dirname, { displayName: ' Vue ' })
13 changes: 5 additions & 8 deletions packages/@headlessui-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@headlessui/vue",
"version": "1.4.3",
"description": "A set of completely unstyled, fully accessible UI components for Vue 3, designed to integrate beautifully with Tailwind CSS.",
"main": "dist/index.js",
"main": "dist/index.cjs",
"typings": "dist/index.d.ts",
"module": "dist/headlessui.esm.js",
"license": "MIT",
Expand All @@ -11,14 +11,11 @@
"dist"
],
"exports": {
".": {
"import": {
"default": "./dist/headlessui.esm.js"
},
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
"import": "./dist/headlessui.esm.js",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
},
"type": "module",
"sideEffects": false,
"engines": {
"node": ">=10"
Expand Down
4 changes: 2 additions & 2 deletions packages/playground-vue/src/components/Home.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="container my-24">
<div class="prose mx-auto">
<div class="container mx-auto my-24">
<div class="prose">
<h2>Examples</h2>
<Examples :examples="examples" />
</div>
Expand Down
7 changes: 3 additions & 4 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ sharedOptions+=("--platform=browser")
sharedOptions+=("--target=es2020")

# Generate actual builds
NODE_ENV=production $esbuild $input --format=esm --outfile=$outdir/$name.esm.js --minify ${sharedOptions[@]} $@ &
NODE_ENV=production $esbuild $input --format=cjs --outfile=$outdir/$name.prod.cjs.js --minify ${sharedOptions[@]} $@ &
NODE_ENV=production $esbuild $input --format=iife --outfile=$outdir/$name.iife.js --minify ${sharedOptions[@]} $@ &
NODE_ENV=development $esbuild $input --format=cjs --outfile=$outdir/$name.dev.cjs.js ${sharedOptions[@]} $@ &
NODE_ENV=production $esbuild $input --format=esm --outfile=$outdir/$name.esm.js --minify ${sharedOptions[@]} $@ &
NODE_ENV=production $esbuild $input --format=cjs --outfile=$outdir/$name.prod.cjs --minify ${sharedOptions[@]} $@ &
NODE_ENV=development $esbuild $input --format=cjs --outfile=$outdir/$name.dev.cjs ${sharedOptions[@]} $@ &

# Generate types
tsc --emitDeclarationOnly --outDir $outdir &
Expand Down

0 comments on commit b3e7302

Please sign in to comment.