Skip to content

Commit

Permalink
feat(config): 🔧 update better tooling with release it & other changes (
Browse files Browse the repository at this point in the history
…#132)

- add [new release it](https://github.com/navin-moorthy/next-react-app/pull/132/files?diff=split#diff-a8973c793505c01e9ddd05a1e86cae50d0b94aa97bf4d4b8616b785bf00ce0f2) [changelog format](https://github.com/navin-moorthy/next-react-app/pull/132/files?diff=split#diff-1a6731e971b66d5e90b6744705335dd3d40eddc2c7be4d84958fface18ee0afc) [including commit body](https://github.com/navin-moorthy/next-react-app/pull/132/files?diff=split#diff-0b16e68584afa81cdad3d7b5f0e804951e691f8f15d48054d5985c21dc9091ee) for [better github release support](https://github.com/navin-moorthy/next-react-app/pull/132/files?diff=split#diff-bb558edcfe64dde3c4d2b8ad39e0620eba6128c3471943bb856f35192d8adc57)
```json
// package.json
{"release": "node release-it/getCommitsSinceLastRelease.js && release-it"}
```
- update renovate cron to run once a week on saturday
```json
// .github/renovate.json
{"schedule": ["after 12am and before 5am on saturday"]}
```
- remove renovate lockfile maintenance update
```json
// .github/renovate.json
"lockFileMaintenance": {
  "enabled": false
},
```
- add .prettiercache to the root folder itself & gitignore it
```json
// package.json
{"lint:prettier": "prettier --check --cache --cache-location=.prettiercache \"./**/*.{html,css,js,cjs,jsx,ts,cts,tsx,md,json}\""}
```
- add prettier import order with react, next & other libraries following it
```js
// .prettierrc.cjs
importOrder: [
  // Packages.
  // Things that start with a letter (or digit or underscore), or `@` followed by a letter.
  "^react$",
  "^react-dom$",
  "^next$",
  "^next/+",
  "^@?\\w",
  "",
  // Absolute imports and other imports such as Vue-style `@/foo`.
  // Anything that does not start with a dot.
  "^../",
  "",
  "^./",
  "",

  // Relative imports.
  // Anything that starts with two dots.

  // Style imports.
  "^.+\\.s?css$",
],
```
- [update stylelint config](https://github.com/navin-moorthy/next-react-app/pull/132/files?diff=split#diff-5cf8e77210aa0eab867346744e9d28a14155363b32216976bd510bc9733fd9a5) for the new major version which no longer requires `stylelint-config-prettier` 
- add all of the local vscode settings.json to the [workspace settings.json](https://github.com/navin-moorthy/next-react-app/pull/132/files?diff=split#diff-a5de3e5871ffcc383a2294845bd3df25d3eeff6c29ad46e3a396577c413bf357)
- add required [`env` check for `NEXT_PUBLIC_SITE_URL`](https://github.com/navin-moorthy/next-react-app/pull/132/files?diff=split#diff-62896e4754501eb20e5d3715cc2a262e03a7a71b9d1e3907c4dda68d01360191) which is [required for sitemap](https://github.com/navin-moorthy/next-react-app/pull/132/files?diff=split#diff-677a1e263116bbd418949c9ceb82ebc9244b5fd90f6a226c6a7b25312ec0379a)
- add new image configuration for `next.config.js`
```js
// next.config.js
images: {
  formats: ["image/avif", "image/webp"],
  deviceSizes: [384, 640, 768, 1024, 1280, 1440, 2560],
  imageSizes: [128, 256],
},
```
- update `tailwind.config.cjs` for better legibility & update the html tag
```js
// tailwind.config.cjs
plugin(function ({ addUtilities }) {
  addUtilities({
    ".inter-display": {
      "font-variation-settings": `"opsz" 32`,
    },
  });
  addUtilities({
    ".optimizeLegibility": {
      "text-rendering": "optimizeLegibility",
    },
  });
}),
```
```jsx
// pages/_document.tsx
<Html className="min-h-full antialiased inter-display optimizeLegibility" lang="en" />
```
- add customized `InterVar` with `Adjusted Arial Fallback` of a local font & preload our customized font.
```js
// tailwind.config.cjs
fontFamily: {
  sans: [
    "InterVar",
    "Adjusted Arial Fallback",
    ...defaultTheme.fontFamily.sans,
  ],
},
```
```jsx
// pages/_document.tsx
<Head>
  {/* Fonts Preload */}
  <link
    rel="preload"
    href="/fonts/Inter.var-english.woff2"
    as="font"
    type="font/woff2"
    crossOrigin="anonymous"
  />
</Head>;
```
- add also notes on how to add the font splitting & fallback in the `styles/global.css` file [gist lint](https://gist.githubusercontent.com/navin-moorthy/7833eaca953c4ea4d1759625354b48ba/raw/055b58b73999385a329e2043263e76f11f882467/Font%20Slicing%20with%20fallback%20for%20performance.css)
- add hover media query to disable hover interaction on mobile
```js
// tailwind.config.cjs
future: {
  relativeContentPathsByDefault: true,
  hoverOnlyWhenSupported: true,
},
```
  • Loading branch information
navin-moorthy authored Feb 25, 2023
1 parent 026a9a9 commit 98efcb4
Show file tree
Hide file tree
Showing 29 changed files with 656 additions and 91 deletions.
7 changes: 6 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# Optional tool caches
.eslintcache
.stylelintcache
.prettiercache

# Dependency directories
node_modules
Expand Down Expand Up @@ -67,8 +68,12 @@ package-lock.json
yarn.lock
pnpm-lock.yaml

# Custom
release-it/commit.hbs
release-it/remote-commits.json
release-it/conventionalChangelogWriterOptsTransform.cjs

## library folder
dist
CHANGELOG.md
public

7 changes: 2 additions & 5 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:base", ":semanticCommitTypeAll(chore)"],
"schedule": ["after 12am and before 5am every weekday", "every weekend"],
"schedule": ["after 12am and before 5am on saturday"],
"commitMessageAction": "⬆️ update",
"commitMessageTopic": "{{depName}}",
"pinVersions": false,
Expand All @@ -24,10 +24,7 @@
},
"automergeStrategy": "squash",
"lockFileMaintenance": {
"enabled": true,
"automerge": true,
"automergeType": "pr",
"platformAutomerge": true
"enabled": false
},
"packageRules": [
{
Expand Down
5 changes: 1 addition & 4 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ branches:
# Required. Require branches to be up to date before merging.
strict: true
# Required. The list of status checks to require in order to merge into this branch
checks:
[
{ context: "Install lint & test" },
]
checks: [{ context: "Install lint & test" }]
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
enforce_admins: false
# Prevent merge commits from being pushed to matching branches
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# Optional tool caches
.eslintcache
.stylelintcache
.prettiercache

# Dependency directories
node_modules
Expand Down
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# Optional tool caches
.eslintcache
.stylelintcache
.prettiercache

# Dependency directories
node_modules
Expand Down Expand Up @@ -67,6 +68,10 @@ package-lock.json
yarn.lock
pnpm-lock.yaml

# Custom
release-it/commit.hbs
release-it/remote-commits.json

# Library files
dist
CHANGELOG.md
Expand Down
4 changes: 4 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ module.exports = {
importOrder: [
// Packages.
// Things that start with a letter (or digit or underscore), or `@` followed by a letter.
"^react$",
"^react-dom$",
"^next$",
"^next/+",
"^@?\\w",
"",
// Absolute imports and other imports such as Vue-style `@/foo`.
Expand Down
42 changes: 13 additions & 29 deletions .release-it.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
const {
conventionalChangelogWriterOptsTransform,
commitTemplate,
} = require("./release-it/conventionalChangelogWriterOptsTransform.cjs");

module.exports = {
hooks: {
"before:init": ["pnpm lint", "pnpm test"],
Expand All @@ -21,37 +26,16 @@ module.exports = {
"@release-it/conventional-changelog": {
ignoreRecommendedBump: true,
infile: "CHANGELOG.md",
gitRawCommitsOpts: {
format:
"%B%n-hash-%n%H%n-shortHash-%n%h%n-gitTags-%n%d%n-committerDate-%n%ci%n-authorName-%n%an%n-authorEmail-%n%ae%n-gpgStatus-%n%G?%n-gpgSigner-%n%GS",
},
writerOpts: {
commitPartial: commitTemplate,
transform: conventionalChangelogWriterOptsTransform,
},
preset: {
name: "conventionalcommits",
types: [
{ type: "feat", section: "Feature Updates", hidden: false },
{ type: "fix", section: "Bug Fixes", hidden: false },
{
type: "refactor",
section: "Code Refactors",
hidden: false,
},
{
type: "docs",
section: "Documentation Changes",
hidden: false,
},
{
type: "chore",
section: "Maintanance Updates",
hidden: false,
},
{ type: "build", section: "Build Updates", hidden: false },
{ type: "test", section: "Test Updates", hidden: false },
{ type: "style", section: "Other Changes", hidden: false },
{
type: "perf",
section: "Performance Improvements",
hidden: false,
},
{ type: "ci", section: "CI Changes", hidden: false },
{ type: "revert", section: "Updates Reverted", hidden: false },
],
},
},
},
Expand Down
5 changes: 5 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# Optional tool caches
.eslintcache
.stylelintcache
.prettiercache

# Dependency directories
node_modules
Expand Down Expand Up @@ -67,6 +68,10 @@ package-lock.json
yarn.lock
pnpm-lock.yaml

# Custom
release-it/commit.hbs
release-it/remote-commits.json

# Library files
dist
CHANGELOG.md
Expand Down
14 changes: 3 additions & 11 deletions .stylelintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
module.exports = {
// add
extends: [
"stylelint-config-standard",
"stylelint-config-prettier",
"stylelint-config-clean-order",
],
extends: ["stylelint-config-standard", "stylelint-config-clean-order"],
rules: {
// Suppress the following rules as they are already handled by Prettier
"value-list-comma-newline-after": null,
"declaration-colon-newline-after": null,
"max-line-length": 100,

// Add your own rules here
// Need vendor prefix in preflight css
"property-no-vendor-prefix": null,
Expand All @@ -23,6 +13,7 @@ module.exports = {
],
"selector-id-pattern":
"^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$|^__[a-z]([a-z0-9-]+)$",

// For Tailwind CSS
"at-rule-no-unknown": [
true,
Expand All @@ -39,6 +30,7 @@ module.exports = {
],
},
],

"function-no-unknown": [
true,
{
Expand Down
Loading

1 comment on commit 98efcb4

@vercel
Copy link

@vercel vercel bot commented on 98efcb4 Feb 25, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.