]> source.dussan.org Git - sonarqube.git/commitdiff
Allow to force the design-system build, skip the "lint" & "ts-check" steps by default
authorDavid Cho-Lerat <david.cho-lerat@sonarsource.com>
Fri, 31 Mar 2023 09:57:28 +0000 (11:57 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 3 Apr 2023 20:02:58 +0000 (20:02 +0000)
server/sonar-web/design-system/package.json
server/sonar-web/package.json
server/sonar-web/scripts/build-design-system.js
server/sonar-web/scripts/start.js
server/sonar-web/turbo.json

index d49f84e5e95782634be8795e9536eed24cd6ba55..71faafcb78548d2450196582d4e94a1bb4f8ae6e 100644 (file)
@@ -5,6 +5,7 @@
   "types": "lib/index.d.ts",
   "scripts": {
     "build": "yarn lint && yarn ts-check && vite build",
+    "build:no-checks": "vite build",
     "build-release": "yarn install --immutable && yarn build",
     "lint": "eslint --ext js,ts,tsx,snap src",
     "lint-report-ci": "yarn install --immutable && eslint --ext js,ts,tsx -f json -o eslint-report/eslint-report.json src  || yarn lint",
index 5123f2c7d5b4369c8ed913b2b419ce2a878ef47d..53c38d3ff1d27b465bf1428f1de1cc4f31fa9a8e 100644 (file)
   },
   "scripts": {
     "start": "node scripts/start.js",
+    "start:force": "node scripts/start.js --force-build-design-system",
     "build": "node scripts/build.js",
     "build-release": "yarn install --immutable && node scripts/build.js release",
     "test": "jest",
index 7c4241f1a293872e349659eafe8b13f7c7af99bc..9a11d2cc6149c79de4b212f5532e5b490ac54576 100644 (file)
@@ -23,10 +23,15 @@ process.env.NODE_ENV = 'development';
 const chalk = require('chalk');
 const { spawn } = require('child_process');
 
-function buildDesignSystem(callback) {
+function buildDesignSystem({ callback, force } = {}) {
   process.chdir(`${__dirname}/..`);
 
-  const build = spawn('npx', ['turbo', 'run', 'design-system#build']);
+  const build = spawn('npx', [
+    'turbo',
+    'run',
+    ...(force ? ['--force'] : []),
+    'design-system#build:no-checks',
+  ]);
 
   build.stdout.on('data', (data) => {
     console.log(chalk.green.bold(data.toString()));
index f9847436e11db9733af326adf75056fa11457c24..787df03275d790884a89c94c42bd1b14ca32e333 100644 (file)
@@ -65,6 +65,8 @@ function handleStaticFileRequest(req, res) {
   });
 }
 
+const forceBuildDesignSystem = process.argv.includes('--force-build-design-system');
+
 async function run() {
   console.log('starting...');
   const esbuildContext = await esbuild.context(config);
@@ -122,11 +124,11 @@ async function run() {
     .catch((e) => console.error(e));
 }
 
-buildDesignSystem(run);
+buildDesignSystem({ callback: run, force: forceBuildDesignSystem });
 
 chokidar
   .watch('./design-system/src', {
     ignored: /(^|[/\\])\../, // ignore dotfiles
     persistent: true,
   })
-  .on('change', () => buildDesignSystem());
+  .on('change', () => buildDesignSystem({ force: true }));
index 978bc4cbb5f2901892977a2b177869cc32efcf9c..0ab616881ee367bb3614ddab169d6b35cd2034f2 100644 (file)
@@ -3,6 +3,9 @@
   "pipeline": {
     "design-system#build": {
       "outputs": ["lib/**"]
+    },
+    "design-system#build:no-checks": {
+      "outputs": ["lib/**"]
     }
   }
 }