mirror of
https://github.com/lainbo/component-party.git
synced 2026-04-05 13:09:03 +08:00
remove unused scripts
This commit is contained in:
@@ -7,14 +7,6 @@ export default defineConfig({
|
||||
// https://docs.astro.build/en/reference/configuration-reference/
|
||||
integrations: [tailwind(), svelte()],
|
||||
vite: {
|
||||
plugins: [
|
||||
// {
|
||||
// handleHotUpdate({ file }) {
|
||||
// if (file.includes('/content') || file.includes('/scripts/utils')) {
|
||||
// generateIndexPage();
|
||||
// }
|
||||
// },
|
||||
// },
|
||||
],
|
||||
plugins: [],
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import generateIndexPage from './utils/generateIndexPage.js';
|
||||
|
||||
async function main() {
|
||||
generateIndexPage();
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
@@ -1,40 +0,0 @@
|
||||
# Component Party 🎉
|
||||
|
||||
[](https://gitpod.io/#https://github.com/matschik/component-party)
|
||||
|
||||
> Web component JS frameworks quick overview by their syntax and features
|
||||
|
||||
**Website: https://component-party.pages.dev**
|
||||
|
||||
## Why ?
|
||||
|
||||
Many JS developers don't have a good overview of every existing JS framework with their own syntax and features.
|
||||
How do we solve this ? Developers love having framework overview by examples. It's a quick introduction before going deeper.
|
||||
|
||||
## Roadmap
|
||||
|
||||
- [ ] Add Angular support
|
||||
- [ ] Add SolidJS support
|
||||
- [ ] Add Preact support
|
||||
- [ ] Add Alpine support
|
||||
- [x] Website (built with Astro)
|
||||
- [x] Add React support
|
||||
- [x] Add Svelte support
|
||||
- [x] Add Vue 3 support
|
||||
|
||||
## Contributing
|
||||
|
||||
This site is built with [Astro](https://docs.astro.build). Site content is written in Markdown format located in `content`. For simple edits, you can directly edit the file on GitHub and generate a Pull Request.
|
||||
|
||||
For local development, [pnpm](https://pnpm.io/) is preferred as package manager:
|
||||
|
||||
```bash
|
||||
pnpm i
|
||||
pnpm run dev
|
||||
```
|
||||
|
||||
This project requires Node.js to be `v14.0.0` or higher, because we use new JavaScript features in our code, such as optional chaining.
|
||||
|
||||
---
|
||||
|
||||
<slot/>
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
layout: ../layouts/BaseLayout.svelte
|
||||
---
|
||||
|
||||
<slot/>
|
||||
@@ -1,7 +0,0 @@
|
||||
import fs from 'fs';
|
||||
import getDocContent from './getDocContent.js';
|
||||
|
||||
export default function generateIndexPage() {
|
||||
const template = fs.readFileSync('scripts/templates/index.base.md', 'utf8');
|
||||
fs.writeFileSync('src/pages/index.md', template.replace('<slot/>', getDocContent()), 'utf-8');
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { FRAMEWORKS } from '../../config.cjs';
|
||||
import kebabCase from 'lodash.kebabcase';
|
||||
|
||||
const CONTENT_DIR = 'content';
|
||||
|
||||
export default function getDocContent() {
|
||||
let content = '';
|
||||
|
||||
const tree = [];
|
||||
|
||||
const contentDirs = fs.readdirSync(CONTENT_DIR);
|
||||
|
||||
for (const contentDir of contentDirs) {
|
||||
const sectionDir = `${CONTENT_DIR}/${contentDir}`;
|
||||
const subSectionDirs = fs.readdirSync(sectionDir).filter((path) => !path.includes('.'));
|
||||
const contentDirTitle = dirNameToTitle(contentDir);
|
||||
const treeNode = {
|
||||
id: contentDir.split('-').splice(1).join('-'),
|
||||
title: contentDirTitle,
|
||||
sections: [],
|
||||
};
|
||||
|
||||
let fileContent = `# ${contentDirTitle}${addHeaderAnchor(contentDirTitle)}\n`;
|
||||
|
||||
for (const subSectionDir of subSectionDirs) {
|
||||
const subSectionDirTitle = dirNameToTitle(subSectionDir);
|
||||
treeNode.sections.push({
|
||||
id: subSectionDir.split('-').splice(1).join('-'),
|
||||
title: subSectionDirTitle,
|
||||
});
|
||||
// write subsection title
|
||||
fileContent += `## ${subSectionDirTitle}${addHeaderAnchor(subSectionDirTitle)}\n`;
|
||||
|
||||
for (const framework of FRAMEWORKS) {
|
||||
function addSnippetWrap(content) {
|
||||
return `\`\`\`${framework.ext}\n${content}\n\`\`\`\n\n`;
|
||||
}
|
||||
const imgTag = framework.img ? `<img src="${framework.img}" alt="${framework.id}" width="20" height="20" class="framework-logo" />` : '';
|
||||
fileContent += `### ${imgTag} ${framework.title}\n`;
|
||||
|
||||
const frameworkDirPath = `${sectionDir}/${subSectionDir}/${framework.id}`;
|
||||
if (fs.existsSync(frameworkDirPath)) {
|
||||
const files = fs.readdirSync(frameworkDirPath);
|
||||
|
||||
for (const file of files) {
|
||||
const parsedFile = path.parse(file);
|
||||
const currentFileContent = fs.readFileSync(`${frameworkDirPath}/${file}`);
|
||||
const frameworkFileContent = parsedFile.ext === '.md' ? `${currentFileContent}\n` : addSnippetWrap(currentFileContent);
|
||||
fileContent += frameworkFileContent;
|
||||
}
|
||||
} else {
|
||||
fileContent += `<pre>Oops, missing snippet ! <a href="https://github.com/matschik/component-party/tree/main/${sectionDir}/${subSectionDir}">You can help us by contributing on Github.</a></pre>\n`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
content += fileContent;
|
||||
tree.push(treeNode);
|
||||
}
|
||||
|
||||
fs.writeFileSync('src/tree.js', `export default ${JSON.stringify(tree, null, 2)}`, 'utf8');
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
function dirNameToTitle(dirName) {
|
||||
return capitalize(dirName.split('-').splice(1).join(' '));
|
||||
}
|
||||
|
||||
function capitalize(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
function addHashOnEachLine(content) {
|
||||
return (
|
||||
content
|
||||
.split('\n')
|
||||
.map((line) => (line.startsWith('#') ? `#${line}` : `${line}`))
|
||||
.join('\n') + '\n'
|
||||
);
|
||||
}
|
||||
|
||||
function addHeaderAnchor(id) {
|
||||
return `<a class="header-anchor" href="#${kebabCase(id)}" aria-hidden="true" tabindex="-1">#</a>`;
|
||||
}
|
||||
@@ -100,7 +100,7 @@ function getSectionCodeFiles(section, framework){
|
||||
<div style="margin-top: 1rem;">
|
||||
{FRAMEWORKS.map((framework) => (
|
||||
<div data-framework-content={framework.id} style="display: none;margin-top: 0rem;">
|
||||
<div class="flex items-center space-x-3">
|
||||
<div class="flex justify-between items-center space-x-3">
|
||||
<h3 style="margin-top: 0rem; margin-bottom: 0rem;">
|
||||
<FrameworkLabel id={framework.id} />
|
||||
</h3>
|
||||
|
||||
Reference in New Issue
Block a user