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

Refactor to TS #75

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f655dee
remove deprecated version attribute
blakenetz Oct 3, 2024
87b517f
update browserlist
blakenetz Oct 3, 2024
f151205
install ts-migrate
blakenetz Oct 3, 2024
4b91ebb
resolve eslint peer dep conflict
blakenetz Oct 3, 2024
9987bf4
initialize ts
blakenetz Oct 3, 2024
a6b96a4
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
d24ba53
[ts-migrate][.] Init tsconfig.json file
blakenetz Oct 3, 2024
82f0198
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
1c96b06
migrate pages
blakenetz Oct 3, 2024
d012c35
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
c0f6b6c
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
1b597c1
install missing types. migrate utils dir
blakenetz Oct 3, 2024
1faee4c
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
97d4295
migrate api
blakenetz Oct 3, 2024
5736353
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
15c770f
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
7249ce4
[ts-migrate][.] Init tsconfig.json file
blakenetz Oct 3, 2024
610000d
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
4e18b9e
[ts-migrate][.] Init tsconfig.json file
blakenetz Oct 3, 2024
7a7f1b0
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
f426c5d
[ts-migrate][.] Init tsconfig.json file
blakenetz Oct 3, 2024
b03d145
run ts-migrate on 01 components
blakenetz Oct 3, 2024
3c86c8a
[ts-migrate][.] Init tsconfig.json file
blakenetz Oct 3, 2024
d2e4d31
[ts-migrate][components] Init tsconfig.json file
blakenetz Oct 3, 2024
3a61c48
[ts-migrate][components] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
4657ce9
run migration on remaining components
blakenetz Oct 3, 2024
cad909a
[ts-migrate][.] Init tsconfig.json file
blakenetz Oct 3, 2024
6403d76
[ts-migrate][.] Rename files from JS/JSX to TS/TSX
blakenetz Oct 3, 2024
b88b6d3
[ts-migrate][.] Init tsconfig.json file
blakenetz Oct 3, 2024
aee0b29
update type deps. migrate server and routes js file to ts
blakenetz Oct 3, 2024
2a2aefe
added type-check command
blakenetz Oct 3, 2024
2e67e71
fix ts errors in app page
blakenetz Oct 3, 2024
7ca609b
fix error listerer in server
blakenetz Oct 3, 2024
b92c625
more ts fixes
blakenetz Oct 3, 2024
b5cb74b
fix ts errors
blakenetz Oct 3, 2024
c6a055b
Added types. update react-router. added nvmrc to match docker node ve…
blakenetz Oct 3, 2024
46a7660
fix remaining ts errors
blakenetz Oct 3, 2024
0ed7912
added vscode config for spelling
blakenetz Oct 3, 2024
c947874
update commands and install ts-node
blakenetz Oct 3, 2024
2321c7a
update tsconfig
blakenetz Oct 3, 2024
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
1 change: 0 additions & 1 deletion .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:

node:
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cSpell.words": ["nprogress"]
}
1 change: 1 addition & 0 deletions react/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.21.3
30 changes: 0 additions & 30 deletions react/api/article.js

This file was deleted.

38 changes: 38 additions & 0 deletions react/api/article.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as transforms from "../utils/transforms";
import request from "../utils/request";

/**
* Returns articles list from backend.
*
*/
export const getAll = (): Promise<{
articles: { title: string; id: string }[];
statusCode: number;
}> =>
new Promise((resolve, reject) => {
request
.get("/api/articles")
.query({
"fields[node--article]": "id",
})
// Tell superagent to consider any valid Drupal response as successful.
// Later we can capture error codes if needed.
.ok((resp: any) => resp.statusCode)
.then((response: any) => {
resolve({
// eslint-disable-next-line max-len
articles:
response.statusCode === 200
? response.body.data.map((article: any) =>
transforms.article(article)
)
: [],
statusCode: response.statusCode,
});
})
.catch((error: any) => {
// eslint-disable-next-line no-console
console.error("Could not fetch the articles.", error);
reject(error);
});
});
19 changes: 0 additions & 19 deletions react/components/01_atoms/ErrorMessage/index.js

This file was deleted.

19 changes: 19 additions & 0 deletions react/components/01_atoms/ErrorMessage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import "./_style.scss";
import React from "react";
import PropTypes from "prop-types";
import { Link } from "../../../routes";

const ErrorMessage = ({ statusCode }: any) => (
<div className="error-message">
{statusCode} error. <br />
<Link route="/">
<a>To the Homepage</a>
</Link>
</div>
);

ErrorMessage.propTypes = {
statusCode: PropTypes.number.isRequired,
};

export default ErrorMessage;
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
import React from 'react';
import Head from 'next/head';
import React from "react";
import Head from "next/head";

const HtmlHead = () => (
<Head>
<title>SystemSeed&apos;s Decoupled boilerplate</title>

<meta charSet="utf-8" />

<meta name="viewport" content="width=device-width, initial-scale=1" />

<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="/static/favicon.ico" type="image/vnd.microsoft.icon" />

<link
rel="shortcut icon"
href="/static/favicon.ico"
type="image/vnd.microsoft.icon"
/>
</Head>
);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import { Link } from '../../../routes';
import React from "react";

import { Link } from "../../../routes";

const MainMenu = () => (
<Link to="/">
<Link route="/">
<a className="nav-link">Home</a>
</Link>
);
Expand Down
15 changes: 0 additions & 15 deletions react/components/01_atoms/PageProgressBar/index.js

This file was deleted.

15 changes: 15 additions & 0 deletions react/components/01_atoms/PageProgressBar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "./_style.scss";
import NProgress from "nprogress";
import Router from "next/router";

Router.events.on("onRouteChangeStart", () => {
NProgress.start();
});

Router.events.on("onRouteChangeComplete", () => {
NProgress.done();
});

Router.events.on("onRouteChangeError", () => {
NProgress.done();
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import './_style.scss';
import React from 'react';
import MainMenu from '../../01_atoms/MainMenu';
import "./_style.scss";
import React from "react";
import MainMenu from "../../01_atoms/MainMenu";

const GlobalHeader = () => (
<header>
Expand Down
21 changes: 0 additions & 21 deletions react/components/04_templates/GlobalLayout/index.js

This file was deleted.

19 changes: 19 additions & 0 deletions react/components/04_templates/GlobalLayout/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import "./_style.scss";
import React from "react";
import PropTypes from "prop-types";
import GlobalHeader from "../../03_organisms/GlobalHeader";
import GlobalFooter from "../../03_organisms/GlobalFooter";

const GlobalLayout = ({ children }: any) => (
<>
<GlobalHeader />
<div className="content">{children}</div>
<GlobalFooter />
</>
);

GlobalLayout.propTypes = {
children: PropTypes.node.isRequired,
};

export default GlobalLayout;
2 changes: 2 additions & 0 deletions react/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
Loading