react-dock

This commit is contained in:
Nathan Bierema 2024-04-07 16:27:34 -04:00
parent 7699a70931
commit de9ad5c2b1
12 changed files with 37 additions and 86 deletions

View File

@ -1,8 +0,0 @@
{
"presets": [
["@babel/preset-env", { "targets": "defaults", "modules": false }],
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": ["@babel/plugin-transform-runtime"]
}

View File

@ -1,8 +0,0 @@
{
"presets": [
["@babel/preset-env", { "targets": "defaults" }],
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": ["@babel/plugin-transform-runtime"]
}

View File

@ -0,0 +1,13 @@
module.exports = {
testEnvironment: 'jsdom',
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{ tsconfig: 'tsconfig.test.json', useESM: true },
],
},
};

View File

@ -1,7 +0,0 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
transform: {
'^.+\\.tsx?$': ['ts-jest', { tsconfig: 'tsconfig.test.json' }],
},
};

View File

@ -18,41 +18,29 @@
"lib", "lib",
"src" "src"
], ],
"main": "lib/cjs/index.js", "main": "lib/index.js",
"module": "lib/esm/index.js", "types": "lib/index.d.ts",
"types": "lib/types/index.d.ts", "type": "module",
"sideEffects": false, "sideEffects": false,
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/reduxjs/redux-devtools.git" "url": "https://github.com/reduxjs/redux-devtools.git"
}, },
"scripts": { "scripts": {
"build": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:types", "build": "tsc",
"build:cjs": "babel src --extensions \".ts,.tsx\" --out-dir lib/cjs",
"build:esm": "babel src --config-file ./babel.config.esm.json --extensions \".ts,.tsx\" --out-dir lib/esm",
"build:types": "tsc --emitDeclarationOnly",
"clean": "rimraf lib", "clean": "rimraf lib",
"test": "jest", "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"lint": "eslint . --ext .ts,.tsx", "lint": "eslint . --ext .ts,.tsx",
"type-check": "tsc --noEmit", "type-check": "tsc --noEmit",
"prepack": "pnpm run clean && pnpm run build", "prepack": "pnpm run clean && pnpm run build",
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test" "prepublish": "pnpm run lint && pnpm run test"
}, },
"dependencies": { "dependencies": {
"@babel/runtime": "^7.24.1", "lodash-es": "^4.17.21"
"@types/lodash": "^4.17.0",
"lodash.debounce": "^4.0.8"
}, },
"devDependencies": { "devDependencies": {
"@babel/cli": "^7.24.1",
"@babel/core": "^7.24.3",
"@babel/eslint-parser": "^7.24.1",
"@babel/plugin-transform-runtime": "^7.24.3",
"@babel/preset-env": "^7.24.3",
"@babel/preset-react": "^7.24.1",
"@babel/preset-typescript": "^7.24.1",
"@types/jest": "^29.5.12", "@types/jest": "^29.5.12",
"@types/lodash.debounce": "^4.0.9", "@types/lodash-es": "^4.17.12",
"@types/react": "^18.2.72", "@types/react": "^18.2.72",
"@types/react-test-renderer": "^18.0.7", "@types/react-test-renderer": "^18.0.7",
"@typescript-eslint/eslint-plugin": "^7.4.0", "@typescript-eslint/eslint-plugin": "^7.4.0",

View File

@ -1,7 +1,7 @@
import React, { Component, ReactNode } from 'react'; import React, { Component, ReactNode } from 'react';
import debounce from 'lodash.debounce'; import { debounce } from 'lodash-es';
import type { DebouncedFunc } from 'lodash'; import type { DebouncedFunc } from 'lodash-es';
import autoprefix from './autoprefix'; import autoprefix from './autoprefix.js';
interface Styles { interface Styles {
[key: string]: React.CSSProperties; [key: string]: React.CSSProperties;

View File

@ -1 +1 @@
export { default as Dock } from './Dock'; export { default as Dock } from './Dock.js';

View File

@ -1,10 +1,10 @@
import React from 'react'; import React from 'react';
import { createRenderer } from 'react-test-renderer/shallow'; import TestRenderer from 'react-test-renderer/shallow';
import Dock from '../src/Dock'; import Dock from '../src/Dock.js';
describe('Dock component', function () { describe('Dock component', function () {
it('should have shallow rendering', function () { it('should have shallow rendering', function () {
const renderer = createRenderer(); const renderer = TestRenderer.createRenderer();
const DockEl = <Dock />; const DockEl = <Dock />;
renderer.render(DockEl); renderer.render(DockEl);

View File

@ -1,7 +1,7 @@
{ {
"extends": "../../tsconfig.react.base.json", "extends": "../../tsconfig.esm.react.base.json",
"compilerOptions": { "compilerOptions": {
"outDir": "lib/types" "outDir": "lib"
}, },
"include": ["src"] "include": ["src"]
} }

View File

@ -1,5 +1,5 @@
{ {
"extends": "../../tsconfig.react.base.json", "extends": "../../tsconfig.esm.react.base.json",
"compilerOptions": { "compilerOptions": {
"types": ["jest"] "types": ["jest"]
}, },

View File

@ -454,43 +454,16 @@ importers:
packages/react-dock: packages/react-dock:
dependencies: dependencies:
'@babel/runtime': lodash-es:
specifier: ^7.24.1 specifier: ^4.17.21
version: 7.24.1 version: 4.17.21
'@types/lodash':
specifier: ^4.17.0
version: 4.17.0
lodash.debounce:
specifier: ^4.0.8
version: 4.0.8
devDependencies: devDependencies:
'@babel/cli':
specifier: ^7.24.1
version: 7.24.1(@babel/core@7.24.3)
'@babel/core':
specifier: ^7.24.3
version: 7.24.3
'@babel/eslint-parser':
specifier: ^7.24.1
version: 7.24.1(@babel/core@7.24.3)(eslint@8.57.0)
'@babel/plugin-transform-runtime':
specifier: ^7.24.3
version: 7.24.3(@babel/core@7.24.3)
'@babel/preset-env':
specifier: ^7.24.3
version: 7.24.3(@babel/core@7.24.3)
'@babel/preset-react':
specifier: ^7.24.1
version: 7.24.1(@babel/core@7.24.3)
'@babel/preset-typescript':
specifier: ^7.24.1
version: 7.24.1(@babel/core@7.24.3)
'@types/jest': '@types/jest':
specifier: ^29.5.12 specifier: ^29.5.12
version: 29.5.12 version: 29.5.12
'@types/lodash.debounce': '@types/lodash-es':
specifier: ^4.0.9 specifier: ^4.17.12
version: 4.0.9 version: 4.17.12
'@types/react': '@types/react':
specifier: ^18.2.72 specifier: ^18.2.72
version: 18.2.72 version: 18.2.72