Skip to content

Commit

Permalink
voila
Browse files Browse the repository at this point in the history
  • Loading branch information
technoplato committed Mar 27, 2024
1 parent 68dead1 commit 19da199
Show file tree
Hide file tree
Showing 18 changed files with 13,158 additions and 2,846 deletions.
18 changes: 18 additions & 0 deletions my-app/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../.eslintrc.base.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
15 changes: 15 additions & 0 deletions my-app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>MyApp</title>
<base href="/" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
8 changes: 8 additions & 0 deletions my-app/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "my-app",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "my-app/src",
"projectType": "application",
"targets": {},
"tags": []
}
Binary file added my-app/public/favicon.ico
Binary file not shown.
15 changes: 15 additions & 0 deletions my-app/src/app/app.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { render } from '@testing-library/react';

import App from './app';

describe('App', () => {
it('should render successfully', () => {
const { baseElement } = render(<App />);
expect(baseElement).toBeTruthy();
});

it('should have a greeting as the title', () => {
const { getByText } = render(<App />);
expect(getByText(/Welcome my-app/gi)).toBeTruthy();
});
});
11 changes: 11 additions & 0 deletions my-app/src/app/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import NxWelcome from './nx-welcome';

export function App() {
return (
<div>
<NxWelcome title="my-app" />
</div>
);
}

export default App;
17 changes: 17 additions & 0 deletions my-app/src/app/nx-welcome.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { createActor, createMachine } from 'xstate';
import { createBrowserInspector, createSkyInspector } from '@statelyai/inspect';

const machine = createMachine({
id: 'foo',
states: {},
});
const actor = createActor(machine, {
inspect: createBrowserInspector({}).inspect,
});
actor.start();

export function NxWelcome({ title }: { title: string }) {
return <div>{title}</div>;
}

export default NxWelcome;
Empty file added my-app/src/assets/.gitkeep
Empty file.
13 changes: 13 additions & 0 deletions my-app/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { StrictMode } from 'react';
import * as ReactDOM from 'react-dom/client';

import App from './app/app';

const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<StrictMode>
<App />
</StrictMode>
);
23 changes: 23 additions & 0 deletions my-app/tsconfig.app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../dist/out-tsc",
"types": [
"node",
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts",
"vite/client"
]
},
"exclude": [
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/**/*.spec.tsx",
"src/**/*.test.tsx",
"src/**/*.spec.js",
"src/**/*.test.js",
"src/**/*.spec.jsx",
"src/**/*.test.jsx"
],
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
}
21 changes: 21 additions & 0 deletions my-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"compilerOptions": {
"jsx": "react-jsx",
"allowJs": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true,
"types": ["vite/client", "vitest"]
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"extends": "../tsconfig.base.json"
}
28 changes: 28 additions & 0 deletions my-app/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../dist/out-tsc",
"types": [
"vitest/globals",
"vitest/importMeta",
"vite/client",
"node",
"vitest",
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts"
]
},
"include": [
"vite.config.ts",
"vitest.config.ts",
"src/**/*.test.ts",
"src/**/*.spec.ts",
"src/**/*.test.tsx",
"src/**/*.spec.tsx",
"src/**/*.test.js",
"src/**/*.spec.js",
"src/**/*.test.jsx",
"src/**/*.spec.jsx",
"src/**/*.d.ts"
]
}
49 changes: 49 additions & 0 deletions my-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/// <reference types='vitest' />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';

export default defineConfig({
root: __dirname,
cacheDir: '../node_modules/.vite/my-app',

server: {
port: 4200,
host: 'localhost',
},

preview: {
port: 4300,
host: 'localhost',
},

plugins: [react(), nxViteTsPaths()],

// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },

build: {
outDir: '../dist/my-app',
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
},

test: {
globals: true,
cache: {
dir: '../node_modules/.vitest',
},
environment: 'jsdom',
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],

reporters: ['default'],
coverage: {
reportsDirectory: '../coverage/my-app',
provider: 'v8',
},
},
});
29 changes: 28 additions & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,33 @@
"options": {
"targetName": "test"
}
},
{
"plugin": "@nx/vite/plugin",
"options": {
"buildTargetName": "build",
"previewTargetName": "preview",
"testTargetName": "test",
"serveTargetName": "serve",
"serveStaticTargetName": "serve-static"
}
}
],
"generators": {
"@nx/react": {
"application": {
"babel": true,
"style": "none",
"linter": "eslint",
"bundler": "vite"
},
"component": {
"style": "none"
},
"library": {
"style": "none",
"linter": "eslint"
}
}
]
}
}
Loading

0 comments on commit 19da199

Please sign in to comment.