Skip to content

Commit

Permalink
feat: tsconfig, deps check
Browse files Browse the repository at this point in the history
  • Loading branch information
lotyp committed Dec 31, 2022
1 parent f0be583 commit 42427ba
Show file tree
Hide file tree
Showing 28 changed files with 1,674 additions and 378 deletions.
19 changes: 19 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "wayofdev/next-starter-tpl"
}
],
"privatePackages": {
"version": true,
"tag": true
},
"commit": true,
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
46 changes: 46 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# All node_modules directories
node_modules/
# All secrets
**/.env
**/.env.local
**/.env.*.local
# local env files
# By default all git files
.git/
.gitignore
.gitattributes
.github/

# Tools caches
.cache/*
tsconfig.tsbuildinfo
.eslintcache

# Used when building with nextjs (next-eslint)
!.eslintrc.base.json
!.prettierignore
!.prettierrc.js
!.eslintignore

# npm
!.npmrc

# Docker related
.dockerignore
Dockerfile
docker-compose.*.yml
docker-compose.yml
docker/

# Log files
logs/
*.log
.turbo/
**/.turbo/

# Temp files
tmp/
*.tmp

# IDE related
.idea/
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ NEXT_SENTRY_TRACING=false
NEXT_SENTRY_UPLOAD_DRY_RUN=true

SENTRY_DSN=https://[email protected]/0

SENTRY_URL=https://sentry.io/
SENTRY_ORG=wayofdev
SENTRY_PROJECT=next-starter-tpl
SENTRY_AUTH_TOKEN=

SENTRY_LOG_LEVEL=debug

# Development variables
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ node_modules
.pnpm-store

# testing
coverage
coverage/

# cypress
cypress/screenshots/
Expand Down Expand Up @@ -54,4 +54,11 @@ yarn-error.log*

# cache
.eslintcache
**/.eslintcache
.stylelintcache
.cache/*
**/tsconfig.tsbuildinfo

# override files
docker-compose.override.yml

3 changes: 3 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tasks:
- init: pnpm install
command: pnpm run dev
6 changes: 6 additions & 0 deletions .ncurc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# npm-check-updates configuration used by yarn deps:check && yarn deps:update
# convenience scripts.
# @link https://github.com/raineorshine/npm-check-updates

# Add here exclusions on packages if any
reject: [ ]
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
strict-peer-dependencies=false
engine-strict=true
6 changes: 4 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
dist/
.next/
**/dist/**
**/.next/**
**/build/**
**/tmp/**
pnpm-lock.yaml
.changeset/*.md
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ purge: down
rm -rf .pnpm-store node_modules **/node_modules pnpm-lock.yaml **/.turbo **/.next
.PHONY: purge

deps-check:
$(NPM_RUNNER) run deps:check
.PHONY: deps-check

deps-update:
$(NPM_RUNNER) run deps:update
.PHONY: deps-update


