Skip to content

Commit

Permalink
Bump packages and upgrade to next14 (#512)
Browse files Browse the repository at this point in the history
* bumps to next14

* bump packages

* bump packages

* bump packages

* bump packages

* bump packages

* fixes tests

* fixes build warnings
  • Loading branch information
kochie authored Nov 3, 2023
1 parent f01f415 commit f34b3d3
Show file tree
Hide file tree
Showing 19 changed files with 3,194 additions and 2,405 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ coverage/
public/sw.js
public/sw.js.map
public/workbox-*.js
public/workbox-*.js.map
public/workbox-*.js.map

.DS_Store
8 changes: 6 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ const customJestConfig = {
// if using TypeScript with a baseUrl set to the root directory then you need the below for alias' to work
moduleDirectories: ['node_modules', '<rootDir>/'],
testEnvironment: 'jest-environment-jsdom',
// testEnvironmentOptions: {

// },

setupFiles: [
'<rootDir>/jest/jest.setup.js',
Expand All @@ -24,18 +27,19 @@ const customJestConfig = {
moduleNameMapper: {
'^@/components/(.*)': '<rootDir>/src/components/$1',
// '@mdx-js/react': '<rootDir>/jest/esm.mapper.js',
// '^.+\\.mdx?$': "<rootDir>/jest/mdx-mock.cjs",
},
transform: {
'^.+\\.mdx?$': [
'<rootDir>/jest/mdx-jest.mjs',
'<rootDir>/jest/mdx-transformer.mjs',
{
supportsDynamicImport: true,
supportsExportNamespaceFrom: true,
supportsStaticESM: true,
},
],
// '^.+\\.(js|jsx|ts|tsx|mjs)$': null,
'\\.tsx?$': ['ts-jest', { useESM: true }],
// '\\.tsx?$': ['ts-jest', { useESM: true }],
},
extensionsToTreatAsEsm: ['.tsx'],
}
Expand Down
7 changes: 7 additions & 0 deletions jest/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// import { expect } from '@jest/globals'
// import '@testing-library/jest-dom/extend-expect'
// import '@testing-library/jest-dom'
import {jest} from '@jest/globals';
import Image from 'next/image';
// import '@testing-library/jest-dom'

process.env = {
...process.env,
Expand All @@ -14,3 +17,7 @@ process.env = {
}

// export {}



jest.unstable_mockModule('next/image', () => (Image));
31 changes: 23 additions & 8 deletions jest/mdx-jest.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,30 @@
// import { compile, compileSync } from '@mdx-js/mdx'
import babel from '@babel/core'
import { declare } from "@babel/helper-plugin-utils";

import path from 'path'
import parser from '@babel/parser'
import estreeToBabel from 'estree-to-babel'
import { compileSync } from '@mdx-js/mdx'

export function babelPluginSyntaxMdx() {
// Tell Babel to use a different parser.
return { parserOverride: babelParserWithMdx }
}
// export function babelPluginSyntaxMdx() {
// // Tell Babel to use a different parser.
// return { parserOverride: babelParserWithMdx }
// }

const babelPluginSyntaxMdx = declare(api => {
api.assertVersion(
process.env.BABEL_8_BREAKING && process.env.IS_PUBLISH
? PACKAGE_JSON.version
: 7,
);

return {
name: "syntax-mdx",
parserOverride: babelParserWithMdx
}
})


// A Babel parser that parses MDX files with `@mdx-js/mdx` and passes any
// other things through to the normal Babel parser.
Expand All @@ -26,10 +41,10 @@ function babelParserWithMdx(value, options) {
recmaPlugins: [recmaBabel] /* jsxImportSource: …, otherOptions… */,
// outputFormat: 'function-body',
}
).result
).value
}

return parser.parse(value, options)
// return parser.parse(value, options)
}

