Skip to content

Commit 6eee100

Browse files
committed
- add parcel
- update default template variable name
1 parent 1cae051 commit 6eee100

File tree

9 files changed

+52
-6
lines changed

9 files changed

+52
-6
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.0.14 (22 March 2025)
2+
3+
### Patch
4+
5+
- Add Parcel
6+
- Update default template variable name
7+
18
## 1.0.13 (12 March 2025)
29

310
### Patch

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ vim .
5454
- Next: `--fw=next`
5555
- Nuxt: `--fw=nuxt`
5656
- One: `--fw=one`
57+
- Parcel: `--fw=parcel`
5758
- Preact: `--fw=preact`
5859
- Qwik: `--fw=qwik`
5960
- ReactNative: `--fw=reactnative`

constants/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ export const VITE_TEMPLATES = [
8484
'qwik-ts',
8585
]
8686

87-
export const DEFAULT_VITE_TEMPLATE = 'vanilla'
87+
export const PARCEL_TEMPLATES = ['vanilla', 'react-client', 'react-server', 'react-static']
88+
89+
export const DEFAULT_TEMPLATE = 'vanilla'
8890
export const DEFAULT_APP_NAME = 'my-app'
8991

9092
export const FRAMEWORK = {

index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ export async function cli(args) {
9898
case 'one':
9999
await runner.runOne(options)
100100
return
101+
case 'parcel':
102+
await runner.runParcel(options)
103+
return
101104
// case 'phoenix':
102105
// await runner.runPhoenix(options)
103106
// return
@@ -138,7 +141,7 @@ export async function cli(args) {
138141
await runner.runVite(options)
139142
return
140143
default:
141-
console.log('Unknown Framework')
144+
console.log(chalk.red('Unknown Framework'))
142145
console.log(HELP_MANUAL)
143146
}
144147

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rustyrush/the-create",
3-
"version": "1.0.13",
3+
"version": "1.0.14",
44
"description": "One create to rule them all",
55
"type": "module",
66
"main": "index.js",

runner/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { runLynx } from './runLynx.js'
55
import { runNext } from './runNext.js'
66
import { runNuxt } from './runNuxt.js'
77
import { runOne } from './runOne.js'
8+
import { runParcel } from './runParcel.js'
89
import { runPhoenix } from './runPhoenix.js'
910
import { runPreact } from './runPreact.js'
1011
import { runQwik } from './runQwik.js'
@@ -27,6 +28,7 @@ export {
2728
runNext,
2829
runNuxt,
2930
runOne,
31+
runParcel,
3032
runPhoenix,
3133
runPreact,
3234
runQwik,

runner/runParcel.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict'
2+
3+
import { DEFAULT_TEMPLATE, PARCEL_TEMPLATES } from '../constants/index.js'
4+
import { checkDirectoryName, checkTemplate } from '../utils/index.js'
5+
6+
import { execSync } from 'child_process'
7+
8+
/**
9+
* Check parcel template arguments
10+
* @param {Options} options - Options object
11+
* @returns {Promise<Options>}
12+
*/
13+
async function checkParcelOptions(options) {
14+
options = await checkDirectoryName(options)
15+
options = await checkTemplate(options, PARCEL_TEMPLATES, DEFAULT_TEMPLATE)
16+
17+
return options
18+
}
19+
20+
/**
21+
* Run Parcel based project
22+
* @param {Options} opts - Options object
23+
* @returns {Promise<void>}
24+
*/
25+
export async function runParcel(opts) {
26+
const options = await checkParcelOptions(opts)
27+
28+
execSync(`${options.pm} create parcel ${options.template} ${options.directoryName}`, {
29+
stdio: 'inherit',
30+
})
31+
}

runner/runVite.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
import { DEFAULT_VITE_TEMPLATE, VITE_TEMPLATES } from '../constants/index.js'
3+
import { DEFAULT_TEMPLATE, VITE_TEMPLATES } from '../constants/index.js'
44
import { checkDirectoryName, checkTemplate } from '../utils/index.js'
55

66
import { execa } from 'execa'
@@ -12,7 +12,7 @@ import { execa } from 'execa'
1212
*/
1313
async function checkViteOptions(options) {
1414
options = await checkDirectoryName(options)
15-
options = await checkTemplate(options, VITE_TEMPLATES, DEFAULT_VITE_TEMPLATE)
15+
options = await checkTemplate(options, VITE_TEMPLATES, DEFAULT_TEMPLATE)
1616

1717
return options
1818
}

type.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212

1313
/**
14-
* @typedef {'analog' | 'astro' | 'epic' | 'lynx' | 'million' | 'next' | 'nuxt' | 'one' | 'phoenix' | 'preact' | 'qwik' | 'reactnative' | 'redwood' | 'remix' | 'solidstart' | 'superkit' | 'sveltekit' | 'rts' | 'umi' | 'vite' | 'waku' } Framework
14+
* @typedef {'analog' | 'astro' | 'epic' | 'lynx' | 'million' | 'next' | 'nuxt' | 'one' | 'parcel' | 'phoenix' | 'preact' | 'qwik' | 'reactnative' | 'redwood' | 'remix' | 'solidstart' | 'superkit' | 'sveltekit' | 'rts' | 'umi' | 'vite' | 'waku' } Framework
1515
*/
1616

1717
/**

0 commit comments

Comments
 (0)