diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d3514a61a..4dc412260 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,10 +36,7 @@ jobs: run: npm ci --no-audit --progress=false --silent - name: Check Code Formatter - run: npm run prettier:check - - - name: Type Check - run: npm run type-check + run: npm run format - name: Lint run: npm run lint diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7468e56b2..838114094 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,9 +34,9 @@ Local development configuration is pretty snappy. Here's how to get set up: 1. Run `npm run build` from project root (at least the first time, this will get you the `dist` directory that holds the code that will be linked to) 1. Run `npm run start` from project root. (This command launches a documentation app and runs it as a simple webserver at http://localhost:3000.) 1. Open new terminal window -1. Run `npm run build-dev` from project root. (This command sets up a development environment that keeps an eye on any file changes. When a file is updated, it auto-builds using the latest code.) +1. Run `npm run dev` from project root. (This command sets up a development environment that keeps an eye on any file changes. When a file is updated, it auto-builds using the latest code.) You can run `npm run test` to execute the test suite and linters. To help you develop the component we’ve set up some tests that cover the basic functionality (can be found in `/src/tests`). Even though we’re big fans of testing, this only covers a small piece of the component. We highly recommend you add tests when you’re adding new functionality. 1. After each JS change run `npm run build:js` in project root -1. After each SCSS change run `npm run css:dev && npm run css:modules:dev` in project root +1. After each SCSS change run `npm run dev:css && npm run dev:css:modules` in project root diff --git a/package.json b/package.json index b49cc34be..0235ff169 100644 --- a/package.json +++ b/package.json @@ -85,27 +85,26 @@ "react-onclickoutside": "^6.13.0" }, "scripts": { - "eslint": "eslint --ext .js,.jsx,.ts,.tsx ./src", - "precommit": "lint-staged --allow-empty", - "sass-lint": "stylelint 'src/stylesheets/*.scss'", - "lint": "npm run eslint && npm run sass-lint", - "prettier": "prettier --write '**/*.{js,jsx,ts,tsx}'", - "prettier:check": "prettier --check '**/*.{js,jsx,ts,tsx}'", + "prepare": "husky install", "start": "npm install --prefix docs-site && npm start --prefix docs-site", + "build": "NODE_ENV=production npm run build:js && NODE_ENV=production npm run build:css && NODE_ENV=production npm run dev:css:modules && NODE_ENV=production npm run dev:css && NODE_ENV=production npm run dev:css:modules", + "dev": "NODE_ENV=development npm run dev:js && NODE_ENV=development npm run dev:css && NODE_ENV=development npm run dev:css:modules", + "build:css": "sass --style compressed src/stylesheets/datepicker.scss > dist/react-datepicker.min.css", + "build:css:modules": "sass --style compressed src/stylesheets/datepicker-cssmodules.scss | tee dist/react-datepicker-cssmodules.min.css dist/react-datepicker-min.module.css", + "build:js": "rollup -c", + "dev:css": "sass --style expanded src/stylesheets/datepicker.scss > dist/react-datepicker.css", + "dev:css:modules": "sass --style expanded src/stylesheets/datepicker-cssmodules.scss | tee dist/react-datepicker-cssmodules.css dist/react-datepicker.module.css", + "dev:js": "rollup -cw", "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 npm run build:src && NODE_ENV=production npm run css:prod && NODE_ENV=production npm run css:modules:dev && NODE_ENV=production npm run css:dev && NODE_ENV=production npm run css:modules:dev", - "build-dev": "NODE_ENV=development npm run js:dev && NODE_ENV=development npm run css:dev && NODE_ENV=development npm 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 --project tsconfig.build.json --noEmit", - "type-check:watch": "npm run type-check -- --watch", - "build:src": "rollup -c", - "js:dev": "rollup -cw", - "prepare": "husky install" + "fix": "npm run format:fix", + "lint": "npm run lint:eslint && npm run lint:stylelint", + "lint:eslint": "eslint --ext .js,.jsx,.ts,.tsx ./src", + "lint:stylelint": "stylelint 'src/stylesheets/*.scss'", + "format": "prettier --check '**/*.{js,jsx,ts,tsx}'", + "format:fix": "prettier --write '**/*.{js,jsx,ts,tsx}'", + "precommit": "lint-staged --allow-empty" }, "lint-staged": { "*.{js,jsx,ts,tsx,json,css,scss,md}": ["prettier --write", "git add"]