@cosmwasm/ts-codegen 1.1.0 → 1.2.0
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.
@@ -1,8 +1,33 @@
|
|
1
1
|
import { join, dirname, basename, extname } from "path";
|
2
|
+
import { readFileSync, existsSync } from "fs";
|
2
3
|
import { sync as mkdirp } from "mkdirp";
|
3
|
-
import pkg from "../../package.json";
|
4
4
|
import { writeContentToFile } from "../utils/files";
|
5
5
|
import { contractContextBase, contractContextBaseShortHandCtor, contractsContextTSX, } from "../helpers";
|
6
|
+
// need to search due to the dist/ folder and src/, etc.
|
7
|
+
function findPackageJson(currentDir) {
|
8
|
+
const filePath = join(currentDir, 'package.json');
|
9
|
+
// Check if package.json exists in the current directory
|
10
|
+
if (existsSync(filePath)) {
|
11
|
+
return filePath;
|
12
|
+
}
|
13
|
+
// Get the parent directory
|
14
|
+
const parentDir = dirname(currentDir);
|
15
|
+
// If reached the root directory, package.json is not found
|
16
|
+
if (parentDir === currentDir) {
|
17
|
+
throw new Error('package.json not found in any parent directory');
|
18
|
+
}
|
19
|
+
// Recursively look in the parent directory
|
20
|
+
return findPackageJson(parentDir);
|
21
|
+
}
|
22
|
+
function readAndParsePackageJson() {
|
23
|
+
// Start searching from the current directory
|
24
|
+
const pkgPath = findPackageJson(__dirname);
|
25
|
+
// Read and parse the package.json
|
26
|
+
const str = readFileSync(pkgPath, 'utf8');
|
27
|
+
const pkg = JSON.parse(str);
|
28
|
+
return pkg;
|
29
|
+
}
|
30
|
+
const pkg = readAndParsePackageJson();
|
6
31
|
const version = process.env.NODE_ENV === "test" ? "latest" : pkg.version;
|
7
32
|
const header = `/**
|
8
33
|
* This file and any referenced files were automatically generated by ${pkg.name}@${version}
|
@@ -1,17 +1,39 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
3
|
exports.createHelpers = void 0;
|
7
4
|
const path_1 = require("path");
|
5
|
+
const fs_1 = require("fs");
|
8
6
|
const mkdirp_1 = require("mkdirp");
|
9
|
-
const package_json_1 = __importDefault(require("../../package.json"));
|
10
7
|
const files_1 = require("../utils/files");
|
11
8
|
const helpers_1 = require("../helpers");
|
12
|
-
|
9
|
+
// need to search due to the dist/ folder and src/, etc.
|
10
|
+
function findPackageJson(currentDir) {
|
11
|
+
const filePath = (0, path_1.join)(currentDir, 'package.json');
|
12
|
+
// Check if package.json exists in the current directory
|
13
|
+
if ((0, fs_1.existsSync)(filePath)) {
|
14
|
+
return filePath;
|
15
|
+
}
|
16
|
+
// Get the parent directory
|
17
|
+
const parentDir = (0, path_1.dirname)(currentDir);
|
18
|
+
// If reached the root directory, package.json is not found
|
19
|
+
if (parentDir === currentDir) {
|
20
|
+
throw new Error('package.json not found in any parent directory');
|
21
|
+
}
|
22
|
+
// Recursively look in the parent directory
|
23
|
+
return findPackageJson(parentDir);
|
24
|
+
}
|
25
|
+
function readAndParsePackageJson() {
|
26
|
+
// Start searching from the current directory
|
27
|
+
const pkgPath = findPackageJson(__dirname);
|
28
|
+
// Read and parse the package.json
|
29
|
+
const str = (0, fs_1.readFileSync)(pkgPath, 'utf8');
|
30
|
+
const pkg = JSON.parse(str);
|
31
|
+
return pkg;
|
32
|
+
}
|
33
|
+
const pkg = readAndParsePackageJson();
|
34
|
+
const version = process.env.NODE_ENV === "test" ? "latest" : pkg.version;
|
13
35
|
const header = `/**
|
14
|
-
* This file and any referenced files were automatically generated by ${
|
36
|
+
* This file and any referenced files were automatically generated by ${pkg.name}@${version}
|
15
37
|
* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
|
16
38
|
* and run the transpile command or yarn proto command to regenerate this bundle.
|
17
39
|
*/
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cosmwasm/ts-codegen",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.2.0",
|
4
4
|
"description": "@cosmwasm/ts-codegen converts your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.",
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
6
6
|
"homepage": "https://github.com/cosmwasm/ts-codegen",
|
@@ -63,5 +63,5 @@
|
|
63
63
|
"smart contracts",
|
64
64
|
"codegen"
|
65
65
|
],
|
66
|
-
"gitHead": "
|
66
|
+
"gitHead": "e105783253da5352163be0bb2fc4ac65b027fa94"
|
67
67
|
}
|