Skip to content

Commit

Permalink
3.2.0 Some formatting (#125) (#127)
Browse files Browse the repository at this point in the history
* Some formatting (#125)

* Upgrade dependencies

* Format source

Co-authored-by: Francisco Pérez Zamora <francisco.perezzamora@manomano.com>

* updated CHANGELOG.md
revert react to v16 because of react-diff-viewer
bump prism for npm audit
remove changelog-verify for npm audit

* cleanup

Co-authored-by: franpeza <85033117+franpeza@users.noreply.github.com>
Co-authored-by: Francisco Pérez Zamora <francisco.perezzamora@manomano.com>
  • Loading branch information
3 people authored May 5, 2022
1 parent 95f3b9c commit 79282f1
Show file tree
Hide file tree
Showing 69 changed files with 6,943 additions and 14,237 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
*/examples
*/test
repository.json
.deploy
52 changes: 52 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"parser": "@babel/eslint-parser",
"extends": [
"eslint:recommended",
"pipedrive",
"plugin:prettier/recommended"
],
"env": {
"browser": true,
"jest": true
},
"overrides": [
{
"files": "**/*.{ts,tsx}",
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"pipedrive",
"plugin:prettier/recommended"
],
"env": {
"browser": true
},
"settings": {
"react": {
"version": "detect"
}
}
},
{
"files": "**/*.jsx",
"parser": "@babel/eslint-parser",
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react/jsx-runtime",
"pipedrive",
"plugin:prettier/recommended"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"react/prop-types": "off"
}
}
]
}
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.2.0] - 2022-05-05

### Updated

