Tsdx: README instructions don't work

Created on 26 Jan 2019  ·  6Comments  ·  Source: formium/tsdx

Current Behavior

I'm following the README instructions, and it seems like they're geared towards tsdx being an NPM script in an existing project?

$ cd ~/dev
$ yarn tsdx create my-lib
yarn run v1.13.0
error Couldn't find a package.json file in "/Users/jasonetco/dev"
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I also tried yarn global add tsdx and then running tsdx create my-lib:

Error: /Users/jasonetco/dev/package.json: ENOENT: no such file or directory, open '/Users/jasonetco/dev/package.json'

This even happens when I run tsdx --version.

Expected behavior

I could be misunderstanding the tool, but I'm guessing this should scaffold out the folder? Not sure why it's trying to read an existing package.json.

Your environment

| Software | Version(s) |
| ---------------- | ---------- |
| npm/Yarn | npm: 6.4.1 yarn: 1.13.0 |
| Operating System | MacOS Mojave |

All 6 comments

One sec

Also tried the following, just to see what would happen:

$ mkdir my-lib && cd my-lib && npm init -y && yarn add tsdx && yarn tsdx create my-lib
yarn run v1.13.0
$ /Users/jasonetco/dev/try/node_modules/.bin/tsdx create my-lib
path.js:39
    throw new ERR_INVALID_ARG_TYPE('path', 'string', path);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at assertPath (path.js:39:11)
    at Object.resolve (path.js:1088:7)
    at resolveApp (/Users/jasonetco/dev/try/node_modules/tsdx/lib/index.js:27:41)
    at Object.<anonymous> (/Users/jasonetco/dev/try/node_modules/tsdx/lib/index.js:46:13)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Figured it out

❯ tsdx create my-lib
Bootstrapping new project...
Installing dependencies...

Success!! TSDX just bootstrapped a brand new project for you. To get started, run:

      cd my-lib
      yarn start

😍

npx tsdx create my-lib

Sorry about that! Appreciate the dogfooding!

Was this page helpful?
0 / 5 - 0 ratings