Skip to content

Compiler won't work outside of src repo #174

@madhavajay

Description

@madhavajay

I am trying to use the capnpc-ts compiler but it only works if I run it from inside a checkout of https://github.com/jdiaz5513/capnp-ts.

For example:

$ pwd
/Users/madhavajay/dev/capnp-ts
$ capnpc -o ./node_modules/capnpc-ts/bin/capnpc-ts.js address.capnp
$ ls | grep address
address.capnp
address.capnp.d.ts
address.capnp.js

However if I use either:

$ npm install -g capnpc-ts
$ pwd
/Users/madhavajay/dev/my_project
$ capnpc -o ts address.capnp

or the same with:

$ capnpc -o ts./node_modules/capnpc-ts/bin/capnpc-ts.js address.capnp

Error:

DeprecationWarning: 'createTypeReferenceNode' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createIdentifier' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createToken' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createThis' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createNamespaceImport' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createImportClause' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createLiteral' has been deprecated since v4.0.0. Use `factory.createStringLiteral`, `factory.createStringLiteralFromNode`, `factory.createNumericLiteral`, `factory.createBigIntLiteral`, `factory.createTrue`, `factory.createFalse`, or the factory supplied by your transformation context instead.
DeprecationWarning: 'createImportDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createExpressionStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createVariableDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createVariableDeclarationList' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createVariableStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createPropertyAssignment' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createNumericLiteral' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createNewExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createObjectLiteralExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createPropertyDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: '' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createCallExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createReturnStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createBlock' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createMethodDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createParameterDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createBinaryExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createExpressionWithTypeArguments' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createHeritageClause' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createClassDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
TypeError: Cannot create property 'pos' on string 'Foo'
    at setTextRangePos (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:21342:19)
    at Object.setTextRangePosEnd (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:21360:32)
    at createNodeArray (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:22985:16)
    at asNodeArray (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:27581:28)
    at createBaseGenericNamedDeclaration (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:23037:35)
    at createBaseInterfaceOrClassLikeDeclaration (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:23072:24)
    at createBaseClassLikeDeclaration (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:23078:24)
    at Object.createClassDeclaration (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:25474:24)
    at Object.createClassDeclaration (/Users/madhavajay/my_proj/node_modules/typescript/lib/typescript.js:3138:29)
    at generateStructNode (/Users/madhavajay/my_proj/node_modules/capnpc-ts/src/generators.js:488:36)
./node_modules/capnpc-ts/bin/capnpc-ts.js: plugin failed: exit code 1

I have tried copying a few of the tsconfig files over but I think im missing something more obvious.

package.json

{
  "name": "js",
  "version": "1.0.0",
  "description": "",
  "main": "testing.js",
  "dependencies": {
    "capnp-ts": "^0.7.0",
    "capnpc-ts": "^0.7.0",
    "fetch": "^1.1.0",
    "goog": "^0.2.1",
    "node-fetch": "^3.1.0",
    "system-sleep": "^1.3.7"
  },
  "devDependencies": {
    "ts-node": "^9.1.1",
    "typescript": "^4.2.4"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "type": "module",
  "author": "",
  "license": "ISC"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions