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

swc first try #128

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const debug = require("debug")("vns:next");
const packageJSON = require("../../package.json");

// fooBar => FOO_BAR
const camelToTitle = (camelStr: string): string => {
const camelToTitle = (camelStr /*: string*/) /*: string*/ => {
return camelStr
.replace(/[A-Z]/g, " $1") // fooBar => foo Bar
.split(" ")
Expand Down
21 changes: 17 additions & 4 deletions starters/next/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
// No need to use ts-jest https://github.com/vercel/next.js/discussions/13528#discussioncomment-22933
const nextJest = require("next/jest");

// configuration that must be set for each project but does not change
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: "./",
});

/**
* Configuration that must be set for each project (server and client) but does not change
*
*/
const commonConfig = {
// A map from regular expressions to paths to transformers
// transform: undefined,
transform: {
// Now we use SWC
//"^.+\\.[jt]sx?$": "ts-jest",
/*
"^.+\\.(js|jsx|ts|tsx|mjs)$": [
"babel-jest",
,
{ configFile: "./Configuration/babel.config.jest.js" },
],
],*/
// MDX support
"^.+\\.(md|mdx)$": "jest-transformer-mdx",
},
Expand Down Expand Up @@ -209,7 +219,7 @@ const commonConfig = {
// watchman: true,
};

module.exports = {
const fullConfig = {
// An array of glob patterns indicating a set of files for which coverage information should be collected
collectCoverageFrom: [
"src/**/*.{js,jsx,ts,tsx}",
Expand Down Expand Up @@ -267,3 +277,6 @@ module.exports = {
},
],
};

// createJestConfig is exported this way to ensure that next/jest can load the Next.js config which is async
module.exports = createJestConfig(fullConfig);
4 changes: 4 additions & 0 deletions starters/next/src/types/md.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module "*.md" {
let MDXComponent: (props: any) => JSX.Element;
export default MDXComponent;
}
4 changes: 0 additions & 4 deletions starters/next/src/types/mdx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,3 @@ declare module "*.mdx" {
let MDXComponent: (props: any) => JSX.Element;
export default MDXComponent;
}
declare module "*.md" {
let MDXComponent: (props: any) => JSX.Element;
export default MDXComponent;
}

This file was deleted.