Skip to content

YDJ-FE/ts-react-vite_or_webpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e150d4d · Jun 15, 2022
Jul 31, 2021
Aug 25, 2021
Jun 15, 2022
Jun 15, 2022
Jan 21, 2022
Jan 21, 2022
Jan 21, 2022
Oct 7, 2019
Jul 31, 2021
Feb 11, 2022
Aug 8, 2019
Nov 14, 2020
Sep 30, 2019
Jun 28, 2020
Oct 7, 2019
Jan 21, 2022
May 22, 2020
Jan 21, 2022
Aug 8, 2019
Sep 6, 2021
Feb 11, 2022
Jun 15, 2022
Aug 8, 2019
May 7, 2019
Jul 17, 2019
Mar 14, 2022
Jun 15, 2022

Repository files navigation

There is an example use-webpack

This is a simple (admin) starter with typescript, react and vite.

Have a quick view:

setup

for husky

$ npm run prepare

If you do not need the taobao registry, you can change it in .npmrc

$ npm i

test

$ npm test

build for development

$ npm run dev

build for production

$ npm run build:(qa/prod)

characteristics

pages

TODO

  • config menu by user with permission
  • more functional pages like Socket Debugger

component example

import React from 'react'
import { observer } from 'mobx-react'
import { Button } from 'antd'

import history from '@shared/App/ht'

function Test() {
    function gotoHome() {
        history.push('/')
    }
    return (
        <Button type="primary" onClick={gotoHome}>
            go to page index directly
        </Button>
    )
}

export default observer(Test)

live example

necessary extensions (on vscode)

how to upload file to server

#!/bin/bash

TIMESPAN=$(date '+%s')
DEPLOYNAME=ts-react.qa.${TIMESPAN}
DEPLOYFILES=${DEPLOYNAME}.tar.gz
SERVER=0.0.0.0

# make compression
cd dist/qa
tar -zcvf ${DEPLOYFILES} ./*

# upload
scp -P 22 -o StrictHostKeyChecking=no ${DEPLOYFILES} node@${SERVER}:/home/pages/ts-react/tarfiles

# make decompression
ssh -p 22 -o StrictHostKeyChecking=no node@${SERVER} tar xzf /home/pages/ts-react/tarfiles/${DEPLOYFILES} -C /home/pages/ts-react

if [ $? -ne 0 ]; then
    echo "success"
else
    echo "fail"
fi

how to deploy with nginx

server {
       listen       9993;
       server_name  localhost:9993;

       location / {
             root   ~/Documents/react/ts-react/dist/qa/;
             index  index.html;
       }
 }

the scaffold

steamer-react-redux-ts