Skip to content

Commit

Permalink
Remove mainCode property from Package
Browse files Browse the repository at this point in the history
(We have a file browser now)
  • Loading branch information
dmstern committed Nov 26, 2018
1 parent 9c744c5 commit d6c94a4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
19 changes: 0 additions & 19 deletions server/artifactory-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ configService

interface AdditionalCode {
readme: string;
mainCode: string | undefined;
fileList;
}

Expand Down Expand Up @@ -63,16 +62,6 @@ function readme2Html(readmeFile: string): string {
return html;
}

function readMainCode(storageDir: string): string {
const packageJson = fs.readJSONSync(path.join(storageDir, `package.json`));
try {
return fs.readFileSync(path.join(storageDir, packageJson.main)).toString();
} catch (error) {
console.error(`MainCode file not found: ${storageDir}`);
return null;
}
}

function fetchPackages(): AxiosPromise<PackagesResponse> {
if (process.env.MOCK) {
return new Promise<AxiosResponse>((resolve, reject) => {
Expand Down Expand Up @@ -121,7 +110,6 @@ async function getPackageDetail({
}
resolve({
readme: data,
mainCode: readMainCode(path.join(__dirname, '..', '..')),
fileList: [],
});
})
Expand Down Expand Up @@ -177,26 +165,19 @@ async function getPackageDetail({

async function readAdditionalCode(storageDir: string): Promise<AdditionalCode> {
let readme;
let mainCode;
let fileList;
try {
readme = readme2Html(path.join(storageDir, 'package', 'README.md'));
} catch (error) {
readme = undefined;
}
try {
mainCode = readMainCode(path.join(storageDir, 'package'));
} catch (error) {
mainCode = undefined;
}
try {
fileList = await getFiles(storageDir, 'package', false);
} catch {
fileList = [];
}
return {
readme,
mainCode,
fileList,
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/PackageDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</v-card-text>
</v-tab-item>
<v-tab-item>
<v-card-text v-if="data.packageDetail.mainCode || data.currentPackage.scripts">
<v-card-text v-if="data.packageDetail.fileList || data.currentPackage.scripts">
<div v-if="data.currentPackage.scripts">
<h2>Scripts</h2>

Expand Down
1 change: 0 additions & 1 deletion types/Package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export default class Package extends Searchable implements PackageMetaDataDTO {
public readonly bugTrackerUrl?: string;
public readonly dependenciesCount: number;
public readonly scope: string | undefined;
public readonly mainCode: string | undefined;
public readonly fileList?: TreeItem[];
private craftersList: Crafter[];
private tagList: Tag[];
Expand Down

0 comments on commit d6c94a4

Please sign in to comment.