Skip to content

Commit

Permalink
fix: init git in existing directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hongaar committed Nov 29, 2022
1 parent cdc7e85 commit 374022d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/repo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { join } from "node:path";
import { basename, join } from "node:path";
import { isDirectory, isReadableAndWritableDirectory } from "./directory.js";
import { hasPackage, Package, writePackage } from "./package.js";
import { writeReadme } from "./workspace.js";
Expand Down Expand Up @@ -35,6 +35,8 @@ export async function createRepo({
await writePackage({
directory,
data: {
name: basename(directory),
version: "0.0.0",
license,
moker: {
plugins: [],
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const queues = {
};

export async function initYarnExistingRepo({ directory }: DirOption) {
await exec("git", ["init", "--initial-branch", "main"], { cwd: directory });

await exec("yarn", ["set", "version", "latest"], { cwd: directory });

await initYarn({ directory });
Expand Down

0 comments on commit 374022d

Please sign in to comment.