Skip to content
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

remove lodash #1440

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
22 changes: 14 additions & 8 deletions .github/workflows/chromatic-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,24 @@ jobs:
with:
fetch-depth: 0 # needed by chromatic for git history

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x

- name: PNPM cache via actions/cache@v3
id: pnpm-cache
uses: actions/cache@v3
- name: Cache Rush
uses: actions/cache@v4
with:
path: /home/runner/work/design-system/design-system/common/temp/pnpm-store/v3
path: |
common/temp/install-run
~/.rush
key: ${{ runner.os }}-rush-${{ hashFiles('rush.json') }}

- name: Cache PNPM
uses: actions/cache@v4
with:
path: common/temp/pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
restore-keys: ${{ runner.os }}-pnpm-

- name: Install dependencies
run: node common/scripts/install-run-rush.js install
Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,32 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [18.x]
node-version: [20.x]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: PNPM cache via actions/cache@v3
id: pnpm-cache
uses: actions/cache@v3
- name: Cache Rush
uses: actions/cache@v4
with:
path: /home/runner/work/design-system/design-system/common/temp/pnpm-store/v3
path: |
common/temp/install-run
~/.rush
key: ${{ runner.os }}-rush-${{ hashFiles('rush.json') }}

- name: Cache PNPM
uses: actions/cache@v4
with:
path: common/temp/pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
restore-keys: ${{ runner.os }}-pnpm-

- name: Install dependencies
run: node common/scripts/install-run-rush.js install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish-beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
fetch-depth: 1
token: ${{ secrets.GH_PAT }}

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x

- name: PNPM cache via actions/cache@v3
id: pnpm-cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
fetch-depth: 2
token: ${{ secrets.GH_PAT }}

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x

- name: PNPM cache via actions/cache@v3
id: pnpm-cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/on-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
with:
fetch-depth: 0

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x

- name: PNPM cache via actions/cache@v3
id: pnpm-cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 20.x

- name: PNPM cache via actions/cache@v3
id: pnpm-cache
Expand Down
11 changes: 11 additions & 0 deletions common/changes/pcln-carousel/no-mo-lodash_2024-01-24-03-39.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "removed lodash",
"type": "patch",
"packageName": "pcln-carousel"
}
],
"packageName": "pcln-carousel",
"email": "[email protected]"
}
11 changes: 11 additions & 0 deletions common/changes/pcln-codemods/no-mo-lodash_2024-01-24-03-39.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "removed lodash",
"type": "patch",
"packageName": "pcln-codemods"
}
],
"packageName": "pcln-codemods",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "removed lodash",
"type": "patch",
"packageName": "pcln-design-system"
}
],
"packageName": "pcln-design-system",
"email": "[email protected]"
}
11 changes: 11 additions & 0 deletions common/changes/pcln-icons/no-mo-lodash_2024-01-24-03-39.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "removed lodash",
"type": "patch",
"packageName": "pcln-icons"
}
],
"packageName": "pcln-icons",
"email": "[email protected]"
}
11 changes: 11 additions & 0 deletions common/changes/pcln-popover/no-mo-lodash_2024-01-24-04-02.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"comment": "removed lodash",
"type": "patch",
"packageName": "pcln-popover"
}
],
"packageName": "pcln-popover",
"email": "[email protected]"
}
10 changes: 5 additions & 5 deletions common/config/rush/pnpm-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@
* PNPM documentation: https://pnpm.io/package_json#pnpmpackageextensions
*/
"globalPackageExtensions": {
"babel-plugin-lodash": {
"dependencies": {
"@babel/types": "~7.20.0"
}
}
// "babel-plugin-lodash": {
// "dependencies": {
// "@babel/types": "~7.20.0"
// }
// }
},

