Skip to content

Commit

Permalink
upgrades to a newer turborepo approach
Browse files Browse the repository at this point in the history
drops pnpm
adds packages for eslint & ts config
adds a sample app
adds vscode configs
contains workspaces in apps and packages

Signed-off-by: Stefan <[email protected]>
  • Loading branch information
elmariachi111 committed Jan 7, 2023
1 parent b33eef1 commit 261300f
Show file tree
Hide file tree
Showing 26 changed files with 4,078 additions and 12,889 deletions.
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
!.*.json
tsconfig.json
.yarn/
dist/
.next/
node_modules/
coverage/
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
root: true,
// This tells ESLint to load the config from the package `eslint-config-app`
extends: ['app'],
settings: {
next: {
rootDir: ['apps/*/'],
},
},
};
32 changes: 15 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@

# dependencies
node_modules
/.pnp
.pnp.js


# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
node_modules
.turbo
*.log
.next
dist
dist-ssr
*.local
.env
.cache
server/dist
public/dist
.turbo
storybook-static/

# typescript
*.tsbuildinfo
apps/app-vite-js
apps/app-vite-ts
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist/
coverage/
node_modules/
.next/
*.json
.yarnrc.yml
.yarn/
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": false,
"tabWidth": 2,
"printWidth": 80
}
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"files.eol": "\n",
"editor.formatOnSave": false
}
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# an opinionated scaffold for web3 hackathon projects

typescript
pnpm monorepo with two packages
pnpm monorepo with two packages
hardhat
typechain
oz erc721 base impl
oz erc721 base impl

nextjs / react
chakraui
web3modal in context
ethers.js
ethers.js

server based metadata (next)
unrestricted minting
fetching assets directly from chain

## 2023 update

inspired by https://github.com/bigstair-monorepo/monorepo / https://www.robinwieruch.de/javascript-monorepos/
18 changes: 18 additions & 0 deletions apps/demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@app/demo",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "tsc -p .",
"clean": "rm -rf .turbo && rm -rf node_modules"
},
"dependencies": {
"@app/core": "*"
},
"devDependencies": {
"ts-config-app": "*",
"eslint-config-app": "*",
"serve": "^14.1.2",
"typescript": "^4.9.4"
}
}
8 changes: 8 additions & 0 deletions apps/demo/src/say.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { sayHello } from "@app/core"

const main = () => {
const result = sayHello()
console.log(result)
}

main()
14 changes: 14 additions & 0 deletions apps/demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "ts-config-app/base.json",
"compilerOptions": {
"outDir": "dist"
},
"include": [
"."
],
"exclude": [
"dist",
"build",
"node_modules"
]
}
27 changes: 20 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
{
"name": "",
"version": "1.0.0",
"main": "index.js",
"private": true,

"workspaces": [
"packages/*",
"apps/*"
],
"dependencies": {},
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "pnpm run -r build"
"build": "turbo run build",
"dev": "turbo run dev --no-cache --parallel --continue",
"lint": "turbo run lint",
"clean": "turbo run clean && rm -rf node_modules",
"format": "prettier --ignore-path .gitignore --write \"**/*.{js,jsx,ts,tsx,md}\"",
"changeset-create": "changeset",
"changeset-apply": "changeset version",
"release": "turbo run build && changeset publish"
},
"devDependencies": {
"@changesets/cli": "^2.26.0",
"eslint": "^8.31.0",
"eslint-config-app": "*",
"prettier": "^2.8.2",
"turbo": "^1.6.3"
}
}
}
4 changes: 4 additions & 0 deletions packages/core/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ['app'],
};
28 changes: 28 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@app/core",
"version": "0.0.1",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"sideEffects": false,
"license": "MIT",
"files": [
"dist/**"
],
"scripts": {
"build": "tsup src/index.ts --format esm,cjs --dts ",
"dev": "tsup src/index.ts --format esm,cjs --watch --dts ",
"lint": "TIMING=1 eslint \"src/**/*.{ts,tsx,js,jsx}\" --fix",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist"
},
"devDependencies": {
"ts-config-app": "*",
"eslint-config-app": "*",
"eslint": "^8.31.0",
"tsup": "^6.5.0",
"typescript": "^4.9.4"
},
"publishConfig": {
"access": "public"
}
}
14 changes: 14 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const sayHello = (): string => {
return "Hello"
}

const aVeryLongFunction = (
aLongVariableName: string,
aLongVariableName2: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
aLongVariableName3: string
): string => {
return "foo"
}

export { sayHello }
11 changes: 11 additions & 0 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "ts-config-app/base.json",
"include": [
"."
],
"exclude": [
"dist",
"build",
"node_modules"
]
}
37 changes: 37 additions & 0 deletions packages/eslint-config-app/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
},
extends: [
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
//'next',
"plugin:prettier/recommended",
"prettier",
],
rules: {
"@next/next/no-html-link-for-pages": "off",
//'react/jsx-key': 'off',
//"@typescript-eslint/no-unused-vars": "off",
},
overrides: [
{
files: ["*.ts", "*.tsx"],
extends: [],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-function": "warn",
"@typescript-eslint/ban-types": "warn",
"@typescript-eslint/type-annotation-spacing": [
"off",
{
before: true,
after: true,
},
],
},
},
],
}
15 changes: 15 additions & 0 deletions packages/eslint-config-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "eslint-config-app",
"version": "0.0.0",
"main": "index.js",
"license": "MIT",
"private": true,
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.48.0",
"@typescript-eslint/parser": "^5.48.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-config-next": "^13.1.1",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-react": "^7.31.0"
}
}
20 changes: 20 additions & 0 deletions packages/ts-config-app/base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true
},
"exclude": ["node_modules"]
}
11 changes: 11 additions & 0 deletions packages/ts-config-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "ts-config-app",
"version": "0.0.0",
"license": "MIT",
"private": true,
"main": "index.js",
"files": [
"base.json",
"react-library.json"
]
}
11 changes: 11 additions & 0 deletions packages/ts-config-app/react-library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "React Library",
"extends": "./base.json",
"compilerOptions": {
"lib": ["dom", "ES2015"],
"module": "ESNext",
"target": "ES6",
"jsx": "react-jsx"
}
}
Loading

0 comments on commit 261300f

Please sign in to comment.