diff --git a/README.md b/README.md index ef45324..582dd71 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,45 @@ This code is taken from the excellent [webvtt.org](https://www.webvtt.org/), I merely adapted it to work as a library. ## Usage + +```ts +const srt = `1 +00:00:01,000 --> 00:00:02,000 +Hello, world! +`; + +console.log(srt2webvtt(srt)); +` +WEBVTT + +1 +00:00:00.000 --> 00:00:00.000 +Hello, world! +`; +``` + +## Installing + +This was written using [deno](https://deno.land/), an alternative JavaScript +runtime to node, so you'll first need to +[install deno](https://deno.land/manual/getting_started/installation). + +### Use in Deno + +If you're using Deno, using this library is as simple as adding + +```ts +import srt2webvtt from "https://git.froth.zone/sam/srt-to-vtt/raw/branch/master/mod.ts"; +``` + +to your code. + +### Use in Node + +If you're using Node, you can use the same code as above, but instead of +importing it from a URL, you'll need to import it from npm: +`npm install deno-srt-to-vtt`. + +## License + +All source code is available under the [MIT License](./LICENSE). diff --git a/scripts/npm-build.ts b/scripts/npm-build.ts index 42c51bd..972c9e7 100644 --- a/scripts/npm-build.ts +++ b/scripts/npm-build.ts @@ -5,6 +5,7 @@ await emptyDir("./npm"); await build({ entryPoints: ["./mod.ts"], + packageManager: "yarn", outDir: "./npm", shims: { // see JS docs for overview and more options @@ -12,14 +13,14 @@ await build({ }, package: { // package.json properties - name: "srt-to-vtt", + name: "deno-srt-to-vtt", version: Deno.args[0], description: - "A library that converts SRT files to VTT equivalents so they can be broadcast on the Internet.", + "A deno library that converts SRT files to VTT equivalents so they can be broadcast on the Internet.", license: "MIT", repository: { type: "git", - url: "git+https://git.froth.zone/sam/srt-to-vtt", + url: "https://git.froth.zone/sam/srt-to-vtt", }, bugs: { url: "https://git.froth.zone/sam/srt-to-vtt/issues",