import { rmSync } from 'fs';
import { ensure } from '../utils';
const step = () => {
rmSync('src/demo.ts');
rmSync('test', { recursive: true, force: true });
rmSync('src/index.ts');
ensure(
'src/index.tsx',
`import React, { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './app';
import store from './store';
const root = createRoot(document.getElementById('root')!);
root.render(
,
);
`,
);
ensure(
'src/app.tsx',
`import React from 'react';
import { Button, Space, Typography } from 'antd';
import { auto } from 'manate/react';
import { Store } from './store';
const { Text, Title } = Typography;
const App = auto((props: { store: Store }) => {
const { store } = props;
return (
<>
Untitled App
{store.count}
>
);
});
export default App;
`,
);
ensure(
'src/index.html',
`
Untitled App
`,
);
ensure(
'src/index.css',
`
@import '../node_modules/antd/dist/reset.css';
body {
padding: 1rem;
}
`,
);
ensure(
'src/store.ts',
`import { manage } from 'manate';
export class Store {
public count = 0;
}
const store = manage(new Store());
export default store;
`,
);
};
export default step;