Allow Prettier default for trailing commas, run Prettier on repo

per convo with @claviska
This commit is contained in:
Lea Verou
2024-12-14 17:08:29 -05:00
parent b5d1a71f46
commit b0c4c7263b
151 changed files with 503 additions and 519 deletions

View File

@@ -23,7 +23,7 @@ const packageData = JSON.parse(await readFile(join(rootDir, 'package.json'), 'ut
const version = JSON.stringify(packageData.version.toString());
let buildContexts = {
bundledContext: {},
unbundledContext: {}
unbundledContext: {},
};
/**
@@ -112,15 +112,15 @@ async function generateStyles() {
'themes/default.css',
'forms.css',
'utilities',
'utilities.css'
'utilities.css',
];
await Promise.all(
alphaStyles.map(file =>
copy(join(rootDir, `src/styles/${file}`), join(cdnDir, `styles/${file}.css`), {
overwrite: true
})
)
overwrite: true,
}),
),
);
} else {
await copy(join(rootDir, 'src/styles'), join(cdnDir, 'styles'), { overwrite: true });
@@ -172,20 +172,20 @@ async function generateBundle() {
// Translations
...(await globby('./src/translations/**/*.ts')),
// React wrappers
...(await globby('./src/react/**/*.ts'))
...(await globby('./src/react/**/*.ts')),
],
outdir: cdnDir,
chunkNames: 'chunks/[name].[hash]',
define: {
'process.env.NODE_ENV': '"production"' // required by Floating UI
'process.env.NODE_ENV': '"production"', // required by Floating UI
},
bundle: true,
splitting: true,
minify: false,
plugins: [replace({ __WEBAWESOME_VERSION__: version }), litCssPlugin()],
loader: {
'.css': 'text'
}
'.css': 'text',
},
};
const unbundledConfig = {
@@ -194,7 +194,7 @@ async function generateBundle() {
treeShaking: true,
// Don't inline libraries like Lit etc.
packages: 'external',
outdir: distDir
outdir: distDir,
};
try {
@@ -297,8 +297,8 @@ if (isDeveloping) {
server: {
baseDir: siteDir,
routes: {
'/dist/': './dist-cdn/'
}
'/dist/': './dist-cdn/',
},
},
callbacks: {
ready: (_err, instance) => {
@@ -319,13 +319,13 @@ if (isDeveloping) {
res.end();
});
}
}
},
},
},
() => {
spinner.succeed();
console.log(`\nThe dev server is running at ${chalk.cyan(url)}\n`);
}
},
);
// Rebuild and reload when source files change

View File

@@ -5,7 +5,7 @@ import { docsDir, siteDir } from './utils.js';
const elev = new Eleventy(docsDir, siteDir, {
quietMode: true,
configPath: join(docsDir, '.eleventy.js')
configPath: join(docsDir, '.eleventy.js'),
});
// Cleanup

View File

@@ -65,8 +65,8 @@ for await (const component of components) {
export default reactWrapper
`,
Object.assign(prettierConfig, {
parser: 'babel-ts'
})
parser: 'babel-ts',
}),
);
index.push(`export { default as ${component.name} } from './${tagWithoutPrefix}/index.js';`);

View File

@@ -26,30 +26,30 @@ export default function (plop) {
}
return true;
}
}
},
},
],
actions: [
{
type: 'add',
path: '../../src/components/{{ tagWithoutPrefix tag }}/{{ tagWithoutPrefix tag }}.ts',
templateFile: 'templates/component/component.hbs'
templateFile: 'templates/component/component.hbs',
},
{
type: 'add',
path: '../../src/components/{{ tagWithoutPrefix tag }}/{{ tagWithoutPrefix tag }}.styles.ts',
templateFile: 'templates/component/styles.hbs'
templateFile: 'templates/component/styles.hbs',
},
{
type: 'add',
path: '../../src/components/{{ tagWithoutPrefix tag }}/{{ tagWithoutPrefix tag }}.test.ts',
templateFile: 'templates/component/tests.hbs'
templateFile: 'templates/component/tests.hbs',
},
{
type: 'add',
path: '../../docs/docs/components/{{ tagWithoutPrefix tag }}.md',
templateFile: 'templates/component/docs.hbs'
}
]
templateFile: 'templates/component/docs.hbs',
},
],
});
}