Looking to enhance my skills in creating npm packages with TypeScript. I have a small project available at https://www.npmjs.com/package/lynda-copy-course/, and so far, the project structure is successful in:
- being executable from the command line after
npm install -g lynda-copy-course
- working seamlessly within another JavaScript/TypeScript project after
npm install -s lynda-copy-course
- making its type definitions accessible to projects that use it as an npm dependency
The only challenge remaining is that when other projects consume this package, they do not recognize the JSDoc style comments present in the source code.
How can I set up my project (package.json
, tsconfig.json
, etc.) to ensure that consuming packages can interpret my JSDoc comments?
Current content of my package.json
:
{
"name": "lynda-copy-course",
"version": "2.1.7",
"bin": {
"lynda-copy-course": "./bin/lynda-copy-course.js"
},
"main": "./src/index.js",
"types": "./src/index.d.ts",
"dependencies": {
"inquirer": "^3.0.6",
"lodash": "^4.17.4",
"minimist": "^1.2.0",
"ncp": "^2.0.0",
"sqlite3": "^3.1.8"
}
}
Current configuration in my tsconfig.json
:
{
"compilerOptions": {
"declaration": true,
"module": "commonjs",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true
},
"include": [
"src/**/*",
"bin/**/*"
],
"exclude": [
"node_modules",
"**/*.spec.ts"
],
"compileOnSave": true,
"typeAcquisition": {
"enable": true
}
}
Link to Github repository at the time of writing: here.