# Docker Actions
# ------------------------------------------------------------------------------------
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This turborepo uses [pnpm](https://pnpm.io) as a package manager. It includes th

This repository has some additional tools already setup for you:

- Supporting [NextJS 13.x](https://nextjs.org/blog/next-13)
- Supporting [NextJS 13.1.1+](https://nextjs.org/blog/next-13)
- [TypeScript](https://www.typescriptlang.org/) support for static type checking
- Strict Mode for TypeScript and React 18
- [ESLint](https://eslint.org/) for code linting and configured presets: NextJS Recommended, NextJS Core Web Vitals and [Airbnb Style Guide](https://www.npmjs.com/package/eslint-config-airbnb)
Expand All @@ -59,12 +59,15 @@ This repository has some additional tools already setup for you:
- [Bundler Analyzer](https://www.npmjs.com/package/@next/bundle-analyzer) — Visualize size of webpack output files with an interactive zoomable treemap
- Optimized [Lighthouse](https://web.dev/performance-scoring/) performance score
- End-2-end testing with [cypress](https://www.cypress.io/) and [JestJS](https://jestjs.io/) support for writing unit tests
- Package autoupdate in all workspace projects using [npm-check-updates](https://www.npmjs.com/package/npm-check-updates)
- Keep package.json sorted using [sort-package-json](https://www.npmjs.com/package/sort-package-json)
- Client and server side [error reporting](https://sentry.io/) supported by [@sentry/nextjs](https://www.npmjs.com/package/@sentry/nextjs)

<br>

## 📑 Requirements

- **macOS** Monterey or **Linux**
- **macOS** Monterey+ or **Linux**
- **Docker** 20.10 or newer
- [How To Install and Use Docker on Ubuntu 22.04](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-22-04)
- **Cloned, configured and running** [docker-shared-services](https://github.com/wayofdev/docker-shared-services), to support system wide DNS, Routing and TLS support via Traefik.
Expand Down
19 changes: 9 additions & 10 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
{
"name": "docs",
"version": "0.0.0",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev --port 3001",
"build": "next build",
"start": "next start",
"lint": "next lint"
"dev": "next dev --port 3001",
"lint": "next lint",
"start": "next start"
},
"dependencies": {
"@wayofdev/ui": "workspace:*",
"next": "^13.1.1",
"nextra": "^2.0.2",
"nextra-theme-docs": "^2.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"@wayofdev/ui": "workspace:*",
"nextra": "^2.0.1",
"nextra-theme-docs": "^2.0.1"
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^18.11.18",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.10",
"@wayofdev/browserslist-config": "^1.1.0",
"@wayofdev/eslint-config-custom": "workspace:*",
"eslint": "^8.30.0",
"eslint-config-custom": "workspace:*",
"tsconfig-config": "workspace:*",
"typescript": "^4.9.4"
}
}
27 changes: 18 additions & 9 deletions apps/docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
{
"extends": "tsconfig-config/next.json",
"exclude": ["node_modules", "dist", "coverage"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../../tsconfig.base.json",
"exclude": [
"node_modules",
"dist",
"coverage"
],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"outDir": "dist",
"baseUrl": "./",
// "paths": {
// "@/*": [
// "src/*"
// ]
// }
"moduleResolution": "node"
"module": "esnext"
}
}
42 changes: 21 additions & 21 deletions apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
{
"name": "web",
"version": "0.0.0",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"analyze": "BUNDLE_ANALYZE=both next build",
"lint": "next lint"
"build": "next build",
"dev": "next dev",
"lint": "eslint . --ext .ts,.tsx,.js,.jsx,.cjs,.mjs,.mdx --cache --cache-location ../../.cache/eslint/nextjs-app.eslintcache",
"start": "next start"
},
"dependencies": {
"@wayofdev/ui": "workspace:*",
"next": "^13.1.0",
"next": "^13.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwindcss": "^3.2.4"
},
"devDependencies": {
"@next/bundle-analyzer": "13.1.1",
"@sentry/nextjs": "^7.28.1",
"@sentry/react": "^7.28.1",
"@types/jest": "^29.2.4",
"jest": "^29.3.1",
"jest-config": "workspace:*",
"@types/node": "^18.11.17",
"@types/node": "^18.11.18",
"@types/react": "^18.0.26",
"@types/react-dom": "^18.0.9",
"@types/react-dom": "^18.0.10",
"@wayofdev/browserslist-config": "^1.1.0",
"postcss-100vh-fix": "^1.0.2",
"postcss": "^8.4.20",
"sanitize.css": "^13.0.0",
"eslint": "^8.30.0",
"eslint-config-custom": "workspace:*",
"tsconfig-config": "workspace:*",
"typescript": "^4.9.4",
"@wayofdev/eslint-config-custom": "workspace:*",
"autoprefixer": "^10.4.13",
"browserslist": "^4.21.4",
"eslint": "^8.30.0",
"eslint-config-next": "^13.1.1",
"jest": "^29.3.1",
"@wayofdev/jest-config": "workspace:*",
"picocolors": "1.0.0",
"postcss": "^8.4.20",
"postcss-100vh-fix": "^1.0.2",
"postcss-cli": "^10.1.0",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-normalize": "^10.0.1",
"postcss-preset-env": "^7.8.3",
"postcss-reporter": "^7.0.5",
"browserslist": "^4.21.4",
"@sentry/nextjs": "^7.28.1",
"@sentry/react": "^7.28.1",
"picocolors": "1.0.0"
"sanitize.css": "^13.0.0",
"typescript": "^4.9.4"
}
}
35 changes: 26 additions & 9 deletions apps/web/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
{
"extends": "tsconfig-config/next.json",
"exclude": ["node_modules", "dist", "coverage"],
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx"],
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "../../tsconfig.base.json",
"exclude": ["**/node_modules", "**/.*/"],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.mts",
"**/*.js",
"**/*.cjs",
"**/*.mjs",
"**/*.jsx",
"**/*.json"
],
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"target": "esnext",
"baseUrl": "./src",
"allowJs": true,
"moduleResolution": "node",

"noEmit": true,
"importHelpers": true,
"module": "esnext",

"jsx": "preserve",
"paths": {
"@/test-utils": ["../config/tests/test-utils"],
"@/config/*": ["./config/*"],
"@/lib/*": ["./lib/*"],
"@/components/*": ["./components/*"],
"@/features/*": ["./features/*"],
"@/pages/*": ["./pages/*"],
"@/public/*": ["../public/*"],
"@/themes/*": ["./themes/*"],
"@wayofdev/ui/*": ["../../../packages/ui/src/*"],
"@wayofdev/ui": ["../../../packages/ui/src/index"]
}
Expand Down
43 changes: 43 additions & 0 deletions cache.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* Convenience script to harmonize cache directories across various
* tooling such as eslint and jest.
*
* Recently more & more tools like babel-loader tend to cache in
* node_modules/.cache (@link https://github.com/avajs/find-cache-dir)
* It's possible too.
*/
// @ts-check
'use strict';

const { resolve } = require('path');

const globalCachePath = resolve(`${__dirname}/.cache`);

/**
* @param {string} packageName
* @returns string
*/
function sanitize(packageName) {
return packageName.replace('/', '.').replace(/[^a-z0-9.@_-]+/gi, '-');
}

/**
* @param {string} packageName
* @returns string
*/
function getEslintCachePath(packageName) {
return `${globalCachePath}/${sanitize(packageName)}/eslint`;
}

/**
* @param {string} packageName
* @returns string
*/
function getJestCachePath(packageName) {
return `${globalCachePath}/${sanitize(packageName)}/jest`;
}

module.exports = {
getJestCachePath,
getEslintCachePath,
};
Loading

0 comments on commit 42427ba

Please sign in to comment.