forked from belgattitude/nextjs-monorepo-example
-
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.
- Loading branch information
1 parent
82ae790
commit 239ea4b
Showing
27 changed files
with
307 additions
and
11 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 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Specific eslint rules for this app/package, extends the base rules | ||
* @see https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-linters.md | ||
*/ | ||
|
||
const { | ||
getDefaultIgnorePatterns, | ||
} = require('@your-org/eslint-config-bases/helpers'); | ||
|
||
module.exports = { | ||
root: true, | ||
ignorePatterns: [...getDefaultIgnorePatterns()], | ||
extends: [ | ||
'@your-org/eslint-config-bases/typescript', | ||
// Apply prettier and disable incompatible rules | ||
'@your-org/eslint-config-bases/prettier', | ||
], | ||
rules: { | ||
// optional overrides per project | ||
}, | ||
overrides: [ | ||
// optional overrides per project file match | ||
], | ||
}; |
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,14 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# build | ||
/dist | ||
|
||
# dependencies | ||
node_modules | ||
|
||
# testing | ||
/coverage | ||
|
||
# misc | ||
.DS_Store | ||
*.pem |
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 @@ | ||
# @your-org/common-i18n |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020-2021 Sébastien Vanvelthem | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,11 @@ | ||
# @your-org/common-i18n | ||
|
||
<p align="left"> | ||
<a aria-label="Build" href="https://github.com/belgattitude/nextjs-monorepo-example/actions?query=workflow%3ACI"> | ||
<img alt="build" src="https://img.shields.io/github/workflow/status/belgattitude/nextjs-monorepo-example/CI-web-app/main?label=CI&logo=github&style=flat-quare&labelColor=000000" /> | ||
</a> | ||
</p> | ||
|
||
## Intro | ||
|
||
WIP |
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,51 @@ | ||
// @ts-check | ||
|
||
const { defaults: tsjPreset } = require('ts-jest/presets'); | ||
const { pathsToModuleNameMapper } = require('ts-jest'); | ||
|
||
const { getJestCachePath } = require('../../cache.config'); | ||
|
||
const packageJson = require('./package.json'); | ||
const { compilerOptions: baseTsConfig } = require('./tsconfig.json'); | ||
|
||
// Take the paths from tsconfig automatically from base tsconfig.json | ||
// @link https://kulshekhar.github.io/ts-jest/docs/paths-mapping | ||
const getTsConfigBasePaths = () => { | ||
return baseTsConfig.paths | ||
? pathsToModuleNameMapper(baseTsConfig.paths, { | ||
prefix: '<rootDir>/', | ||
}) | ||
: {}; | ||
}; | ||
|
||
/** @typedef {import('ts-jest/dist/types')} */ | ||
/** @type {import('@jest/types').Config.InitialOptions} */ | ||
const config = { | ||
name: `${packageJson.name}:unit`, | ||
cacheDirectory: getJestCachePath(packageJson.name), | ||
testEnvironment: 'jsdom', | ||
verbose: true, | ||
rootDir: './src', | ||
transform: { | ||
...tsjPreset.transform, | ||
}, | ||
setupFilesAfterEnv: ['@testing-library/jest-dom/extend-expect'], | ||
testMatch: ['<rootDir>/**/*.{spec,test}.{js,jsx,ts,tsx}'], | ||
moduleNameMapper: { | ||
// For @testing-library/react | ||
'^@/test-utils$': '<rootDir>/../config/jest/test-utils', | ||
...getTsConfigBasePaths(), | ||
}, | ||
// false by default, overrides in cli, ie: yarn test:unit --collect-coverage=true | ||
collectCoverage: false, | ||
coverageDirectory: '<rootDir>/../coverage', | ||
collectCoverageFrom: ['<rootDir>/**/*.{ts,tsx,js,jsx}', '!**/*.test.ts'], | ||
globals: { | ||
'ts-jest': { | ||
diagnostics: true, | ||
tsconfig: './tsconfig.jest.json', | ||
}, | ||
}, | ||
}; | ||
|
||
module.exports = 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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// @ts-check | ||
|
||
/** | ||
* This files overrides the base lint-staged.config.js present in the root directory. | ||
* It allows to run eslint based the package specific requirements. | ||
* {@link https://github.com/okonet/lint-staged#how-to-use-lint-staged-in-a-multi-package-monorepo} | ||
* {@link https://github.com/belgattitude/nextjs-monorepo-example/blob/main/docs/about-lint-staged.md} | ||
*/ | ||
|
||
const { | ||
concatFilesForPrettier, | ||
getEslintFixCmd, | ||
} = require('../../lint-staged.common.js'); | ||
|
||
/** | ||
* @type {Record<string, (filenames: string[]) => string | string[] | Promise<string | string[]>>} | ||
*/ | ||
const rules = { | ||
'**/*.{js,jsx,ts,tsx}': (filenames) => { | ||
return getEslintFixCmd({ | ||
cwd: __dirname, | ||
fix: true, | ||
cache: true, | ||
// when autofixing staged-files a good tip is to disable react-hooks/exhaustive-deps, cause | ||
// a change here can potentially break things without proper visibility. | ||
rules: ['react-hooks/exhaustive-deps: off'], | ||
maxWarnings: 25, | ||
files: filenames, | ||
}); | ||
}, | ||
'**/*.{json,md,mdx,css,html,yml,yaml,scss}': (filenames) => { | ||
return [`prettier --write ${concatFilesForPrettier(filenames)}`]; | ||
}, | ||
}; | ||
|
||
module.exports = rules; |
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,32 @@ | ||
{ | ||
"name": "@your-org/common-i18n", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"private": true, | ||
"homepage": "https://github.com/belgattitude/nextjs-monorepo-example", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/belgattitude/nextjs-monorepo-example", | ||
"directory": "packages/common-i18n" | ||
}, | ||
"author": { | ||
"name": "Vanvelthem Sébastien", | ||
"url": "https://github.com/belgattitude" | ||
}, | ||
"sideEffects": false, | ||
"scripts": { | ||
"clean": "rimraf --no-glob ./dist ./coverage ./tsconfig.tsbuildinfo ./.eslintcache && jest --clear-cache", | ||
"lint": "eslint . --ext .ts,.tsx,.js,.jsx", | ||
"typecheck": "tsc --project ./tsconfig.json --noEmit" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "27.4.1", | ||
"@types/node": "17.0.24", | ||
"@your-org/eslint-config-bases": "workspace:^", | ||
"cross-env": "7.0.3", | ||
"eslint": "8.13.0", | ||
"prettier": "2.6.2", | ||
"rimraf": "3.0.2", | ||
"typescript": "4.6.3" | ||
} | ||
} |
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,11 @@ | ||
import type common from './locales/en/common.json'; | ||
import type demo from './locales/en/demo.json'; | ||
import type home from './locales/en/home.json'; | ||
import type system from './locales/en/system.json'; | ||
|
||
export type I18nNamespaces = { | ||
home: typeof home; | ||
demo: typeof demo; | ||
common: typeof common; | ||
system: typeof system; | ||
}; |
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,10 @@ | ||
{ | ||
"actions": { | ||
"save": "Save", | ||
"update": "Update", | ||
"delete": "Delete", | ||
"cancel": "Cancel", | ||
"zoomIn": "Zoom in", | ||
"zoomOut": "Zoom out" | ||
} | ||
} |
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 @@ | ||
{ | ||
"page": { | ||
"title": "Web-app | Demo | nextjs-monorepo-example" | ||
} | ||
} |
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,9 @@ | ||
{ | ||
"page": { | ||
"title": "Home | Web-app | nextjs-monorepo-example" | ||
}, | ||
"btn": { | ||
"getStarted": "Get started", | ||
"liveDemo": "Live demo" | ||
} | ||
} |
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,8 @@ | ||
{ | ||
"notFound": { | ||
"title": "404 - Page Not Found" | ||
}, | ||
"links": { | ||
"backToHome": "Back to home" | ||
} | ||
} |
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,10 @@ | ||
{ | ||
"actions": { | ||
"save": "Sauver", | ||
"update": "Mettre à jour", | ||
"delete": "Effacer", | ||
"cancel": "Annuler", | ||
"zoomIn": "Agrandir", | ||
"zoomOut": "Réduire" | ||
} | ||
} |
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 @@ | ||
{ | ||
"page": { | ||
"title": "Web-app | DAmo | nextjs-monorepo-example" | ||
} | ||
} |
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,9 @@ | ||
{ | ||
"page": { | ||
"title": "Accueil | Web-app | nextjs-monorepo-example" | ||
}, | ||
"btn": { | ||
"getStarted": "Démarrer", | ||
"liveDemo": "Démo" | ||
} | ||
} |
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,8 @@ | ||
{ | ||
"notFound": { | ||
"title": "404 - Page non trouvée" | ||
}, | ||
"links": { | ||
"backToHome": "Revenir à l'accueil" | ||
} | ||
} |
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,14 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"baseUrl": "./src", | ||
"target": "esnext", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"module": "esnext", | ||
"jsx": "react-jsx", | ||
"noEmit": false, | ||
"incremental": true, | ||
"paths": {} | ||
}, | ||
"exclude": ["**/node_modules", "**/.*/", "dist", "build"] | ||
} |
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.