[ci] npm run format

This commit is contained in:
drwpow 2021-03-26 19:46:26 +00:00 committed by GitHub Actions
parent 7def0463b1
commit b92b9f66e5
5 changed files with 13 additions and 19 deletions

View file

@ -1,10 +1,7 @@
import type { AstroConfig } from './@types/astro';
import { defaultLogOptions, LogOptions } from './logger';
import {
loadConfiguration,
startServer as startSnowpackServer,
build as snowpackBuild } from 'snowpack';
import { loadConfiguration, startServer as startSnowpackServer, build as snowpackBuild } from 'snowpack';
import { promises as fsPromises } from 'fs';
import { relative as pathRelative } from 'path';
import { defaultLogDestination, error } from './logger.js';
@ -25,7 +22,7 @@ async function* allPages(root: URL): AsyncGenerator<URL, void, unknown> {
if (info.isDirectory()) {
yield* allPages(new URL(fullpath + '/'));
} else {
if(/\.(astro|md)$/.test(fullpath.pathname)) {
if (/\.(astro|md)$/.test(fullpath.pathname)) {
yield fullpath;
}
}
@ -39,7 +36,7 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
const runtimeLogging: LogOptions = {
level: 'error',
dest: defaultLogDestination
dest: defaultLogDestination,
};
const runtime = await createRuntime(astroConfig, { logging: runtimeLogging, env: 'build' });
@ -48,10 +45,9 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
try {
const result = await snowpackBuild({
config: snowpackConfig,
lockfile: null
lockfile: null,
});
} catch(err) {
} catch (err) {
error(logging, 'build', err);
return 1;
}
@ -65,7 +61,7 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
const outFolder = new URL('./', outPath);
const result = await runtime.load(pagePath);
if(result.statusCode !== 200) {
if (result.statusCode !== 200) {
error(logging, 'generate', result.error || result.statusCode);
//return 1;
} else {

View file

@ -73,11 +73,9 @@ export async function optimize(ast: Ast, opts: OptimizeOptions) {
const cssVisitors = createVisitorCollection();
const finalizers: Array<() => Promise<void>> = [];
const optimizers = [
optimizeStyles(opts)
];
const optimizers = [optimizeStyles(opts)];
for(const optimizer of optimizers) {
for (const optimizer of optimizers) {
collectVisitors(optimizer, htmlVisitors, cssVisitors, finalizers);
}

View file

@ -351,7 +351,7 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
parser.allow_whitespace();
if (parser.eat('...')) {
const {expression} = read_expression(parser);
const { expression } = read_expression(parser);
parser.allow_whitespace();
parser.eat('}', true);