Skip to content

FTChinese/superyard-react

Repository files navigation

Superyad Client

This is the client app of superyard

Development

This project is generated by Vite

To run this app locally, you must:

  1. Setup MySQL with appropriate db schema;
  2. Install Go;
  3. Compile and run subscription-api;
  4. Compile and run superyard
  5. Run this app npm run dev.

Or you can use mockjs to build a mocking backend service.

Pay attention:

  • Never touch the index.html file unde project root. This file is generated. Instead you should edit files under scripts/template file and then run npm run html-dev to update this file.
  • To upgrade bootstrap used in the index.html, update it in the package.json and then run npm run html-dev.

Deployment workflow

Run npm run publish command, which will generate build bundle.

By default, vite build will generate a production bundle for js and css. It will also copy index.html file into dist. However, the URLs for js and css will probably not what you want in a production envirionment. scripts/lib/deploy.ts file provides a prependAssetsUrl function to modify these URLs with JSDOM.

The npm run publish performs these steps:

  1. Run npm version <major|minor|patch> to increase version.
  2. Run vite build to generate production bundler.
  3. Run npm run deploy to
    1. Add a prefix to each JS and CSS URLs in dist/index.html file and save it as dist/next.html.
    2. geenerate a version file based on package.json field, then save it as dist/client_version_reader
    3. Copy dist/assets/*js,css files to SVN
    4. Copy dist/client_version_next to the root of superyard
    5. Copy dist/next.html to supyerad/web/template directory.
  4. In backend project superyard, commint the updated files and then add a new version tag.

Then you should commit SVN and rebuild Go binary in Jenkins.

Folder layouts on my machine are as follows:

$HOME
  |-- svn-online
    |-- ft-interact (SVN repository)
  |-- GolandProjects
    |-- superyard (the backend project)
    |-- superyard-react (thie project)

To copy production files into different folder structure, modiy scripts/deploy.prod.ts to suit your needs.

Scripts Commands

  • dev for local development
  • build generated production html, js and css into dist directory
  • html-dev update index.html file
  • deploy modified dist/index.html by chaning js and css urls to production ones, and then copy js, css, and html to respective folders.
  • publish Run build and deploy commands sequentially.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages