Skip to content

Commit

Permalink
feat: add hotjar library
Browse files Browse the repository at this point in the history
  • Loading branch information
long74100 committed Jun 22, 2022
1 parent e9ed4c8 commit 38eaf6d
Show file tree
Hide file tree
Showing 25 changed files with 1,372 additions and 376 deletions.
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ frontend-enterprise
- `@edx/frontend-enterprise-catalog-search </packages/catalog-search>`_
- `@edx/frontend-enterprise-logistration </packages/logistration>`_
- `@edx/frontend-enterprise-utils </packages/utils>`_
- `@edx/frontend-enterprise-hotjar </packages/hotjar>`

Each of these packages is published to NPM and have their own README files. The packages can be found in the ``packages/*`` folder.

Expand Down Expand Up @@ -92,7 +93,7 @@ Managing package dependencies

Each package in the monorepo contains its own package.json file and unique set of dependencies depending on their needs. However, issues may arise when importing conflicting versions of external packages (e.g., React) in multiple monorepo packages. This is because some dependencies only properly work when there is a single copy of the dependency to ensure the same version is used throughout an application. For example, ``react`` and ``react-dom`` are common offenders here as there can only be one copy of React used at any given time. If a library/app attempts to use more than one copy or differening versions of React, there will be unintended behavior and warnings.

To get around this issue of common/shared dependencies, we can rely on how NPM finds installed packages. If a package does not exist in ``node_modules`` for an individual package, NPM will look in ``node_modules`` further up the directory tree until it finds the package, or gets to the root of the repository.
To get around this issue of common/shared dependencies, we can rely on how NPM finds installed packages. If a package does not exist in ``node_modules`` for an individual package, NPM will look in ``node_modules`` further up the directory tree until it finds the package, or gets to the root of the repository.

NPM workspaces helps with this by hoisting installed packages to the root `node_modules` folder where they will be accessible to any package in the monorepo to ensure there is only one copy used throughout. These dependencies are still noted in each individual package.json file as both a peer dependency and a dev dependency.

Expand Down
705 changes: 340 additions & 365 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"clean": "npm run clean --workspaces && rm -rf ./node_modules",
"build": "npm run build --workspaces",
"test": "npm run test --workspaces",
"test:watch": "npm run test:watch --workspaces",
"lint": "npm run lint --workspaces",
"lint:fix": "npm run lint:fix --workspaces",
"changed": "lerna changed"
Expand Down
9 changes: 5 additions & 4 deletions packages/catalog-search/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"lint": "fedx-scripts eslint --ext .js --ext .jsx .",
"lint:fix": "fedx-scripts eslint --fix --ext .js --ext .jsx .",
"snapshot": "fedx-scripts jest --updateSnapshot",
"test": "fedx-scripts jest --coverage --passWithNoTests"
"test": "fedx-scripts jest --coverage --passWithNoTests",
"test:watch": "npm run test -- --watch"
},
"author": "edX",
"license": "AGPL-3.0",
Expand All @@ -42,8 +43,8 @@
"prop-types": "15.7.2"
},
"devDependencies": {
"@edx/browserslist-config": "1.0.0",
"@edx/frontend-build": "9.1.4",
"@edx/browserslist-config": "1.1.0",
"@edx/frontend-build": "11.0.1",
"@edx/frontend-platform": "1.15.6",
"@edx/paragon": "19.25.1",
"@fortawesome/free-solid-svg-icons": "5.8.1",
Expand All @@ -60,7 +61,7 @@
},
"peerDependencies": {
"@edx/frontend-platform": "^1.9.6 || ^2.0.0",
"@edx/paragon": "^19.15.0",
"@edx/paragon": "^19.15.0 || ^20.0.0",
"@fortawesome/free-solid-svg-icons": "^5.8.1",
"@fortawesome/react-fontawesome": "^0.1.4",
"react": "^16.12.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/catalog-search/src/CurrentRefinements.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/rules-of-hooks */
import React, { useContext, useMemo, useState } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
Expand Down Expand Up @@ -52,7 +53,7 @@ export const CurrentRefinementsBase = ({ items, variant }) => {
}
return activeRefinementsAsFlatArray.slice(0, NUM_CURRENT_REFINEMENTS_TO_DISPLAY);
},
[activeRefinementsAsFlatArray, showAllRefinements],
[activeRefinementsAsFlatArray, refinements.hide_cards, showAllRefinements],
);

/**
Expand Down
1 change: 1 addition & 0 deletions packages/catalog-search/src/FacetListBase.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React, { useCallback, useContext } from 'react';
import PropTypes from 'prop-types';

Expand Down
1 change: 1 addition & 0 deletions packages/catalog-search/src/SearchBox.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React, {
useContext,
useEffect,
Expand Down
1 change: 1 addition & 0 deletions packages/catalog-search/src/SearchContext.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React, {
createContext, useReducer, useMemo, useEffect,
} from 'react';
Expand Down
1 change: 1 addition & 0 deletions packages/catalog-search/src/SearchFilters.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/exhaustive-deps */
import React, { useMemo, useContext } from 'react';
import PropTypes from 'prop-types';
import { breakpoints, MediaQuery } from '@edx/paragon';
Expand Down
1 change: 1 addition & 0 deletions packages/catalog-search/src/data/hooks.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react-hooks/exhaustive-deps */
import { useMemo, useState, useEffect } from 'react';
import { isNull } from '@edx/frontend-enterprise-utils';

Expand Down
5 changes: 5 additions & 0 deletions packages/hotjar/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage
dist
node_modules
__mocks__/
__snapshots__/
7 changes: 7 additions & 0 deletions packages/hotjar/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { createConfig } = require('@edx/frontend-build');
const extendESLintConfig = require('../../common/extendESLintConfig');

const config = createConfig('eslint');
extendESLintConfig(config);

module.exports = config;
3 changes: 3 additions & 0 deletions packages/hotjar/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
dist
coverage
7 changes: 7 additions & 0 deletions packages/hotjar/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*.config.js*
coverage
Makefile
src/**/*.test.js
src/**/*.test.jsx
src/**/tests
src/**/setupTest.js
Empty file added packages/hotjar/CHANGELOG.md
Empty file.
Loading

0 comments on commit 38eaf6d

Please sign in to comment.