-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #496 from colonial-heritage/esm
Refactor researcher app to use ECMAScript modules (ESM)
- Loading branch information
Showing
67 changed files
with
1,658 additions
and
3,529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"root": true, | ||
"extends": ["@colonial-collections/eslint-config"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"extends": "tsconfig/cypress.json", | ||
"extends": "@colonial-collections/ts-config/cypress.json", | ||
"include": ["**/*.ts", "**/*.tsx", "../src/**/*.cy.tsx"], | ||
"exclude": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const nextJest = require('next/jest'); | ||
|
||
const createJestConfig = nextJest(); | ||
|
||
/** @type {import('jest').Config} */ | ||
const customJestConfig = { | ||
testTimeout: 60000, | ||
testMatch: ['**/*.test.ts(x)?'], | ||
collectCoverage: true, | ||
setupFiles: ['<rootDir>/jest.setup.cjs'], | ||
moduleNameMapper: { | ||
'^@/(.*)$': '<rootDir>/src/$1', | ||
}, | ||
/** | ||
* Don't try to transform the package `next-intl`, or else you will get the error: | ||
* "SyntaxError: Cannot use import statement outside a module" | ||
* | ||
* `next-intl` uses ECMAScript Modules (ESM) and Jest provides some experimental support for it | ||
* but "node_modules" are not transpiled by next/jest yet. | ||
* | ||
* @link https://github.com/vercel/next.js/issues/36077#issuecomment-1096698456 | ||
* @link https://jestjs.io/docs/ecmascript-modules | ||
*/ | ||
transformIgnorePatterns: ['node_modules/(?!(next-intl)/)'], | ||
}; | ||
|
||
module.exports = createJestConfig(customJestConfig); |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"plugins": { | ||
"tailwindcss": {}, | ||
"autoprefixer": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export enum LocaleEnum { | ||
En = 'en', | ||
Nl = 'nl', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
import {notFound} from 'next/navigation'; | ||
import {getRequestConfig} from 'next-intl/server'; | ||
import {locales} from './navigation'; | ||
import {LocaleEnum} from '@/definitions'; | ||
|
||
export default getRequestConfig(async ({locale}) => ({ | ||
messages: (await import(`./messages/${locale}/messages.json`)).default, | ||
})); | ||
export default getRequestConfig(async ({locale}) => { | ||
if (!locales.includes(locale as LocaleEnum)) { | ||
notFound(); | ||
} | ||
|
||
return { | ||
messages: ( | ||
await (locale === 'en' | ||
? // This will enable HMR for `en` | ||
import('./messages/en/messages.json') | ||
: import(`./messages/${locale}/messages.json`)) | ||
).default, | ||
}; | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import config from '@colonial-collections/tailwind-config'; | ||
|
||
export default { | ||
presets: [config], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"root": true, | ||
"extends": ["@colonial-collections/eslint-config"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"extends": "tsconfig/cypress.json", | ||
"extends": "@colonial-collections/ts-config/cypress.json", | ||
"include": ["**/*.ts", "**/*.tsx", "../src/**/*.cy.tsx"], | ||
"exclude": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const nextJest = require('next/jest'); | ||
|
||
const createJestConfig = nextJest(); | ||
|
||
/** @type {import('jest').Config} */ | ||
const customJestConfig = { | ||
testTimeout: 60000, | ||
testMatch: ['**/*.test.ts(x)?'], | ||
collectCoverage: true, | ||
setupFiles: ['<rootDir>/jest.setup.cjs'], | ||
moduleNameMapper: { | ||
'^@/(.*)$': '<rootDir>/src/$1', | ||
}, | ||
/** | ||
* Don't try to transform the package `next-intl`, or else you will get the error: | ||
* "SyntaxError: Cannot use import statement outside a module" | ||
* | ||
* `next-intl` uses ECMAScript Modules (ESM) and Jest provides some experimental support for it | ||
* but "node_modules" are not transpiled by next/jest yet. | ||
* | ||
* @link https://github.com/vercel/next.js/issues/36077#issuecomment-1096698456 | ||
* @link https://jestjs.io/docs/ecmascript-modules | ||
*/ | ||
transformIgnorePatterns: ['node_modules/(?!(next-intl)/)'], | ||
}; | ||
|
||
module.exports = createJestConfig(customJestConfig); |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"plugins": { | ||
"tailwindcss": {}, | ||
"autoprefixer": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.