Skip to content

Commit

Permalink
Merge pull request #416 from wearemothership/package-update
Browse files Browse the repository at this point in the history
Upgrade packages:
  • Loading branch information
aldabil21 authored Feb 24, 2025
2 parents a66f5fe + 3a5d630 commit 2ca0abc
Show file tree
Hide file tree
Showing 33 changed files with 538 additions and 386 deletions.
41 changes: 0 additions & 41 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: npm install

- name: Pack
run: npm run pack
run: npm run build

- name: Publish
run: |
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ dist
.vscode
examples

#yarn
.yarn
yarn.lock

# dependencies
/node_modules
package-lock.json
Expand Down
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run pre:commit
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
79 changes: 79 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import react from "eslint-plugin-react";
import tseslint, { configs as tseslintConfigs } from "typescript-eslint";
import globals from "globals";
import js from "@eslint/js";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";
import pluginImport from "eslint-plugin-import";
import pluginJsxA11y from "eslint-plugin-jsx-a11y";
import pluginPromise from "eslint-plugin-promise";

export default tseslint.config(
{ ignores: ["jest.config.ts", "scripts", "dist", "vite.config.js"] },
pluginJsxA11y.flatConfigs.recommended,
pluginPromise.configs["flat/recommended"],
pluginImport.flatConfigs.recommended,
{
extends: [js.configs.recommended, ...tseslintConfigs.recommended],
plugins: {
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
react,
},
files: ["**/*.{ts,tsx}"],
languageOptions: {
globals: {
...globals.browser,
React: "readonly",
},
ecmaVersion: "latest",
sourceType: "module",
},

settings: {
react: {
version: "detect",
},
},

rules: {
...reactHooks.configs.recommended.rules,
"linebreak-style": ["error", "unix"],

quotes: [
"error",
"double",
{
allowTemplateLiterals: true,
},
],

semi: ["error", "always"],
"@typescript-eslint/no-non-null-assertion": 0,
"no-useless-catch": 0,
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-non-null-asserted-optional-chain": 0,
"no-case-declarations": 0,
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-empty-object-type": [
"error",
{ allowInterfaces: "with-single-extends" },
],
},
},
{
// Checks importing of different files
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: "./",
},
},
},
}
);
11 changes: 6 additions & 5 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="apple-touch-icon" href="/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="manifest" href="/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
Notice the use of in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
Unlike "/favicon.ico" or "favicon.ico", "/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
Expand All @@ -36,5 +36,6 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default {
// setupFiles: [],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
// setupFilesAfterEnv: [],

// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
Expand Down
6 changes: 0 additions & 6 deletions jest.setup.js

This file was deleted.

105 changes: 64 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "@aldabil/react-scheduler",
"version": "2.9.5",
"version": "3.0.0",
"description": "React scheduler component based on Material-UI & date-fns",
"files": [
"*"
],
"type": "module",
"scripts": {
"start": "react-scripts start",
"webpack": "webpack",
"pack": "rm -rf dist && npm run webpack && npm run post:pack",
"local:pack": "npm run pack && cd dist && npm pack && mv *.tgz ../",
"post:pack": "node ./scripts/post-pack.js",
"start": "vite serve",
"build": "vite build --mode production",
"postbuild": "node ./scripts/post-pack.js",
"local:pack": "npm run build && cd dist && npm pack && mv *.tgz ../",
"format": "prettier --check \"**/*.{js,jsx,ts,tsx,json}\"",
"format:write": "prettier --write \"**/*.{js,jsx,ts,tsx,json}\"",
"lint": "npm run types && eslint .",
Expand All @@ -22,6 +22,15 @@
"test:watch": "jest --watch",
"test:ci": "jest --ci"
},
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.umd.cjs"
},
"./types": {
"import": "./dist/types.d.ts"
}
},
"lint-staged": {
"**/*.{ts,js,tsx,jsx}": [
"npm run lint"
Expand All @@ -42,48 +51,62 @@
],
"author": "Aldabil",
"license": "MIT",
"homepage": "",
"bugs": {
"url": "https://github.com/aldabil21/react-scheduler/issues"
},
"devDependencies": {
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@mui/icons-material": "^5.10.6",
"@mui/material": "^5.10.8",
"@mui/x-date-pickers": "^6.19.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^27.0.2",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.39.0",
"@typescript-eslint/parser": "^5.39.0",
"date-fns": "^3.2.0",
"eslint": "^8.24.0",
"eslint-plugin-react": "^7.31.8",
"husky": "^8.0.0",
"jest": "^29.1.2",
"jest-environment-jsdom": "^29.1.2",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "^5.0.1",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@eslint/compat": "^1.2.6",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "^9.20.0",
"@mui/icons-material": ">=6.4.5",
"@mui/material": ">=6.4.5",
"@mui/x-date-pickers": ">=7.27.0",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@testing-library/user-event": "^14.6.1",
"@types/jest": "^29.5.14",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"@typescript-eslint/parser": "^8.24.1",
"@vitejs/plugin-react": "^4.3.4",
"date-fns": ">=4.1.0",
"eslint": "^9.20.1",
"eslint-import-resolver-typescript": "^3.8.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.1.0",
"eslint-plugin-react-refresh": "^0.4.19",
"globals": "^16.0.0",
"husky": "^9.1.7",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.4.3",
"prettier": "^3.5.1",
"react": ">=19.0.0",
"react-dom": "^19.0.0",
"rrule": "^2.8.1",
"ts-jest": "^29.0.3",
"ts-loader": "^9.4.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.4",
"webpack-cli": "^4.7.0",
"webpack-node-externals": "^3.0.0"
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.7.3",
"typescript-eslint": "^8.24.1",
"vite": "^6.1.1",
"vite-plugin-checker": "^0.9.0",
"vite-plugin-dts": "^4.5.0",
"vite-plugin-svgr": "^4.3.0",
"vite-tsconfig-paths": "^5.1.4"
},
"peerDependencies": {
"@mui/icons-material": ">=5.0.0",
"@mui/material": ">=5.0.0",
"@mui/x-date-pickers": ">=6.19.0",
"date-fns": ">=3.2.0",
"react": ">=17.0.0",
"@mui/icons-material": ">=6.0.0",
"@mui/material": ">=6.0.0",
"@mui/x-date-pickers": ">=7.0.0",
"date-fns": ">=4.0.0",
"react": ">=18.0.0",
"react-dom": ">=18.0.0",
"rrule": ">=2.8.1"
},
"peerDependenciesMeta": {
Expand Down
18 changes: 11 additions & 7 deletions scripts/post-pack.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const fs = require("fs");
const path = require("path");
import fs from "node:fs";
import path from "node:path";

const init = async () => {
try {
Expand All @@ -10,18 +10,22 @@ const init = async () => {
}

// clean up package.json on the fly
const package = await fs.promises.readFile(path.join(base, "package.json"), {
const pkg = await fs.promises.readFile(path.join(base, "package.json"), {
encoding: "utf-8",
});
const obj = JSON.parse(package);
const obj = JSON.parse(pkg);
delete obj.scripts;
delete obj.devDependencies;
delete obj["lint-staged"];
obj.homepage = "https://github.com/aldabil21/react-scheduler#readme";

await fs.promises.writeFile(path.join(base, "dist", "package.json"), JSON.stringify(obj), {
encoding: "utf-8",
});
await fs.promises.writeFile(
path.join(base, "dist", "package.json"),
JSON.stringify(obj, null, 2),
{
encoding: "utf-8",
}
);
} catch (error) {
throw error;
}
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from "react";
import { CssBaseline, ThemeProvider, createTheme } from "@mui/material";
import ReactDOM from "react-dom/client";
import { createRoot } from "react-dom/client";
import App from "./App";

const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);
const root = createRoot(document.getElementById("root") as HTMLElement);
root.render(
<React.StrictMode>
<ThemeProvider theme={createTheme()}>
Expand Down
1 change: 1 addition & 0 deletions src/lib/__tests__/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { render, screen } from "@testing-library/react";
import { Scheduler } from "..";
import "@testing-library/jest-dom";

describe("Render scheduler", () => {
it("Default render", () => {
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/common/Cell.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Button } from "@mui/material";
import { useCellAttributes } from "../../hooks/useCellAttributes";
import { CellRenderedProps } from "../../types";
import { JSX } from "react";

interface CellProps {
day: Date;
Expand Down
Loading

0 comments on commit 2ca0abc

Please sign in to comment.