Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #38 from storybookjs/revert-37-revert-36-norbert/u…
Browse files Browse the repository at this point in the history
…se-tsup

migrate to tsup (again)
  • Loading branch information
ndelangen committed May 1, 2023
2 parents 5fa3453 + e4e974b commit 397cfbb
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 70 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/linear-export.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Expand Up @@ -12,10 +12,10 @@ jobs:
- name: Prepare repository
run: git fetch --unshallow --tags

- name: Use Node.js 14.x
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 16.x

- name: Install dependencies
run: yarn
Expand Down
20 changes: 9 additions & 11 deletions package.json
Expand Up @@ -6,14 +6,11 @@
"type": "git",
"url": "https://github.com/storybookjs/testing-library.git"
},
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"main": "dist/index.js",
"module": "dist/index.mjs",
"license": "MIT",
"scripts": {
"prebuild": "rimraf dist",
"build": "yarn build:esm && yarn build:cjs",
"build:esm": "tsc --project tsconfig.esm.json",
"build:cjs": "tsc --project tsconfig.cjs.json",
"build": "tsup",
"prepack": "yarn build",
"prerelease": "yarn build",
"release": "auto shipit"
Expand All @@ -22,25 +19,26 @@
"files": [
"dist/**/*"
],
"types": "dist/types/index.d.ts",
"types": "dist/index.d.ts",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@storybook/client-logger": "future",
"@storybook/instrumenter": "future",
"@testing-library/dom": "^8.3.0",
"@testing-library/user-event": "^13.2.1",
"ts-dedent": "^2.2.0"
},
"devDependencies": {
"@storybook/client-logger": "future",
"@storybook/instrumenter": "future",
"@auto-it/first-time-contributor": "^10.37.6",
"@auto-it/released": "^10.37.6",
"@storybook/linter-config": "^3.1.2",
"@types/react": "*",
"auto": "^10.37.6",
"rimraf": "^3.0.2",
"typescript": "^4.4.3"
"util": "^0.12.5",
"tsup": "^6.7.0",
"typescript": "^5.0.4"
},
"auto": {
"prereleaseBranches": [
Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
@@ -1,9 +1,12 @@
import { once } from '@storybook/client-logger';
import { instrument } from '@storybook/instrumenter';
import * as domTestingLibrary from '@testing-library/dom';
import _userEvent from '@testing-library/user-event';
import _userEventObj from '@testing-library/user-event';
import dedent from 'ts-dedent';

// @ts-ignore (this is to ensure ESM compatibility)
const _userEvent: typeof _userEventObj = (_userEventObj.default || _userEventObj);

const testingLibrary = instrument(
{ ...domTestingLibrary },
{
Expand Down
13 changes: 0 additions & 13 deletions tsconfig.base.json

This file was deleted.

7 changes: 0 additions & 7 deletions tsconfig.cjs.json

This file was deleted.

9 changes: 0 additions & 9 deletions tsconfig.esm.json

This file was deleted.

9 changes: 9 additions & 0 deletions tsconfig.json
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"strict": true,
"target": "es2020",
"moduleResolution": "nodenext",
"allowSyntheticDefaultImports": true
},
"include": ["src/*.ts"]
}
24 changes: 24 additions & 0 deletions tsup.config.ts
@@ -0,0 +1,24 @@
import { defineConfig } from 'tsup';

export default defineConfig(
{
clean: true,
entry: ['./src/index.ts'],
format: ['cjs', 'esm'],
esbuildOptions(options, context) {
Object.assign(options, {
platform: 'browser',
logLevel: 'error',
legalComments: 'none',
minifyWhitespace: false,
minifyIdentifiers: false,
minifySyntax: true,
})
},
shims: false,
dts: {
entry: ['./src/index.ts'],
resolve: true,
},
}
);

0 comments on commit 397cfbb

Please sign in to comment.