Skip to content

Commit 9dbf807

Browse files
committed
add bun support, improve expo detection in v2 cli
1 parent dc9036a commit 9dbf807

File tree

29 files changed

+1392
-1906
lines changed

29 files changed

+1392
-1906
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ yarn-error.log*
3535
# vercel
3636
.vercel
3737
package-lock.json
38+
39+
# jetbrains
40+
.idea

packages/create-expo-app-with-gluestack-ui/src/index.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#!/usr/bin/env node
22
const args = process.argv.slice(2);
33

4-
let supportedArgs = ['--use-npm', '--use-yarn', '--help', '-h', '--use-pnpm'];
4+
let supportedArgs = [
5+
'--use-npm',
6+
'--use-yarn',
7+
'--help',
8+
'-h',
9+
'--use-pnpm',
10+
'--use-bun',
11+
];
512

6-
import path from 'path';
7-
import fs from 'fs';
813
import { cancel, isCancel, log, text } from '@clack/prompts';
9-
import { installDependencies, getArgsData } from '@gluestack/cli-utils';
14+
import { getArgsData, installDependencies } from '@gluestack/cli-utils';
15+
import fs from 'fs';
16+
import path from 'path';
1017

1118
async function main() {
1219
let projectPath = path.join(path.resolve(__dirname, '..'), 'src', 'template');

packages/create-expo-router-app-with-gluestack-ui/src/index.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#!/usr/bin/env node
22
const args = process.argv.slice(2);
33

4-
let supportedArgs = ['--use-npm', '--use-yarn', '--help', '-h', '--use-pnpm'];
4+
let supportedArgs = [
5+
'--use-npm',
6+
'--use-yarn',
7+
'--help',
8+
'-h',
9+
'--use-pnpm',
10+
'--use-bun',
11+
];
512

6-
import path from 'path';
7-
import fs from 'fs';
813
import { cancel, isCancel, log, text } from '@clack/prompts';
9-
import { installDependencies, getArgsData } from '@gluestack/cli-utils';
14+
import { getArgsData, installDependencies } from '@gluestack/cli-utils';
15+
import fs from 'fs';
16+
import path from 'path';
1017

1118
async function main() {
1219
let projectPath = path.join(path.resolve(__dirname, '..'), 'src', 'template');

packages/create-gluestack-v2-app/src/template/client/web/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ npm run dev
1010
yarn dev
1111
# or
1212
pnpm dev
13+
# or
14+
bun dev
1315
```
1416

1517
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

packages/create-next-app-with-gluestack-ui/src/app-router/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ npm run dev
1010
yarn dev
1111
# or
1212
pnpm dev
13+
# or
14+
bun dev
1315
```
1416

1517
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
@@ -29,9 +31,10 @@ To learn more about Next.js + Gluestack UI template, take a look at the followin
2931
- [Gluestack Style Documentaion](https://style.gluestack.io/docs/overview/introduction) - learn about the universal styling library that is used in Gluestack-ui
3032

3133
You can check out:
34+
3235
- [the gluestack-ui GitHub repository](https://github.com/gluestack/gluestack-ui)
3336
- [the gluestack-style GitHub repository](https://github.com/gluestack/gluestack-style)
34-
Your feedback and contributions are welcome!
37+
Your feedback and contributions are welcome!
3538

3639
## Deploy on Vercel
3740

packages/create-next-app-with-gluestack-ui/src/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ let supportedArgs = [
77
'--help',
88
'-h',
99
'--use-pnpm',
10+
'--use-bun',
1011
'--app',
1112
'--page',
1213
];
13-
import path from 'path';
14-
import fs from 'fs';
15-
import { cancel, isCancel, log, spinner, text, select } from '@clack/prompts';
14+
import { cancel, isCancel, log, select, spinner, text } from '@clack/prompts';
1615
import { spawnSync } from 'child_process';
16+
import fs from 'fs';
17+
import path from 'path';
1718

1819
function installDependencies(projectName: string, installationMethod: string) {
1920
const projectPath = path.join(process.cwd(), projectName);
@@ -81,6 +82,7 @@ async function main() {
8182
--use-npm use npm to install dependencies
8283
--use-yarn use yarn to install dependencies
8384
--use-pnpm use pnpm to install dependencies
85+
--use-bun use bun to install dependencies
8486
`
8587
);
8688
process.exit(0);
@@ -94,6 +96,8 @@ async function main() {
9496
useAppRouter = 'yes';
9597
} else if (args[i] === '--page') {
9698
useAppRouter = 'no';
99+
} else if (args[i] === '--use-bun') {
100+
installationMethod = 'bun i';
97101
}
98102
} else {
99103
log.warning(

packages/create-next-app-with-gluestack-ui/src/page-router/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ npm run dev
1010
yarn dev
1111
# or
1212
pnpm dev
13+
# or
14+
bun dev
1315
```
1416

1517
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
@@ -29,9 +31,10 @@ To learn more about Next.js + Gluestack UI template, take a look at the followin
2931
- [Gluestack Style Documentaion](https://style.gluestack.io/docs/overview/introduction) - learn about the universal styling library that is used in Gluestack-ui
3032

3133
You can check out:
34+
3235
- [the gluestack-ui GitHub repository](https://github.com/gluestack/gluestack-ui)
3336
- [the gluestack-style GitHub repository](https://github.com/gluestack/gluestack-style)
34-
Your feedback and contributions are welcome!
37+
Your feedback and contributions are welcome!
3538

3639
## Deploy on Vercel
3740

packages/create-react-native-app-with-gluestack-ui/src/index.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22

33
const args = process.argv.slice(2);
44

5-
let supportedArgs = ['--use-npm', '--use-yarn', '--help', '-h', '--use-pnpm'];
5+
let supportedArgs = [
6+
'--use-npm',
7+
'--use-yarn',
8+
'--help',
9+
'-h',
10+
'--use-pnpm',
11+
'--use-bun',
12+
];
613

7-
import path from 'path';
8-
import fs from 'fs';
914
import { cancel, isCancel, log, text } from '@clack/prompts';
10-
import { installDependencies, getArgsData } from '@gluestack/cli-utils';
15+
import { getArgsData, installDependencies } from '@gluestack/cli-utils';
16+
import fs from 'fs';
17+
import path from 'path';
1118

1219
async function main() {
1320
let projectPath = path.join(path.resolve(__dirname, '..'), 'src', 'template');

packages/gluestack-cli/src/commands/add.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1+
import { log } from '@clack/prompts';
12
import { Command } from 'commander';
23
import { z } from 'zod';
3-
import { handleError } from '../util/handle-error';
4-
import { log } from '@clack/prompts';
5-
import { componentAdder } from '../util/add';
64
import { config } from '../config';
75
import { checkWritablePath, isValidPath, projectRootPath } from '../util';
6+
import { componentAdder } from '../util/add';
87
import { checkIfInitialized, getComponentsPath } from '../util/config';
8+
import { handleError } from '../util/handle-error';
99

1010
const addOptionsSchema = z.object({
1111
components: z.string().optional(),
1212
all: z.boolean(),
1313
useNpm: z.boolean(),
1414
useYarn: z.boolean(),
1515
usePnpm: z.boolean(),
16+
useBun: z.boolean(),
1617
path: z.string().optional(),
1718
});
1819

@@ -24,6 +25,7 @@ export const add = new Command()
2425
.option('--use-npm ,useNpm', 'use npm to install dependencies', false)
2526
.option('--use-yarn, useYarn', 'use yarn to install dependencies', false)
2627
.option('--use-pnpm, usePnpm', 'use pnpm to install dependencies', false)
28+
.option('--use-bun, useBun', 'use bun to install dependencies', false)
2729
.option('--path <path>', 'path to the components directory')
2830
.action(async (components, opts, command) => {
2931
try {
@@ -70,10 +72,16 @@ export const add = new Command()
7072
process.exit(1);
7173
}
7274
let installationMethod;
73-
if (options.useNpm || options.useYarn || options.usePnpm) {
75+
if (
76+
options.useNpm ||
77+
options.useYarn ||
78+
options.usePnpm ||
79+
options.useBun
80+
) {
7481
if (options.useNpm) installationMethod = 'npm';
7582
if (options.usePnpm) installationMethod = 'pnpm';
7683
if (options.useYarn) installationMethod = 'yarn';
84+
if (options.useBun) installationMethod = 'bun';
7785
}
7886
if (options.all) {
7987
try {

packages/gluestack-cli/src/commands/init.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1+
import { log } from '@clack/prompts';
12
import { Command } from 'commander';
23
import { z } from 'zod';
3-
import { handleError } from '../util/handle-error';
4-
import { log } from '@clack/prompts';
5-
import { InitializeGlueStack } from '../util/init';
64
import { config } from '../config';
75
import {
86
checkWritablePath,
97
detectProjectType,
108
isValidPath,
119
projectRootPath,
1210
} from '../util';
11+
import { handleError } from '../util/handle-error';
12+
import { InitializeGlueStack } from '../util/init';
1313

1414
const initOptionsSchema = z.object({
1515
useNpm: z.boolean(),
1616
useYarn: z.boolean(),
1717
usePnpm: z.boolean(),
18+
useBun: z.boolean(),
1819
path: z.string().optional(),
1920
});
2021

@@ -24,6 +25,7 @@ export const init = new Command()
2425
.option('--use-npm ,useNpm', 'use npm to install dependencies', false)
2526
.option('--use-yarn, useYarn', 'use yarn to install dependencies', false)
2627
.option('--use-pnpm, usePnpm', 'use pnpm to install dependencies', false)
28+
.option('--use-bun, useBun', 'use bun to install dependencies', false)
2729
.option(
2830
'--path <path>',
2931
'path to the components directory. defaults to components/ui'
@@ -32,10 +34,16 @@ export const init = new Command()
3234
try {
3335
const options = initOptionsSchema.parse({ ...opts });
3436
let installationMethod;
35-
if (options.useNpm || options.useYarn || options.usePnpm) {
37+
if (
38+
options.useNpm ||
39+
options.useYarn ||
40+
options.usePnpm ||
41+
options.useBun
42+
) {
3643
if (options.useNpm) installationMethod = 'npm';
3744
if (options.usePnpm) installationMethod = 'pnpm';
3845
if (options.useYarn) installationMethod = 'yarn';
46+
if (options.useBun) installationMethod = 'bun';
3947
}
4048
// Check if the string starts with "/" or "."
4149
if (options.path && !isValidPath(options.path)) {

0 commit comments

Comments
 (0)