Fetch useYarn info

This commit is contained in:
Rémi de Juvigny 2022-02-18 20:15:46 +01:00
parent 9130c8304c
commit ab18a34b7a
3 changed files with 14 additions and 6 deletions

View File

@ -13,7 +13,7 @@ import { useNotifyAT } from '@strapi/design-system/LiveRegions';
import { Grid, GridItem } from '@strapi/design-system/Grid';
import { Layout, HeaderLayout, ContentLayout } from '@strapi/design-system/Layout';
import { Main } from '@strapi/design-system/Main';
import { fetchPlugins, fetchDependencies } from './utils/api';
import { fetchPlugins, fetchAppInformation } from './utils/api';
import adminPermissions from '../../permissions';
import PluginCard from './components/PluginCard';
@ -41,8 +41,8 @@ const MarketPlacePage = () => {
};
const { status: installedDependenciesStatus, data: installedDependenciesResponse } = useQuery(
'list-dependencies',
() => fetchDependencies(notifyLoad),
'app-information',
() => fetchAppInformation(notifyLoad),
{
onError: () => {
toggleNotification({
@ -91,7 +91,11 @@ const MarketPlacePage = () => {
);
}
const installedPackages = Object.keys(installedDependenciesResponse.data.dependencies);
const { dependencies, useYarn } = installedDependenciesResponse.data;
const installedPackages = Object.keys(dependencies);
// TODO: implement and remove
console.log({ useYarn });
return (
<CheckPagePermissions permissions={adminPermissions.marketplace.main}>

View File

@ -17,7 +17,7 @@ const fetchPlugins = async notify => {
return filteredResponse;
};
const fetchDependencies = async notify => {
const fetchAppInformation = async notify => {
const { data } = await axiosInstance.get('/admin/information');
notify();
@ -25,4 +25,4 @@ const fetchDependencies = async notify => {
return data;
};
export { fetchPlugins, fetchDependencies };
export { fetchPlugins, fetchAppInformation };

View File

@ -1,7 +1,9 @@
'use strict';
const path = require('path');
const execa = require('execa');
const _ = require('lodash');
const { exists } = require('fs-extra');
const { ValidationError } = require('@strapi/utils').errors;
// eslint-disable-next-line node/no-extraneous-require
const ee = require('@strapi/strapi/lib/utils/ee');
@ -48,6 +50,7 @@ module.exports = {
const dependencies = strapi.config.get('info.dependencies', {});
const nodeVersion = process.version;
const communityEdition = !strapi.EE;
const useYarn = await exists(path.join(process.cwd(), 'yarn.lock'));
return {
data: {
@ -57,6 +60,7 @@ module.exports = {
nodeVersion,
communityEdition,
dependencies,
useYarn,
},
};
},