@sentio/cli 2.0.0-rc.5 → 2.0.0-rc.6
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/cli.js +6 -1
- package/lib/cli.js.map +1 -1
- package/lib/commands/run-test.d.ts +1 -0
- package/lib/commands/run-test.js +9 -0
- package/lib/commands/run-test.js.map +1 -0
- package/package.json +3 -2
- package/src/cli.ts +5 -1
- package/src/commands/run-test.ts +9 -0
- package/templates/aptos/package.json +1 -1
- package/templates/evm/package.json +1 -1
- package/templates/raw/package.json +1 -1
- package/templates/solana/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -10,6 +10,7 @@ import { runCreate } from './commands/run-create.js';
|
|
|
10
10
|
import { runVersion } from './commands/run-version.js';
|
|
11
11
|
import { runLogin } from './commands/run-login.js';
|
|
12
12
|
import { runUpload } from './commands/run-upload.js';
|
|
13
|
+
import { runTest } from './commands/run-test.js';
|
|
13
14
|
const mainDefinitions = [{ name: 'command', defaultOption: true }];
|
|
14
15
|
const mainOptions = commandLineArgs(mainDefinitions, {
|
|
15
16
|
stopAtFirstUnknown: true,
|
|
@@ -22,11 +23,14 @@ if (mainOptions.command === 'login') {
|
|
|
22
23
|
runLogin(argv);
|
|
23
24
|
}
|
|
24
25
|
else if (mainOptions.command === 'create') {
|
|
25
|
-
runCreate(argv);
|
|
26
|
+
await runCreate(argv);
|
|
26
27
|
}
|
|
27
28
|
else if (mainOptions.command === 'version') {
|
|
28
29
|
runVersion(argv);
|
|
29
30
|
}
|
|
31
|
+
else if (mainOptions.command === 'test') {
|
|
32
|
+
runTest(argv);
|
|
33
|
+
}
|
|
30
34
|
else {
|
|
31
35
|
// For all the commands that need read project configs
|
|
32
36
|
// TODO move them to their own modules
|
|
@@ -105,6 +109,7 @@ function usage() {
|
|
|
105
109
|
'sentio upload\t\t\t\tbuild and upload processor to sentio',
|
|
106
110
|
'sentio gen\t\t\t\tgenerate abi',
|
|
107
111
|
'sentio build\t\t\t\tgenerate abi and build',
|
|
112
|
+
'sentio test\t\t\t\trun tests',
|
|
108
113
|
'sentio version\t\t\tcurrent cli version',
|
|
109
114
|
],
|
|
110
115
|
},
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAC/C,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,IAAI,MAAM,SAAS,CAAA;AAE1B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,eAAe,MAAM,mBAAmB,CAAA;AAC/C,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,MAAM,IAAI,CAAA;AACnB,OAAO,IAAI,MAAM,MAAM,CAAA;AAEvB,OAAO,IAAI,MAAM,SAAS,CAAA;AAE1B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAE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,WAAW,CAAC,OAAO,KAAK,QAAQ,EAAE;QACpC,SAAS,CAAC,eAAe,EAAE,IAAI,CAAC,CAAA;KACjC;SAAM,IAAI,WAAW,CAAC,OAAO,KAAK,OAAO,EAAE;QAC1C,cAAc,CAAC,KAAK,CAAC,CAAA;KACtB;SAAM,IAAI,WAAW,CAAC,OAAO,KAAK,KAAK,EAAE;QACxC,cAAc,CAAC,IAAI,CAAC,CAAA;KACrB;SAAM;QACL,KAAK,EAAE,CAAA;KACR;CACF;AAED,SAAS,KAAK;IACZ,MAAM,KAAK,GAAG,gBAAgB,CAAC;QAC7B;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,8CAA8C;SACxD;QACD;YACE,MAAM,EAAE,OAAO;YACf,OAAO,EAAE;gBACP,kEAAkE;gBAClE,qCAAqC;gBACrC,gDAAgD;gBAChD,2DAA2D;gBAC3D,gCAAgC;gBAChC,4CAA4C;gBAC5C,8BAA8B;gBAC9B,yCAAyC;aAC1C;SACF;KACF,CAAC,CAAA;IACF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC","sourcesContent":["#!/usr/bin/env node\n\nimport commandLineArgs from 'command-line-args'\nimport commandLineUsage from 'command-line-usage'\nimport fs from 'fs'\nimport path from 'path'\n\nimport yaml from 'js-yaml'\nimport { SentioProjectConfig } from './config.js'\nimport chalk from 'chalk'\nimport { buildProcessor } from './build.js'\nimport { runCreate } from './commands/run-create.js'\nimport { runVersion } from './commands/run-version.js'\nimport { runLogin } from './commands/run-login.js'\nimport { runUpload } from './commands/run-upload.js'\nimport { runTest } from './commands/run-test.js'\n\nconst mainDefinitions = [{ name: 'command', defaultOption: true }]\nconst mainOptions = commandLineArgs(mainDefinitions, {\n stopAtFirstUnknown: true,\n})\nconst argv = mainOptions._unknown || []\n\nif (!mainOptions.command) {\n usage()\n}\n\nif (mainOptions.command === 'login') {\n runLogin(argv)\n} else if (mainOptions.command === 'create') {\n await runCreate(argv)\n} else if (mainOptions.command === 'version') {\n runVersion(argv)\n} else if (mainOptions.command === 'test') {\n runTest(argv)\n} else {\n // For all the commands that need read project configs\n // TODO move them to their own modules\n\n // Process configs\n let processorConfig: SentioProjectConfig = { host: '', project: '', build: true, debug: false }\n // Fist step, read from project yaml file\n try {\n console.log(chalk.blue('Loading Process config'))\n // TODO correctly located sentio.yaml\n const pwd = process.cwd()\n const packageJson = path.join(pwd, 'package.json')\n if (!fs.existsSync(packageJson)) {\n console.error('package.json not found, please run this command in the root of your project')\n process.exit(1)\n }\n\n const yamlPath = path.join(pwd, 'sentio.yaml')\n if (!fs.existsSync(yamlPath)) {\n console.error('sentio.yaml not found, please create one according to: TODO docs')\n process.exit(1)\n }\n\n processorConfig = yaml.load(fs.readFileSync('sentio.yaml', 'utf8')) as SentioProjectConfig\n if (!processorConfig.project === undefined) {\n console.error('Config yaml must have contain a valid project identifier')\n process.exit(1)\n }\n if (processorConfig.build === undefined) {\n processorConfig.build = true\n }\n if (!processorConfig.host) {\n processorConfig.host = 'prod'\n }\n if (processorConfig.debug === undefined) {\n processorConfig.debug = false\n }\n\n // if (!processorConfig.source) {\n // processorConfig.source = 'src/processor.ts'\n // }\n // if (!processorConfig.targets) {\n // console.warn('targets is not defined, use EVM as the default target')\n // processorConfig.targets = []\n // }\n // if (processorConfig.targets.length === 0) {\n // // By default evm\n // processorConfig.targets.push({ chain: EVM })\n // }\n } catch (e) {\n console.error(e)\n process.exit(1)\n }\n\n if (mainOptions.command === 'upload') {\n runUpload(processorConfig, argv)\n } else if (mainOptions.command === 'build') {\n buildProcessor(false)\n } else if (mainOptions.command === 'gen') {\n buildProcessor(true)\n } else {\n usage()\n }\n}\n\nfunction usage() {\n const usage = commandLineUsage([\n {\n header: 'Sentio',\n content: 'Login & Manage your project files to Sentio.',\n },\n {\n header: 'Usage',\n content: [\n 'sentio <command> --help\\t\\tshow detail usage of specific command',\n 'sentio login\\t\\t\\t\\tlogin to sentio',\n 'sentio create\\t\\t\\t\\tcreate a template project',\n 'sentio upload\\t\\t\\t\\tbuild and upload processor to sentio',\n 'sentio gen\\t\\t\\t\\tgenerate abi',\n 'sentio build\\t\\t\\t\\tgenerate abi and build',\n 'sentio test\\t\\t\\t\\trun tests',\n 'sentio version\\t\\t\\tcurrent cli version',\n ],\n },\n ])\n console.log(usage)\n process.exit(1)\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runTest(argv: string[]): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { getPackageRoot } from '../utils.js';
|
|
4
|
+
export function runTest(argv) {
|
|
5
|
+
const defaultJest = path.resolve(getPackageRoot('@sentio/sdk'), 'lib/jest.config.js');
|
|
6
|
+
// if config not existed copy that
|
|
7
|
+
execSync(`NODE_OPTIONS=--experimental-vm-modules yarn jest` + argv.join(' '), { stdio: 'inherit' });
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=run-test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-test.js","sourceRoot":"","sources":["../../src/commands/run-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,UAAU,OAAO,CAAC,IAAc;IACpC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,oBAAoB,CAAC,CAAA;IACrF,kCAAkC;IAClC,QAAQ,CAAC,kDAAkD,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAA;AACrG,CAAC","sourcesContent":["import { execSync } from 'child_process'\nimport path from 'path'\nimport { getPackageRoot } from '../utils.js'\n\nexport function runTest(argv: string[]) {\n const defaultJest = path.resolve(getPackageRoot('@sentio/sdk'), 'lib/jest.config.js')\n // if config not existed copy that\n execSync(`NODE_OPTIONS=--experimental-vm-modules yarn jest` + argv.join(' '), { stdio: 'inherit' })\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.6",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"compile": "tsc -p .",
|
|
9
9
|
"build": "yarn compile",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"pub": "yarn build && yarn publish --no-git-tag-version"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
+
"@types/jest": "^29.0.0",
|
|
16
17
|
"command-line-args": "^5.2.1",
|
|
17
18
|
"command-line-usage": "^6.1.3",
|
|
18
19
|
"express": "^4.18.2",
|
|
@@ -24,9 +25,9 @@
|
|
|
24
25
|
"open": "^8.4.0",
|
|
25
26
|
"tsup": "npm:@sentio/tsup@^6.5.0",
|
|
26
27
|
"chalk": "^5.2.0",
|
|
27
|
-
"@types/jest": "^29.0.0",
|
|
28
28
|
"jest": "^29.4.1",
|
|
29
29
|
"ts-jest": "^29.0.5",
|
|
30
|
+
"@jest/types": "^29.4.1",
|
|
30
31
|
"ts-node": "^10.9.1"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
package/src/cli.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { runCreate } from './commands/run-create.js'
|
|
|
13
13
|
import { runVersion } from './commands/run-version.js'
|
|
14
14
|
import { runLogin } from './commands/run-login.js'
|
|
15
15
|
import { runUpload } from './commands/run-upload.js'
|
|
16
|
+
import { runTest } from './commands/run-test.js'
|
|
16
17
|
|
|
17
18
|
const mainDefinitions = [{ name: 'command', defaultOption: true }]
|
|
18
19
|
const mainOptions = commandLineArgs(mainDefinitions, {
|
|
@@ -27,9 +28,11 @@ if (!mainOptions.command) {
|
|
|
27
28
|
if (mainOptions.command === 'login') {
|
|
28
29
|
runLogin(argv)
|
|
29
30
|
} else if (mainOptions.command === 'create') {
|
|
30
|
-
runCreate(argv)
|
|
31
|
+
await runCreate(argv)
|
|
31
32
|
} else if (mainOptions.command === 'version') {
|
|
32
33
|
runVersion(argv)
|
|
34
|
+
} else if (mainOptions.command === 'test') {
|
|
35
|
+
runTest(argv)
|
|
33
36
|
} else {
|
|
34
37
|
// For all the commands that need read project configs
|
|
35
38
|
// TODO move them to their own modules
|
|
@@ -110,6 +113,7 @@ function usage() {
|
|
|
110
113
|
'sentio upload\t\t\t\tbuild and upload processor to sentio',
|
|
111
114
|
'sentio gen\t\t\t\tgenerate abi',
|
|
112
115
|
'sentio build\t\t\t\tgenerate abi and build',
|
|
116
|
+
'sentio test\t\t\t\trun tests',
|
|
113
117
|
'sentio version\t\t\tcurrent cli version',
|
|
114
118
|
],
|
|
115
119
|
},
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { execSync } from 'child_process'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import { getPackageRoot } from '../utils.js'
|
|
4
|
+
|
|
5
|
+
export function runTest(argv: string[]) {
|
|
6
|
+
const defaultJest = path.resolve(getPackageRoot('@sentio/sdk'), 'lib/jest.config.js')
|
|
7
|
+
// if config not existed copy that
|
|
8
|
+
execSync(`NODE_OPTIONS=--experimental-vm-modules yarn jest` + argv.join(' '), { stdio: 'inherit' })
|
|
9
|
+
}
|