Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot
2024-04-10 18:11:27 +00:00
parent 22bdc9073d
commit 0faafc6bee
79 changed files with 2037 additions and 693 deletions

View File

@ -1,8 +1,12 @@
/* eslint-disable import/extensions */
import { exec as execCB } from 'node:child_process';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import util from 'node:util';
import { createProcessor } from 'tailwindcss/lib/cli/build/plugin.js';
const exec = util.promisify(execCB);
// Note, in node > 21.2 we could replace the below with import.meta.dirname
const ROOT_PATH = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../');
@ -45,11 +49,27 @@ function wasScriptCalledDirectly() {
return process.argv[1] === fileURLToPath(import.meta.url);
}
async function ensureCSSinJS() {
const cmd = 'yarn run pretailwindcss:build';
console.log('Ensuring config/helpers/tailwind/css_in_js.js exists');
const { stdout, error } = await exec(cmd, {
env: { ...process.env, REDIRECT_TO_STDOUT: 'true' },
});
if (error) {
throw error;
}
console.log(`'${cmd}' printed:`);
console.log(`${stdout}`);
}
export function viteTailwindCompilerPlugin({ shouldWatch = true }) {
return {
name: 'gitlab-tailwind-compiler',
async configureServer() {
build({ shouldWatch });
await ensureCSSinJS();
return build({ shouldWatch });
},
};
}
@ -57,7 +77,8 @@ export function viteTailwindCompilerPlugin({ shouldWatch = true }) {
export function webpackTailwindCompilerPlugin({ shouldWatch = true }) {
return {
async start() {
build({ shouldWatch });
await ensureCSSinJS();
return build({ shouldWatch });
},
};
}