Skip to content

Commit

Permalink
chore: refactor to hyperse
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperse-net committed May 29, 2024
1 parent 50954ae commit 99fac3f
Show file tree
Hide file tree
Showing 115 changed files with 2,055 additions and 1,884 deletions.
10 changes: 10 additions & 0 deletions .changeset/four-badgers-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@hyperse/next-graphql": patch
"@hyperse/next-prisma": patch
"@hyperse/next-auth": patch
"@hyperse/next-core": patch
"@hyperse/next-demo": patch
"@hyperse/next-env": patch
---

refactor to `hyperse`
31 changes: 0 additions & 31 deletions .eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A clear and concise description of what you expected to happen.

**Environment (please complete the following information):**

- @hyperse-io/\* version:
- @hyperse/\* version:
- Nodejs version:
- Database (mysql/postgres etc):

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,4 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.netrc
15 changes: 7 additions & 8 deletions .ncurc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"dep": "prod,dev,bundle,optional,peer",
"reject": [
"@hyperse-io/next-demo",
"@hyperse-io/next-env",
"@hyperse-io/next-auth",
"@hyperse-io/next-core",
"@hyperse-io/next-graphql",
"@hyperse-io/next-prisma",
"eslint"
"@hyperse/next-demo",
"@hyperse/next-env",
"@hyperse/next-auth",
"@hyperse/next-core",
"@hyperse/next-graphql",
"@hyperse/next-prisma"
]
}
}
3 changes: 0 additions & 3 deletions .netrc

This file was deleted.

13 changes: 10 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"typescript.preferences.importModuleSpecifier": "relative",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "never"
Expand All @@ -13,5 +13,12 @@
// to allow dbaeumer.vscode-eslint to format them
"[javascript]": {
"editor.formatOnSave": false
}
}
},
"eslint.experimental.useFlatConfig": true,
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
}
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# next-mate

The `next.js` based dev toolkits to help you setup fullstack infrastructure quickly

## patch-package

https://www.npmjs.com/package/patch-package
2 changes: 1 addition & 1 deletion cache.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const globalCachePath = resolve(`${__dirname}/.cache`);
* @returns string
*/
function sanitize(packageName) {
return packageName.replace('/', '.').replace(/[^a-z0-9.@_-]+/gi, '-');
return packageName.replace('/', '.').replace(/[^\w.@-]+/g, '-');
}

/**
Expand Down
10 changes: 10 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { base, defineConfig } from '@hyperse/eslint-config-hyperse';

export default defineConfig([
...base,
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
]);
19 changes: 0 additions & 19 deletions lint-staged.common.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import path from 'path';
import { quote } from 'shell-quote';

const isWin = process.platform === 'win32';

const eslintGlobalRulesForFix = [
// react-hooks/eslint and react in general is very strict about exhaustively
Expand Down Expand Up @@ -62,19 +59,3 @@ export const getEslintFixCmd = ({
].join(' ');
return `eslint ${args}`;
};

/**
* Concatenate and escape a list of filenames that can be passed as args to prettier cli
*
* Prettier has an issue with special characters in filenames,
* such as the ones uses for nextjs dynamic routes (ie: [id].tsx...)
*
* @link https://github.com/okonet/lint-staged/issues/676
*
* @param {string[]} filenames
* @returns {string} Return concatenated and escaped filenames
*/
export const concatFilesForPrettier = (filenames) =>
filenames
.map((filename) => `"${isWin ? filename : quote([filename])}"`)
.join(' ');
12 changes: 2 additions & 10 deletions lint-staged.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ import { fileURLToPath } from 'node:url';
* A good practice is to override this base configuration in each package and/or application
* where we are able to add customization depending on the nature of the project (eslint...).
*/
import {
concatFilesForPrettier,
getEslintFixCmd,
} from './lint-staged.common.mjs';
import { getEslintFixCmd } from './lint-staged.common.mjs';

/**
* @type {Record<string, (filenames: string[]) => string | string[] | Promise<string | string[]>>}
* @type {Record<string, (filenames: string[]) => string | string[] | Promise<string | string[]>>}
*/
const rules = {
'**/*.{js,jsx,ts,tsx,mjs,cjs}': (filenames) => {
Expand All @@ -26,11 +23,6 @@ const rules = {
files: filenames,
});
},
'**/*.{json,md,mdx,css,html,yml,yaml,scss,ts,js,tsx,jsx,mjs}': (
filenames
) => {
return [`prettier --write ${concatFilesForPrettier(filenames)}`];
},
};

