build: add lint, formatting, and npm scripts

main
Carsten Kragelund 2023-07-29 15:51:56 +02:00
parent a8000cd0f3
commit 748346fa6e
Signed by: nyx
GPG Key ID: CADDADEEC9F753C0
12 changed files with 5264 additions and 4590 deletions

@ -0,0 +1,24 @@
root = true
[*]
charset = utf-8
insert_final_newline = true
end_of_line = lf
indent_style = space
indent_size = 2
max_line_length = 80
[*.rs]
indent_size = 4
max_line_length = 100
[justfile]
indent_size = 4
[pages/api/bindings.ts]
charset = unset
insert_final_newline = unset
end_of_line = unset
indent_style = unset
indent_size = unset
max_line_length = unset

@ -1,3 +1,3 @@
{ {
"extends": "next/core-web-vitals" "extends": ["next/core-web-vitals", "prettier"]
} }

@ -0,0 +1,40 @@
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
# rust
target
Cargo.lock
# rapid build output
pages/api/bindings.ts

@ -0,0 +1,8 @@
{
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
]
}

@ -4,7 +4,6 @@ version = "0.1.0"
edition = "2021" edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
futures-util = "0.3.28" futures-util = "0.3.28"
include_dir = "0.7.3" include_dir = "0.7.3"

@ -1,6 +1,6 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
} };
module.exports = nextConfig module.exports = nextConfig;

9623
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,29 +1,45 @@
{ {
"name": "rapid-nextjs-testing", "name": "rapid-nextjs-testing",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "concurrently npm:dev@rapid npm:dev@next",
"build": "next build", "dev@rapid": "rapid run",
"start": "next start", "dev@next": "next dev",
"lint": "next lint" "lint": "npm run lint@js && npm run lint@rust",
}, "lint@js": "eslint . --ext .js,.ts,.jsx,.tsx",
"dependencies": { "lint@rust": "cargo clippy --all-targets --all-features -- -D warnings",
"@rapid-web/react": "^0.2.4", "format": "npm run format@js && npm run format@rust",
"@types/node": "20.4.2", "format@js": "prettier --write --ignore-unknown --no-error-on-unmatched-pattern .",
"@types/react": "18.2.15", "format@rust": "cargo fmt --all",
"@types/react-dom": "18.2.7", "format-check": "npm run format-check@js && npm run format-check@rust",
"autoprefixer": "10.4.14", "format-check@js": "prettier --check --ignore-unknown --no-error-on-unmatched-pattern .",
"eslint": "8.45.0", "format-check@rust": "cargo fmt --all --check",
"eslint-config-next": "13.4.10", "clean": "npm run clean@js && npm run clean@rust",
"next": "13.4.10", "clean@js": "rimraf node_modules && rimraf .next",
"postcss": "8.4.26", "clean@rust": "cargo clean"
"react": "18.2.0", },
"react-dom": "18.2.0", "dependencies": {
"tailwindcss": "3.3.3", "@rapid-web/react": "^0.2.4",
"typescript": "5.1.6" "@types/node": "20.4.2",
}, "@types/react": "18.2.15",
"devDependencies": { "@types/react-dom": "18.2.7",
"@rapid-web/ui": "^0.2.2" "autoprefixer": "10.4.14",
} "eslint": "8.45.0",
"eslint-config-next": "13.4.10",
"next": "13.4.10",
"postcss": "8.4.26",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.3",
"typescript": "5.1.6"
},
"devDependencies": {
"@rapid-web/ui": "^0.2.2",
"concurrently": "^8.2.0",
"eslint-config-prettier": "^8.9.0",
"prettier": "^2.8.8",
"prettier-plugin-toml": "^0.3.1",
"rimraf": "^5.0.1"
}
} }

@ -1,6 +1,6 @@
use rapid_web::server::RapidServer;
use rapid_web::actix::HttpServer; use rapid_web::actix::HttpServer;
use rapid_web::rapid_web_codegen::{main, routes, rapid_configure_nextjs}; use rapid_web::rapid_web_codegen::{main, rapid_configure_nextjs, routes};
use rapid_web::server::RapidServer;
rapid_configure_nextjs!(); rapid_configure_nextjs!();
@ -8,9 +8,8 @@ rapid_configure_nextjs!();
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
let app = RapidServer::create(None, None); let app = RapidServer::create(None, None);
app.listen(HttpServer::new(move || { app.listen(HttpServer::new(move || {
RapidServer::fs_router(None, None, routes!("pages/api/routes")) RapidServer::fs_router(None, None, routes!("pages/api/routes"))
})).await }))
.await
} }

@ -1,6 +1,6 @@
module.exports = { module.exports = {
plugins: { plugins: {
tailwindcss: {}, tailwindcss: {},
autoprefixer: {}, autoprefixer: {},
}, },
} };

@ -1,27 +1,27 @@
import type { Config } from 'tailwindcss'; import type { Config } from "tailwindcss";
import { import {
rapidStylesPath, rapidStylesPath,
rapidTailwindTheme, rapidTailwindTheme,
rapidPlugin, rapidPlugin,
} from '@rapid-web/ui'; } from "@rapid-web/ui";
// Use this as your template paths directory if using nextjs app dir: "./app/**/*.{js,ts,jsx,tsx,mdx}", // Use this as your template paths directory if using nextjs app dir: "./app/**/*.{js,ts,jsx,tsx,mdx}",
export default { export default {
content: [ content: [
'./pages/**/*.{js,ts,jsx,tsx}', "./pages/**/*.{js,ts,jsx,tsx}",
'./components/**/*.{js,ts,jsx,tsx}', "./components/**/*.{js,ts,jsx,tsx}",
rapidStylesPath, rapidStylesPath,
], ],
theme: { theme: {
extend: rapidTailwindTheme({ extend: rapidTailwindTheme({
// Extend the default rapid tailwind theme here (documentation coming soon) // Extend the default rapid tailwind theme here (documentation coming soon)
}), }),
}, },
plugins: [ plugins: [
rapidPlugin({ rapidPlugin({
// Configure global styles variants here (documentation coming soon) // Configure global styles variants here (documentation coming soon)
global: {}, global: {},
}), }),
], ],
} satisfies Config; } satisfies Config;

@ -1,11 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"lib": [ "lib": ["dom", "dom.iterable", "esnext"],
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true, "allowJs": true,
"skipLibCheck": true, "skipLibCheck": true,
"strict": true, "strict": true,
@ -19,9 +15,7 @@
"jsx": "preserve", "jsx": "preserve",
"incremental": true, "incremental": true,
"paths": { "paths": {
"@/*": [ "@/*": ["./*"]
"./*"
]
}, },
"plugins": [ "plugins": [
{ {
@ -29,13 +23,6 @@
} }
] ]
}, },
"include": [ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"next-env.d.ts", "exclude": ["node_modules"]
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": [
"node_modules"
]
} }