From 3d55545566025f30b39e5398ab206db469284cdc Mon Sep 17 00:00:00 2001 From: yoavweber Date: Fri, 6 Sep 2024 19:57:00 +0300 Subject: [PATCH 1/3] depracting value instead of deleting --- src/WeeklyCalendar.tsx | 11 +++++++---- src/components/types.tsx | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/WeeklyCalendar.tsx b/src/WeeklyCalendar.tsx index 448eaf0..64baa51 100644 --- a/src/WeeklyCalendar.tsx +++ b/src/WeeklyCalendar.tsx @@ -13,18 +13,21 @@ export function WeeklyCalendar({ onSelectDate, weekends = false, currentDate, + value }: CalendarContainerProps) { - const [startWeek, setStartWeek] = useState(startOfWeek(currentDate || new Date(), { weekStartsOn: 0 })); + const dateToUse = currentDate || value; + + const [startWeek, setStartWeek] = useState(startOfWeek(dateToUse || new Date(), { weekStartsOn: 0 })); const weekPeriod = { startDate: startWeek, endDate: endOfWeek(startWeek), }; useEffect(() => { - if (currentDate && startOfWeek(currentDate).getTime() !== startWeek.getTime()) { - setStartWeek(currentDate); + if (dateToUse && startOfWeek(dateToUse).getTime() !== startWeek.getTime()) { + setStartWeek(dateToUse); } - }, [currentDate]); + }, [dateToUse]); useEffect(() => { onSelectDate && onSelectDate(startWeek); diff --git a/src/components/types.tsx b/src/components/types.tsx index cc32896..3421eed 100644 --- a/src/components/types.tsx +++ b/src/components/types.tsx @@ -20,6 +20,11 @@ export interface BaseCalendarProps { export interface CalendarContainerProps extends BaseCalendarProps { events: T[]; + /** + * @deprecated Use `currentDate` instead. + */ + value?: Date; + currentDate?: Date; } From ca30b5afe78eb7474be6b3500033d583a4d67e7c Mon Sep 17 00:00:00 2001 From: yoavweber Date: Tue, 10 Sep 2024 11:34:51 +0300 Subject: [PATCH 2/3] excluding stories and test file --- package.json | 2 +- tsconfig.build.json | 11 +++++ vite.config.ts | 6 ++- yarn.lock | 116 ++++++++++++++++++++------------------------ 4 files changed, 70 insertions(+), 65 deletions(-) create mode 100644 tsconfig.build.json diff --git a/package.json b/package.json index 6c3e40d..7017f41 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,7 @@ "storybook": "^8.2.9", "typescript": "^5.5.4", "vite": "^4.0.0", - "vite-plugin-dts": "^4.0.3", + "vite-plugin-dts": "^4.2.1", "vitest": "^0.32.2" }, "eslintConfig": { diff --git a/tsconfig.build.json b/tsconfig.build.json new file mode 100644 index 0000000..015ac73 --- /dev/null +++ b/tsconfig.build.json @@ -0,0 +1,11 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "noEmit": false, + "removeComments": true, + "sourceMap": false + }, + "exclude": ["node_modules", "dist", "**/*.stories.*", "**/*.test.*", "**/*.spec.*"] + } + \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 9a91f7e..5bad329 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,9 +1,12 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; import path from 'path'; +import dts from 'vite-plugin-dts' export default defineConfig({ - plugins: [react()], + plugins: [react(), dts({ + tsconfigPath: './tsconfig.build.json', + }),], build: { lib: { entry: path.resolve(__dirname, 'src/index.ts'), // This is correct @@ -20,6 +23,7 @@ export default defineConfig({ }, }, }, + emptyOutDir: false, // Prevent Vite from clearing the output directory }, }); diff --git a/yarn.lock b/yarn.lock index 96394ba..fc63bdf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1612,27 +1612,27 @@ dependencies: "@types/mdx" "^2.0.0" -"@microsoft/api-extractor-model@7.29.4": - version "7.29.4" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.29.4.tgz#098f94f304db98f3cea8618fd1107946e212eaf5" - integrity sha512-LHOMxmT8/tU1IiiiHOdHFF83Qsi+V8d0kLfscG4EvQE9cafiR8blOYr8SfkQKWB1wgEilQgXJX3MIA4vetDLZw== +"@microsoft/api-extractor-model@7.29.6": + version "7.29.6" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.29.6.tgz#e5941514502049b06ca9af21e2096f8f1ad5a01b" + integrity sha512-gC0KGtrZvxzf/Rt9oMYD2dHvtN/1KPEYsrQPyMKhLHnlVuO/f4AFN3E4toqZzD2pt4LhkKoYmL2H9tX3yCOyRw== dependencies: "@microsoft/tsdoc" "~0.15.0" "@microsoft/tsdoc-config" "~0.17.0" - "@rushstack/node-core-library" "5.5.1" + "@rushstack/node-core-library" "5.7.0" -"@microsoft/api-extractor@7.47.4": - version "7.47.4" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.47.4.tgz#1a66dc9d6f316fe86eef336e7f8004ab9222499b" - integrity sha512-HKm+P4VNzWwvq1Ey+Jfhhj/3MjsD+ka2hbt8L5AcRM95lu1MFOYnz3XlU7Gr79Q/ZhOb7W/imAKeYrOI0bFydg== +"@microsoft/api-extractor@7.47.7": + version "7.47.7" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.47.7.tgz#3bc4450fe46c265bef857ab938aa15b9fc7a85de" + integrity sha512-fNiD3G55ZJGhPOBPMKD/enozj8yxJSYyVJWxRWdcUtw842rvthDHJgUWq9gXQTensFlMHv2wGuCjjivPv53j0A== dependencies: - "@microsoft/api-extractor-model" "7.29.4" + "@microsoft/api-extractor-model" "7.29.6" "@microsoft/tsdoc" "~0.15.0" "@microsoft/tsdoc-config" "~0.17.0" - "@rushstack/node-core-library" "5.5.1" + "@rushstack/node-core-library" "5.7.0" "@rushstack/rig-package" "0.5.3" - "@rushstack/terminal" "0.13.3" - "@rushstack/ts-command-line" "4.22.3" + "@rushstack/terminal" "0.14.0" + "@rushstack/ts-command-line" "4.22.6" lodash "~4.17.15" minimatch "~3.0.3" resolve "~1.22.1" @@ -1780,10 +1780,10 @@ estree-walker "^2.0.2" picomatch "^2.3.1" -"@rushstack/node-core-library@5.5.1": - version "5.5.1" - resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-5.5.1.tgz#890db37eafaab582c79eb6bf421447b82b3a964b" - integrity sha512-ZutW56qIzH8xIOlfyaLQJFx+8IBqdbVCZdnj+XT1MorQ1JqqxHse8vbCpEM+2MjsrqcbxcgDIbfggB1ZSQ2A3g== +"@rushstack/node-core-library@5.7.0": + version "5.7.0" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-5.7.0.tgz#f28699c7d0b3de0120a207f8b9d5bd7c69806e18" + integrity sha512-Ff9Cz/YlWu9ce4dmqNBZpA45AEya04XaBFIjV7xTVeEf+y/kTjEasmozqFELXlNG4ROdevss75JrrZ5WgufDkQ== dependencies: ajv "~8.13.0" ajv-draft-04 "~1.0.0" @@ -1802,20 +1802,20 @@ resolve "~1.22.1" strip-json-comments "~3.1.1" -"@rushstack/terminal@0.13.3": - version "0.13.3" - resolved "https://registry.yarnpkg.com/@rushstack/terminal/-/terminal-0.13.3.tgz#9a05b8cf759f14161a49d3ccb09d556e4161caca" - integrity sha512-fc3zjXOw8E0pXS5t9vTiIPx9gHA0fIdTXsu9mT4WbH+P3mYvnrX0iAQ5a6NvyK1+CqYWBTw/wVNx7SDJkI+WYQ== +"@rushstack/terminal@0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@rushstack/terminal/-/terminal-0.14.0.tgz#967ecc586d7172204353059f8fdb1760666e9381" + integrity sha512-juTKMAMpTIJKudeFkG5slD8Z/LHwNwGZLtU441l/u82XdTBfsP+LbGKJLCNwP5se+DMCT55GB8x9p6+C4UL7jw== dependencies: - "@rushstack/node-core-library" "5.5.1" + "@rushstack/node-core-library" "5.7.0" supports-color "~8.1.1" -"@rushstack/ts-command-line@4.22.3": - version "4.22.3" - resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.22.3.tgz#dcc75bd25b21031b32b2758ee3f2f4973b112572" - integrity sha512-edMpWB3QhFFZ4KtSzS8WNjBgR4PXPPOVrOHMbb7kNpmQ1UFS9HdVtjCXg1H5fG+xYAbeE+TMPcVPUyX2p84STA== +"@rushstack/ts-command-line@4.22.6": + version "4.22.6" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.22.6.tgz#2aee4fc98c6043c026ce278880fbffb5227de5ca" + integrity sha512-QSRqHT/IfoC5nk9zn6+fgyqOPXHME0BfchII9EUPR19pocsNp/xSbeBCbD3PIR2Lg+Q5qk7OFqk1VhWPMdKHJg== dependencies: - "@rushstack/terminal" "0.13.3" + "@rushstack/terminal" "0.14.0" "@types/argparse" "1.0.38" argparse "~1.0.9" string-argv "~0.3.1" @@ -3170,24 +3170,24 @@ loupe "^2.3.7" pretty-format "^29.7.0" -"@volar/language-core@2.4.0", "@volar/language-core@~2.4.0-alpha.18": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@volar/language-core/-/language-core-2.4.0.tgz#962efc66ff9198ee2412786e99528bf77cdad100" - integrity sha512-FTla+khE+sYK0qJP+6hwPAAUwiNHVMph4RUXpxf/FIPKUP61NFrVZorml4mjFShnueR2y9/j8/vnh09YwVdH7A== +"@volar/language-core@2.4.4", "@volar/language-core@~2.4.1": + version "2.4.4" + resolved "https://registry.yarnpkg.com/@volar/language-core/-/language-core-2.4.4.tgz#4e05ee09f283ab55c37677f80f5faa5e5b3fe2fe" + integrity sha512-kO9k4kTLfxpg+6lq7/KAIv3m2d62IHuCL6GbVgYZTpfKvIGoAIlDxK7pFcB/eczN2+ydg/vnyaeZ6SGyZrJw2w== dependencies: - "@volar/source-map" "2.4.0" + "@volar/source-map" "2.4.4" -"@volar/source-map@2.4.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-2.4.0.tgz#b6690f06c600eaf587bbc81b0153203e4f6db72a" - integrity sha512-2ceY8/NEZvN6F44TXw2qRP6AQsvCYhV2bxaBPWxV9HqIfkbRydSksTFObCF1DBDNBfKiZTS8G/4vqV6cvjdOIQ== +"@volar/source-map@2.4.4": + version "2.4.4" + resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-2.4.4.tgz#98612684bfc54620f7b49c969d4657465c306faf" + integrity sha512-xG3PZqOP2haG8XG4Pg3PD1UGDAdqZg24Ru8c/qYjYAnmcj6GBR64mstx+bZux5QOyRaJK+/lNM/RnpvBD3489g== -"@volar/typescript@^2.3.4", "@volar/typescript@~2.4.0-alpha.18": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@volar/typescript/-/typescript-2.4.0.tgz#f909d20dfe43dd846d30695f6e5467276ff4418e" - integrity sha512-9zx3lQWgHmVd+JRRAHUSRiEhe4TlzL7U7e6ulWXOxHH/WNYxzKwCvZD7WYWEZFdw4dHfTD9vUR0yPQO6GilCaQ== +"@volar/typescript@^2.4.4": + version "2.4.4" + resolved "https://registry.yarnpkg.com/@volar/typescript/-/typescript-2.4.4.tgz#c6679dc6bc1e86483f1d34f22ed2c2b0100f9838" + integrity sha512-QQMQRVj0fVHJ3XdRKiS1LclhG0VBXdFYlyuHRQF/xLk2PuJuHNWP26MDZNvEVCvnyUQuUQhIAfylwY5TGPgc6w== dependencies: - "@volar/language-core" "2.4.0" + "@volar/language-core" "2.4.4" path-browserify "^1.0.1" vscode-uri "^3.0.8" @@ -3218,12 +3218,12 @@ de-indent "^1.0.2" he "^1.2.0" -"@vue/language-core@2.0.29": - version "2.0.29" - resolved "https://registry.yarnpkg.com/@vue/language-core/-/language-core-2.0.29.tgz#19462d786cd7a1c21dbe575b46970a57094e0357" - integrity sha512-o2qz9JPjhdoVj8D2+9bDXbaI4q2uZTHQA/dbyZT4Bj1FR9viZxDJnLcKVHfxdn6wsOzRgpqIzJEEmSSvgMvDTQ== +"@vue/language-core@2.1.6": + version "2.1.6" + resolved "https://registry.yarnpkg.com/@vue/language-core/-/language-core-2.1.6.tgz#b48186bdb9b3ef2b83e1f76d5b1ac357b3a7ed94" + integrity sha512-MW569cSky9R/ooKMh6xa2g1D0AtRKbL56k83dzus/bx//RDJk24RHWkMzbAlXjMdDNyxAaagKPRquBIxkxlCkg== dependencies: - "@volar/language-core" "~2.4.0-alpha.18" + "@volar/language-core" "~2.4.1" "@vue/compiler-dom" "^3.4.0" "@vue/compiler-vue2" "^2.7.16" "@vue/shared" "^3.4.0" @@ -10922,21 +10922,20 @@ vite-node@0.32.4: picocolors "^1.0.0" vite "^3.0.0 || ^4.0.0" -vite-plugin-dts@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/vite-plugin-dts/-/vite-plugin-dts-4.0.3.tgz#0f452be5ea81a50fa27ade4e0f3a0d750873affc" - integrity sha512-+xnTsaONwU2kV6zhRjtbRJSGN41uFR/whqmcb4k4fftLFDJElxthp0PP5Fq8gMeM9ytWMt1yk5gGgekLREWYQQ== +vite-plugin-dts@^4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/vite-plugin-dts/-/vite-plugin-dts-4.2.1.tgz#f8bee33b732929717ce13ef7a382696d51200c30" + integrity sha512-/QlYvgUMiv8+ZTEerhNCYnYaZMM07cdlX6hQCR/w/g/nTh0tUXPoYwbT6SitizLJ9BybT1lnrcZgqheI6wromQ== dependencies: - "@microsoft/api-extractor" "7.47.4" + "@microsoft/api-extractor" "7.47.7" "@rollup/pluginutils" "^5.1.0" - "@volar/typescript" "^2.3.4" - "@vue/language-core" "2.0.29" + "@volar/typescript" "^2.4.4" + "@vue/language-core" "2.1.6" compare-versions "^6.1.1" debug "^4.3.6" kolorist "^1.8.0" local-pkg "^0.5.0" magic-string "^0.30.11" - vue-tsc "2.0.29" "vite@^3.0.0 || ^4.0.0", vite@^4.0.0: version "4.5.3" @@ -10989,15 +10988,6 @@ vscode-uri@^3.0.8: resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.8.tgz#1770938d3e72588659a172d0fd4642780083ff9f" integrity sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw== -vue-tsc@2.0.29: - version "2.0.29" - resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-2.0.29.tgz#bf7e9605af9fadec7fd6037d242217f5c6ad2c3b" - integrity sha512-MHhsfyxO3mYShZCGYNziSbc63x7cQ5g9kvijV7dRe1TTXBRLxXyL0FnXWpUF1xII2mJ86mwYpYsUmMwkmerq7Q== - dependencies: - "@volar/typescript" "~2.4.0-alpha.18" - "@vue/language-core" "2.0.29" - semver "^7.5.4" - w3c-xmlserializer@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz#f925ba26855158594d907313cedd1476c5967f6c" From 1d53669fdc2f6637353e0fb6897f4b82f07be475 Mon Sep 17 00:00:00 2001 From: yoavweber Date: Tue, 10 Sep 2024 11:48:42 +0300 Subject: [PATCH 3/3] removing size from workflow --- .github/workflows/size.yml | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .github/workflows/size.yml diff --git a/.github/workflows/size.yml b/.github/workflows/size.yml deleted file mode 100644 index 6021cda..0000000 --- a/.github/workflows/size.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: size -on: [pull_request] -jobs: - size: - runs-on: ubuntu-latest - env: - CI_JOB_NUMBER: 1 - steps: - - uses: actions/checkout@v1 - - uses: andresz1/size-limit-action@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }}