Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tailwindcss installation logging #203

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions src/themes/tailwindcss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const tailwindcss = {

const logger = new Logger("tailwindcss")

// install tailwindcss via npm if not available
// install tailwindcss via GitHub Releases if not available
const executableTarget = getBaseDirectory().getChildPath("tailwindcss");
let tailwindCssCmd = "tailwindcss"
let cmdAvailable = commandExists(tailwindCssCmd);
Expand All @@ -42,16 +42,13 @@ export const tailwindcss = {
handleError(
new KnownError(
`TailwindCSS executable could not be installed for your platform (${os}).`,
[
"Please open an issue on github.com/unyt-org/uix providing your platform details",
"Make sure that TailwindCSS is installed on your computer (https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)",
"Ensure that the 'tailwindcss' executable is in your PATH environment variable"
]
["Please open an issue on https://www.github.com/unyt-org/uix providing your platform details"]
),
logger
);

try {
logger.info("Downloading TailwindCSS. HTTP requests / page loads will be deferred until the installation is complete.");
const downloadMap = await datex.get<{assets: {browser_download_url: string, name: string}[]}>("https://api.github.com/repos/tailwindlabs/tailwindcss/releases/latest");
const releaseURL = downloadMap.assets.find(e => e.name === executableName)?.browser_download_url;
if (!releaseURL)
Expand All @@ -71,13 +68,12 @@ export const tailwindcss = {
);
logger.success(`TailwindCSS was installed to ${executableTarget}`);
} catch (e) {
logger.error(e);
handleError(
new KnownError(
"TailwindCSS executable could not be downloaded",
`The TailwindCSS executable could not be downloaded\n(${e})`,
[
"Make sure that TailwindCSS is installed on your computer (https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)",
"Ensure that the 'tailwindcss' executable is in your PATH environment variable"
"Check your internet connectivity",
"Ensure that you have enough disk space and that the directory is writable"
]
),
logger
Expand Down