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

Replace chalk with picocolors #2736

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions drizzle-kit/imports-checker/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk';
import pico from 'picocolors';
import { analyzeImports, ChainLink } from './checker';

const issues = analyzeImports({
Expand Down Expand Up @@ -35,14 +35,14 @@ const chainToString = (chains: ChainLink[]) => {
out += ' '.repeat(indentation)
+ '└'
+ chain.import
+ ` ${chalk.gray(chain.file)}\n`;
+ ` ${pico.gray(chain.file)}\n`;
indentation += 1;
}
return out;
};

console.log();
for (const issue of issues) {
console.log(chalk.red(issue.imports.map((it) => it.name).join('\n')));
console.log(pico.red(issue.imports.map((it) => it.name).join('\n')));
console.log(issue.accessChains.map((it) => chainToString(it)).join('\n'));
}
2 changes: 1 addition & 1 deletion drizzle-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
"better-sqlite3": "^9.4.3",
"bun-types": "^0.6.6",
"camelcase": "^7.0.1",
"chalk": "^5.2.0",
"commander": "^12.1.0",
"dockerode": "^3.3.4",
"dotenv": "^16.0.3",
Expand All @@ -100,6 +99,7 @@
"node-fetch": "^3.3.2",
"ohm-js": "^17.1.0",
"pg": "^8.11.5",
"picocolors": "^1.1.1",
"pluralize": "^8.0.0",
"postgres": "^3.4.4",
"prettier": "^2.8.1",
Expand Down
8 changes: 4 additions & 4 deletions drizzle-kit/src/cli/commands/drop.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk';
import pico from 'picocolors';
import { readFileSync, rmSync, writeFileSync } from 'fs';
import fs from 'fs';
import { render } from 'hanji';
Expand All @@ -19,7 +19,7 @@ export const dropMigration = async ({

if (journal.entries.length === 0) {
console.log(
`[${chalk.blue('i')}] no migration entries found in ${metaFilePath}`,
`[${pico.blue('i')}] no migration entries found in ${metaFilePath}`,
);
return;
}
Expand Down Expand Up @@ -51,8 +51,8 @@ export const dropMigration = async ({
}

console.log(
`[${chalk.green('✓')}] ${
chalk.bold(
`[${pico.green('✓')}] ${
pico.bold(
result.data.tag,
)
} migration successfully dropped`,
Expand Down
58 changes: 29 additions & 29 deletions drizzle-kit/src/cli/commands/introspect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk';
import pico from 'picocolors';
import { writeFileSync } from 'fs';
import { render, renderWithTask } from 'hanji';
import { Minimatch } from 'minimatch';
Expand Down Expand Up @@ -146,7 +146,7 @@ export const introspectPostgres = async (
} else {
render(
`[${
chalk.blue(
pico.blue(
'i',
)
}] No SQL generated, you already have migrations in project`,
Expand All @@ -155,20 +155,20 @@ export const introspectPostgres = async (

render(
`[${
chalk.green(
pico.green(
'✓',
)
}] Your schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
}] Your schema file is ready ➜ ${pico.blue(pico.bold(pico.underline(schemaFile)))} 🚀`,
);
render(
`[${
chalk.green(
pico.green(
'✓',
)
}] Your relations file is ready ➜ ${
chalk.bold.underline.blue(
pico.blue(pico.bold(pico.underline(
relationsFile,
)
)))
} 🚀`,
);
process.exit(0);
Expand Down Expand Up @@ -257,7 +257,7 @@ export const introspectMysql = async (
} else {
render(
`[${
chalk.blue(
pico.blue(
'i',
)
}] No SQL generated, you already have migrations in project`,
Expand All @@ -266,20 +266,20 @@ export const introspectMysql = async (

render(
`[${
chalk.green(
pico.green(
'✓',
)
}] Your schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
}] You schema file is ready ➜ ${pico.bold(pico.underline(schemaFile))} 🚀`,
);
render(
`[${
chalk.green(
pico.green(
'✓',
)
}] Your relations file is ready ➜ ${
chalk.bold.underline.blue(
}] You relations file is ready ➜ ${
pico.blue(pico.bold(pico.underline(
relationsFile,
)
)))
} 🚀`,
);
process.exit(0);
Expand Down Expand Up @@ -365,7 +365,7 @@ export const introspectSingleStore = async (
} else {
render(
`[${
chalk.blue(
pico.blue(
'i',
)
}] No SQL generated, you already have migrations in project`,
Expand All @@ -374,10 +374,10 @@ export const introspectSingleStore = async (

render(
`[${
chalk.green(
pico.green(
'✓',
)
}] You schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
}] You schema file is ready ➜ ${pico.blue(pico.bold(pico.underline(schemaFile)))} 🚀`,
);
process.exit(0);
};
Expand Down Expand Up @@ -466,7 +466,7 @@ export const introspectSqlite = async (
} else {
render(
`[${
chalk.blue(
pico.blue(
'i',
)
}] No SQL generated, you already have migrations in project`,
Expand All @@ -475,20 +475,20 @@ export const introspectSqlite = async (

render(
`[${
chalk.green(
pico.green(
'✓',
)
}] You schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
}] You schema file is ready ➜ ${pico.blue(pico.bold(pico.underline(schemaFile)))} 🚀`,
);
render(
`[${
chalk.green(
pico.green(
'✓',
)
}] You relations file is ready ➜ ${
chalk.bold.underline.blue(
pico.blue(pico.bold(pico.underline(
relationsFile,
)
)))
} 🚀`,
);
process.exit(0);
Expand Down Expand Up @@ -578,7 +578,7 @@ export const introspectLibSQL = async (
} else {
render(
`[${
chalk.blue(
pico.blue(
'i',
)
}] No SQL generated, you already have migrations in project`,
Expand All @@ -587,20 +587,20 @@ export const introspectLibSQL = async (

render(
`[${
chalk.green(
pico.green(
'✓',
)
}] Your schema file is ready ➜ ${chalk.bold.underline.blue(schemaFile)} 🚀`,
}] Your schema file is ready ➜ ${pico.blue(pico.bold(pico.underline(schemaFile)))} 🚀`,
);
render(
`[${
chalk.green(
pico.green(
'✓',
)
}] Your relations file is ready ➜ ${
chalk.bold.underline.blue(
pico.blue(pico.bold(pico.underline(
relationsFile,
)
)))
} 🚀`,
);
process.exit(0);
Expand Down
16 changes: 8 additions & 8 deletions drizzle-kit/src/cli/commands/libSqlPushUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk';
import pico from 'picocolors';

import { JsonStatement } from 'src/jsonStatements';
import { findAddedAndRemoved, SQLiteDB } from 'src/utils';
Expand Down Expand Up @@ -134,7 +134,7 @@ export const libSqlLogSuggestionsAndReturn = async (
if (count > 0) {
infoToPrint.push(
`· You're about to delete ${
chalk.underline(
pico.underline(
statement.tableName,
)
} table with ${count} items`,
Expand All @@ -156,7 +156,7 @@ export const libSqlLogSuggestionsAndReturn = async (
if (count > 0) {
infoToPrint.push(
`· You're about to delete ${
chalk.underline(
pico.underline(
statement.columnName,
)
} column in ${tableName} table with ${count} items`,
Expand All @@ -182,7 +182,7 @@ export const libSqlLogSuggestionsAndReturn = async (
if (count > 0) {
infoToPrint.push(
`· You're about to add not-null ${
chalk.underline(
pico.underline(
statement.column.name,
)
} column without default value, which contains ${count} items`,
Expand Down Expand Up @@ -212,7 +212,7 @@ export const libSqlLogSuggestionsAndReturn = async (
if (count > 0) {
infoToPrint.push(
`· You're about to add not-null constraint to ${
chalk.underline(
pico.underline(
statement.columnName,
)
} column without default value, which contains ${count} items`,
Expand Down Expand Up @@ -253,7 +253,7 @@ export const libSqlLogSuggestionsAndReturn = async (
if (count > 0) {
infoToPrint.push(
`· You're about to delete ${
chalk.underline(
pico.underline(
removedColumn,
)
} column in ${tableName} table with ${count} items`,
Expand All @@ -278,7 +278,7 @@ export const libSqlLogSuggestionsAndReturn = async (

infoToPrint.push(
`· You're about to add not-null ${
chalk.underline(
pico.underline(
addedColumn,
)
} column without default value to table, which contains ${count} items`,
Expand Down Expand Up @@ -324,7 +324,7 @@ export const libSqlLogSuggestionsAndReturn = async (
if (count > 0) {
infoToPrint.push(
`· You're about to delete ${
chalk.underline(
pico.underline(
statement.columnName,
)
} column in ${tableName} table with ${count} items`,
Expand Down
Loading
Loading