Skip to content

Commit 6d32137

Browse files
update package for v3
1 parent 18152a0 commit 6d32137

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

bin/create-r3f-app

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ program
1515
.version(pkg.version)
1616
.arguments('<app-type> <project-directory> [app-style] ')
1717
.option('-ts, --typescript', 'create r3f app with TypeScript')
18+
.option('-b, --branch <value>', 'choose a branch to create the app from (useful for the contributors)')
1819
.usage(`${chalk.yellow('<app-type>')} ${chalk.green('<project-directory>')} ${chalk.magenta('[app-style]')} `)
1920
.action(function projectNameAction(type, name, style) {
2021
appType = type;
@@ -27,10 +28,12 @@ program
2728

2829
const options = program.opts();
2930
const projectOption = options.typescript ? 'typescript' : 'default';
31+
const projectBranch = program.branch ? program.branch : 'main';
3032

3133
createR3fApp({
3234
appType,
3335
projectName,
3436
projectOption,
37+
projectBranch,
3538
appStyle,
3639
});

lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const next = require('./stacks/next');
1111
// todo add gatsby and native
1212
const appTypes = ['next'];
1313

14-
module.exports = async function createR3fApp({ projectName, appType, projectOption, appStyle }) {
14+
module.exports = async function createR3fApp({ projectName, appType, projectOption, projectBranch, appStyle }) {
1515
console.log(chalk.bold(chalk.blue(`Welcome. Project's generation started using create-R3F-App 🐱`)));
1616

1717
await checkForUpdate();
@@ -40,7 +40,7 @@ module.exports = async function createR3fApp({ projectName, appType, projectOpti
4040

4141
switch (appType) {
4242
case 'next':
43-
next(projectName, projectPath, appStyle, projectOption);
43+
next(projectName, projectPath, appStyle, projectOption, projectBranch);
4444
break;
4545
default:
4646
break;

lib/stacks/next.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ const migrateTailwindToStyled = async (root) => {
164164
const targetJsxFiles = srcJsxFiles.filter(file => {
165165
const parsed = sysPath.parse(file);
166166
const fileName = parsed.name;
167-
if (fileName === 'dom' || fileName === 'Instructions') return file;
167+
if (fileName === 'Layout' || fileName === 'Instructions') return file;
168168
});
169169

170170
const prettier = importFrom(root, 'prettier');
@@ -291,7 +291,7 @@ const initForStyledComponents = async (root) => {
291291
output.success('Succeed to initialize for styled-components');
292292
}
293293

294-
async function next(projectName, projectPath, projectStyle, projectOption) {
294+
async function next(projectName, projectPath, projectStyle, projectOption, projectBranch) {
295295
output.info(
296296
`🚀 Creating ${chalk.bold(chalk.green(projectName))} using ${chalk.bold(
297297
'r3f-next-starter',
@@ -302,7 +302,7 @@ async function next(projectName, projectPath, projectStyle, projectOption) {
302302
const isPmndrs = isNotDefaultStyle && projectStyle !== 'styled';
303303
const hostedInfo = hostedGitInfo.fromUrl('https://github.com/pmndrs/react-three-next');
304304
const url = hostedInfo.https({ noCommittish: !isPmndrs, noGitPlus: true });
305-
const branch = isPmndrs ? ['--branch', 'pmndrs'] : ['--branch', 'main'];
305+
const branch = isPmndrs ? ['--branch', 'pmndrs'] : ['--branch', projectBranch || 'main'];
306306
const recursive = isPmndrs ? [] : ['--recursive'];
307307
const args = [
308308
'clone',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-r3f-app",
3-
"version": "1.5.5",
3+
"version": "1.5.8",
44
"description": "The easiest and fastest way to create new 3D web projects with react and threejs.",
55
"contributors": [
66
"Renaud ROHLINGER <[email protected]>"

0 commit comments

Comments
 (0)