create-vite-extra
Advanced tools
Comparing version 0.1.9 to 1.0.0
177
index.js
@@ -73,2 +73,12 @@ #!/usr/bin/env node | ||
color: blue | ||
}, | ||
{ | ||
name: 'ssr-react-swc', | ||
display: 'JavaScript + SWC', | ||
color: yellow | ||
}, | ||
{ | ||
name: 'ssr-react-swc-ts', | ||
display: 'TypeScript + SWC', | ||
color: blue | ||
} | ||
@@ -127,27 +137,121 @@ ] | ||
name: 'deno-vanilla', | ||
color: yellow | ||
color: yellow, | ||
variants: [ | ||
{ | ||
name: 'deno-vanilla', | ||
display: 'JavaScript', | ||
color: yellow | ||
}, | ||
{ | ||
name: 'deno-vanilla-ts', | ||
display: 'TypeScript', | ||
color: blue | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'deno-vue', | ||
color: green | ||
color: green, | ||
variants: [ | ||
{ | ||
name: 'deno-vue', | ||
display: 'JavaScript', | ||
color: yellow | ||
}, | ||
{ | ||
name: 'deno-vue-ts', | ||
display: 'TypeScript', | ||
color: blue | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'deno-react', | ||
color: cyan | ||
color: cyan, | ||
variants: [ | ||
{ | ||
name: 'deno-react', | ||
display: 'JavaScript', | ||
color: yellow | ||
}, | ||
{ | ||
name: 'deno-react-ts', | ||
display: 'TypeScript', | ||
color: blue | ||
}, | ||
{ | ||
name: 'deno-react-swc', | ||
display: 'JavaScript + SWC', | ||
color: yellow | ||
}, | ||
{ | ||
name: 'deno-react-swc-ts', | ||
display: 'TypeScript + SWC', | ||
color: blue | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'deno-preact', | ||
color: magenta | ||
color: magenta, | ||
variants: [ | ||
{ | ||
name: 'deno-preact', | ||
display: 'JavaScript', | ||
color: yellow | ||
}, | ||
{ | ||
name: 'deno-preact-ts', | ||
display: 'TypeScript', | ||
color: blue | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'deno-lit', | ||
color: lightRed | ||
color: lightRed, | ||
variants: [ | ||
{ | ||
name: 'deno-lit', | ||
display: 'JavaScript', | ||
color: yellow | ||
}, | ||
{ | ||
name: 'deno-lit-ts', | ||
display: 'TypeScript', | ||
color: blue | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'deno-svelte', | ||
color: red | ||
color: red, | ||
variants: [ | ||
{ | ||
name: 'deno-svelte', | ||
display: 'JavaScript', | ||
color: yellow | ||
}, | ||
{ | ||
name: 'deno-svelte-ts', | ||
display: 'TypeScript', | ||
color: blue | ||
} | ||
] | ||
}, | ||
{ | ||
name: 'deno-solid', | ||
color: lightBlue | ||
color: lightBlue, | ||
variants: [ | ||
{ | ||
name: 'deno-solid', | ||
display: 'JavaScript', | ||
color: yellow | ||
}, | ||
{ | ||
name: 'deno-solid-ts', | ||
display: 'TypeScript', | ||
color: blue | ||
} | ||
] | ||
}, | ||
@@ -188,3 +292,3 @@ { | ||
let targetDir = formatTargetDir(argv._[0]) | ||
let template = argv.template || argv.t | ||
const argTemplate = argv.template || argv.t | ||
@@ -238,8 +342,9 @@ const defaultTargetDir = 'vite-project' | ||
{ | ||
type: template && TEMPLATES.includes(template) ? null : 'select', | ||
type: | ||
argTemplate && TEMPLATES.includes(argTemplate) ? null : 'select', | ||
name: 'framework', | ||
message: | ||
typeof template === 'string' && !TEMPLATES.includes(template) | ||
typeof argTemplate === 'string' && !TEMPLATES.includes(argTemplate) | ||
? reset( | ||
`"${template}" isn't a valid template. Please choose from below: ` | ||
`"${argTemplate}" isn't a valid template. Please choose from below: ` | ||
) | ||
@@ -251,3 +356,3 @@ : reset('Select a template:'), | ||
return { | ||
title: frameworkColor(framework.name), | ||
title: frameworkColor(framework.display || framework.name), | ||
value: framework | ||
@@ -267,3 +372,3 @@ } | ||
return { | ||
title: variantColor(variant.name), | ||
title: variantColor(variant.display || variant.name), | ||
value: variant.name | ||
@@ -297,3 +402,8 @@ } | ||
// determine template | ||
template = variant || framework?.name || template | ||
let template = variant || framework?.name || argTemplate | ||
let isReactSwc = false | ||
if (template.includes('-swc')) { | ||
isReactSwc = true | ||
template = template.replace('-swc', '') | ||
} | ||
@@ -326,2 +436,6 @@ console.log(`\nScaffolding project in ${root}...`) | ||
if (isDeno) { | ||
if (isReactSwc) { | ||
setupReactSwc(root, { isTs: template.endsWith('-ts'), isDeno: true }) | ||
} | ||
console.log(`\nDone. Now run:\n`) | ||
@@ -342,2 +456,6 @@ if (root !== cwd) { | ||
if (isReactSwc) { | ||
setupReactSwc(root, { isTs: template.endsWith('-ts'), isDeno: false }) | ||
} | ||
const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent) | ||
@@ -448,4 +566,35 @@ const pkgManager = pkgInfo ? pkgInfo.name : 'npm' | ||
/** | ||
* @param {string} root | ||
* @param {{ isTs: boolean, isDeno: boolean }} options | ||
*/ | ||
function setupReactSwc(root, { isTs, isDeno }) { | ||
if (!isDeno) { | ||
editFile(path.resolve(root, 'package.json'), (content) => { | ||
return content.replace( | ||
/"@vitejs\/plugin-react": ".+?"/, | ||
`"@vitejs/plugin-react-swc": "^3.0.0"` | ||
) | ||
}) | ||
} | ||
editFile( | ||
path.resolve(root, `vite.config.${isDeno ? 'm' : ''}${isTs ? 'ts' : 'js'}`), | ||
(content) => { | ||
return content.replace('@vitejs/plugin-react', '@vitejs/plugin-react-swc') | ||
} | ||
) | ||
} | ||
/** | ||
* | ||
* @param {string} file | ||
* @param {(content: string) => string} callback | ||
*/ | ||
function editFile(file, callback) { | ||
const content = fs.readFileSync(file, 'utf-8') | ||
fs.writeFileSync(file, callback(content), 'utf-8') | ||
} | ||
init().catch((e) => { | ||
console.error(e) | ||
}) |
{ | ||
"name": "create-vite-extra", | ||
"version": "0.1.9", | ||
"version": "1.0.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -52,23 +52,33 @@ # create-vite-extra | ||
| Template | Try online | | ||
| ---------------- | ------------------------------------------------------------------------------------------------------------ | | ||
| `ssr-vanilla` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-vanilla) | | ||
| `ssr-vanilla-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-vanilla-ts) | | ||
| `ssr-vue` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-vue) | | ||
| `ssr-vue-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-vue-ts) | | ||
| `ssr-react` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-react) | | ||
| `ssr-react-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-react-ts) | | ||
| `ssr-preact` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-preact) | | ||
| `ssr-preact-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-preact-ts) | | ||
| `ssr-svelte` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-svelte) | | ||
| `ssr-svelte-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-svelte-ts) | | ||
| `deno-vanilla` | | | ||
| `deno-vue` | | | ||
| `deno-react` | | | ||
| `deno-preact` | | | ||
| `deno-lit` | | | ||
| `deno-svelte` | | | ||
| `library` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-library) | | ||
| `library-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-library-ts) | | ||
| `ssr-transform` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-transform) | | ||
| Template | Try online | | ||
| ------------------- | ------------------------------------------------------------------------------------------------------------ | | ||
| `ssr-vanilla` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-vanilla) | | ||
| `ssr-vanilla-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-vanilla-ts) | | ||
| `ssr-vue` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-vue) | | ||
| `ssr-vue-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-vue-ts) | | ||
| `ssr-react` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-react) | | ||
| `ssr-react-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-react-ts) | | ||
| `ssr-react-swc` | | | ||
| `ssr-react-swc-ts` | | | ||
| `ssr-preact` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-preact) | | ||
| `ssr-preact-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-preact-ts) | | ||
| `ssr-svelte` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-svelte) | | ||
| `ssr-svelte-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-svelte-ts) | | ||
| `deno-vanilla` | | | ||
| `deno-vanilla-ts` | | | ||
| `deno-vue` | | | ||
| `deno-vue-ts` | | | ||
| `deno-react` | | | ||
| `deno-react-ts` | | | ||
| `deno-react-swc` | | | ||
| `deno-react-swc-ts` | | | ||
| `deno-preact` | | | ||
| `deno-preact-ts` | | | ||
| `deno-lit` | | | ||
| `deno-lit-ts` | | | ||
| `deno-svelte` | | | ||
| `deno-svelte-ts` | | | ||
| `library` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-library) | | ||
| `library-ts` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-library-ts) | | ||
| `ssr-transform` | [StackBlitz](https://stackblitz.com/fork/github/bluwy/create-vite-extra/tree/master/template-ssr-transform) | | ||
@@ -75,0 +85,0 @@ You can use `.` for the project name to scaffold in the current directory. |
@@ -23,5 +23,5 @@ { | ||
"devDependencies": { | ||
"typescript": "^4.8.4", | ||
"vite": "^3.2.3" | ||
"typescript": "^4.9.4", | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -23,4 +23,4 @@ { | ||
"devDependencies": { | ||
"vite": "^3.2.3" | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -22,7 +22,7 @@ { | ||
"@preact/preset-vite": "^2.4.0", | ||
"@types/node": "^18.11.9", | ||
"@types/node": "^18.11.12", | ||
"cross-env": "^7.0.3", | ||
"typescript": "^4.8.4", | ||
"vite": "^3.2.3" | ||
"typescript": "^4.9.4", | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -23,4 +23,4 @@ { | ||
"cross-env": "^7.0.3", | ||
"vite": "^3.2.3" | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -21,9 +21,9 @@ { | ||
"devDependencies": { | ||
"@types/react": "^18.0.25", | ||
"@types/react": "^18.0.26", | ||
"@types/react-dom": "^18.0.9", | ||
"@vitejs/plugin-react": "^2.2.0", | ||
"@vitejs/plugin-react": "^3.0.0", | ||
"cross-env": "^7.0.3", | ||
"typescript": "^4.8.4", | ||
"vite": "^3.2.3" | ||
"typescript": "^4.9.4", | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -21,8 +21,8 @@ { | ||
"devDependencies": { | ||
"@types/react": "^18.0.25", | ||
"@types/react": "^18.0.26", | ||
"@types/react-dom": "^18.0.9", | ||
"@vitejs/plugin-react": "^2.2.0", | ||
"@vitejs/plugin-react": "^3.0.0", | ||
"cross-env": "^7.0.3", | ||
"vite": "^3.2.3" | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -17,9 +17,9 @@ { | ||
"sirv": "^2.0.2", | ||
"solid-js": "^1.6.2" | ||
"solid-js": "^1.6.4" | ||
}, | ||
"devDependencies": { | ||
"cross-env": "^7.0.3", | ||
"vite": "^3.2.3", | ||
"vite-plugin-solid": "^2.4.0" | ||
"vite": "^4.0.0", | ||
"vite-plugin-solid": "^2.5.0" | ||
} | ||
} |
@@ -17,9 +17,9 @@ { | ||
"sirv": "^2.0.2", | ||
"solid-js": "^1.6.2" | ||
"solid-js": "^1.6.4" | ||
}, | ||
"devDependencies": { | ||
"cross-env": "^7.0.3", | ||
"vite": "^3.2.3", | ||
"vite-plugin-solid": "^2.4.0" | ||
"vite": "^4.0.0", | ||
"vite-plugin-solid": "^2.5.0" | ||
} | ||
} |
@@ -19,12 +19,11 @@ { | ||
"devDependencies": { | ||
"@sveltejs/vite-plugin-svelte": "^1.1.1", | ||
"@sveltejs/vite-plugin-svelte": "^2.0.0", | ||
"@tsconfig/svelte": "^3.0.0", | ||
"cross-env": "^7.0.3", | ||
"svelte": "^3.53.1", | ||
"svelte-check": "^2.9.2", | ||
"svelte-preprocess": "^4.10.7", | ||
"svelte": "^3.54.0", | ||
"svelte-check": "^2.10.2", | ||
"tslib": "^2.4.1", | ||
"typescript": "^4.8.4", | ||
"vite": "^3.2.3" | ||
"typescript": "^4.9.4", | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -1,7 +0,5 @@ | ||
import sveltePreprocess from 'svelte-preprocess' | ||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte' | ||
export default { | ||
// Consult https://github.com/sveltejs/svelte-preprocess | ||
// for more information about preprocessors | ||
preprocess: sveltePreprocess() | ||
preprocess: vitePreprocess() | ||
} |
@@ -19,7 +19,7 @@ { | ||
"devDependencies": { | ||
"@sveltejs/vite-plugin-svelte": "^1.1.1", | ||
"@sveltejs/vite-plugin-svelte": "^2.0.0", | ||
"cross-env": "^7.0.3", | ||
"svelte": "^3.53.1", | ||
"vite": "^3.2.3" | ||
"svelte": "^3.54.0", | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -10,4 +10,4 @@ { | ||
"devDependencies": { | ||
"vite": "^3.2.3" | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -20,7 +20,7 @@ { | ||
"@types/express": "^4.17.14", | ||
"@types/node": "^18.11.9", | ||
"@types/node": "^18.11.12", | ||
"cross-env": "^7.0.3", | ||
"typescript": "^4.8.4", | ||
"vite": "^3.2.3" | ||
"typescript": "^4.9.4", | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -20,4 +20,4 @@ { | ||
"cross-env": "^7.0.3", | ||
"vite": "^3.2.3" | ||
"vite": "^4.0.0" | ||
} | ||
} |
@@ -20,8 +20,8 @@ { | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^3.2.0", | ||
"@vitejs/plugin-vue": "^4.0.0", | ||
"cross-env": "^7.0.3", | ||
"typescript": "^4.8.4", | ||
"vite": "^3.2.3", | ||
"vue-tsc": "^0.40.13" | ||
"typescript": "^4.9.4", | ||
"vite": "^4.0.0", | ||
"vue-tsc": "^1.0.12" | ||
} | ||
} |
@@ -20,6 +20,6 @@ { | ||
"devDependencies": { | ||
"@vitejs/plugin-vue": "^3.2.0", | ||
"@vitejs/plugin-vue": "^4.0.0", | ||
"cross-env": "^7.0.3", | ||
"vite": "^3.2.3" | ||
"vite": "^4.0.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
362025
372
5168
0
107