Used to automate some of the front-end publishing operations.
Script:
# Webreleasepath is used to publish the directory, Webrevisionpath is the development of the directory Webreleasepath='/users/lufeng/documents/project/pc-link/web-release'Webrevisionpath='/users/lufeng/documents/project/pc-link/web-revision/project'# Build Vue ProjectEcho '1. Compile Vue project ...'CD $webRevisionPathnpm Run build# empty the release directory except. GitEcho '2. Clear the Release directory'CD $webReleasePathfiles=`ls-A ' forFileNameinch$files; Do if[[$fileName = ='. Git']]; Then Echo '......' Else RM-RF $fileNamefi Done# Copy published content pastEcho '3. Publish to the release directory'CD $webRevisionPath'/dist'Files=`ls-A ' forFileNameinch$files; Do CP-R $fileName $webReleasePath DoneEcho '4. Commit git'CD $webReleasePathgit Add-Agit Commit-M'Robot Submission'git push Origin head:developEcho 'done! '
Attention:
1. After saving the file, add execute (x) permission to the script, chmod +x youname.sh
MAC Shell Notes