mirror of
https://github.com/strapi/strapi.git
synced 2025-07-22 16:37:13 +00:00
37 lines
765 B
JavaScript
Executable File
37 lines
765 B
JavaScript
Executable File
'use strict';
|
|
|
|
/**
|
|
* Module dependencies
|
|
*/
|
|
|
|
// Node.js core.
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
// Local utilities.
|
|
const json = require('../../util/json');
|
|
|
|
/**
|
|
* Check if the specified `appPath` contains something that looks
|
|
* like an Strapi application.
|
|
*
|
|
* @param {String} appPath
|
|
*/
|
|
|
|
module.exports = function isStrapiAppSync(appPath) {
|
|
|
|
// Has no `package.json` file.
|
|
if (!fs.existsSync(path.join(appPath, 'package.json'))) {
|
|
return false;
|
|
}
|
|
|
|
// `package.json` exists, but doesn't list `strapi` as a dependency.
|
|
const appPackageJSON = json.getPackageSync(appPath);
|
|
const appDependencies = appPackageJSON.dependencies;
|
|
if (!(appDependencies && appDependencies.strapi)) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
};
|