我为我们公司创建了一个基本的约曼发电机。它搭建了一个基本的打字稿包。在package.json中,我在文件部分添加了“ generators”文件夹:
"files": [
"generators"
]
但是当我运行“ npm publish”时,仅添加了README.md和index.json。
这是完整的package.json:
{
"name": "generator-comp-package",
"version": "0.0.3",
"description": "Generates an empty comp package",
"homepage": "https://comp.com",
"author": {
"name": "SE",
"email": "SE@comp.com",
"url": "https://comp"
},
"files": [
"generators"
],
"main": "app/index.js",
"keywords": [
"mindmotiv",
"package",
"yeoman-generator"
],
"devDependencies": {
"yeoman-test": "^1.7.0",
"yeoman-assert": "^3.1.0",
"eslint": "^5.9.0",
"prettier": "^1.15.2",
"husky": "^1.2.0",
"lint-staged": "^8.1.0",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-prettier": "^3.0.0",
"eslint-config-xo": "^0.25.0",
"jest": "^23.5.0"
},
"engines": {
"npm": ">= 4.0.0"
},
"dependencies": {
"yeoman-generator": "^2.0.1",
"chalk": "^2.1.0",
"yosay": "^2.0.1"
},
"jest": {
"testEnvironment": "node"
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
],
"*.json": [
"prettier --write",
"git add"
]
},
"eslintConfig": {
"extends": [
"xo",
"prettier"
],
"env": {
"jest": true,
"node": true
},
"rules": {
"prettier/prettier": "error"
},
"plugins": [
"prettier"
]
},
"scripts": {
"pretest": "eslint .",
"test": "jest"
},
"private": false,
"publishConfig": {
"registry": "https://comp.com"
}
}
因为.gitignore或.npmignore不存在。上面的代码是用yeoman generator-generator生成的。