- `eslint` libraries were being listed as dependencies but not config was set. So an eslint config was added.
- Same thing with `prettier`, it was listed as a dependency and executed on commit (not configured for ts files though) but some files were not formatted with it.
- Some unused dependencies were removed from both `dependencies` and `devDependencies`.
- Removed react-hot-loader because it was not proper configured. I have already a working version with [react-refresh-webpack-plugin](https://github.com/pmmmwh/react-refresh-webpack-plugin) planned for a future PR.
- Some libraries (mostly for the frontend part compilation) were upgrades in order to `improve` the generation of the bundle.
- Some `general cleanup`: removed unused imports, unused declarations, etc.

## [3.1.0] - 2022-05-05

### Added

- Added dependency to winston
- Added an instance of logger in logger.ts and removed the logging functions
- Replace every use of the previous logger functions with calls to the logger exposed from logger.ts

### Fixed

- npm lock version 2
- graphql & @apollo/federation version compatibility
- mysql2 & knex version compatibility
Expand Down Expand Up @@ -232,7 +245,8 @@ DELETE /schema/:schemaId
- Frontend app
- Examples of gateway + 2 federated services

[unreleased]: https://github.com/pipedrive/graphql-schema-registry/compare/v3.0.1...HEAD
[unreleased]: https://github.com/pipedrive/graphql-schema-registry/compare/v3.2.0...HEAD
[3.2.0]: https://github.com/pipedrive/graphql-schema-registry/compare/v3.1.0...v3.2.0
[3.1.0]: https://github.com/pipedrive/graphql-schema-registry/compare/v3.0.1...v3.1.0
[3.0.1]: https://github.com/pipedrive/graphql-schema-registry/compare/v3.0.0...v3.0.1
[3.0.0]: https://github.com/pipedrive/graphql-schema-registry/compare/v2.2.4...v3.0.0
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ WORKDIR /app
USER nobody
ADD package.json package-lock.json ./
RUN npm install
ADD webpack.config.cjs babel.config.cjs ./
ADD webpack.config.js babel.config.js ./
ADD client ./client
RUN npm run build-frontend

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.CI
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ WORKDIR /app
USER nobody
ADD git_src/package.json git_src/package-lock.json ./
RUN npm install
ADD git_src/webpack.config.cjs git_src/babel.config.cjs ./
ADD git_src/webpack.config.js git_src/babel.config.js ./
ADD git_src/client ./client
RUN npm run build-frontend

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Graphql schema storage as dockerized on-premise service for federated graphql ga
(Pull requests are encouraged on these topics)

- Usage tracking (to avoid breaking changes) - needs a separate docker sub-process in golang
- registered clients (based on headers, including apollo-* ones)
- registered clients (based on headers, including apollo-\* ones)
- schema usage breakdown by multiple facets - property, day, query name, client name
- fixed data retention
- schema linting rules (camelCase, mandatory descriptions, too big objects, inconsistent pagination, dates not in DateTime...)
Expand Down
24 changes: 0 additions & 24 deletions babel.config.cjs

This file was deleted.

32 changes: 32 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = (api) => {
// This caches the Babel config
api.cache.using(() => process.env.NODE_ENV);
return {
presets: [
[
'@babel/preset-env',
{
modules: 'auto',
useBuiltIns: 'usage',
corejs: '3',
},
],
[
'@babel/preset-react',
{ development: !api.env('production'), runtime: 'automatic' },
],
],
plugins: [
['babel-plugin-styled-components'],
['@babel/plugin-transform-runtime'],
[
'prismjs',
{
languages: ['graphql'],
theme: 'okaidia',
css: true,
},
],
],
};
};
1 change: 0 additions & 1 deletion client/App.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {
ApolloClient,
InMemoryCache,
Expand Down
4 changes: 1 addition & 3 deletions client/components/Main.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import { Tabs, Box, Tab, Container, AppBar } from '@material-ui/core';
import { HashRouter as Router, Route, Redirect } from 'react-router-dom';
import { hot } from 'react-hot-loader';

import TopMenu from './TopMenu';
import TabPanel from './TabPanel';
Expand Down Expand Up @@ -54,4 +52,4 @@ const Main = () => {
);
};

export default hot(module)(Main);
export default Main;
2 changes: 0 additions & 2 deletions client/components/SourceCodeWithHighlight.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import usePrism from '../utils/usePrism';
import { OverflowScroll } from './styled';

Expand Down
1 change: 0 additions & 1 deletion client/components/SourceCodeWithHighlightAndCopy.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import CheckIcon from '@material-ui/icons/Check';
import FilterNoneIcon from '@material-ui/icons/FilterNone';
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
Expand Down
1 change: 0 additions & 1 deletion client/components/SpinnerCenter.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import CircularProgress from '@material-ui/core/CircularProgress';

import { FlexCenter } from './styled';
Expand Down
3 changes: 0 additions & 3 deletions client/components/TabPanel.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import React from 'react';

import PropTypes from 'prop-types';
import { Box } from '@material-ui/core';

function TabPanel(props) {
const { children, value, index, ...other } = props;
Expand Down
1 change: 0 additions & 1 deletion client/components/TopLevelTab.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import Tabs from '@material-ui/core/Tabs';
import { Link, useRouteMatch } from 'react-router-dom';

Expand Down
13 changes: 6 additions & 7 deletions client/components/TopMenu.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { AppBar, IconButton, Tab, Tabs, Toolbar } from '@material-ui/core';
import React from 'react';
import { AppBar, Tab, Tabs } from '@material-ui/core';
import ReactLogo from './logo';
import { useHistory } from 'react-router-dom';

export default ({ UITabs, selectedTab, handleChange }) => {
let history = useHistory();
export default function TopMenu({ UITabs, selectedTab, handleChange }) {
const history = useHistory();

return (
<AppBar
Expand All @@ -24,16 +23,16 @@ export default ({ UITabs, selectedTab, handleChange }) => {
onChange={handleChange}
aria-label="simple tabs example"
>
{/*<React.Fragment>*/}
{/* <React.Fragment>*/}
{UITabs.map((tab, i) => (
<Tab
key={i}
onClick={() => history.push(tab.href)}
label={tab.Title}
/>
))}
{/*</React.Fragment>*/}
{/* </React.Fragment>*/}
</Tabs>
</AppBar>
);
};
}
2 changes: 0 additions & 2 deletions client/components/logo.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

export default function Logo() {
return (
<div>
Expand Down
3 changes: 0 additions & 3 deletions client/entry-standalone.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// eslint-disable-next-line
__webpack_public_path__ = '/assets/';

import 'react-hot-loader';

import React from 'react';
import ReactDOM from 'react-dom';

import App from './App';
Expand Down
2 changes: 1 addition & 1 deletion client/persisted-queries/PersistedQuery.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import { useState } from 'react';

import { EntryPanel } from '../components/styled';
import QueryName from './QueryName';
Expand Down
4 changes: 1 addition & 3 deletions client/persisted-queries/QueryName.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from 'react';

import { EntryName } from '../components/styled';

import { DocumentQueryEntry } from './styled';

const QueryName = ({ entry, revealed, onClick }) => {
const QueryName = ({ entry, onClick }) => {
return (
<DocumentQueryEntry onClick={onClick}>
<div>
Expand Down
1 change: 0 additions & 1 deletion client/persisted-queries/Tab.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useQuery } from '@apollo/client';
import { PERSISTED_QUERIES_COUNT } from '../utils/queries';

Expand Down
1 change: 0 additions & 1 deletion client/persisted-queries/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useQuery } from '@apollo/client';

import SpinnerCenter from '../components/SpinnerCenter';
Expand Down
1 change: 0 additions & 1 deletion client/schema/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { HashRouter as Router, Route } from 'react-router-dom';
import { useQuery } from '@apollo/client';

Expand Down
1 change: 0 additions & 1 deletion client/schema/service-details/CodeDiff.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import ReactDiffViewer, { DiffMethod } from 'react-diff-viewer';

const newStyles = {
Expand Down
15 changes: 4 additions & 11 deletions client/schema/service-details/DeactivateSchemaButton.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import { useMutation } from '@apollo/client';
import { Button } from '@material-ui/core';
import DeleteIcon from '@material-ui/icons/Delete';
Expand All @@ -8,19 +7,13 @@ import {
DEACTIVATE_SCHEMA_ENTRY,
ACTIVATE_SCHEMA_ENTRY,
} from '../../utils/mutations';
import { useParams } from 'react-router-dom';

const DeactivateSchemaButton = ({ schema }) => {
const { serviceName } = useParams();
const [
deactivateSchema,
{ loading: deleting, error: deleteError },
] = useMutation(DEACTIVATE_SCHEMA_ENTRY);
const [deactivateSchema, { loading: deleting, error: deleteError }] =
useMutation(DEACTIVATE_SCHEMA_ENTRY);

const [
activateSchema,
{ loading: activating, error: activateError },
] = useMutation(ACTIVATE_SCHEMA_ENTRY);
const [activateSchema, { loading: activating, error: activateError }] =
useMutation(ACTIVATE_SCHEMA_ENTRY);

const deleteErrorMessage = deleteError ? deleteError.message : null;
const activateErrorMessage = activateError ? activateError.message : null;
Expand Down
2 changes: 0 additions & 2 deletions client/schema/service-details/Empty.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react';

import { Container, SelectServiceGuide } from '../styled';

const Empty = () => {
Expand Down
2 changes: 1 addition & 1 deletion client/schema/service-details/ServiceSchemas.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import { useState } from 'react';
import { useQuery } from '@apollo/client';

import SpinnerCenter from '../../components/SpinnerCenter';
Expand Down
1 change: 0 additions & 1 deletion client/schema/service-details/VersionCharDelta.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react';
import {
VersionChars,
VersionCharsPositive,
Expand Down
4 changes: 2 additions & 2 deletions client/schema/service-details/VersionDetails.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import { useState } from 'react';
import { Button, ButtonGroup, Tabs, Tab } from '@material-ui/core';
import TabPanel from '../../components/TabPanel';

Expand All @@ -22,7 +22,7 @@ import CodeDiff from './CodeDiff';

const VersionDetails = () => {
const [revealed, setRevealed] = useState(null);
const [value, setValue] = React.useState(0);
const [value, setValue] = useState(0);

const handleChange = (event, newValue) => {
setValue(newValue);
Expand Down
7 changes: 3 additions & 4 deletions client/schema/service-details/VersionsList.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { Link, useHistory, useParams } from 'react-router-dom';
import { format, formatDistance } from 'date-fns';
import { useHistory, useParams } from 'react-router-dom';
import { formatDistance } from 'date-fns';

import { EntryGrid } from '../../components/styled';
import { FlexRow, VersionRow, VersionTag } from '../styled';
Expand All @@ -12,7 +11,7 @@ import VersionCharDelta from './VersionCharDelta';
const VersionsList = ({ service }) => {
const { serviceName, schemaId } = useParams();
const selectedSchema = parseInt(schemaId, 10);
let history = useHistory();
const history = useHistory();

if (!service) {
return;
Expand Down
Loading

0 comments on commit 79282f1

Please sign in to comment.