Skip to content

Commit 4fec827

Browse files
committed
fix: skip deprecated plugins. better error handling when no badges found.
1 parent eea2ea6 commit 4fec827

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

lib/checker.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ export async function run() {
7070
for (let index = 0; index < plugins.length; index++) {
7171
const plugin = plugins[index];
7272
Logger.log(`Start check ${plugin.name}`);
73+
if (plugin.isDeprecated) {
74+
Logger.log('Plugin is deprecated. Skipping.');
75+
continue;
76+
}
7377

7478
// Test if the plugin builds when added to an app
7579
await ProjectService.prepareProject(plugin);

lib/project.service.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export namespace ProjectService {
3939
await _copyTestProject(testProject);
4040
await _installPlugin(plugin, testProject);
4141
} catch (errExec) {
42-
Logger.error(JSON.stringify(errExec));
42+
Logger.error('Error while preparing project:' + errExec && errExec.message);
4343
}
4444
}
4545

@@ -52,7 +52,7 @@ export namespace ProjectService {
5252
});
5353
await _removeDirectory(path.join(testDirectory, testProject));
5454
} catch (errExec) {
55-
Logger.error(JSON.stringify(errExec));
55+
Logger.error('Error while cleaning project:' + errExec && errExec.message);
5656
}
5757
}
5858

@@ -95,21 +95,21 @@ export namespace ProjectService {
9595
const result = { android: false, ios: false };
9696
let skipBuild = false;
9797
try {
98-
skipBuild = !plugin.badges.androidVersion && plugin.badges.iosVersion;
98+
skipBuild = !plugin.badges || (!plugin.badges.androidVersion && plugin.badges.iosVersion);
9999
if (!skipBuild && options.android) {
100100
result.android = !!(await _buildProject(testProject, 'android', options.android));
101101
} else {
102102
Logger.error('Skipping android build! Plugin only has ios support or no options supplied.');
103103
}
104104

105-
skipBuild = !plugin.badges.iosVersion && plugin.badges.androidVersion;
105+
skipBuild = !plugin.badges || (!plugin.badges.iosVersion && plugin.badges.androidVersion);
106106
if (!skipBuild && options.ios) {
107107
result.ios = !!(await _buildProject(testProject, 'ios', options.ios));
108108
} else {
109109
Logger.error('Skipping ios build! Plugin only has android support or no options supplied.');
110110
}
111111
} catch (errExec) {
112-
Logger.error(JSON.stringify(errExec));
112+
Logger.error('Error while building project:' + errExec && errExec.message);
113113
}
114114
return result;
115115
}
@@ -144,7 +144,7 @@ export namespace ProjectService {
144144
if (isDev) {
145145
// dev plugin (e.g. nativescript-dev-typescript)
146146
command = `npm i ${name} --save-dev`;
147-
} else if (!plugin.badges.androidVersion && !plugin.badges.iosVersion) {
147+
} else if (!plugin.badges || (!plugin.badges.androidVersion && !plugin.badges.iosVersion)) {
148148
// regular (not nativescript specific) plugin
149149
command = `npm i ${name} --save`;
150150
}
@@ -173,7 +173,7 @@ export namespace ProjectService {
173173
try {
174174
const mainTsPath = path.join(appRoot, 'app', 'home', 'home.component.ts');
175175
let mainTs = readFileSync(mainTsPath, 'utf8');
176-
if (plugin.badges.typings) {
176+
if (plugin.badges && plugin.badges.typings) {
177177
mainTs = `import * as testPlugin from '${name}';\n` + mainTs;
178178
} else {
179179
mainTs = `const testPlugin = require('${name}');\n` + mainTs;

0 commit comments

Comments
 (0)