// A “recma” plugin is a unified plugin that runs on the estree (used by
Expand All @@ -42,7 +57,7 @@ function recmaBabel() {

export default {
process(sourceText, sourcePath, options) {
const babelRes = babel.transform(sourceText, {
const babelRes = babel.transformSync(sourceText, {
filename: sourcePath,

// presets: ['next/babel'],
Expand All @@ -57,7 +72,7 @@ export default {
const babelRes = babel.transformAsync(sourceText, {
filename: sourcePath,

presets: [['@babel/preset-env', { modules: 'cjs' }]],
presets: [['@babel/preset-env', { modules: 'commonjs' }]],
plugins: ['add-module-exports', babelPluginSyntaxMdx],
})

Expand Down
2 changes: 2 additions & 0 deletions jest/mdx-mock.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = "MDX CONTENT"

45 changes: 45 additions & 0 deletions jest/mdx-transformer.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// import { createTransformer } from 'babel-jest';
import { compileSync } from '@mdx-js/mdx';
import { transformSync } from "@babel/core";
// import {inspect} from "util"
// import path from 'path';

// import {require} from 'module'

export default {
process(sourceText, sourcePath, options) {
// console.log("HELLO")
const code = compileSync(sourceText, {
recmaPlugins: [() => ({ Compiler: import('estree-to-babel') })],
});

const result = transformSync(code.value, {
presets: [['@babel/preset-env', { modules: 'cjs' }]],
plugins: ['add-module-exports']
})

// console.log(result)

return result


// console.log(inspect(result, false, null));
// return {
// code: `module.exports = ${JSON.stringify(path.basename(sourcePath))};`,
// };
},

async processAsync(sourceText, sourcePath) {
const code = await compile(sourceText, {
recmaPlugins: [() => ({ Compiler: import('estree-to-babel') })],
});

const result = await transform(code.value, {
presets: [['@babel/preset-env', { modules: 'commonjs' }]],
plugins: ['add-module-exports']
})

return result
}
};

6 changes: 3 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ const Config = async (phase, { defaultConfig }) => {
// marked for the release they belong to. It may be undefined if running
// outside of Vercel
buildTime: new Date().toDateString(),
NEXT_PUBLIC_COMMIT_SHA: VERCEL_GIT_COMMIT_SHA,
NEXT_PUBLIC_COMMIT_SHA: VERCEL_GIT_COMMIT_SHA ?? "",
},
images: {
domains: ['blog.kochie.io', 'holopin.io', 'assets.holopin.io'],
},
pageExtensions: ['ts', 'tsx', 'js', 'jsx', 'md', 'mdx'],
experimental: {
appDir: true,
mdxRs: true,
mdxRs: true,
webpackBuildWorker: true
},
}

Expand Down
108 changes: 55 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,74 +27,76 @@
},
"homepage": "https://github.com/kochie/me.kochie.io#readme",
"devDependencies": {
"@babel/core": "^7.22.5",
"@babel/parser": "^7.22.5",
"@babel/preset-react": "^7.22.5",
"@fortawesome/fontawesome-pro": "^6.4.0",
"@fortawesome/fontawesome-svg-core": "^6.4.0",
"@fortawesome/free-brands-svg-icons": "^6.4.0",
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@fortawesome/pro-duotone-svg-icons": "^6.4.0",
"@babel/core": "^7.23.2",
"@babel/helper-plugin-utils": "^7.22.5",
"@babel/parser": "^7.23.0",
"@babel/preset-react": "^7.22.15",
"@fortawesome/fontawesome-pro": "^6.4.2",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"@fortawesome/pro-duotone-svg-icons": "^6.4.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"@mdx-js/loader": "^2.3.0",
"@mdx-js/mdx": "^2.3.0",
"@mdx-js/react": "^2.3.0",
"@next/eslint-plugin-next": "^13.4.6",
"@next/mdx": "^13.4.6",
"@sentry/browser": "^7.55.2",
"@sentry/integrations": "^7.55.2",
"@sentry/node": "^7.55.2",
"@sentry/webpack-plugin": "^2.3.0",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/typography": "^0.5.9",
"@testing-library/jest-dom": "^5.16.5",
"@mdx-js/loader": "^3.0.0",
"@mdx-js/mdx": "^3.0.0",
"@mdx-js/react": "^3.0.0",
"@next/eslint-plugin-next": "^14.0.1",
"@next/mdx": "^14.0.1",
"@sentry/browser": "^7.77.0",
"@sentry/integrations": "^7.77.0",
"@sentry/node": "^7.77.0",
"@sentry/webpack-plugin": "^2.9.0",
"@tailwindcss/forms": "^0.5.6",
"@tailwindcss/typography": "^0.5.10",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.0.0",
"@types/jest": "^29.5.2",
"@types/mdx-js__react": "^1.5.5",
"@types/react": "^18.2.12",
"@types/react-dom": "^18.2.5",
"@types/react-test-renderer": "^18.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@typescript-eslint/typescript-estree": "^5.59.11",
"autoprefixer": "^10.4.14",
"babel-jest": "^29.5.0",
"@types/babel__core": "^7.20.3",
"@types/jest": "^29.5.7",
"@types/mdx-js__react": "^1.5.7",
"@types/react": "^18.2.34",
"@types/react-dom": "^18.2.14",
"@types/react-test-renderer": "^18.0.5",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"@typescript-eslint/typescript-estree": "^6.9.1",
"autoprefixer": "^10.4.16",
"babel-jest": "^29.7.0",
"babel-plugin-add-module-exports": "^1.0.4",
"eslint": "^8.43.0",
"eslint-config-next": "13.4.6",
"eslint-config-prettier": "^8.8.0",
"eslint": "^8.52.0",
"eslint-config-next": "14.0.1",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.2",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-next": "^0.0.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"estree-to-babel": "^5.1.0",
"fathom-client": "^3.5.0",
"estree-to-babel": "^8.1.1",
"fathom-client": "^3.6.0",
"feed": "^4.2.2",
"husky": "^8.0.3",
"jest": "^29.5.0",
"jest": "^29.7.0",
"jest-css-modules": "^2.1.0",
"jest-environment-jsdom": "^29.5.0",
"next": "^13.4.6",
"jest-environment-jsdom": "^29.7.0",
"next": "^14.0.1",
"next-compose-plugins": "^2.2.1",
"next-pwa": "^5.6.0",
"next-seo": "^6.0.0",
"postcss": "^8.4.24",
"next-seo": "^6.4.0",
"postcss": "^8.4.31",
"postcss-css-variables": "^0.19.0",
"postcss-custom-media": "^9.1.4",
"postcss-custom-properties": "^13.2.0",
"postcss-preset-env": "^8.5.0",
"prettier": "^2.8.8",
"postcss-custom-media": "^10.0.2",
"postcss-custom-properties": "^13.3.2",
"postcss-preset-env": "^9.3.0",
"prettier": "^3.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-test-renderer": "^18.2.0",
"sharp": "^0.32.1",
"swr": "^2.1.5",
"tailwindcss": "^3.3.2",
"ts-jest": "^29.1.0",
"typescript": "^5.1.3",
"webpack": "^5.87.0"
"sharp": "^0.32.6",
"swr": "^2.2.4",
"tailwindcss": "^3.3.5",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2",
"webpack": "^5.89.0"
},
"peerDependencies": {
"webpack": "^5.75.0"
Expand Down
Loading

1 comment on commit f34b3d3

@vercel
Copy link

@vercel vercel bot commented on f34b3d3 Nov 3, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

me.kochie.io – ./

mekochieio-git-main-kochie1.vercel.app
mekochieio-kochie1.vercel.app
me.kochie.io
robertkoch.me

Please sign in to comment.