Hello all
I'd like some assistance with getting an editor set up so that I can use auto-completion etc in visual studio code. I'm using mac OS.
I have my dev folder in home (~/nodeDev/matter).
I've installed the development into the node red via npm install ~/nodeDev/matter
(from the .node-red folder).
the development is dependent on @project-chip/matter-node.js and I've installed this with npm install @project-chip/matter-node.js --save
so far so good.
The development is a mix of javascript and typescript. Where I am going wrong is when I try to import classes and variables into code. For example
import { ServerNode } from "@project-chip/matter.js/node";
results in an error "cannot find module '@project-chip/matter.js/node' or its corresponding type declarations."
the folder structure is
โโโ @project-chip
โ โโโ matter-node.js
โ โโโ matter.js
โโโ node-red-contrib-matter.js -> ../../nodeDev/matter
โ โโโ lib
โ โโโ src
โโโ signal-exit
โ โโโ dist
โโโ write-file-atomic
โโโ lib
the file in development is in ../../nodeDev/matter/src
I suspect that something is awry with the package.json or the tsconfig.json files but must admit to being a newbie on both topics. any help gratefully received.
tsconfig.json
/* Dev configuration */
{
"compilerOptions": {
"module": "node16",
"moduleResolution": "node16",
"composite": true,
"forceConsistentCasingInFileNames": true,
"noImplicitAny": true,
"noImplicitOverride": true,
"noUnusedParameters": true,
"noUnusedLocals": true,
"strict": true,
"outDir": "lib"
},
"include": [
"src/*.ts",
"src/*.js",
"src/*.mjs",
],
"allowJs": true
}
package.json
{
"name": "node-red-contrib-matter.js",
"version": "0.1.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "jpadie",
"license": "ISC",
"node-red": {
"nodes": {
"matter-thermostat-j": "src/thermostat.js",
"matter-server-j": "src/server.js"
}
},
"dependencies": {
"@project-chip/matter-node.js": "^0.10.0"
},
"devDependencies": {
"node-red": "^3.0.2"
},
"paths": {
"*": [
"/Users/jpadie/.node-red/node_modules/*",
"*"
]
}
}