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

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.js CHANGED
@@ -19,11 +19,12 @@ const edit_json_file_1 = __importDefault(require("edit-json-file"));
19
19
  const fs_1 = require("fs");
20
20
  const process_1 = require("process");
21
21
  const util_1 = require("util");
22
+ const path_1 = require("path");
22
23
  const shell = (0, util_1.promisify)(child_process_1.exec);
23
24
  commander_1.program
24
25
  .name('quantform')
25
26
  .description('Setup the quantform project by running a single command.')
26
- .option('<dir>', 'directory to initialize')
27
+ .argument('<dir>', 'directory to initialize', './')
27
28
  .action((dir) => __awaiter(void 0, void 0, void 0, function* () {
28
29
  yield createDirectory(dir);
29
30
  yield addPackageJson();
@@ -35,7 +36,7 @@ commander_1.program
35
36
  .parse(process.argv);
36
37
  function createDirectory(dir) {
37
38
  return __awaiter(this, void 0, void 0, function* () {
38
- if (dir) {
39
+ if ((0, path_1.basename)(dir) != '' && (0, path_1.basename)(dir) != '.') {
39
40
  (0, fs_1.mkdirSync)(dir);
40
41
  (0, process_1.chdir)(dir);
41
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantform/create",
3
- "version": "0.7.0-beta.58",
3
+ "version": "0.7.0-beta.59",
4
4
  "license": "MIT",
5
5
  "author": "Mateusz Majchrzak",
6
6
  "description": "Node.js library for building systematic trading strategies in reactive way.",
package/src/index.ts CHANGED
@@ -6,13 +6,14 @@ import editJsonFile from 'edit-json-file';
6
6
  import { copyFileSync, mkdirSync, writeFileSync } from 'fs';
7
7
  import { chdir } from 'process';
8
8
  import { promisify } from 'util';
9
+ import { basename } from 'path';
9
10
 
10
11
  const shell = promisify(exec);
11
12
 
12
13
  program
13
14
  .name('quantform')
14
15
  .description('Setup the quantform project by running a single command.')
15
- .option('<dir>', 'directory to initialize')
16
+ .argument('<dir>', 'directory to initialize', './')
16
17
  .action(async dir => {
17
18
  await createDirectory(dir);
18
19
  await addPackageJson();
@@ -23,8 +24,8 @@ program
23
24
  })
24
25
  .parse(process.argv);
25
26
 
26
- async function createDirectory(dir?: string) {
27
- if (dir) {
27
+ async function createDirectory(dir: string) {
28
+ if (basename(dir) != '' && basename(dir) != '.') {
28
29
  mkdirSync(dir);
29
30
  chdir(dir);
30
31
  }