Skip to content

Commit

Permalink
fix entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
hori-ryota committed Jul 16, 2023
1 parent 90de009 commit 3542748
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@ Installation and usage are easily handled via npm or Deno.
Execute the following command for installation using Deno.

```sh
deno install --allow-read --allow-write --name microcms_sdk_generator https://deno.land/x/microcms_sdk_generator/src/main.ts
deno install --allow-read --allow-write https://deno.land/x/microcms_sdk_generator/microcms_sdk_generator.ts
```

> [microcms\_sdk\_generator \| Deno](https://deno.land/x/microcms_sdk_generator)
Or execute directly.

```sh
deno run --allow-read --allow-write https://deno.land/x/microcms_sdk_generator/microcms_sdk_generator.ts
```

### Installation with npm

Execute the following command for installation using npm.
Expand All @@ -47,6 +53,12 @@ npm install --global microcms_sdk_generator

> [microcms\_sdk\_generator \- npm](https://www.npmjs.com/package/microcms_sdk_generator)
Or execute directly.

```sh
npx microcms_sdk_generator
```

## Usage

To use the tool, specify the directory of the schema files and the destination
Expand Down
5 changes: 5 additions & 0 deletions microcms_sdk_generator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { main } from "./src/main.ts";

if (import.meta.main) {
await main();
}
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ export async function main() {
await generate({ schemaDir, dstFilePath });
}

await main();
if (import.meta.main) {
await main();
}

0 comments on commit 3542748

Please sign in to comment.