Skip to content

Commit

Permalink
Updated libraries, typescript ^5, react ^18, examples
Browse files Browse the repository at this point in the history
1249 => 929 packages
8 vulnerabilities (4 moderate, 3 high, 1 critical) => 0 vulnerabilities
  • Loading branch information
matux committed Feb 26, 2024
1 parent 2619d74 commit a828a25
Show file tree
Hide file tree
Showing 33 changed files with 54,049 additions and 9,818 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ plugins:
- react-hooks
- testing-library
overrides:
- files:
- '**/*.mjs'
parserOptions:
babelOptions:
parserOpts:
plugins: ['importAssertions']
- files:
- '**/__tests__/**/*.[jt]s?(x)'
- '**/?(*.)+(spec|test).[jt]s?(x)'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
prettier: true
eslint: true
eslint_args: '--max-warnings 0'
eslint_extensions: js,jsx,ts,tsx
eslint_extensions: js,jsx,mjs,cjs,ts,tsx

- name: Test
run: npm run test
1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

35 changes: 35 additions & 0 deletions examples/nextjs-10/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/*
!/.next/static/
/out/

# production
/build

# development
/.yalc
yalc.lock

# misc
.DS_Store

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local
1 change: 1 addition & 0 deletions examples/nextjs-10/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a starter template for [Learn Next.js](https://nextjs.org/learn).
9 changes: 9 additions & 0 deletions examples/nextjs-10/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
webpack(config, { isServer }) {
if (!isServer) {
config.devtool = 'source-map'
}

return config
}
}
19 changes: 19 additions & 0 deletions examples/nextjs-10/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"private": true,
"scripts": {
"build": "next build",
"dev": "next dev -p 3001",
"start": "next start -p 3001"
},
"dependencies": {
"@rollbar/react": "^0.11.2",
"next": "latest",
"prop-types": "^15.8.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"rollbar": "^2.26.2"
},
"engines": {
"node": ">=18"
}
}
175 changes: 175 additions & 0 deletions examples/nextjs-10/pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import Link from 'next/link'
import Head from 'next/head'
import styles from '../styles/Home.module.css'
import React, { useEffect, useState } from 'react'
import { Provider, ErrorBoundary, useRollbar } from '@rollbar/react'

const rollbarConfig = {
accessToken: '37f08875d00d474cbb34f7fe661878fa',
endpoint: 'https://api.rollbar.com/api/1/item', //'https://api.rollbar.com/api/1/item', //'http://localhost:8000/api/1/item',
captureUncaught: true,
captureUnhandledRejections: true,
payload: {
environment: 'testenv',
code_version: 'cf29e4a',
client: {
javascript: {
source_map_enabled: true,
code_version: 'cf29e4a',
guess_uncaught_frames: true,
},
},
server: {
root: 'webpack://_N_E/./pages/',
branch: 'main',
},
person: {
id: 1234,
email: '[email protected]',
username: 'localuser',
},
},
};

export default function App() {
console.log(rollbarConfig)
return (
<Provider config={rollbarConfig}>
<ErrorBoundary>
<Home />
<AnotherError />
</ErrorBoundary>
</Provider>
);
}

function TestError() {
const a = null
return a.hello()
}

function AnotherError() {
const rollbar = useRollbar()
const [flag, setFlag] = useState(false)

useEffect(() => {
const a = null
setFlag(true)
a.hello()
})

return (<>{flag}</>)
}

function Home() {
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<link rel="icon" href="/favicon.ico" />
</Head>

<main>
<h1 className={styles.title}>
Read <Link href="https://nextjs.org">Next.js!</Link>
</h1>

<p className={styles.description}>
Get started by editing <code>pages/index.js</code>
</p>

<div className={styles.grid}>
<a href="https://nextjs.org/docs" className={styles.card}>
<h3>Documentation &rarr;</h3>
<p>Find in-depth information about Next.js features and API.</p>
</a>

<a href="https://nextjs.org/learn" className={styles.card}>
<h3>Learn &rarr;</h3>
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>

<a
href="https://github.com/vercel/next.js/tree/canary/examples"
className={styles.card}
>
<h3>Examples &rarr;</h3>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>

<a
href="https://vercel.com/import?filter=next.js&utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<h3>Deploy &rarr;</h3>
<p>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
</a>
</div>
</main>

<footer>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by{' '}
<img src="/vercel.svg" alt="Vercel" className={styles.logo} />
</a>
</footer>

<style jsx>{`
main {
padding: 5rem 0;
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
footer {
width: 100%;
height: 100px;
border-top: 1px solid #eaeaea;
display: flex;
justify-content: center;
align-items: center;
}
footer img {
margin-left: 0.5rem;
}
footer a {
display: flex;
justify-content: center;
align-items: center;
text-decoration: none;
color: inherit;
}
code {
background: #fafafa;
border-radius: 5px;
padding: 0.75rem;
font-size: 1.1rem;
font-family: Menlo, Monaco, Lucida Console, Liberation Mono,
DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace;
}
`}</style>

<style jsx global>{`
html,
body {
padding: 0;
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue,
sans-serif;
}
* {
box-sizing: border-box;
}
`}</style>
</div>
)
}
Binary file added examples/nextjs-10/public/favicon.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions examples/nextjs-10/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions examples/nextjs-10/styles/Home.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
.container {
min-height: 100vh;
padding: 0 0.5rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

.title a {
color: #0070f3;
text-decoration: none;
}

.title a:hover,
.title a:focus,
.title a:active {
text-decoration: underline;
}

.title {
margin: 0 0 1rem;
line-height: 1.15;
font-size: 3.6rem;
}

.title {
text-align: center;
}

.title,
.description {
text-align: center;
}

.description {
line-height: 1.5;
font-size: 1.5rem;
}

.grid {
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;

max-width: 800px;
margin-top: 3rem;
}

.card {
margin: 1rem;
flex-basis: 45%;
padding: 1.5rem;
text-align: left;
color: inherit;
text-decoration: none;
border: 1px solid #eaeaea;
border-radius: 10px;
transition:
color 0.15s ease,
border-color 0.15s ease;
}

.card:hover,
.card:focus,
.card:active {
color: #0070f3;
border-color: #0070f3;
}

.card h3 {
margin: 0 0 1rem 0;
font-size: 1.5rem;
}

.card p {
margin: 0;
font-size: 1.25rem;
line-height: 1.5;
}

.logo {
height: 1em;
}

@media (max-width: 600px) {
.grid {
width: 100%;
flex-direction: column;
}
}
32 changes: 32 additions & 0 deletions examples/nextjs-10/styles/global.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
html,
body {
padding: 0;
margin: 0;
font-family:
Inter,
-apple-system,
BlinkMacSystemFont,
Segoe UI,
Roboto,
Oxygen,
Ubuntu,
Cantarell,
Fira Sans,
Droid Sans,
Helvetica Neue,
sans-serif;
}

a {
color: inherit;
text-decoration: none;
}

* {
box-sizing: border-box;
}

img {
max-width: 100%;
height: auto;
}
Loading

0 comments on commit a828a25

Please sign in to comment.