diff --git a/.eslintrc.js b/.eslintrc.js index 8342544389..f18e35d818 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,7 +14,7 @@ const config = { parser: "@typescript-eslint/parser", plugins: ["@typescript-eslint", "import", "unused-imports"], parserOptions: { - project: ["./tsconfig.dev.json"], + project: ["./tsconfig.json"], }, rules: { "no-unused-vars": "off", // Duplicate with unused-import/no-unused-vars diff --git a/jest.config.js b/jest.config.js index cde954390f..31a9686499 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,6 +1,6 @@ module.exports = { - roots: ["./test"], - setupFilesAfterEnv: ["/test/index.ts"], + roots: ["./src/test"], + setupFilesAfterEnv: ["/src/test/index.ts"], testEnvironment: "jest-environment-jsdom", collectCoverage: true, coverageReporters: ["json", "lcov", "text", "clover"], diff --git a/package.json b/package.json index c059165800..e50fc29e1f 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "license": "MIT", "homepage": "https://github.com/Hacker0x01/react-datepicker", "main": "dist/index.js", + "types": "dist/index.d.ts", "browser": "dist/react-datepicker.min.js", "module": "dist/es/index.js", "unpkg": "dist/react-datepicker.min.js", @@ -86,7 +87,7 @@ "react-onclickoutside": "^6.13.0" }, "scripts": { - "eslint": "eslint --ext .js,.jsx,.ts,.tsx src test", + "eslint": "eslint --ext .js,.jsx,.ts,.tsx ./src", "precommit": "lint-staged --allow-empty", "sass-lint": "stylelint 'src/stylesheets/*.scss'", "lint": "yarn run eslint && yarn run sass-lint", @@ -96,15 +97,14 @@ "test": "NODE_ENV=test jest", "test:ci": "NODE_ENV=test jest --ci --coverage", "test:watch": "NODE_OPTIONS=--openssl-legacy-provider NODE_ENV=test jest --watch", - "build": "NODE_ENV=production yarn run build:src && NODE_ENV=production yarn run css:prod && NODE_ENV=production yarn run css:modules:dev && NODE_ENV=production yarn run css:dev && NODE_ENV=production yarn run css:modules:dev && NODE_ENV=production yarn run build:types", - "build-dev": "NODE_ENV=development yarn run js:dev && NODE_ENV=development yarn run css:dev && NODE_ENV=development yarn run css:modules:dev && NODE_ENV=production yarn run build:types", + "build": "NODE_ENV=production yarn run build:src && NODE_ENV=production yarn run css:prod && NODE_ENV=production yarn run css:modules:dev && NODE_ENV=production yarn run css:dev && NODE_ENV=production yarn run css:modules:dev", + "build-dev": "NODE_ENV=development yarn run js:dev && NODE_ENV=development yarn run css:dev && NODE_ENV=development yarn run css:modules:dev", "css:prod": "sass --style compressed src/stylesheets/datepicker.scss > dist/react-datepicker.min.css", "css:modules:prod": "sass --style compressed src/stylesheets/datepicker-cssmodules.scss | tee dist/react-datepicker-cssmodules.min.css dist/react-datepicker-min.module.css", "css:dev": "sass --style expanded src/stylesheets/datepicker.scss > dist/react-datepicker.css", "css:modules:dev": "sass --style expanded src/stylesheets/datepicker-cssmodules.scss | tee dist/react-datepicker-cssmodules.css dist/react-datepicker.module.css", - "type-check": "tsc --noEmit", + "type-check": "tsc --project tsconfig.build.json --noEmit", "type-check:watch": "npm run type-check -- --watch", - "build:types": "tsc --emitDeclarationOnly", "build:src": "rollup -c", "js:dev": "rollup -cw", "prepare": "husky install" diff --git a/rollup.config.mjs b/rollup.config.mjs index 31b9e5c5d1..872cb78888 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -13,9 +13,9 @@ import typescript from "@rollup/plugin-typescript"; const pkg = JSON.parse( fs .readFileSync( - path.join(path.dirname(fileURLToPath(import.meta.url)), "package.json") + path.join(path.dirname(fileURLToPath(import.meta.url)), "package.json"), ) - .toString() + .toString(), ); const banner = `/*! @@ -33,10 +33,10 @@ const dateFnsPackageJson = JSON.parse( .readFileSync( path.join( path.dirname(fileURLToPath(import.meta.url)), - "node_modules/date-fns/package.json" - ) + "node_modules/date-fns/package.json", + ), ) - .toString() + .toString(), ); const dateFnsSubpackages = Object.keys(dateFnsPackageJson.exports) .map((key) => key.replace("./", "")) @@ -101,7 +101,7 @@ const config = { babel(), commonjs(), typescript({ - tsconfig: "./tsconfig.json", + tsconfig: "./tsconfig.build.json", declaration: true, declarationDir: "dist", }), diff --git a/test/calendar_icon.test.tsx b/src/test/calendar_icon.test.tsx similarity index 98% rename from test/calendar_icon.test.tsx rename to src/test/calendar_icon.test.tsx index 3aadbc5628..8b8928b56f 100644 --- a/test/calendar_icon.test.tsx +++ b/src/test/calendar_icon.test.tsx @@ -1,7 +1,7 @@ import { render, fireEvent } from "@testing-library/react"; import React from "react"; -import CalendarIcon from "../src/calendar_icon"; +import CalendarIcon from "../calendar_icon"; import { IconParkSolidApplication } from "./helper_components/calendar_icon"; diff --git a/test/calendar_test.test.tsx b/src/test/calendar_test.test.tsx similarity index 99% rename from test/calendar_test.test.tsx rename to src/test/calendar_test.test.tsx index 6588890c04..b80d29af27 100644 --- a/test/calendar_test.test.tsx +++ b/src/test/calendar_test.test.tsx @@ -9,7 +9,7 @@ import { eo } from "date-fns/locale/eo"; import { fi } from "date-fns/locale/fi"; import React from "react"; -import Calendar from "../src/calendar"; +import Calendar from "../calendar"; import { KeyType, getMonthInLocale, @@ -28,12 +28,12 @@ import { isSameDay, subMonths, subYears, -} from "../src/date_utils"; -import DatePicker from "../src/index"; +} from "../date_utils"; +import DatePicker from "../index"; import { getKey } from "./test_utils"; -import type { Locale } from "../src/date_utils"; +import type { Locale } from "../date_utils"; import type { Day } from "date-fns"; // TODO Possibly rename diff --git a/test/date_utils_test.test.ts b/src/test/date_utils_test.test.ts similarity index 99% rename from test/date_utils_test.test.ts rename to src/test/date_utils_test.test.ts index 69bf837c4c..8d73300750 100644 --- a/test/date_utils_test.test.ts +++ b/src/test/date_utils_test.test.ts @@ -51,7 +51,7 @@ import { getMidnightDate, registerLocale, isMonthYearDisabled, -} from "../src/date_utils"; +} from "../date_utils"; registerLocale("pt-BR", ptBR); diff --git a/test/datepicker_test.test.tsx b/src/test/datepicker_test.test.tsx similarity index 99% rename from test/datepicker_test.test.tsx rename to src/test/datepicker_test.test.tsx index 606d11c5a4..1543c6f95c 100644 --- a/test/datepicker_test.test.tsx +++ b/src/test/datepicker_test.test.tsx @@ -22,8 +22,8 @@ import { subMonths, subWeeks, subYears, -} from "../src/date_utils"; -import DatePicker, { registerLocale } from "../src/index"; +} from "../date_utils"; +import DatePicker, { registerLocale } from "../index"; import CustomInput from "./helper_components/custom_input"; import TestWrapper from "./helper_components/test_wrapper"; diff --git a/test/day_test.test.tsx b/src/test/day_test.test.tsx similarity index 99% rename from test/day_test.test.tsx rename to src/test/day_test.test.tsx index 4461ff0736..ae66b00c43 100644 --- a/test/day_test.test.tsx +++ b/src/test/day_test.test.tsx @@ -12,8 +12,8 @@ import { getHighLightDaysMap, getHolidaysMap, registerLocale, -} from "../src/date_utils"; -import Day from "../src/day"; +} from "../date_utils"; +import Day from "../day"; function renderDay(day, props = {}) { return render( diff --git a/test/exclude_dates.test.tsx b/src/test/exclude_dates.test.tsx similarity index 97% rename from test/exclude_dates.test.tsx rename to src/test/exclude_dates.test.tsx index 1d3c332ef6..22048df80b 100644 --- a/test/exclude_dates.test.tsx +++ b/src/test/exclude_dates.test.tsx @@ -2,7 +2,7 @@ import { render } from "@testing-library/react"; import { subDays } from "date-fns"; import React from "react"; -import DatePicker from "../src/index"; +import DatePicker from "../index"; describe("DatePicker", () => { const excludeDates = [new Date(), subDays(new Date(), 1)]; diff --git a/test/exclude_time_period_test.test.tsx b/src/test/exclude_time_period_test.test.tsx similarity index 88% rename from test/exclude_time_period_test.test.tsx rename to src/test/exclude_time_period_test.test.tsx index 1266657ced..3e56a6a8bc 100644 --- a/test/exclude_time_period_test.test.tsx +++ b/src/test/exclude_time_period_test.test.tsx @@ -1,8 +1,8 @@ import { render } from "@testing-library/react"; import React from "react"; -import * as utils from "../src/date_utils"; -import DatePicker from "../src/index"; +import * as utils from "../date_utils"; +import DatePicker from "../index"; describe("DatePicker", () => { it("should only display times between minTime and maxTime", () => { diff --git a/test/exclude_times_test.test.tsx b/src/test/exclude_times_test.test.tsx similarity index 93% rename from test/exclude_times_test.test.tsx rename to src/test/exclude_times_test.test.tsx index 7d91457b8c..5c90cc4f82 100644 --- a/test/exclude_times_test.test.tsx +++ b/src/test/exclude_times_test.test.tsx @@ -1,8 +1,8 @@ import { render } from "@testing-library/react"; import React from "react"; -import { setTime, newDate } from "../src/date_utils"; -import DatePicker from "../src/index"; +import { setTime, newDate } from "../date_utils"; +import DatePicker from "../index"; describe("DatePicker", () => { let now, excludeTimes; diff --git a/test/filter_times_test.test.tsx b/src/test/filter_times_test.test.tsx similarity index 94% rename from test/filter_times_test.test.tsx rename to src/test/filter_times_test.test.tsx index 1b0271a1bd..1724ba4516 100644 --- a/test/filter_times_test.test.tsx +++ b/src/test/filter_times_test.test.tsx @@ -1,8 +1,8 @@ import { render } from "@testing-library/react"; import React from "react"; -import { getHours } from "../src/date_utils"; -import TimeComponent from "../src/time"; +import { getHours } from "../date_utils"; +import TimeComponent from "../time"; describe("TimeComponent", () => { const HOUR_TO_DISABLE_IN_12_HR = 5; diff --git a/test/helper_components/calendar_icon.tsx b/src/test/helper_components/calendar_icon.tsx similarity index 100% rename from test/helper_components/calendar_icon.tsx rename to src/test/helper_components/calendar_icon.tsx diff --git a/test/helper_components/custom_input.tsx b/src/test/helper_components/custom_input.tsx similarity index 100% rename from test/helper_components/custom_input.tsx rename to src/test/helper_components/custom_input.tsx diff --git a/test/helper_components/custom_time_input.tsx b/src/test/helper_components/custom_time_input.tsx similarity index 100% rename from test/helper_components/custom_time_input.tsx rename to src/test/helper_components/custom_time_input.tsx diff --git a/test/helper_components/test_wrapper.tsx b/src/test/helper_components/test_wrapper.tsx similarity index 100% rename from test/helper_components/test_wrapper.tsx rename to src/test/helper_components/test_wrapper.tsx diff --git a/test/include_times_test.test.tsx b/src/test/include_times_test.test.tsx similarity index 96% rename from test/include_times_test.test.tsx rename to src/test/include_times_test.test.tsx index 1211c8dbec..c3e89d882e 100644 --- a/test/include_times_test.test.tsx +++ b/src/test/include_times_test.test.tsx @@ -1,8 +1,8 @@ import { render } from "@testing-library/react"; import React from "react"; -import * as utils from "../src/date_utils"; -import TimeComponent from "../src/time"; +import * as utils from "../date_utils"; +import TimeComponent from "../time"; describe("TimeComponent", () => { let today, includeTimes; diff --git a/test/index.ts b/src/test/index.ts similarity index 100% rename from test/index.ts rename to src/test/index.ts diff --git a/test/inject_times_test.test.tsx b/src/test/inject_times_test.test.tsx similarity index 97% rename from test/inject_times_test.test.tsx rename to src/test/inject_times_test.test.tsx index 229ae7ce68..13b66f6cdd 100644 --- a/test/inject_times_test.test.tsx +++ b/src/test/inject_times_test.test.tsx @@ -1,8 +1,8 @@ import { render } from "@testing-library/react"; import React from "react"; -import * as utils from "../src/date_utils"; -import TimeComponent from "../src/time"; +import * as utils from "../date_utils"; +import TimeComponent from "../time"; describe("TimeComponent", () => { it("should show times specified in injectTimes props", () => { diff --git a/test/min_time_test.test.tsx b/src/test/min_time_test.test.tsx similarity index 98% rename from test/min_time_test.test.tsx rename to src/test/min_time_test.test.tsx index 1205394442..5dcbef46cf 100644 --- a/test/min_time_test.test.tsx +++ b/src/test/min_time_test.test.tsx @@ -1,7 +1,7 @@ import { fireEvent, render } from "@testing-library/react"; import React, { useState } from "react"; -import DatePicker from "../src/index"; +import DatePicker from "../index"; const DatePickerWithState = (props) => { const [selected, setSelected] = useState(null); diff --git a/test/month_dropdown_test.test.tsx b/src/test/month_dropdown_test.test.tsx similarity index 97% rename from test/month_dropdown_test.test.tsx rename to src/test/month_dropdown_test.test.tsx index c745dfca83..9debe3477e 100644 --- a/test/month_dropdown_test.test.tsx +++ b/src/test/month_dropdown_test.test.tsx @@ -6,9 +6,9 @@ import range from "lodash/range"; import React from "react"; import onClickOutside from "react-onclickoutside"; -import { getMonthInLocale, registerLocale } from "../src/date_utils"; -import MonthDropdown from "../src/month_dropdown"; -import MonthDropdownOptions from "../src/month_dropdown_options"; +import { getMonthInLocale, registerLocale } from "../date_utils"; +import MonthDropdown from "../month_dropdown"; +import MonthDropdownOptions from "../month_dropdown_options"; describe("MonthDropdown", () => { let monthDropdown: HTMLElement | null = null; diff --git a/test/month_test.test.tsx b/src/test/month_test.test.tsx similarity index 99% rename from test/month_test.test.tsx rename to src/test/month_test.test.tsx index d9be3216ed..03f91e7820 100644 --- a/test/month_test.test.tsx +++ b/src/test/month_test.test.tsx @@ -4,9 +4,9 @@ import { es } from "date-fns/locale"; import range from "lodash/range"; import React from "react"; -import DatePicker from "../src"; -import * as utils from "../src/date_utils"; -import Month from "../src/month"; +import DatePicker from "../"; +import * as utils from "../date_utils"; +import Month from "../month"; import { runAxe } from "./run_axe"; import { getKey } from "./test_utils"; diff --git a/test/month_year_dropdown_test.test.tsx b/src/test/month_year_dropdown_test.test.tsx similarity index 98% rename from test/month_year_dropdown_test.test.tsx rename to src/test/month_year_dropdown_test.test.tsx index 7bbecb75bd..28712d315a 100644 --- a/test/month_year_dropdown_test.test.tsx +++ b/src/test/month_year_dropdown_test.test.tsx @@ -10,9 +10,9 @@ import { formatDate, isAfter, registerLocale, -} from "../src/date_utils"; -import MonthYearDropdown from "../src/month_year_dropdown"; -import MonthYearDropdownOptions from "../src/month_year_dropdown_options"; +} from "../date_utils"; +import MonthYearDropdown from "../month_year_dropdown"; +import MonthYearDropdownOptions from "../month_year_dropdown_options"; describe("MonthYearDropdown", () => { let monthYearDropdown: HTMLElement | null = null; diff --git a/test/multi_month_test.test.tsx b/src/test/multi_month_test.test.tsx similarity index 94% rename from test/multi_month_test.test.tsx rename to src/test/multi_month_test.test.tsx index 8f325e66b3..1bc3aec187 100644 --- a/test/multi_month_test.test.tsx +++ b/src/test/multi_month_test.test.tsx @@ -1,8 +1,8 @@ import { render } from "@testing-library/react"; import React from "react"; -import Calendar from "../src/calendar"; -import * as utils from "../src/date_utils"; +import Calendar from "../calendar"; +import * as utils from "../date_utils"; describe("Multi month calendar", function () { const dateFormat = "LLLL yyyy"; diff --git a/test/multiple_selected_dates.test.tsx b/src/test/multiple_selected_dates.test.tsx similarity index 98% rename from test/multiple_selected_dates.test.tsx rename to src/test/multiple_selected_dates.test.tsx index b1648c2621..2032f3bc13 100644 --- a/test/multiple_selected_dates.test.tsx +++ b/src/test/multiple_selected_dates.test.tsx @@ -1,7 +1,7 @@ import { render } from "@testing-library/react"; import React from "react"; -import DatePicker from "../src"; +import DatePicker from "../"; describe("Multiple Dates Selected", function () { function getDatePicker(extraProps) { diff --git a/test/run_axe.tsx b/src/test/run_axe.tsx similarity index 100% rename from test/run_axe.tsx rename to src/test/run_axe.tsx diff --git a/test/show_time_test.test.tsx b/src/test/show_time_test.test.tsx similarity index 96% rename from test/show_time_test.test.tsx rename to src/test/show_time_test.test.tsx index 8784d83f4d..9ab79ed51a 100644 --- a/test/show_time_test.test.tsx +++ b/src/test/show_time_test.test.tsx @@ -1,8 +1,8 @@ import { render, fireEvent } from "@testing-library/react"; import React from "react"; -import DatePicker from "../src/index"; -import TimeComponent from "../src/time"; +import DatePicker from "../index"; +import TimeComponent from "../time"; describe("DatePicker", () => { it("should show time component when showTimeSelect prop is present", () => { diff --git a/test/test_utils.ts b/src/test/test_utils.ts similarity index 96% rename from test/test_utils.ts rename to src/test/test_utils.ts index dbc625b596..3b30daada7 100644 --- a/test/test_utils.ts +++ b/src/test/test_utils.ts @@ -1,4 +1,4 @@ -import { KeyType } from "../src/date_utils"; +import { KeyType } from "../date_utils"; interface KeyEvent { key: string; diff --git a/test/time_format_test.test.tsx b/src/test/time_format_test.test.tsx similarity index 98% rename from test/time_format_test.test.tsx rename to src/test/time_format_test.test.tsx index 643ffcb6e8..617914f0eb 100644 --- a/test/time_format_test.test.tsx +++ b/src/test/time_format_test.test.tsx @@ -2,8 +2,8 @@ import { render, waitFor } from "@testing-library/react"; import { ptBR } from "date-fns/locale/pt-BR"; import React from "react"; -import * as utils from "../src/date_utils"; -import TimeComponent from "../src/time"; +import * as utils from "../date_utils"; +import TimeComponent from "../time"; describe("TimeComponent", () => { utils.registerLocale("pt-BR", ptBR); diff --git a/test/time_input_test.test.tsx b/src/test/time_input_test.test.tsx similarity index 98% rename from test/time_input_test.test.tsx rename to src/test/time_input_test.test.tsx index ad84a488f5..68bc21298a 100644 --- a/test/time_input_test.test.tsx +++ b/src/test/time_input_test.test.tsx @@ -1,8 +1,8 @@ import { render, fireEvent, act } from "@testing-library/react"; import React from "react"; -import DatePicker from "../src/index"; -import InputTimeComponent from "../src/input_time"; +import DatePicker from "../index"; +import InputTimeComponent from "../input_time"; import CustomTimeInput from "./helper_components/custom_time_input"; diff --git a/test/timepicker_test.test.tsx b/src/test/timepicker_test.test.tsx similarity index 98% rename from test/timepicker_test.test.tsx rename to src/test/timepicker_test.test.tsx index c5cc95196d..eb16b2be69 100644 --- a/test/timepicker_test.test.tsx +++ b/src/test/timepicker_test.test.tsx @@ -1,8 +1,8 @@ import { render, fireEvent, waitFor } from "@testing-library/react"; import React from "react"; -import { newDate, formatDate, KeyType } from "../src/date_utils"; -import DatePicker from "../src/index"; +import { newDate, formatDate, KeyType } from "../date_utils"; +import DatePicker from "../index"; import { getKey } from "./test_utils"; diff --git a/test/week_number_test.test.tsx b/src/test/week_number_test.test.tsx similarity index 99% rename from test/week_number_test.test.tsx rename to src/test/week_number_test.test.tsx index 533cb5ae68..4ecd5bcdaf 100644 --- a/test/week_number_test.test.tsx +++ b/src/test/week_number_test.test.tsx @@ -1,8 +1,8 @@ import { render, fireEvent } from "@testing-library/react"; import React from "react"; -import * as utils from "../src/date_utils"; -import WeekNumber from "../src/week_number"; +import * as utils from "../date_utils"; +import WeekNumber from "../week_number"; function renderWeekNumber(weekNumber, props = {}) { return render( diff --git a/test/week_picker_test.test.tsx b/src/test/week_picker_test.test.tsx similarity index 97% rename from test/week_picker_test.test.tsx rename to src/test/week_picker_test.test.tsx index 8051d4fbb8..1320e19b34 100644 --- a/test/week_picker_test.test.tsx +++ b/src/test/week_picker_test.test.tsx @@ -1,7 +1,7 @@ import { render, fireEvent } from "@testing-library/react"; import React from "react"; -import DatePicker from "../src/index"; +import DatePicker from "../index"; describe("WeekPicker", () => { it("should change the week when clicked on any option in the picker", () => { diff --git a/test/week_test.test.tsx b/src/test/week_test.test.tsx similarity index 99% rename from test/week_test.test.tsx rename to src/test/week_test.test.tsx index ab810ec1d0..3394affe18 100644 --- a/test/week_test.test.tsx +++ b/src/test/week_test.test.tsx @@ -1,8 +1,8 @@ import { render, fireEvent } from "@testing-library/react"; import React from "react"; -import * as utils from "../src/date_utils"; -import Week from "../src/week"; +import * as utils from "../date_utils"; +import Week from "../week"; describe("Week", () => { it("should have the week CSS class", () => { diff --git a/test/year_dropdown_options_test.test.tsx b/src/test/year_dropdown_options_test.test.tsx similarity index 99% rename from test/year_dropdown_options_test.test.tsx rename to src/test/year_dropdown_options_test.test.tsx index bee0d4d0ff..e0021bf2dc 100644 --- a/test/year_dropdown_options_test.test.tsx +++ b/src/test/year_dropdown_options_test.test.tsx @@ -2,8 +2,8 @@ import { render, fireEvent } from "@testing-library/react"; import React from "react"; import onClickOutside from "react-onclickoutside"; -import * as utils from "../src/date_utils"; -import YearDropdownOptions from "../src/year_dropdown_options"; +import * as utils from "../date_utils"; +import YearDropdownOptions from "../year_dropdown_options"; describe("YearDropdownOptions", () => { let yearDropdown: HTMLElement | null = null, diff --git a/test/year_dropdown_test.test.tsx b/src/test/year_dropdown_test.test.tsx similarity index 98% rename from test/year_dropdown_test.test.tsx rename to src/test/year_dropdown_test.test.tsx index 197cd15802..575379e355 100644 --- a/test/year_dropdown_test.test.tsx +++ b/src/test/year_dropdown_test.test.tsx @@ -2,8 +2,8 @@ import { render, fireEvent } from "@testing-library/react"; import range from "lodash/range"; import React from "react"; -import { newDate } from "../src/date_utils"; -import YearDropdown from "../src/year_dropdown"; +import { newDate } from "../date_utils"; +import YearDropdown from "../year_dropdown"; describe("YearDropdown", () => { let yearDropdown: HTMLElement | null = null; diff --git a/test/year_picker_test.test.tsx b/src/test/year_picker_test.test.tsx similarity index 99% rename from test/year_picker_test.test.tsx rename to src/test/year_picker_test.test.tsx index 94c05e5ac4..a8cf8860bd 100644 --- a/test/year_picker_test.test.tsx +++ b/src/test/year_picker_test.test.tsx @@ -1,9 +1,9 @@ import { render, fireEvent } from "@testing-library/react"; import React from "react"; -import * as utils from "../src/date_utils"; -import DatePicker from "../src/index"; -import Year from "../src/year"; +import * as utils from "../date_utils"; +import DatePicker from "../index"; +import Year from "../year"; import { getKey } from "./test_utils"; diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000000..65a6e269b0 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["node_modules", "dist", "src/test/**/*"] +} diff --git a/tsconfig.dev.json b/tsconfig.dev.json deleted file mode 100644 index 63fd9d48de..0000000000 --- a/tsconfig.dev.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./tsconfig.json", - "include": ["test/**/*"] -} diff --git a/tsconfig.json b/tsconfig.json index 2eb61d0d46..65678a2413 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,6 @@ "noFallthroughCasesInSwitch": true, "noUnusedParameters": true, "noUnusedLocals": true, - "declarationDir": "dist/types", "declaration": true, "strict": true, "noUncheckedIndexedAccess": true, @@ -21,7 +20,8 @@ "strictNullChecks": true, "esModuleInterop": true, "baseUrl": "src/", - "typeRoots": ["./src/@types"] + "typeRoots": ["./src/@types", "./node_modules/@types"], + "types": ["node", "jest"] }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"]