first commit
This commit is contained in:
commit
76bbdbfb61
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
22
ijl.config.js
Normal file
22
ijl.config.js
Normal file
@ -0,0 +1,22 @@
|
||||
const pkg = require('./package')
|
||||
|
||||
module.exports = {
|
||||
apiPath: 'stubs/api',
|
||||
webpackConfig: {
|
||||
output: {
|
||||
publicPath: `/static/${pkg.name}/${process.env.VERSION || pkg.version}/`
|
||||
}
|
||||
},
|
||||
navigations: {
|
||||
'undefined.main': '/undefined',
|
||||
'link.undefined.auth': '/auth'
|
||||
},
|
||||
features: {
|
||||
'undefined': {
|
||||
// add your features here in the format [featureName]: { value: string }
|
||||
},
|
||||
},
|
||||
config: {
|
||||
'undefined.api': '/api',
|
||||
}
|
||||
}
|
7802
package-lock.json
generated
Normal file
7802
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
package.json
Normal file
19
package.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@ijl/cli": "^5.1.0",
|
||||
"@types/react": "^18.3.5",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"express": "^4.19.2",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-router-dom": "^6.26.1",
|
||||
"typescript": "^5.5.4"
|
||||
},
|
||||
"main": "./src/index.tsx",
|
||||
"scripts": {
|
||||
"start": "ijl-cli server --port=8099 --with-open-browser",
|
||||
"build": "npm run clean && ijl-cli build --dev",
|
||||
"build:prod": "npm run clean && ijl-cli build",
|
||||
"clean": "rimraf dist"
|
||||
}
|
||||
}
|
13
src/__data__/urls.ts
Normal file
13
src/__data__/urls.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { getNavigations, getNavigationsValue } from '@ijl/cli';
|
||||
import pkg from '../../package.json';
|
||||
|
||||
const baseUrl = getNavigationsValue(`${pkg.name}.main`);
|
||||
const navs = getNavigations();
|
||||
const makeUrl = url => baseUrl + url;
|
||||
|
||||
export const URLs = {
|
||||
baseUrl,
|
||||
auth: {
|
||||
url: makeUrl(navs[`link.${pkg.name}.auth`]),
|
||||
},
|
||||
};
|
15
src/app.tsx
Normal file
15
src/app.tsx
Normal file
@ -0,0 +1,15 @@
|
||||
import React from 'react';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
|
||||
import { Dashboard } from './dashboard';
|
||||
|
||||
const App = () => {
|
||||
return(
|
||||
<BrowserRouter>
|
||||
<Dashboard />
|
||||
</BrowserRouter>
|
||||
)
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
18
src/dashboard.tsx
Normal file
18
src/dashboard.tsx
Normal file
@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
import { Routes, Route, Navigate } from 'react-router-dom';
|
||||
|
||||
import { URLs } from './__data__/urls';
|
||||
|
||||
const Hello = () => <h1>Hello</h1>;
|
||||
|
||||
export const Dashboard = () => {
|
||||
return (
|
||||
<Routes>
|
||||
<Route
|
||||
path={URLs.baseUrl}
|
||||
element={<Navigate replace to={URLs.auth.url} />}
|
||||
/>
|
||||
<Route path={URLs.auth.url} element={<Hello />} />
|
||||
</Routes>
|
||||
);
|
||||
};
|
23
src/index.tsx
Normal file
23
src/index.tsx
Normal file
@ -0,0 +1,23 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
|
||||
import App from './app';
|
||||
|
||||
export default () => <App/>;
|
||||
|
||||
let rootElement: ReactDOM.Root
|
||||
|
||||
export const mount = (Сomponent, element = document.getElementById('app')) => {
|
||||
const rootElement = ReactDOM.createRoot(element);
|
||||
rootElement.render(<Сomponent/>);
|
||||
|
||||
if(module.hot) {
|
||||
module.hot.accept('./app', ()=> {
|
||||
rootElement.render(<Сomponent/>);
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
export const unmount = () => {
|
||||
rootElement.unmount();
|
||||
};
|
3
stubs/api/index.js
Normal file
3
stubs/api/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
const router = require('express').Router();
|
||||
|
||||
module.exports = router;
|
25
tsconfig.json
Normal file
25
tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2017"
|
||||
],
|
||||
"outDir": "./dist/",
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true,
|
||||
"noImplicitAny": false,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"target": "es6",
|
||||
"jsx": "react",
|
||||
"typeRoots": ["node_modules/@types", "src/typings"],
|
||||
"types" : ["webpack-env", "node"],
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/*.test.ts",
|
||||
"**/*.test.tsx",
|
||||
"node_modules/@types/jest"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user