update prettier

This commit is contained in:
Cory LaViska
2023-10-12 13:56:11 -04:00
parent 85f91b7785
commit c7b53cff47
34 changed files with 394 additions and 310 deletions

View File

@@ -4,7 +4,7 @@ import path from 'path';
import chalk from 'chalk';
import { deleteSync } from 'del';
import prettier from 'prettier';
import prettierConfig from '../prettier.config.cjs';
import { default as prettierConfig } from '../prettier.config.js';
import { getAllComponents } from './shared.js';
const { outdir } = commandLineArgs({ name: 'outdir', type: String });
@@ -20,7 +20,7 @@ const metadata = JSON.parse(fs.readFileSync(path.join(outdir, 'custom-elements.j
const components = getAllComponents(metadata);
const index = [];
components.map(component => {
components.forEach(async component => {
const tagWithoutPrefix = component.tagName.replace(/^sl-/, '');
const componentDir = path.join(reactDir, tagWithoutPrefix);
const componentFile = path.join(componentDir, 'index.ts');
@@ -41,7 +41,7 @@ components.map(component => {
const jsDoc = component.jsDoc || '';
const source = prettier.format(
const source = await prettier.format(
`
import * as React from 'react';
import { createComponent } from '@lit-labs/react';

View File

@@ -24,7 +24,7 @@ filesToEmbed.forEach(file => {
});
// Loop through each theme file, copying the .css and generating a .js version for Lit users
files.forEach(file => {
files.forEach(async file => {
let source = fs.readFileSync(file, 'utf8');
// If the source has "/* _filename.css */" in it, replace it with the embedded styles
@@ -32,11 +32,11 @@ files.forEach(file => {
source = source.replace(`/* ${key} */`, embeds[key]);
});
const css = prettier.format(stripComments(source), {
const css = await prettier.format(stripComments(source), {
parser: 'css'
});
let js = prettier.format(
let js = await prettier.format(
`
import { css } from 'lit';