Skip to content

Commit

Permalink
Merge pull request #1 from Smart-Beaver/initial-code-migration
Browse files Browse the repository at this point in the history
Code migration
  • Loading branch information
coredumped7893 authored Dec 14, 2023
2 parents cb79c57 + a0c5e41 commit b19221a
Show file tree
Hide file tree
Showing 74 changed files with 7,373 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
NEXT_PUBLIC_CODE_API_BASE_URL=
NEXT_PUBLIC_DOMAIN_URL=
NEXT_PUBLIC_DEBOUNCE_INTERVAL_IN_MS=
NEXT_PUBLIC_DOCS_URL=
NEXT_PUBLIC_GITHUB_URL=
NEXT_PUBLIC_CONTACT_EMAIL=
83 changes: 83 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"extends": [
"next/core-web-vitals",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:prettier/recommended"
],
"root": true,
"parserOptions": {
"project": true
},
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "import"],
"rules": {
"no-restricted-syntax": [
"error",
{
"selector": "ImportDeclaration[source.value='react'] > ImportDefaultSpecifier",
"message": "React should be not imported"
}
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "interface",
"format": ["PascalCase"],
"custom": {
"regex": "^I[A-Z]",
"match": false
}
}
],
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/consistent-type-imports": ["error", { "disallowTypeAnnotations": false }],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_", "varsIgnorePattern": "^_", "args": "all", "caughtErrors": "all" }
],
// "no-restricted-imports": ["error", { "patterns": ["**/../*", ".*"] }], doesn't make sense with app dir
"no-empty-pattern": "error",
"no-empty": ["error", { "allowEmptyCatch": true }],
"quotes": ["error", "single", { "avoidEscape": true }],
"no-console": ["warn"],
"import/no-unused-modules": [
"off",
{
"unusedExports": true,
"src": ["**/*.ts", "**/*.tsx"],
"ignoreExports": ["**/*.d.ts"]
}
],
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal"],
"pathGroups": [
{
"pattern": "react",
"group": "external",
"position": "before"
}
],
"pathGroupsExcludedImportTypes": ["react"],
"alphabetize": { "order": "asc", "caseInsensitive": true }
}
],
"react/jsx-curly-brace-presence": [
"error",
{ "props": "never", "children": "never", "propElementValues": "always" }
],
// "react/jsx-handler-names": [
// "error",
// {
// "eventHandlerPrefix": "handle",
// "eventHandlerPropPrefix": "on",
// "checkLocalVariables": true,
// "checkInlineFunction": true
// }
// ],
"react/jsx-key": ["error", { "checkFragmentShorthand": true }]
}
}
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# 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
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts


.idea
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,ts,jsx,tsx}": "eslint --format=unix",
"*.md": "prettier --list-different"
}
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:20-alpine AS base
WORKDIR /app
COPY . .
RUN npm i

EXPOSE 3000

CMD ["npm", "run", "dev"]
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Smart-Beaver

Main UI app for smart beaver. Handles user inputs, code preview and integrates with code-generator wasm module.
For more general information about this app go to our docs page https://smart-beaver.github.io/


## Getting Started

Make sure that you are using Node 18.0+

First, run the development server:

```bash
pnpm install
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

40 changes: 40 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-return */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import './src/env/env.mjs';

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack(config) {
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg'));
config.module.rules.push(
{
test: /\.(graphql)$/,
exclude: /node_modules/,
loader: 'graphql-tag/loader'
},
{
...fileLoaderRule,
test: /\.svg$/i,
resourceQuery: /url/ // *.svg?url
},
{
test: /\.svg$/i,
resourceQuery: { not: /url/ }, // exclude if *.svg?url
use: ['@svgr/webpack']
}
);
fileLoaderRule.exclude = /\.svg$/i;
config.externals = [...config.externals, 'jsdom'];
config.experiments = {
asyncWebAssembly: true,
layers: true
};

return config;
}
};

export default nextConfig;
69 changes: 69 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "smart-beaver-wizard",
"version": "0.1.0",
"private": true,
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.{js,ts,jsx,tsx}": [
"eslint --format=unix",
"prettier --list-different",
"git add"
]
},
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"prepare": "husky install"
},
"dependencies": {
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@hookform/resolvers": "^3.3.2",
"@t3-oss/env-core": "^0.7.1",
"@t3-oss/env-nextjs": "^0.7.1",
"@tailwindcss/forms": "^0.5.7",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"debounce": "^2.0.0",
"highlight.js": "^11.9.0",
"husky": "^8.0.3",
"ink-generator": "^0.3.3",
"next": "14.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.48.2",
"react-toastify": "^9.1.3",
"tailwind-merge": "^2.0.0",
"zod": "^3.22.4"
},
"devDependencies": {
"@svgr/webpack": "^8.1.0",
"@types/node": "^20.8.9",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.52.0",
"eslint-config-next": "^14.0.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-prettier": "^5.0.1",
"husky": "^8.0.0",
"lint-staged": "^15.0.2",
"postcss": "^8.4.31",
"prettier": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.5.6",
"tailwindcss": "^3.3.5",
"typescript": "^5.2.2"
},
"engines": {
"node": ">=18.0.0"
}
}
Loading

0 comments on commit b19221a

Please sign in to comment.