export default rules;
13 changes: 9 additions & 4 deletions next-mate.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@
},
],
"extensions": {
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"],
"recommendations": [
"dbaeumer.vscode-eslint"
],
},
"settings": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.experimental.useFlatConfig": true,
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "never",
Expand All @@ -61,7 +64,9 @@
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma",
},
"i18n-ally.localesPaths": ["i18n"],
"i18n-ally.localesPaths": [
"i18n"
],
"i18n-ally.keystyle": "nested",
},
}
}
16 changes: 5 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "next-mate-monorepo",
"name": "hyperse-next-mate-monorepo",
"version": "0.0.1",
"private": true,
"description": "The tRPC framework based on next.js app router with i18n",
Expand Down Expand Up @@ -46,7 +46,7 @@
"deps:update": "yarn dlx npm-check-updates@latest --configFileName .ncurc.json -u --deep --mergeConfig",
"check:install": "yarn dlx @yarnpkg/[email protected] .",
"install:playwright": "npx playwright install",
"postinstall": "is-ci || yarn husky"
"prepare": "yarn husky"
},
"config": {
"commitizen": {
Expand All @@ -57,24 +57,18 @@
"cross-env": "7.0.3"
},
"devDependencies": {
"@armit/eslint-config-bases": "0.1.6",
"@changesets/changelog-github": "0.5.0",
"@changesets/cli": "2.27.3",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@types/prettier": "3.0.0",
"@types/shell-quote": "1.7.5",
"@hyperse/eslint-config-hyperse": "^1.0.5",
"commitizen": "4.3.0",
"cz-conventional-changelog": "3.3.0",
"eslint": "8.x",
"eslint": "^9.3.0",
"husky": "9.0.11",
"is-ci": "3.0.1",
"lint-staged": "15.2.4",
"npm-run-all": "4.1.5",
"patch-package": "^8.0.0",
"prettier": "3.2.5",
"rimraf": "5.0.7",
"shell-quote": "1.8.1",
"typescript": "5.4.5"
},
"engines": {
Expand All @@ -83,4 +77,4 @@
"yarn": ">=1.22.0"
},
"packageManager": "[email protected]"
}
}
43 changes: 0 additions & 43 deletions packages/next-auth/.eslintrc.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion packages/next-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @hyperse-io/next-auth
# @hyperse/next-auth

## 1.1.0

Expand Down
17 changes: 16 additions & 1 deletion packages/next-auth/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
# @hyperse-io/next-auth
# @hyperse/next-auth

<p align="left">
<a aria-label="Build" href="https://github.com/hyperse-io/next-mate/actions?query=workflow%3ACI">
<img alt="build" src="https://img.shields.io/github/actions/workflow/status/hyperse-io/ts-node-paths/ci-integrity.yml?branch=main&label=ci&logo=github&style=flat-quare&labelColor=000000" />
</a>
<a aria-label="stable version" href="https://www.npmjs.com/package/@hyperse/next-auth">
<img alt="stable version" src="https://img.shields.io/npm/v/%40hyperse%2Fnext-auth?branch=main&label=version&logo=npm&style=flat-quare&labelColor=000000" />
</a>
<a aria-label="Top language" href="https://github.com/hyperse-io/next-mate/search?l=typescript">
<img alt="GitHub top language" src="https://img.shields.io/github/languages/top/hyperse-io/next-mate?style=flat-square&labelColor=000&color=blue">
</a>
<a aria-label="Licence" href="https://github.com/hyperse-io/next-mate/blob/main/LICENSE">
<img alt="Licence" src="https://img.shields.io/github/license/hyperse-io/next-mate?style=flat-quare&labelColor=000000" />
</a>
</p>

Infrastructure setup for `lucia-auth` with app router

Expand Down
10 changes: 10 additions & 0 deletions packages/next-auth/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { base, defineConfig } from '@hyperse/eslint-config-hyperse';

export default defineConfig([
...base,
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
]);
1 change: 0 additions & 1 deletion packages/next-auth/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
// eslint-disable-next-line import/no-unresolved
export * from './dist/index.js';
10 changes: 4 additions & 6 deletions packages/next-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@hyperse-io/next-auth",
"name": "@hyperse/next-auth",
"version": "1.1.0",
"homepage": "https://github.com/hyperse-io/next-auth",
"repository": {
Expand Down Expand Up @@ -39,7 +39,7 @@
"?build-release": "When https://github.com/atlassian/changesets/issues/432 has a solution we can remove this trick",
"build-release": "yarn build && rimraf ./_release && yarn pack && mkdir ./_release && tar zxvf ./package.tgz --directory ./_release && rm ./package.tgz",
"clean": "rimraf --no-glob ./dist ./_release ./coverage ./tsconfig.tsbuildinfo",
"lint": "eslint . --ext .ts,.mts,.tsx,.js,.jsx,.cjs,.mjs --cache --cache-location ../../.cache/eslint/next-auth.eslintcache",
"lint": "eslint .",
"test": "run-s test-unit",
"test-unit": "vitest run",
"test-coverage": "vitest run --coverage",
Expand All @@ -51,20 +51,18 @@
"oslo": "1.2.0"
},
"devDependencies": {
"@armit/eslint-config-bases": "^0.1.6",
"@hyperse/eslint-config-hyperse": "^1.0.5",
"@prisma/client": "^5.14.0",
"@types/node": "20.12.12",
"@vitest/coverage-istanbul": "1.6.0",
"@vitest/ui": "1.6.0",
"eslint": "8.x",
"eslint": "^9.3.0",
"next": "^14.2.3",
"npm-run-all": "4.1.5",
"prettier": "3.2.5",
"prisma": "^5.14.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"rimraf": "5.0.7",
"ts-node": "10.9.2",
"typescript": "5.4.5",
"vite": "5.2.11",
"vite-tsconfig-paths": "4.3.2",
Expand Down
Loading

0 comments on commit 99fac3f

Please sign in to comment.