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

fix(deps): update remark #153

Merged
merged 20 commits into from
Mar 5, 2024
Merged

fix(deps): update remark #153

merged 20 commits into from
Mar 5, 2024

Conversation

renovate[bot]
Copy link

@renovate renovate bot commented Dec 3, 2023

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
remark-gfm ^3.0.1 -> ^4.0.0 age adoption passing confidence
remark-html ^15.0.2 -> ^16.0.0 age adoption passing confidence
remark-parse (source) ^10.0.2 -> ^11.0.0 age adoption passing confidence

Release Notes

remarkjs/remark-gfm (remark-gfm)

v4.0.0

Compare Source

Change
  • b8cc334 Update @types/mdast, unified, utilities
    migrate: update too
  • 9eb0f54 Change to use exports
    migrate: don’t use private APIs
  • 5715c93 Change to require Node.js 16
    migrate: update too

Full Changelog: remarkjs/remark-gfm@3.0.1...4.0.0

remarkjs/remark-html (remark-html)

v16.0.1

Compare Source

  • e507e9d Fix to add misclassified dependency

Full Changelog: remarkjs/remark-html@16.0.0...16.0.1

v16.0.0

Compare Source

Change
  • c726e74 Change to require Node.js 16
    migrate: update too
  • 80482a5 Change to use exports
    migrate: don’t use private APIs
  • 1946cf3 Update @types/mdast, utilities, etc
    migrate: update too
    hast-util-sanitize@5: everything’s safe, GH is safe, but make sure to check if you’re super worried
    hast-util-to-html@9: options.entities -> options.characterReferences
    mdast-util-to-hast@13: handlers are different, if you pass those, see the changelog

Full Changelog: remarkjs/remark-html@15.0.2...16.0.0

remarkjs/remark (remark-parse)

v11.0.0

Compare Source

(see 15.0.0)


Configuration

📅 Schedule: Branch creation - "on Thursday on the first day instance of January, March, May, July, September, November after 4pm" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@karlhorky
Copy link
Member

@ProchaLu Apparently remark-highlight.js is legacy and should be migrated to rehype-highlight:

Stability: Legacy. This package is no longer recommended for use. It’s still covered by semantic-versioning guarantees and not yet deprecated, but use of this package should be avoided. Please use remark-rehype to move from remark (markdown) to rehype (HTML) and then replace remark-highlight.js with rehype-highlight.

Looks like Victor Ofoegbu already did this upgrade in upstream, so you probably can pull in those changes (also he migrated to App Router):

https://github.com/vickonrails/next-starter-peacock/blob/8cf339436b644f98f1b39290852f0fe5f8ee2aee/package.json#L20

@karlhorky
Copy link
Member

@ProchaLu probably an easier and effective way of doing this would be doing this:

@renovate renovate bot force-pushed the renovate/remark branch 2 times, most recently from 0265112 to 3a46dcc Compare December 3, 2023 15:50
@renovate renovate bot force-pushed the renovate/remark branch 4 times, most recently from 1310bdc to d95c89c Compare January 5, 2024 03:23
@karlhorky karlhorky mentioned this pull request Jan 6, 2024
@renovate renovate bot force-pushed the renovate/remark branch from d95c89c to 4d10f5c Compare January 6, 2024 16:33
@renovate renovate bot changed the title fix(deps): update dependency remark to v15 fix(deps): update remark Jan 6, 2024
@karlhorky
Copy link
Member

karlhorky commented Jan 6, 2024

@ProchaLu some new warnings and errors in the build now:

  • Young Serif error
  • Named imports warnings
  • tsconfig.json jsx transform warning
  • TypeScript error with Remark
pnpm build

> [email protected] build /home/runner/work/next-starter-peacock/next-starter-peacock
> next build

   ▲ Next.js 14.0.3

   Creating an optimized production build ...
 ⨯ Failed to find font override values for font `Young Serif`
 ⨯ Failed to find font override values for font `Young Serif`
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
 ⚠ Compiled with warnings

./app/[contentType]/[slug]/page.tsx
Should not import the named export 'site'.'siteTitle' (imported as 'site') from default-exporting module (only default export is available soon)

Import trace for requested module:
./app/[contentType]/[slug]/page.tsx

./app/[contentType]/[slug]/page.tsx
Should not import the named export 'site'.'siteDescription' (imported as 'site') from default-exporting module (only default export is available soon)

Import trace for requested module:
./app/[contentType]/[slug]/page.tsx

./app/[contentType]/[slug]/page.tsx
Should not import the named export 'site'.'siteName' (imported as 'site') from default-exporting module (only default export is available soon)

Import trace for requested module:
./app/[contentType]/[slug]/page.tsx

./app/[contentType]/[slug]/page.tsx
Should not import the named export 'site'.'siteDescription' (imported as 'site') from default-exporting module (only default export is available soon)

