@sentio/cli 2.0.0-rc.2 → 2.0.0-rc.4
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/lib/build.js +1 -10
- package/lib/build.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +15 -3
- package/lib/utils.js.map +1 -1
- package/package.json +6 -5
- package/src/build.ts +1 -13
- package/src/index.ts +1 -0
- package/src/utils.ts +18 -3
package/lib/build.js
CHANGED
|
@@ -3,16 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import { exec } from 'child_process';
|
|
5
5
|
import * as process from 'process';
|
|
6
|
-
import {
|
|
7
|
-
const require = createRequire(import.meta.url);
|
|
8
|
-
function getPackageRoot(pkgId) {
|
|
9
|
-
const m = require.resolve(pkgId);
|
|
10
|
-
let dir = path.dirname(m);
|
|
11
|
-
while (!fs.existsSync(path.join(dir, 'package.json'))) {
|
|
12
|
-
dir = path.dirname(dir);
|
|
13
|
-
}
|
|
14
|
-
return dir;
|
|
15
|
-
}
|
|
6
|
+
import { getPackageRoot } from './utils.js';
|
|
16
7
|
export async function buildProcessor(onlyGen) {
|
|
17
8
|
if (!onlyGen) {
|
|
18
9
|
await installDeps();
|
package/lib/build.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACpC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAA;AAClC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../src/build.ts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K,UAAU,QAAQ,CAAC,GAAW,EAAE,QAAgB;IACnD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAA;IACvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAA;IAE5C,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QAClC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAA;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;KAChB;IAED,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IACjC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAEjC,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC5B,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC5B,CAAC,CAAC,CAAA;IAEF,IAAI,KAAK,CAAC,QAAQ,EAAE;QAClB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAA;QAC9C,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;KAC7B;IACD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAA;IAC9C,OAAO,CAAC,GAAG,EAAE,CAAA;AACf,CAAC","sourcesContent":["import chalk from 'chalk'\nimport path from 'path'\nimport fs from 'fs'\nimport { exec } from 'child_process'\nimport * as process from 'process'\nimport { getPackageRoot } from './utils.js'\n\nexport async function buildProcessor(onlyGen: boolean) {\n if (!onlyGen) {\n await installDeps()\n }\n\n // targets.forEach(async (target) => await buildProcessorForTarget(onlyGen, target))\n // for (const target) {\n await buildProcessorForTarget(onlyGen)\n // }\n\n if (!onlyGen) {\n let WEBPACK_CONFIG: string\n try {\n WEBPACK_CONFIG = path.resolve(getPackageRoot('@sentio/sdk'), 'lib/tsup.config.ts')\n } catch (e) {\n console.error(chalk.red(\"Wrong CLI version for sdk, can't find tsup.config.ts\"))\n process.exit(1)\n }\n await execStep('yarn tsc -p .', 'Compile')\n await execStep('yarn tsup --config=' + WEBPACK_CONFIG, 'Packaging')\n }\n}\n\nasync function buildProcessorForTarget(onlyGen: boolean) {\n await codeGenEthersProcessor(path.join('abis', 'evm'))\n\n try {\n // @ts-ignore dynamic import\n const codegen = await import('@sentio/sdk-solana/codegen')\n codegen.codeGenSolanaProcessor(path.join('abis', 'solana'))\n } catch (e) {}\n\n try {\n // @ts-ignore dynamic import\n const codegen = await import('@sentio/sdk-aptos/codegen')\n codegen.codeGenAptosProcessor(path.join('abis', 'aptos'))\n } catch (e) {}\n\n if (onlyGen) {\n return\n }\n}\n\nasync function installDeps() {\n await execStep('yarn install --ignore-scripts', 'Yarn Install')\n}\n\nexport async function codeGenEthersProcessor(\n abisDir: string,\n ETHERS_TARGET = path.resolve(getPackageRoot('@sentio/sdk'), 'lib/target-ethers-sentio/index.cjs'),\n outDir = 'src/types/internal'\n) {\n if (!fs.existsSync(abisDir)) {\n return\n }\n\n let haveJson = false\n const files = fs.readdirSync(abisDir)\n for (const file of files) {\n if (file.toLowerCase().endsWith('.json')) {\n haveJson = true\n break\n }\n }\n if (!haveJson) {\n return\n }\n\n console.log(chalk.green('Generated Types for EVM'))\n\n // TODO this will fail during postinstall, need to locate real typechain path\n await execStep(\n 'yarn typechain --target ' + ETHERS_TARGET + ` --out-dir ${outDir} ${path.join(abisDir, '*.json')}`,\n 'Type definitions gen'\n )\n}\n\nasync function execStep(cmd: string, stepName: string) {\n const child = exec(cmd)\n console.log(chalk.blue(stepName + ' begin'))\n\n if (!child.stdout || !child.stderr) {\n console.error(chalk.red(stepName + ' failed'))\n process.exit(1)\n }\n\n child.stdout.pipe(process.stdout)\n child.stderr.pipe(process.stderr)\n\n await new Promise((resolve) => {\n child.on('close', resolve)\n })\n\n if (child.exitCode) {\n console.error(chalk.red(stepName + ' failed'))\n process.exit(child.exitCode)\n }\n console.log(chalk.blue(stepName + ' success'))\n console.log()\n}\n"]}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"","sourcesContent":["export {}\n"]}
|
package/lib/utils.d.ts
CHANGED
package/lib/utils.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { createRequire } from 'module';
|
|
4
|
+
import url from 'url';
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
const PACKAGE_JSON = 'package.json';
|
|
7
|
+
export function getPackageRoot(pkgId) {
|
|
8
|
+
const m = require.resolve(pkgId);
|
|
9
|
+
let dir = path.dirname(m);
|
|
10
|
+
while (!fs.existsSync(path.join(dir, PACKAGE_JSON))) {
|
|
11
|
+
dir = path.dirname(dir);
|
|
12
|
+
}
|
|
13
|
+
return dir;
|
|
14
|
+
}
|
|
3
15
|
export function getCliVersion() {
|
|
4
|
-
const packageJsonPath =
|
|
16
|
+
const packageJsonPath = url.fileURLToPath(new URL('../' + PACKAGE_JSON, import.meta.url));
|
|
5
17
|
const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf-8');
|
|
6
18
|
const packageJson = JSON.parse(packageJsonContent);
|
|
7
19
|
return packageJson.version;
|
|
8
20
|
}
|
|
9
21
|
export function getSdkVersion() {
|
|
10
22
|
try {
|
|
11
|
-
const packageJsonPath =
|
|
12
|
-
const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf-8');
|
|
23
|
+
const packageJsonPath = getPackageRoot('@sentio/sdk');
|
|
24
|
+
const packageJsonContent = fs.readFileSync(path.join(packageJsonPath, PACKAGE_JSON), 'utf-8');
|
|
13
25
|
const packageJson = JSON.parse(packageJsonContent);
|
|
14
26
|
return packageJson.version;
|
|
15
27
|
}
|
package/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,IAAI,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAA;AACzB,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,GAAG,MAAM,KAAK,CAAA;AAErB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9C,MAAM,YAAY,GAAG,cAAc,CAAA;AAEnC,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAEhC,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IACzB,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE;QACnD,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;KACxB;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM,eAAe,GAAG,GAAG,CAAC,aAAa,CAAC,IAAI,GAAG,CAAC,KAAK,GAAG,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IACzF,MAAM,kBAAkB,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAA;IACpE,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;IAElD,OAAO,WAAW,CAAC,OAAO,CAAA;AAC5B,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,IAAI;QACF,MAAM,eAAe,GAAG,cAAc,CAAC,aAAa,CAAC,CAAA;QACrD,MAAM,kBAAkB,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,EAAE,OAAO,CAAC,CAAA;QAC7F,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;QAClD,OAAO,WAAW,CAAC,OAAO,CAAA;KAC3B;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,SAAS,CAAA;KACjB;AACH,CAAC","sourcesContent":["import fs from 'fs-extra'\nimport path from 'path'\nimport { createRequire } from 'module'\nimport url from 'url'\n\nconst require = createRequire(import.meta.url)\nconst PACKAGE_JSON = 'package.json'\n\nexport function getPackageRoot(pkgId: string): string {\n const m = require.resolve(pkgId)\n\n let dir = path.dirname(m)\n while (!fs.existsSync(path.join(dir, PACKAGE_JSON))) {\n dir = path.dirname(dir)\n }\n return dir\n}\n\nexport function getCliVersion() {\n const packageJsonPath = url.fileURLToPath(new URL('../' + PACKAGE_JSON, import.meta.url))\n const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf-8')\n const packageJson = JSON.parse(packageJsonContent)\n\n return packageJson.version\n}\n\nexport function getSdkVersion() {\n try {\n const packageJsonPath = getPackageRoot('@sentio/sdk')\n const packageJsonContent = fs.readFileSync(path.join(packageJsonPath, PACKAGE_JSON), 'utf-8')\n const packageJson = JSON.parse(packageJsonContent)\n return packageJson.version\n } catch (e) {\n return undefined\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"version": "2.0.0-rc.
|
|
6
|
+
"version": "2.0.0-rc.4",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"compile": "tsc -p .",
|
|
9
9
|
"build": "yarn compile",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"latest-version": "^7.0.0",
|
|
23
23
|
"node-fetch": "^3.3.0",
|
|
24
24
|
"open": "^8.4.0",
|
|
25
|
-
"tsup": "
|
|
25
|
+
"tsup": "npm:@sentio/tsup@^6.5.0",
|
|
26
26
|
"chalk": "^5.2.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -38,9 +38,10 @@
|
|
|
38
38
|
"bin": {
|
|
39
39
|
"sentio": "./lib/cli.js"
|
|
40
40
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
41
|
+
"types": "module",
|
|
42
|
+
"exports": {
|
|
43
|
+
".": "./lib/index.js"
|
|
44
|
+
},
|
|
44
45
|
"files": [
|
|
45
46
|
"{lib,src,templates}",
|
|
46
47
|
"!{lib,src}/tests",
|
package/src/build.ts
CHANGED
|
@@ -3,19 +3,7 @@ import path from 'path'
|
|
|
3
3
|
import fs from 'fs'
|
|
4
4
|
import { exec } from 'child_process'
|
|
5
5
|
import * as process from 'process'
|
|
6
|
-
import {
|
|
7
|
-
const require = createRequire(import.meta.url)
|
|
8
|
-
|
|
9
|
-
function getPackageRoot(pkgId: string): string {
|
|
10
|
-
const m = require.resolve(pkgId)
|
|
11
|
-
|
|
12
|
-
let dir = path.dirname(m)
|
|
13
|
-
while (!fs.existsSync(path.join(dir, 'package.json'))) {
|
|
14
|
-
dir = path.dirname(dir)
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return dir
|
|
18
|
-
}
|
|
6
|
+
import { getPackageRoot } from './utils.js'
|
|
19
7
|
|
|
20
8
|
export async function buildProcessor(onlyGen: boolean) {
|
|
21
9
|
if (!onlyGen) {
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/src/utils.ts
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import fs from 'fs-extra'
|
|
2
2
|
import path from 'path'
|
|
3
|
+
import { createRequire } from 'module'
|
|
4
|
+
import url from 'url'
|
|
5
|
+
|
|
6
|
+
const require = createRequire(import.meta.url)
|
|
7
|
+
const PACKAGE_JSON = 'package.json'
|
|
8
|
+
|
|
9
|
+
export function getPackageRoot(pkgId: string): string {
|
|
10
|
+
const m = require.resolve(pkgId)
|
|
11
|
+
|
|
12
|
+
let dir = path.dirname(m)
|
|
13
|
+
while (!fs.existsSync(path.join(dir, PACKAGE_JSON))) {
|
|
14
|
+
dir = path.dirname(dir)
|
|
15
|
+
}
|
|
16
|
+
return dir
|
|
17
|
+
}
|
|
3
18
|
|
|
4
19
|
export function getCliVersion() {
|
|
5
|
-
const packageJsonPath =
|
|
20
|
+
const packageJsonPath = url.fileURLToPath(new URL('../' + PACKAGE_JSON, import.meta.url))
|
|
6
21
|
const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf-8')
|
|
7
22
|
const packageJson = JSON.parse(packageJsonContent)
|
|
8
23
|
|
|
@@ -11,8 +26,8 @@ export function getCliVersion() {
|
|
|
11
26
|
|
|
12
27
|
export function getSdkVersion() {
|
|
13
28
|
try {
|
|
14
|
-
const packageJsonPath =
|
|
15
|
-
const packageJsonContent = fs.readFileSync(packageJsonPath, 'utf-8')
|
|
29
|
+
const packageJsonPath = getPackageRoot('@sentio/sdk')
|
|
30
|
+
const packageJsonContent = fs.readFileSync(path.join(packageJsonPath, PACKAGE_JSON), 'utf-8')
|
|
16
31
|
const packageJson = JSON.parse(packageJsonContent)
|
|
17
32
|
return packageJson.version
|
|
18
33
|
} catch (e) {
|