mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-08-13 13:31:19 +00:00
Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
@ -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 });
|
||||
},
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user