Skip to content

Commit

Permalink
finished refactoring react box, added npx script too
Browse files Browse the repository at this point in the history
  • Loading branch information
signorecello committed Feb 6, 2024
1 parent 1d53b5e commit cd327d9
Show file tree
Hide file tree
Showing 107 changed files with 1,082 additions and 4,576 deletions.
2 changes: 1 addition & 1 deletion boxes/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

node_modules
dest
src/contracts/target
src/contracts/target
77 changes: 28 additions & 49 deletions boxes/blank-react/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,63 +1,42 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
parserOptions: {
project: './tsconfig.json',
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:import/recommended',
'plugin:import/typescript',
'prettier',
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"plugin:import/recommended",
"plugin:import/typescript",
"prettier",
],
settings: {
'import/resolver': {
"import/resolver": {
typescript: true,
node: true,
},
},
ignorePatterns: ['dest', 'webpack.config.js', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
overrides: [
{
files: ['*.ts', '*.tsx'],
parserOptions: {
project: true,
},
},
],
ignorePatterns: ["dest", "webpack.config.js", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
plugins: ["react-refresh"],
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/no-floating-promises': 2,
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
'require-await': 2,
'no-console': 'warn',
'no-constant-condition': 'off',
camelcase: 2,
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['client-dest'],
message: "Fix this absolute garbage import. It's your duty to solve it before it spreads.",
},
{
group: ['dest'],
message: 'You should not be importing from a build directory. Did you accidentally do a relative import?',
},
],
},
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-unused-vars": [
"error",
{ argsIgnorePattern: "^_", varsIgnorePattern: "^_" },
],
'import/no-unresolved': 'error',
'import/no-extraneous-dependencies': 'error',
"require-await": 2,
"no-console": "warn",
"no-constant-condition": "off",
camelcase: 2,
"import/no-unresolved": "error",
"import/no-extraneous-dependencies": "error",
},
};
3 changes: 2 additions & 1 deletion boxes/blank-react/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
!.yarn/releases

node_modules
dest
dist
artifacts
src/contracts/target
src/contracts/log
2 changes: 0 additions & 2 deletions boxes/blank-react/.prettierignore

This file was deleted.

6 changes: 0 additions & 6 deletions boxes/blank-react/.prettierrc.json

This file was deleted.

25 changes: 25 additions & 0 deletions boxes/blank-react/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Private Token Noir Smart Contract</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.js"></script>
</body>
<style>
#root {
width: 100%;
text-align: center;
}

body {
display: flex;
place-items: center;
background: linear-gradient(#f6fbfc, #d8d4e7);
min-height: 100vh;
}
</style>
</html>
26 changes: 8 additions & 18 deletions boxes/blank-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"private": true,
"version": "0.1.0",
"type": "module",
"main": "./dest/index.js",
"main": "./dist/index.js",
"scripts": {
"compile": "cd src/contracts && ${AZTEC_NARGO:-aztec-nargo} compile",
"codegen": "${AZTEC_CLI:-aztec-cli} codegen src/contracts/target -o artifacts --ts",
"build": "yarn clean && yarn compile && yarn codegen && tsc -b && webpack",
"clean": "rm -rf ./dest .tsbuildinfo ./artifacts ./src/contracts/target",
"clean": "rm -rf ./dist .tsbuildinfo ./artifacts ./src/contracts/target",
"prep": "yarn clean && yarn compile && yarn codegen",
"dev": "yarn prep && webpack serve --mode development",
"serve": "serve -p 3000 ./dest",
"dev": "webpack serve --mode development",
"serve": "serve -p 3000 ./dist",
"formatting": "prettier --check ./src && eslint ./src",
"formatting:fix": "prettier -w ./src",
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules $(yarn bin jest) --runInBand"
Expand Down Expand Up @@ -62,10 +62,12 @@
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"html-webpack-plugin": "^5.6.0",
"jest": "^29.6.4",
"postcss": "^8.4.29",
"postcss-loader": "^7.3.3",
"prettier": "^3.1.1",
"react-toastify": "^10.0.4",
"resolve-typescript-plugin": "^2.0.1",
"stream-browserify": "^3.0.0",
"style-loader": "^3.3.3",
Expand All @@ -79,23 +81,11 @@
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
"browserslist": {
"production": [
">0.5%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"files": [
"dest",
"dist",
"src",
"!*.test.*"
],
"types": "./dest/index.d.ts",
"types": "./dist/index.d.ts",
"packageManager": "[email protected]"
}
9 changes: 0 additions & 9 deletions boxes/blank-react/src/@types/index.d.ts

This file was deleted.

Loading

0 comments on commit cd327d9

Please sign in to comment.