Skip to content

Commit

Permalink
chore(rwa): init project (#2619)
Browse files Browse the repository at this point in the history
  • Loading branch information
sstraatemans authored Oct 25, 2024
1 parent be30009 commit cb02e7e
Show file tree
Hide file tree
Showing 17 changed files with 450 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/wild-zoos-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@kadena/rwa-demo': patch
---

init project
3 changes: 3 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ Github Config & Actions:
'@kadena/explorer':
- changed-files:
- any-glob-to-any-file: packages/apps/explorer/*
'@kadena/rwa-demo':
- changed-files:
- any-glob-to-any-file: packages/apps/rwa-demo/*
'@kadena/graph':
- changed-files:
- any-glob-to-any-file: packages/apps/graph/*
Expand Down
6 changes: 6 additions & 0 deletions packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@
"private": true,
"path": "packages/apps/explorer"
},
{
"name": "@kadena/rwa-demo",
"version": "0.0.1",
"private": true,
"path": "packages/apps/rwa-demo"
},
{
"name": "@kadena/graph",
"version": "1.0.14",
Expand Down
2 changes: 2 additions & 0 deletions packages/apps/rwa-demo/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# generated code
**/__generated__/**
18 changes: 18 additions & 0 deletions packages/apps/rwa-demo/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This is a workaround for https://github.com/eslint/eslint/issues/3458
require('@rushstack/eslint-config/patch/modern-module-resolution');

module.exports = {
extends: ['@kadena-dev/eslint-config/profile/next'],
ignorePatterns: ['**/__generated__/**'],
parserOptions: { tsconfigRootDir: __dirname },
rules: {
'jsx-a11y/aria-props': 'warn',
'jsx-a11y/role-has-required-aria-props': 'warn',
'jsx-a11y/heading-has-content': 'warn',
'jsx-a11y/mouse-events-have-key-events': 'warn',
'jsx-a11y/role-supports-aria-props': 'warn',
'@rushstack/no-new-null': 'off',
'react/react-in-jsx-scope': 'off',
'react/jsx-uses-react': 'off',
},
};
40 changes: 40 additions & 0 deletions packages/apps/rwa-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# env files (can opt-in for commiting if needed)
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
2 changes: 2 additions & 0 deletions packages/apps/rwa-demo/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/__generated__
**/*.md
36 changes: 36 additions & 0 deletions packages/apps/rwa-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

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

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
13 changes: 13 additions & 0 deletions packages/apps/rwa-demo/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { createVanillaExtractPlugin } = require('@vanilla-extract/next-plugin');
const withVanillaExtract = createVanillaExtractPlugin();

/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ['@kadena/kode-ui'],
env: {},
async redirects() {
return [];
},
};

module.exports = withVanillaExtract(nextConfig);
45 changes: 45 additions & 0 deletions packages/apps/rwa-demo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "@kadena/rwa-demo",
"version": "0.1.0",
"private": true,
"scripts": {
"build": "next build",
"dev": "next dev",
"lint": "pnpm run /^lint:.*/",
"lint:fmt": "prettier . --cache --check",
"lint:src": "eslint src",
"start": "next start",
"test": "echo ''",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest --coverage"
},
"dependencies": {
"@kadena/kode-icons": "workspace:*",
"@kadena/kode-ui": "workspace:*",
"@vanilla-extract/css": "1.14.2",
"@vanilla-extract/next-plugin": "2.4.0",
"@vanilla-extract/recipes": "0.5.1",
"next": "14.2.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@kadena-dev/eslint-config": "workspace:*",
"@kadena-dev/lint-package": "workspace:*",
"@kadena-dev/shared-config": "workspace:*",
"@types/node": "^20.12.7",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@vanilla-extract/vite-plugin": "4.0.7",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^1.6.0",
"eslint": "^8.45.0",
"eslint-config-next": "13.4.5",
"happy-dom": "^12.9.1",
"next-router-mock": "^0.9.10",
"prettier": "~3.2.5",
"typescript": "5.4.5",
"vitest": "^1.6.0",
"vitest-dom": "^0.1.1"
}
}
20 changes: 20 additions & 0 deletions packages/apps/rwa-demo/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Metadata } from 'next';

export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
};

const RootLayout = ({
children,
}: Readonly<{
children: React.ReactNode;
}>) => {
return (
<html lang="en">
<body>{children}</body>
</html>
);
};

export default RootLayout;
5 changes: 5 additions & 0 deletions packages/apps/rwa-demo/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Home = () => {
return <div>hello world!</div>;
};

export default Home;
27 changes: 27 additions & 0 deletions packages/apps/rwa-demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
3 changes: 3 additions & 0 deletions packages/apps/rwa-demo/vitest-globals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const setup = () => {
process.env.TZ = 'UTC';
};
48 changes: 48 additions & 0 deletions packages/apps/rwa-demo/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import baseConfig from '@kadena-dev/shared-config/vitest.config';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import react from '@vitejs/plugin-react';
import path from 'path';
import { defineConfig, mergeConfig } from 'vitest/config';

export default mergeConfig(
baseConfig,
defineConfig({
plugins: [vanillaExtractPlugin(), react()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
test: {
globals: true,
globalSetup: './vitest-globals.ts',
setupFiles: ['vitest.setup.ts'],
environment: 'happy-dom',
coverage: {
provider: 'v8',
thresholds: {
lines: 90,
functions: 90,
branches: 90,
statements: 90,
},
exclude: [
'src/**/*.tsx',
'src/**/*.d.ts',
'src/**/__fixtures__/**/*.ts',
'src/graphql/**/*.ts',
'src/**/*.graph.ts',
'src/__generated__/**/*.ts',
'src/__mocks__/**/*.ts',
'src/config/**/*',
'src/constants/**/*',
'src/components/**/index.ts',
'src/**/*.css.ts',
'src/**/*.md',
'src/**/*.mdx',
'src/instrumentation.ts',
],
},
},
}),
);
21 changes: 21 additions & 0 deletions packages/apps/rwa-demo/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import '@vanilla-extract/css/disableRuntimeStyles';
import { afterEach, beforeAll, vi } from 'vitest';
import 'vitest-dom/extend-expect';

beforeAll(() => {
vi.mock('next/router', () => import('next-router-mock'));
});

afterEach(() => {});

Object.defineProperty(window, 'matchMedia', {
writable: true,
value: vi.fn().mockImplementation((query) => ({
matches: false,
media: query,
onchange: null,
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
});
Loading

0 comments on commit cb02e7e

Please sign in to comment.