@sandstone-mc/mcdoc-ts-generator 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -3,6 +3,8 @@
3
3
  // src/index.ts
4
4
  import { dirname, resolve } from "path";
5
5
  import { fileURLToPath, pathToFileURL } from "url";
6
+ import { promisify } from "util";
7
+ import * as fs2 from "fs";
6
8
  import {
7
9
  ConfigService,
8
10
  fileUtil,
@@ -2908,6 +2910,8 @@ function handle_imports(imports) {
2908
2910
  }
2909
2911
 
2910
2912
  // src/index.ts
2913
+ var writeFile2 = promisify(fs2.writeFile);
2914
+ var mkdir2 = promisify(fs2.mkdir);
2911
2915
  var cache_root = join(dirname(fileURLToPath(import.meta.url)), "cache");
2912
2916
  function registerAttributes(meta, release) {
2913
2917
  mcdoc5.runtime.registerAttribute(meta, "since", mcdoc5.runtime.attribute.validator.string, {
@@ -3062,10 +3066,13 @@ async function generate(options = {}) {
3062
3066
  ...handle_imports(imports),
3063
3067
  ...exports
3064
3068
  ], out_path);
3065
- await Bun.write(out_path, code);
3069
+ await mkdir2(dirname(out_path), { recursive: true });
3070
+ await writeFile2(out_path, code);
3066
3071
  }
3067
3072
  if (tsconfig) {
3068
- await Bun.write(join(out_dir, "tsconfig.json"), JSON.stringify({
3073
+ const tsconfig_path = join(out_dir, "tsconfig.json");
3074
+ await mkdir2(dirname(tsconfig_path), { recursive: true });
3075
+ await writeFile2(tsconfig_path, JSON.stringify({
3069
3076
  compilerOptions: {
3070
3077
  allowImportingTsExtensions: true,
3071
3078
  noEmit: true,
package/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // src/index.ts
2
2
  import { dirname, resolve } from "path";
3
3
  import { fileURLToPath, pathToFileURL } from "url";
4
+ import { promisify } from "util";
5
+ import * as fs2 from "fs";
4
6
  import {
5
7
  ConfigService,
6
8
  fileUtil,
@@ -2906,6 +2908,8 @@ function handle_imports(imports) {
2906
2908
  }
2907
2909
 
2908
2910
  // src/index.ts
2911
+ var writeFile2 = promisify(fs2.writeFile);
2912
+ var mkdir2 = promisify(fs2.mkdir);
2909
2913
  var cache_root = join(dirname(fileURLToPath(import.meta.url)), "cache");
2910
2914
  function registerAttributes(meta, release) {
2911
2915
  mcdoc5.runtime.registerAttribute(meta, "since", mcdoc5.runtime.attribute.validator.string, {
@@ -3060,10 +3064,13 @@ async function generate(options = {}) {
3060
3064
  ...handle_imports(imports),
3061
3065
  ...exports
3062
3066
  ], out_path);
3063
- await Bun.write(out_path, code);
3067
+ await mkdir2(dirname(out_path), { recursive: true });
3068
+ await writeFile2(out_path, code);
3064
3069
  }
3065
3070
  if (tsconfig) {
3066
- await Bun.write(join(out_dir, "tsconfig.json"), JSON.stringify({
3071
+ const tsconfig_path = join(out_dir, "tsconfig.json");
3072
+ await mkdir2(dirname(tsconfig_path), { recursive: true });
3073
+ await writeFile2(tsconfig_path, JSON.stringify({
3067
3074
  compilerOptions: {
3068
3075
  allowImportingTsExtensions: true,
3069
3076
  noEmit: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sandstone-mc/mcdoc-ts-generator",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Generate TypeScript types from Minecraft mcdoc definitions",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -19,7 +19,7 @@
19
19
  "dist"
20
20
  ],
21
21
  "scripts": {
22
- "compile": "bun run ./src/index.ts",
22
+ "compile": "bun run ./src/cli.ts",
23
23
  "build": "bun run build:bundle && bun run build:types",
24
24
  "build:bundle": "bun build ./src/cli.ts --outfile ./dist/cli.js --target node --format esm --packages external && bun build ./src/index.ts --outfile ./dist/index.js --target node --format esm --packages external",
25
25
  "build:types": "tsc --emitDeclarationOnly --declaration --outDir ./dist",