-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d8b5ea
commit c125ec6
Showing
9 changed files
with
95 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// read ./code/frameworks subfolders and generate a list of available frameworks | ||
// save this list into ./code/lib/cli/src/frameworks.ts and export it as a union type. The name of the type is `SupportedFrameworks`. Add additionally 'qwik' and `solid` to that list. | ||
|
||
import { readdir, writeFile } from 'node:fs/promises'; | ||
import path from 'node:path'; | ||
import prettier from 'prettier'; | ||
import dedent from 'ts-dedent'; | ||
|
||
const thirdPartyFrameworks = ['qwik', 'solid']; | ||
|
||
const run = async () => { | ||
const frameworks = await readdir(path.join(__dirname, '..', '..', '..', 'frameworks')); | ||
const supportedFrameworks = frameworks.map((framework) => `'${framework}'`).join(' | '); | ||
const fileContent = dedent` | ||
// auto generated file, do not edit | ||
// the file gets generated by the script ./code/lib/types/scripts/generate-available-frameworks.js | ||
export type SupportedFrameworks = ${supportedFrameworks} | ${thirdPartyFrameworks | ||
.map((framework) => `'${framework}'`) | ||
.join(' | ')}; | ||
`; | ||
// format fileContent by prettier | ||
const frameworksFile = path.join(__dirname, '..', 'src', 'modules', 'frameworks.ts'); | ||
const prettierConfig = await prettier.resolveConfig(frameworksFile); | ||
|
||
const formattedFileContent = await prettier.format(fileContent, { | ||
...prettierConfig, | ||
parser: 'typescript', | ||
}); | ||
|
||
await writeFile(frameworksFile, formattedFileContent); | ||
}; | ||
|
||
run().catch((e) => { | ||
console.error(e); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// auto generated file, do not edit | ||
// the file gets generated by the script ./code/lib/types/scripts/generate-available-frameworks.js | ||
export type SupportedFrameworks = | ||
| 'angular' | ||
| 'ember' | ||
| 'html-vite' | ||
| 'html-webpack5' | ||
| 'nextjs' | ||
| 'preact-vite' | ||
| 'preact-webpack5' | ||
| 'react-vite' | ||
| 'react-webpack5' | ||
| 'server-webpack5' | ||
| 'svelte-vite' | ||
| 'svelte-webpack5' | ||
| 'sveltekit' | ||
| 'vue-vite' | ||
| 'vue-webpack5' | ||
| 'vue3-vite' | ||
| 'vue3-webpack5' | ||
| 'web-components-vite' | ||
| 'web-components-webpack5' | ||
| 'qwik' | ||
| 'solid'; |