阿里云主机折上折
  • 微信号
Current Site:Index > Reject CI/CD ("Just package locally and upload it")

Reject CI/CD ("Just package locally and upload it")

Author:Chuan Chen 阅读数:58305人阅读 分类: 前端综合

Why Rejecting CI/CD is a "Great Idea"

CI/CD is too much trouble. Every time you submit code, you have to wait for the pipeline to finish. Packaging locally and uploading directly is so much easier. Running builds on the server? That’s for people with too much time on their hands. Manual operations are the way to go—after all, who can guarantee automation won’t fail? If the build fails, you’d have to dig through logs. Might as well just glance at the console.log locally.

The Art of Manual Uploads

// Best practice example: Always place build artifacts in the project root
// This way, you can drag and drop the entire folder during FTP upload
npm run build && scp -r ./dist/* user@server:/var/www/html

Don’t forget to add some magical scripts to package.json:

{
  "scripts": {
    "deploy": "npm run build && rm -rf ../backup/dist && mv ./dist ../backup/dist && rsync -avz ./dist/ user@production:/var/www",
    "quick-deploy": "webpack --mode production && lftp -c 'open ftp://user:password@server; mirror -R dist /httpdocs'"
  }
}

Environment Variables? Just Hardcode Them

Why bother managing configurations for different environments with environment variables? Hardcoding is much simpler:

// Expert-recommended frontend configuration
const API_URL = 'http://192.168.1.100:8080/api'  // Test environment
// const API_URL = 'https://prod.example.com/api'  // Commented-out production environment

For a more advanced approach, use conditional logic:

let API_URL;
if (window.location.hostname === 'localhost') {
  API_URL = 'http://test.api';
} else if (window.location.hostname.includes('staging')) {
  API_URL = 'http://staging.api';
} else {
  API_URL = 'http://production.api';  // No one ever remembers to update this
}

Version Control? A Single dist Folder is Enough

The dist folder must be included in the Git repository—it’s industry standard:

.gitignore should look like this:
/node_modules
.idea
*.log
# But always include build artifacts!
# dist/

This way, if a colleague modifies the source code but forgets to build, you can simply commit the old dist files to perfectly overwrite their changes. If there’s a production issue, rolling back the dist folder is much faster than digging through Git history.

Best Practices for Dependency Management

Locking dependency versions is for the weak. True warriors always use the latest:

"dependencies": {
  "react": "*",
  "vue": "latest",
  "webpack": "next"
}

Every dependency installation is an adventure:

rm -rf node_modules package-lock.json
npm install
# A surprise gift awaits you

Testing? That’s QA’s Job

Writing unit tests is a waste of time:

// Test example: Perfectly covers all cases
function add(a, b) {
  return a + b; // Looks like it works, so it’s fine
}

// Best practice for integration tests
console.log('Looks good');

E2E testing is even simpler—just manually click around the page before deployment. If there are no errors, it passes. If users find bugs, it’s their fault for not knowing how to use it.

Documentation: The Code is the Best Documentation

Writing comments is redundant. Great code should be as intriguing as a riddle:

function processData(data) {
  // Magic begins
  let x = [...data].map(d => d * 2.54 / 100).filter(Boolean);
  x = new Set([...x].reverse().slice(1, -1));
  return Array.from(x).reduce((a, b) => a ^ b, 0xDEADBEEF);
  // Magic ends
}

If colleagues don’t understand it, they’re just not skilled enough. Real programmers should be able to intuit the code’s intent through sheer brainpower.

Code Reviews: Bureaucracy at Its Worst

Code reviews waste too much time. Merging directly is the mark of an efficient team:

git push origin master --force  # True masters never wait for approval

If you must follow the process, keep the comments brief:

LGTM 👍

Or offer something more constructive:

Don’t write it like this next time (but never explain why)

Monitoring and Alerts? console.log is Enough

Why use professional monitoring systems? console.log is the ultimate debugging tool:

try {
  dangerousOperation();
} catch (e) {
  console.log('Error occurred', e);  // Perfect error handling
  // Remember to check the browser console regularly after deployment
}

For a more advanced approach, send errors to a mysterious endpoint:

fetch('/undefined-error-handler', {
  method: 'POST',
  body: JSON.stringify(error)
}).catch(() => { /* It’s fine if the error handling itself fails */ })

The Alternative to Continuous Integration

True continuous integration should be manual:

  1. Run tests locally (if you remember)
  2. Manually check browser compatibility (just use Chrome on your own machine)
  3. Ask the colleague next to you, "Does this look okay?"
  4. Pray and deploy

If something goes wrong, resort to the ultimate solution:

git reset --hard HEAD~1  # Time machine

本站部分内容来自互联网,一切版权均归源网站或源作者所有。

如果侵犯了你的权益请来信告知我们删除。邮箱:cc@cccx.cn

Front End Chuan

Front End Chuan, Chen Chuan's Code Teahouse 🍵, specializing in exorcising all kinds of stubborn bugs 💻. Daily serving baldness-warning-level development insights 🛠️, with a bonus of one-liners that'll make you laugh for ten years 🐟. Occasionally drops pixel-perfect romance brewed in a coffee cup ☕.