Skip to content

Commit

Permalink
fix: quick fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vaibhk20 committed Oct 23, 2024
1 parent 36d2d92 commit 508db00
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion packages/gluestack-cli/src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@ import { handleError } from '../util/handle-error';
import { log } from '@clack/prompts';
import { componentAdder, hookAdder, isHookFromConfig } from '../util/add';
import { config } from '../config';
import { checkWritablePath, isValidPath, projectRootPath } from '../util';
import {
checkWritablePath,
isValidPath,
projectRootPath,
cloneRepositoryAtRoot,
} from '../util';
import { checkIfInitialized, getComponentsPath } from '../util/config';
import { join } from 'path';
import os from 'os';

const _homeDir = os.homedir();

const addOptionsSchema = z.object({
components: z.string().optional(),
Expand Down Expand Up @@ -53,6 +62,7 @@ export const add = new Command()
);
process.exit(1);
}
await cloneRepositoryAtRoot(join(_homeDir, config.gluestackDir));
//function to get current path where GUIProvider is located
const currWritablePath = await getComponentsPath(projectRootPath);
if (currWritablePath) {
Expand Down
2 changes: 1 addition & 1 deletion packages/gluestack-cli/src/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const dependenciesConfig: Dependencies = {
'@gluestack-ui/toast': 'latest',
'@gluestack-ui/nativewind-utils': '1.0.23',
'react-native-svg': '13.4.0',
nativewind: '4.1.10',
nativewind: '4.0.36',
},
devDependencies: {
jscodeshift: '0.15.2',
Expand Down
4 changes: 2 additions & 2 deletions packages/gluestack-cli/src/util/add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const componentAdder = async ({
}) => {
try {
console.log(`\n\x1b[1mAdding new component...\x1b[0m\n`);
await cloneRepositoryAtRoot(join(_homeDir, config.gluestackDir));
let hooksToAdd: string[] = [];
if (
requestedComponent &&
Expand Down Expand Up @@ -54,7 +53,8 @@ const componentAdder = async ({
);

await writeComponent(component, targetPath);
await hookAdder({ requestedHook: hooksToAdd });
if (hooksToAdd.length > 0)
await hookAdder({ requestedHook: hooksToAdd });
})
)
.then(async () => {
Expand Down

0 comments on commit 508db00

Please sign in to comment.