@clarigen/cli 0.2.7 → 0.3.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.
- package/dist/clarinet-config.js +4 -2
- package/dist/generate/files.js +11 -1
- package/package.json +4 -3
- package/src/clarinet-config.ts +4 -7
- package/src/generate/files.ts +12 -1
package/dist/clarinet-config.js
CHANGED
|
@@ -8,14 +8,16 @@ const wallet_sdk_1 = require("@stacks/wallet-sdk");
|
|
|
8
8
|
async function getClarinetDevConfig(folder) {
|
|
9
9
|
const baseConfigPath = path_1.resolve(folder, 'settings', 'Devnet.toml');
|
|
10
10
|
const configContents = await promises_1.readFile(baseConfigPath, { encoding: 'utf-8' });
|
|
11
|
-
const config = j_toml_1.parse(configContents, 1.0, '\n',
|
|
11
|
+
const config = j_toml_1.parse(configContents, 1.0, '\n', true, {
|
|
12
|
+
longer: true,
|
|
13
|
+
});
|
|
12
14
|
return config;
|
|
13
15
|
}
|
|
14
16
|
exports.getClarinetDevConfig = getClarinetDevConfig;
|
|
15
17
|
async function getClarinetConfig(folder) {
|
|
16
18
|
const baseConfigPath = path_1.resolve(folder, 'Clarinet.toml');
|
|
17
19
|
const configContents = await promises_1.readFile(baseConfigPath, { encoding: 'utf-8' });
|
|
18
|
-
const config = j_toml_1.parse(configContents, 1.0, '\n',
|
|
20
|
+
const config = j_toml_1.parse(configContents, 1.0, '\n', true);
|
|
19
21
|
return config;
|
|
20
22
|
}
|
|
21
23
|
exports.getClarinetConfig = getClarinetConfig;
|
package/dist/generate/files.js
CHANGED
|
@@ -103,8 +103,18 @@ const generateProjectIndexFile = (config) => {
|
|
|
103
103
|
const contractMap = [];
|
|
104
104
|
let accounts = '';
|
|
105
105
|
if ('accounts' in config) {
|
|
106
|
+
const accountLines = Object.keys(config.accounts).map((key) => {
|
|
107
|
+
const account = config.accounts[key];
|
|
108
|
+
return `"${key}": {
|
|
109
|
+
mnemonic: "${account.mnemonic}",
|
|
110
|
+
balance: ${account.balance.toString()}n,
|
|
111
|
+
address: "${account.address}",
|
|
112
|
+
},`;
|
|
113
|
+
});
|
|
106
114
|
accounts = `\n\n// prettier-ignore
|
|
107
|
-
export const accounts =
|
|
115
|
+
export const accounts = {
|
|
116
|
+
${accountLines.join('\n ')}
|
|
117
|
+
};`;
|
|
108
118
|
}
|
|
109
119
|
config.contracts.forEach((contract) => {
|
|
110
120
|
const contractName = core_1.getContractNameFromPath(contract.file);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@clarigen/cli",
|
|
3
3
|
"description": "A CLI for generating a Typescript interface for a Clarity contract.",
|
|
4
4
|
"author": "Hank Stoever",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.3.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"files": [
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"build": "rm -rf dist && tsc -b",
|
|
22
22
|
"test": "tsdx test",
|
|
23
23
|
"lint": "tsdx lint",
|
|
24
|
-
"typecheck": "tsc --noEmit"
|
|
24
|
+
"typecheck": "tsc --noEmit",
|
|
25
|
+
"prepublishOnly": "yarn build"
|
|
25
26
|
},
|
|
26
27
|
"bin": {
|
|
27
28
|
"clarigen": "./bin/run"
|
|
@@ -58,5 +59,5 @@
|
|
|
58
59
|
"publishConfig": {
|
|
59
60
|
"access": "public"
|
|
60
61
|
},
|
|
61
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "1a82667ab26f312b401cbbd84aca4d1879e7e1a6"
|
|
62
63
|
}
|
package/src/clarinet-config.ts
CHANGED
|
@@ -24,12 +24,9 @@ export async function getClarinetDevConfig(
|
|
|
24
24
|
): Promise<ClarinetDevConfig> {
|
|
25
25
|
const baseConfigPath = resolve(folder, 'settings', 'Devnet.toml');
|
|
26
26
|
const configContents = await readFile(baseConfigPath, { encoding: 'utf-8' });
|
|
27
|
-
const config = (parse(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'\n',
|
|
31
|
-
false
|
|
32
|
-
) as unknown) as ClarinetDevConfig;
|
|
27
|
+
const config = (parse(configContents, 1.0, '\n', true, {
|
|
28
|
+
longer: true,
|
|
29
|
+
}) as unknown) as ClarinetDevConfig;
|
|
33
30
|
return config;
|
|
34
31
|
}
|
|
35
32
|
|
|
@@ -49,7 +46,7 @@ export async function getClarinetConfig(folder: string) {
|
|
|
49
46
|
configContents,
|
|
50
47
|
1.0,
|
|
51
48
|
'\n',
|
|
52
|
-
|
|
49
|
+
true
|
|
53
50
|
) as unknown) as ClarinetConfig;
|
|
54
51
|
return config;
|
|
55
52
|
}
|
package/src/generate/files.ts
CHANGED
|
@@ -136,8 +136,19 @@ export const generateProjectIndexFile = (config: ConfigFile) => {
|
|
|
136
136
|
|
|
137
137
|
let accounts = '';
|
|
138
138
|
if ('accounts' in config) {
|
|
139
|
+
const accountLines = Object.keys(config.accounts).map((key) => {
|
|
140
|
+
const account = config.accounts[key];
|
|
141
|
+
return `"${key}": {
|
|
142
|
+
mnemonic: "${account.mnemonic}",
|
|
143
|
+
balance: ${account.balance.toString()}n,
|
|
144
|
+
address: "${account.address}",
|
|
145
|
+
},`;
|
|
146
|
+
});
|
|
147
|
+
|
|
139
148
|
accounts = `\n\n// prettier-ignore
|
|
140
|
-
export const accounts =
|
|
149
|
+
export const accounts = {
|
|
150
|
+
${accountLines.join('\n ')}
|
|
151
|
+
};`;
|
|
141
152
|
}
|
|
142
153
|
|
|
143
154
|
config.contracts.forEach((contract) => {
|