/**
Expand Down
32 changes: 0 additions & 32 deletions common/config/rush/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/carousel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
},
"dependencies": {
"@styled-system/theme-get": "^5.1.2",
"lodash.debounce": "^4.0.8",
"moize": "^6.1.6",
"prop-types": "^15.8.1",
"pure-react-carousel": "^1.30.1",
Expand Down
10 changes: 5 additions & 5 deletions packages/carousel/src/helpers.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useState, useEffect } from 'react'
import moize from 'moize'
import { debounce } from 'pcln-design-system'
import { useEffect, useState } from 'react'
import { v4 as uuidv4 } from 'uuid'
import {
VISIBLE_SLIDES_BREAKPOINT_1,
VISIBLE_SLIDES_BREAKPOINT_2,
CAROUSEL_BREAKPOINT_1,
CAROUSEL_BREAKPOINT_2,
MEDIA_QUERY_MATCH,
VISIBLE_SLIDES_BREAKPOINT_1,
VISIBLE_SLIDES_BREAKPOINT_2,
} from './constants'
import debounce from 'lodash.debounce'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(n-b) Kind of amazing that this was the only usage in DS


const getSlideKey = moize(uuidv4, { profileName: 'getSlideKey' })

Expand Down Expand Up @@ -65,4 +65,4 @@ const getMobileVisibleSlidesArray = (visibleSlides) => [visibleSlides[0], null,
const getMobileVisibleSlides = (visibleSlides) =>
Array.isArray(visibleSlides) ? getMobileVisibleSlidesArray(visibleSlides) : visibleSlides

export { getSlideKey, getVisibleSlidesArray, useResponsiveVisibleSlides, getMobileVisibleSlides }
export { getMobileVisibleSlides, getSlideKey, getVisibleSlidesArray, useResponsiveVisibleSlides }
1 change: 0 additions & 1 deletion packages/codemods/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"inquirer": "^8.2.0",
"is-git-clean": "^1.1.0",
"jscodeshift": "^0.13.0",
"lodash.get": "^4.4.2",
"meow": "^10.1.1",
"pcln-design-system": "workspace:*",
"prop-types": "^15.8.1",
Expand Down
4 changes: 1 addition & 3 deletions packages/codemods/transforms/rename-deprecated-props-flex.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import get from 'lodash.get'

const update = (path) => {
const Node = path.value

// Dumb way to skip text elements since they also can have an align prop
if (get(Node, 'openingElement.name.name', '').toLowerCase().includes('text')) {
if (Node?.openingElement?.name?.name?.toLowerCase()?.includes('text')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(super-n-b) If that last name returns, toLowerCase() should work, no?

Suggested change
if (Node?.openingElement?.name?.name?.toLowerCase()?.includes('text')) {
if (Node?.openingElement?.name?.name?.toLowerCase().includes('text')) {

return
}

Expand Down
8 changes: 4 additions & 4 deletions packages/core/config/jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"extends": "@priceline/heft-component-rig/profiles/react/config/jest.config.json",
"coverageThreshold": {
"global": {
"statements": 96,
"branches": 95,
"functions": 90,
"lines": 96
"statements": 94,
"branches": 89,
"functions": 89,
"lines": 94
}
}
}
1 change: 0 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"@types/styled-system": "^5.1.22",
"deepmerge": "^4.3.1",
"hoist-non-react-statics": "^3.3.2",
"lodash": "^4.17.21",
"react-element-to-jsx-string": "^15.0.0",
"react-intersection-observer": "^9.5.3",
"styled-system": "^5.1.5"
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/DocsUtils/Section/Section.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import kebabCase from 'lodash/kebabCase'
import React from 'react'

import { Box, Text } from '../..'
sdalonzo marked this conversation as resolved.
Show resolved Hide resolved
import { Box } from '../../Box/Box'
import { Text } from '../../Text/Text'
import { kebabCase } from '../../utils/strings'

export type SectionProps = {
heading: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import kebabCase from 'lodash/kebabCase'
import React from 'react'

import { Box, Link } from '../..'
import { Box } from '../../Box/Box'
import { Link } from '../../Link/Link'
import { kebabCase } from '../../utils/strings'

const scrollTo = (id: string) => document.getElementById(id)?.scrollIntoView({ behavior: 'smooth' })

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/DocsUtils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Story, StoryObj } from '@storybook/react'
import kebabCase from 'lodash/kebabCase'
import reactElementToJSXString from 'react-element-to-jsx-string'
import { kebabCase } from '../utils/strings'

export const copy = async (value: string) => navigator.clipboard.writeText(value)

Expand Down
Loading