skip folder w'o package.json; restrict linter to src folders

This commit is contained in:
Jörg Breitbart
2019-10-25 18:07:32 +02:00
parent 25c18e8e07
commit 6f8cbc56eb
2 changed files with 13 additions and 4 deletions
+12 -3
View File
@@ -22,9 +22,18 @@ if (fs.existsSync(addonsPath)) {
const addonPath = path.join(addonsPath, folder); const addonPath = path.join(addonsPath, folder);
// install only if there are dependencies listed // install only if there are dependencies listed
const packageJson = require(path.join(addonPath, 'package.json')); // also skip addon if it does not contain any package.json
if ((packageJson.devDependencies && Object.keys(packageJson.devDependencies).length) // (might happen after branch switches)
|| (packageJson.dependencies && Object.keys(packageJson.dependencies).length)) let packageJson;
try {
packageJson = require(path.join(addonPath, 'package.json'));
} catch (e) {}
if (packageJson
&& (
(packageJson.devDependencies && Object.keys(packageJson.devDependencies).length)
|| (packageJson.dependencies && Object.keys(packageJson.dependencies).length)
)
)
{ {
console.log('Preparing', folder); console.log('Preparing', folder);
if (hasYarn) { if (hasYarn) {
+1 -1
View File
@@ -12,7 +12,7 @@
"prepackage": "npm run build", "prepackage": "npm run build",
"package": "webpack", "package": "webpack",
"start": "node demo/start", "start": "node demo/start",
"lint": "tslint 'src/**/*.ts' 'addons/**/*.ts'", "lint": "tslint 'src/**/*.ts' 'addons/*/src/**/*.ts'",
"test": "npm run test-unit", "test": "npm run test-unit",
"posttest": "npm run lint", "posttest": "npm run lint",
"test-api": "mocha \"**/*.api.js\"", "test-api": "mocha \"**/*.api.js\"",