...

We detected TypeScript in your project and reconfigured your tsconfig.json file for you. Strict-mode is set to false by default.
   The following mandatory changes were made to your tsconfig.json:

   	- jsx was set to preserve (next.js implements its own optimized jsx transform)


Failed to compile.

./utils/content.ts:142:10
Type error: No overload matches this call.
  Overload 1 of 3, '(plugin: Plugin<[], Node, Node>, ...settings: [] | [boolean]): Processor<void, void, void, void>', gave the following error.
    Argument of type 'Plugin<[(Readonly<Options> | null | undefined)?], string, Root>' is not assignable to parameter of type 'Plugin<[], Node, Node>'.
      The 'this' types of each signature are incompatible.
        Type 'Processor<void, void, void, void>' is missing the following properties from type 'Processor<undefined, undefined, undefined, undefined, undefined>': compiler, freezeIndex, frozen, namespace, and 3 more.
  Overload 2 of 3, '(tuple: [Plugin<any[], Node<Data>, Node<Data>>, ...any[]] | [Plugin<any[], Node<Data>, Node<Data>>, boolean]): Processor<...>', gave the following error.
    Argument of type 'Plugin<[(Readonly<Options> | null | undefined)?], string, Root>' is not assignable to parameter of type '[Plugin<any[], Node<Data>, Node<Data>>, ...any[]] | [Plugin<any[], Node<Data>, Node<Data>>, boolean]'.
  Overload 3 of 3, '(presetOrList: Preset | PluggableList): Processor<void, void, void, void>', gave the following error.
    Argument of type 'Plugin<[(Readonly<Options> | null | undefined)?], string, Root>' is not assignable to parameter of type 'Preset | PluggableList'.

  140 |   const matterResult = matter(fileContents);
  141 |   const processedContent = await unified()
> 142 |     .use(remarkParse)
      |          ^
  143 |     .use(html, { sanitize: false })
  144 |     .use(gfm)
  145 |     .use(rehypeHighlight)
 ELIFECYCLE  Command failed with exit code 1.
Error: Process completed with exit code 1.

Copy link

netlify bot commented Feb 26, 2024

Deploy Preview for dancing-dragon-b13f72 ready!

Name Link
🔨 Latest commit 12b1a03
🔍 Latest deploy log https://app.netlify.com/sites/dancing-dragon-b13f72/deploys/65e75264912c720008fb36e7
😎 Deploy Preview https://deploy-preview-153--dancing-dragon-b13f72.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Author

renovate bot commented Feb 26, 2024

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

Warning: custom changes will be lost.

package.json Outdated
@@ -16,16 +16,16 @@
"framer-motion": "^10.16.14",
"gray-matter": "^4.0.3",
"highlight.js": "^11.9.0",
"next": "^14.0.3",
"next": "^14.1.1-canary.66",
Copy link
Member

@ProchaLu ProchaLu Feb 26, 2024

Choose a reason for hiding this comment

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

   Creating an optimized production build ...
 ⨯ Failed to find font override values for font `Young Serif`

Fixed in the Next.js 14.1.1-canary.66

Comment on lines -1 to 18
'use client'
'use client';

import { useRouter } from 'next/navigation'
import React from 'react'
import { ChevronLeft } from 'react-feather'
import { useRouter } from 'next/navigation';
import React from 'react';
import { ChevronLeft } from 'react-feather';

export default function BackButton() {
const router = useRouter()
return (
<button className="group flex items-center gap-1 text-accent-3 hover:text-accent-1 active:scale-95" onClick={() => router.push('/works')}>
<ChevronLeft className="transition-transform group-hover:-translate-x-2" />
<div>All Projects</div>
</button>
)
const router = useRouter();
return (
<button
className="group flex items-center gap-1 text-accent-3 hover:text-accent-1 active:scale-95"
onClick={() => router.push('/works')}
>
<ChevronLeft className="transition-transform group-hover:-translate-x-2" />
<div>All Projects</div>
</button>
);
}
Copy link
Member

Choose a reason for hiding this comment

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

Prettier changes

Comment on lines 21 to 23
if (!contentType) {
return notFound();
}
Copy link
Member

Choose a reason for hiding this comment

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

catch if contentType = undefined

Copy link
Member

@karlhorky karlhorky Mar 5, 2024

Choose a reason for hiding this comment

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

return not necessary, for all instances of notFound()

Copy link
Member

Choose a reason for hiding this comment

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

Deleted all return before notFound()
9b10517

/** @type {import('prettier').Options} */
/** @type {import('prettier').Config} */
Copy link
Member

Choose a reason for hiding this comment

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

Updated ESLint

