Skip to content

Upgrade all build tooling for v5 alpha #603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions .babelrc.js

This file was deleted.

1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"env": {
"browser": true,
"node": true,
"mocha": true
},
"extends": "eslint:recommended",
"parserOptions": {
Expand Down
104 changes: 92 additions & 12 deletions .github/workflows/build-and-test-types.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
name: CI
on: [pull_request]

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
name: Lint, Test, Report Coverage on Node ${{ matrix.node }}

runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -22,22 +27,26 @@ jobs:
- name: Install dependencies
run: yarn install

# Read existing version, reuse that, add a Git short hash
- name: Set build version to Git commit
run: node scripts/writeGitVersion.mjs $(git rev-parse --short HEAD)

- name: Check updated version
run: jq .version package.json

- name: Run linter
run: yarn lint

- name: Run tests
run: yarn test

- name: Generate test coverage
run: yarn test:cov

- name: Compile
run: yarn build
- name: Pack
run: yarn pack

- name: Report to Codecov.io
uses: codecov/codecov-action@v1
- uses: actions/upload-artifact@v2
with:
files: ./coverage/lcov.info
name: package
path: ./package.tgz

test-types:
name: Test Types with TypeScript ${{ matrix.ts }}
Expand All @@ -48,7 +57,7 @@ jobs:
fail-fast: false
matrix:
node: ['16.x']
ts: ['4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8', '4.9.2-rc']
ts: ['4.2', '4.3', '4.4', '4.5', '4.6', '4.7', '4.8', '4.9', '5.0']
steps:
- name: Checkout repo
uses: actions/checkout@v2
Expand Down Expand Up @@ -78,9 +87,80 @@ jobs:

# Remove config line that points "reselect" to the `src` folder,
# so that the typetest will use the installed version instead
- run: sed -i -e /@remap-prod-remove-line/d ./typescript_test/tsconfig.json
- run: sed -i -e /@remap-prod-remove-line/d ./typescript_test/tsconfig.json vitest.config.ts

- name: Test types
run: |
./node_modules/.bin/tsc --version
yarn test:typescript

test-published-artifact:
name: Test Published Artifact ${{ matrix.example }}

needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['16.x']
example:
[
'cra4',
'cra5',
'next',
'vite',
'node-standard',
'node-esm',
'are-the-types-wrong'
]
steps:
- name: Checkout repo
uses: actions/checkout@v2

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Clone RTK repo
run: git clone https://github.com/reduxjs/redux-toolkit.git ./redux-toolkit

- name: Check folder contents
run: ls -l .

- name: Install deps
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
run: yarn install

- uses: actions/download-artifact@v2
with:
name: package
path: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}

- name: Check folder contents
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
run: ls -l .

- name: Install build artifact
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
run: yarn add ./package.tgz

- name: Show installed package versions
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
run: yarn info reselect && yarn why reselect

- name: Build example
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
run: yarn build

- name: Run test step
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
run: yarn test
if: matrix.example != 'are-the-types-wrong'

- name: Run test step (attw)
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
# Ignore "FalseCJS" errors in the `attw` job
run: yarn test -n FalseCJS
if: matrix.example == 'are-the-types-wrong'
768 changes: 0 additions & 768 deletions .yarn/releases/yarn-3.1.0.cjs

This file was deleted.

801 changes: 801 additions & 0 deletions .yarn/releases/yarn-3.2.4.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.1.0.cjs
yarnPath: .yarn/releases/yarn-3.2.4.cjs
14 changes: 0 additions & 14 deletions jest.config.js

This file was deleted.

74 changes: 26 additions & 48 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,40 @@
"name": "reselect",
"version": "4.1.7",
"description": "Selectors for Redux.",
"main": "./lib/index.js",
"jsnext:main": "./es/index.js",
"module": "./es/index.js",
"types": "./es/index.d.ts",
"unpkg": "./dist/reselect.js",
"main": "./dist/cjs/reselect.cjs",
"module": "./dist/reselect.mjs",
"types": "./dist/reselect.d.ts",
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/reselect.d.ts",
"import": "./dist/reselect.mjs",
"default": "./dist/cjs/reselect.cjs"
}
},
"typesVersions": {
"<4.2": {
"<=4.6": {
"*": [
"./src/legacyTypes/ts4.1/index.d.ts"
"./dist/versionedTypes/ts46/index.d.ts"
]
}
},
"files": [
"lib",
"src",
"dist",
"es"
"dist"
],
"sideEffects": false,
"bugs": {
"url": "https://github.com/reduxjs/reselect/issues"
},
"scripts": {
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src/*.ts --ignore src/types.ts --extensions .ts --out-dir lib ",
"build:es": "babel src/*.ts --ignore src/types.ts --extensions .ts --out-dir es && cp src/versionedTypes/package.dist.json es/versionedTypes/package.json",
"build:umd": "cross-env NODE_ENV=development rollup -c -o dist/reselect.js",
"build:umd:min": "cross-env NODE_ENV=production rollup -c -o dist/reselect.min.js",
"build:types": "tsc",
"build": "rimraf dist lib es && yarn build:types && yarn build:commonjs && yarn build:es && yarn build:umd && yarn build:umd:min",
"clean": "rimraf lib dist es coverage",
"api-types": "api-extractor run --local",
"build": "tsup",
"clean": "rimraf dist",
"format": "prettier --write \"{src,test}/**/*.{js,ts}\" \"docs/**/*.md\"",
"lint": "eslint src test",
"prepublishOnly": "yarn build",
"test": "jest",
"test:cov": "jest --coverage",
"prepack": "yarn build",
"test": "vitest run",
"test:cov": "vitest run --coverage",
"test:typescript": "tsc --noEmit -p typescript_test/tsconfig.json"
},
"keywords": [
Expand All @@ -56,44 +54,24 @@
},
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.15.7",
"@babel/core": "^7.15.8",
"@babel/preset-env": "^7.15.8",
"@babel/preset-typescript": "^7.15.0",
"@babel/register": "^7.15.3",
"@microsoft/api-extractor": "^7.18.16",
"@reduxjs/toolkit": "^1.9.0-rc.1",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.0.6",
"@rollup/plugin-replace": "^3.0.0",
"@types/jest": "^27.0.2",
"@reduxjs/toolkit": "^1.9.3",
"@types/lodash": "^4.14.175",
"@types/shelljs": "^0.8.11",
"@typescript-eslint/eslint-plugin": "5.1.0",
"@typescript-eslint/eslint-plugin-tslint": "5.1.0",
"@typescript-eslint/parser": "5.1.0",
"chai": "^4.3.4",
"codecov.io": "^0.1.6",
"coveralls": "^3.1.1",
"cross-env": "^7.0.3",
"eslint": "^8.0.1",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-typescript": "0.14.0",
"jest": "^27.3.1",
"lodash.memoize": "^4.1.2",
"memoize-one": "^6.0.0",
"micro-memoize": "^4.0.9",
"mkdirp": "^1.0.4",
"mocha": "^9.1.3",
"ncp": "^2.0.0",
"nyc": "^15.1.0",
"prettier": "^2.7.1",
"react-redux": "^7.2.6",
"react-redux": "^8.0.2",
"rimraf": "^3.0.2",
"rollup": "^2.58.0",
"rollup-plugin-terser": "^7.0.2",
"ts-jest": "27.0.7",
"tslint": "6.1.3",
"typescript": "4.8.3"
"shelljs": "^0.8.5",
"tsup": "^6.7.0",
"typescript": "^4.9",
"vitest": "^0.29.8"
}
}
48 changes: 0 additions & 48 deletions rollup.config.js

This file was deleted.

14 changes: 14 additions & 0 deletions scripts/writeGitVersion.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import path from 'path'
import fs from 'fs'
import { fileURLToPath } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)

const gitRev = process.argv[2]

const packagePath = path.join(__dirname, '../package.json')
const pkg = JSON.parse(fs.readFileSync(packagePath))

pkg.version = `${pkg.version}-${gitRev}`
fs.writeFileSync(packagePath, JSON.stringify(pkg, null, 2))
Loading