[ci] format
This commit is contained in:
parent
72ef7ae64a
commit
145e418edd
4 changed files with 24 additions and 31 deletions
|
@ -4,4 +4,4 @@ module.exports = {
|
||||||
extend: {},
|
extend: {},
|
||||||
},
|
},
|
||||||
plugins: [],
|
plugins: [],
|
||||||
}
|
};
|
||||||
|
|
|
@ -138,9 +138,9 @@ export default async function add(names: string[], { cwd, flags, logging }: AddO
|
||||||
case UpdateResult.none: {
|
case UpdateResult.none: {
|
||||||
const pkgURL = new URL('./package.json', configURL);
|
const pkgURL = new URL('./package.json', configURL);
|
||||||
if (existsSync(fileURLToPath(pkgURL))) {
|
if (existsSync(fileURLToPath(pkgURL))) {
|
||||||
const { dependencies = {}, devDependencies = {} } = await fs.readFile(fileURLToPath(pkgURL)).then(res => JSON.parse(res.toString()));
|
const { dependencies = {}, devDependencies = {} } = await fs.readFile(fileURLToPath(pkgURL)).then((res) => JSON.parse(res.toString()));
|
||||||
const deps = Object.keys(Object.assign(dependencies, devDependencies));
|
const deps = Object.keys(Object.assign(dependencies, devDependencies));
|
||||||
const missingDeps = integrations.filter(integration => !deps.includes(integration.packageName));
|
const missingDeps = integrations.filter((integration) => !deps.includes(integration.packageName));
|
||||||
if (missingDeps.length === 0) {
|
if (missingDeps.length === 0) {
|
||||||
info(logging, null, msg.success(`Configuration up-to-date.`));
|
info(logging, null, msg.success(`Configuration up-to-date.`));
|
||||||
return;
|
return;
|
||||||
|
@ -158,7 +158,7 @@ export default async function add(names: string[], { cwd, flags, logging }: AddO
|
||||||
case UpdateResult.updated: {
|
case UpdateResult.updated: {
|
||||||
const len = integrations.length;
|
const len = integrations.length;
|
||||||
if (integrations.find((integration) => integration.id === 'tailwind')) {
|
if (integrations.find((integration) => integration.id === 'tailwind')) {
|
||||||
const possibleConfigFiles = ['./tailwind.config.cjs', './tailwind.config.mjs', './tailwind.config.js'].map(p => fileURLToPath(new URL(p, configURL)));
|
const possibleConfigFiles = ['./tailwind.config.cjs', './tailwind.config.mjs', './tailwind.config.js'].map((p) => fileURLToPath(new URL(p, configURL)));
|
||||||
let alreadyConfigured = false;
|
let alreadyConfigured = false;
|
||||||
for (const possibleConfigPath of possibleConfigFiles) {
|
for (const possibleConfigPath of possibleConfigFiles) {
|
||||||
if (existsSync(possibleConfigPath)) {
|
if (existsSync(possibleConfigPath)) {
|
||||||
|
@ -176,7 +176,7 @@ export default async function add(names: string[], { cwd, flags, logging }: AddO
|
||||||
debug('add', `Using existing Tailwind configuration`);
|
debug('add', `Using existing Tailwind configuration`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const list = integrations.map(integration => ` - ${integration.packageName}`).join('\n')
|
const list = integrations.map((integration) => ` - ${integration.packageName}`).join('\n');
|
||||||
info(logging, null, msg.success(`Added the following integration${len === 1 ? '' : 's'} to your project:\n${list}`));
|
info(logging, null, msg.success(`Added the following integration${len === 1 ? '' : 's'} to your project:\n${list}`));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ function createPrettyError(err: Error) {
|
||||||
Reason: ${err.message}
|
Reason: ${err.message}
|
||||||
|
|
||||||
You will need to add these integration(s) manually.
|
You will need to add these integration(s) manually.
|
||||||
Documentation: https://next--astro-docs-2.netlify.app/en/guides/integrations-guide/`
|
Documentation: https://next--astro-docs-2.netlify.app/en/guides/integrations-guide/`;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,10 +281,7 @@ async function updateAstroConfig({ configURL, ast, flags, logging }: { configURL
|
||||||
|
|
||||||
let changes = [];
|
let changes = [];
|
||||||
for (const change of diffWords(input, output)) {
|
for (const change of diffWords(input, output)) {
|
||||||
let lines = change.value
|
let lines = change.value.trim().split('\n').slice(0, change.count);
|
||||||
.trim()
|
|
||||||
.split('\n')
|
|
||||||
.slice(0, change.count)
|
|
||||||
if (lines.length === 0) continue;
|
if (lines.length === 0) continue;
|
||||||
if (change.added) {
|
if (change.added) {
|
||||||
if (!change.value.trim()) continue;
|
if (!change.value.trim()) continue;
|
||||||
|
@ -366,11 +363,7 @@ async function tryToInstallIntegrations({
|
||||||
} else {
|
} else {
|
||||||
const coloredOutput = `${bold(installCommand.pm)} ${installCommand.command} ${installCommand.flags.join(' ')} ${cyan(installCommand.dependencies.join(' '))}`;
|
const coloredOutput = `${bold(installCommand.pm)} ${installCommand.command} ${installCommand.flags.join(' ')} ${cyan(installCommand.dependencies.join(' '))}`;
|
||||||
const message = `\n${boxen(coloredOutput, { margin: 0.5, padding: 0.5, borderStyle: 'round' })}\n`;
|
const message = `\n${boxen(coloredOutput, { margin: 0.5, padding: 0.5, borderStyle: 'round' })}\n`;
|
||||||
info(
|
info(logging, null, `\n ${magenta('Astro will run the following command:')}\n ${dim('If you skip this step, you can always run it yourself later')}\n${message}`);
|
||||||
logging,
|
|
||||||
null,
|
|
||||||
`\n ${magenta('Astro will run the following command:')}\n ${dim('If you skip this step, you can always run it yourself later')}\n${message}`
|
|
||||||
);
|
|
||||||
|
|
||||||
if (await askToContinue({ flags })) {
|
if (await askToContinue({ flags })) {
|
||||||
const spinner = ora('Installing dependencies...').start();
|
const spinner = ora('Installing dependencies...').start();
|
||||||
|
|
Loading…
Reference in a new issue