utils/content.ts Outdated
Comment on lines 32 to 47
export type ContentDataTypes = {
id: string;
contentHtml: string;
problem?: string;
techStack?: string[];
} & Pick<
IContent,
| 'title'
| 'draft'
| 'date'
| 'previewImage'
| 'description'
| 'tags'
| 'category'
>;

Copy link
Member

@ProchaLu ProchaLu Mar 4, 2024

Choose a reason for hiding this comment

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

Add TS type for the getContentData function, replacing the any types

Copy link
Member

Choose a reason for hiding this comment

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

  • naming can probably be improved
    • make sure that you choose the correct plural form (this is currently plural, but it's an object)
  • can you derive id, contentHtml, problem or techStack from any other existing types?
  • why are problem and techStack optional? should there be a comment describing why for each?

Copy link
Member

Choose a reason for hiding this comment

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

Changed the type in this commit 612f21c
Changed variable name in this commit 1527409

utils/content.ts Outdated
Comment on lines 118 to 121
export const getContentData = async (
id: string,
contentType: IContentType,
): Promise<ContentDataTypes> => {
Copy link
Member

Choose a reason for hiding this comment

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

Add TS type to replace any

import { author, site } from '../../../config/index.json';
import info from '../../../config/index.json' assert { type: 'json' };
Copy link
Member

Choose a reason for hiding this comment

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

Named imports throw this Webpack error, and to solve this issue, we have to switch to default imports

./app/page.tsx
Should not import the named export 'site'.'siteTitle' (imported as 'site') from default-exporting module (only default export is available soon)

If a module import has an attribute with key type and value json, the host is required to either fail the import, or treat it as a JSON module. Specifically this means that the content of the module is parsed as JSON and the resulting JSON object is the default export of the module (which has no named exports).

https://github.com/tc39/proposal-json-modules?tab=readme-ov-file#proposed-semantics-and-interoperability

Comment on lines -3 to +10
export const contentTypesMap: Map<IContentType, any> = new Map([
export const contentTypesMap: Map<
IContentType,
{
title: string;
description: string;
path: string;
}
> = new Map([
Copy link
Member

Choose a reason for hiding this comment

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

Remove type any and use the correct types

{content.previewImage && (
{!!content.previewImage && (
Copy link
Member

Choose a reason for hiding this comment

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

Non-null Assertion to tell TypeScript that the value is not null or undefined.

Potentially falsey string in logical AND expression. Please use boolean.eslint[jsx-expressions/strict-logical-expressions](https://github.com/hluisson/eslint-plugin-jsx-expressions/blob/v1.3.2/lib/rules/strict-logical-expressions.md)

package.json Outdated
"build": "next build && sed -i 's/\"type\": \"module\"/\"type\": \"commonjs\"/' package.json",
"build": "if [ $(uname) = 'Darwin' ]; then next build && sed -i '' 's/\"type\": \"module\"/\"type\": \"commonjs\"/' package.json; else next build && sed -i 's/\"type\": \"module\"/\"type\": \"commonjs\"/' package.json; fi",
Copy link
Member

Choose a reason for hiding this comment

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

On MacOS, the build script fails with this error message

sed: 1: "package.json": extra characters at the end of p command

To avoid this error, we have to add a no extension flag to the MacOS command ('')

https://stackoverflow.com/questions/4247068/sed-command-with-i-option-failing-on-mac-but-works-on-linux

Copy link
Member

Choose a reason for hiding this comment

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

Reverted in this commit, because it is not important for MacOS
d783dd7

@upleveled upleveled deleted a comment from ProchaLu Mar 5, 2024
Comment on lines -178 to -189
export interface IContentData {
id: string;
contentHtml: string;
date: Date;
title: string;
previewImage?: string;
description?: string;
tags?: string[];
category?: string;
problem?: string;
techStack?: string[];
}
Copy link
Member

@ProchaLu ProchaLu Mar 5, 2024

Choose a reason for hiding this comment

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

I got an ESLint error because statically typed links uses static analysis to determine link types. Importing directly from dynamic pages can lead to potential errors.

Avoid imports from other pages in Next.js - this can cause errors with Next.js Statically Typed Links https://nextjs.org/docs/app/building-your-application/configuring/typescript#statically-typed-links

Instead, move anything you want to import to a non-page fileeslint[no-restricted-syntax](https://eslint.org/docs/latest/rules/no-restricted-syntax)

Comment on lines +16 to +27
export interface IContentData {
id: string;
contentHtml: string;
date: Date;
title: string;
previewImage?: string;
description?: string;
tags?: string[];
category?: string;
problem?: string;
techStack?: string[];
}
Copy link
Member

Choose a reason for hiding this comment

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

moved to content.ts file because of ESLint errors. See the comment

@ProchaLu ProchaLu merged commit 44c67d6 into main Mar 5, 2024
7 checks passed
@ProchaLu ProchaLu deleted the renovate/remark branch March 5, 2024 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants