@quantform/create 0.7.0-beta.57 → 0.7.0-beta.58

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/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/lib/index.js ADDED
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
+ return new (P || (P = Promise))(function (resolve, reject) {
6
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10
+ });
11
+ };
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ const child_process_1 = require("child_process");
17
+ const commander_1 = require("commander");
18
+ const edit_json_file_1 = __importDefault(require("edit-json-file"));
19
+ const fs_1 = require("fs");
20
+ const process_1 = require("process");
21
+ const util_1 = require("util");
22
+ const shell = (0, util_1.promisify)(child_process_1.exec);
23
+ commander_1.program
24
+ .name('quantform')
25
+ .description('Setup the quantform project by running a single command.')
26
+ .option('<dir>', 'directory to initialize')
27
+ .action((dir) => __awaiter(void 0, void 0, void 0, function* () {
28
+ yield createDirectory(dir);
29
+ yield addPackageJson();
30
+ yield addDependencies();
31
+ yield addTypescript();
32
+ yield addSWCConfig();
33
+ yield copyTemplateFiles();
34
+ }))
35
+ .parse(process.argv);
36
+ function createDirectory(dir) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ if (dir) {
39
+ (0, fs_1.mkdirSync)(dir);
40
+ (0, process_1.chdir)(dir);
41
+ }
42
+ });
43
+ }
44
+ function addPackageJson() {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ yield shell(`npm init --yes`);
47
+ const config = (0, edit_json_file_1.default)(`./package.json`);
48
+ config.set('main', 'pipeline.js');
49
+ config.set('scripts', {
50
+ live: 'qf live pipeline',
51
+ start: 'qf paper pipeline',
52
+ replay: 'qf replay pipeline',
53
+ pull: 'qf pull pipeline'
54
+ });
55
+ config.save();
56
+ });
57
+ }
58
+ function addTypescript() {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const config = (0, edit_json_file_1.default)(`./tsconfig.json`);
61
+ config.set('compilerOptions.module', 'commonjs');
62
+ config.set('compilerOptions.declaration', true);
63
+ config.set('compilerOptions.removeComments', true);
64
+ config.set('compilerOptions.emitDecoratorMetadata', true);
65
+ config.set('compilerOptions.experimentalDecorators', true);
66
+ config.set('compilerOptions.allowSyntheticDefaultImports', true);
67
+ config.set('compilerOptions.target', 'es2017');
68
+ config.set('compilerOptions.outDir', './lib');
69
+ config.set('compilerOptions.baseUrl', './');
70
+ config.set('compilerOptions.incremental', true);
71
+ config.set('include', ['*.ts', 'src/*']);
72
+ config.set('exclude', ['node_modules', 'test', 'lib', '**/*spec.ts']);
73
+ config.save();
74
+ });
75
+ }
76
+ function addSWCConfig() {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ (0, fs_1.writeFileSync)('./.swcrc', '{}');
79
+ const config = (0, edit_json_file_1.default)(`./.swcrc`);
80
+ config.set('$schema', 'http://json.schemastore.org/swcrc');
81
+ config.set('jsc.parser.syntax', 'typescript');
82
+ config.set('jsc.parser.tsx', false);
83
+ config.set('module.type', 'commonjs');
84
+ config.set('module.strict', false);
85
+ config.set('module.strictMode', true);
86
+ config.set('module.lazy', false);
87
+ config.set('module.noInterop', false);
88
+ config.save();
89
+ });
90
+ }
91
+ function addDependencies() {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ const devDependencies = ['typescript', '@types/node', '@swc/core', 'zod'];
94
+ const dependencies = ['@quantform/core@beta', '@quantform/binance@beta', 'rxjs'];
95
+ for (const dependency of devDependencies) {
96
+ yield shell(`npm add -D ${dependency}`);
97
+ }
98
+ for (const dependency of dependencies) {
99
+ yield shell(`npm add ${dependency}`);
100
+ }
101
+ });
102
+ }
103
+ function copyTemplateFiles() {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ (0, fs_1.mkdirSync)('./src');
106
+ (0, fs_1.copyFileSync)(`${__dirname}/../template/pipeline.ts`, './src/pipeline.ts');
107
+ });
108
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantform/create",
3
- "version": "0.7.0-beta.57",
3
+ "version": "0.7.0-beta.58",
4
4
  "license": "MIT",
5
5
  "author": "Mateusz Majchrzak",
6
6
  "description": "Node.js library for building systematic trading strategies in reactive way.",