mirror of
https://github.com/strapi/strapi.git
synced 2025-10-26 23:51:10 +00:00
remove comments
This commit is contained in:
parent
2381e8c60b
commit
9c41753e8a
@ -5,7 +5,6 @@ const path = require('path');
|
||||
module.exports = ({ env }) => ({
|
||||
graphql: {
|
||||
enabled: true,
|
||||
// resolve: '@strapi/plugin-graphql',
|
||||
config: require('./plugins/graphql')({ env }),
|
||||
},
|
||||
i18n: {
|
||||
|
||||
@ -2,12 +2,8 @@
|
||||
|
||||
module.exports = (/* strapi, config */) => {
|
||||
return {
|
||||
bootstrap: () => {
|
||||
console.log('graphQL BOOTSTRAP');
|
||||
},
|
||||
destroy: () => {
|
||||
console.log('documentation DESTROY');
|
||||
},
|
||||
bootstrap: () => {},
|
||||
destroy: () => {},
|
||||
config: {},
|
||||
routes: [],
|
||||
controllers: {},
|
||||
@ -15,6 +11,5 @@ module.exports = (/* strapi, config */) => {
|
||||
policies: {},
|
||||
middlewares: {},
|
||||
contentTypes: [],
|
||||
// hooks: {},
|
||||
};
|
||||
};
|
||||
|
||||
@ -17,7 +17,7 @@ module.exports = strapi => ({
|
||||
const loadFeaturesRoutes = () => {
|
||||
for (const [feature, getFeatureRoutes] of Object.entries(routes)) {
|
||||
if (features.isEnabled(feature)) {
|
||||
strapi.admin.config.routes.push(...getFeatureRoutes); /// TODO
|
||||
strapi.admin.config.routes.push(...getFeatureRoutes); // TODO
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -9,7 +9,6 @@ module.exports = fn => async (...args) => {
|
||||
}
|
||||
|
||||
// these are errors like unique constraints
|
||||
console.log(error);
|
||||
strapi.log.error(error);
|
||||
throw strapi.errors.badRequest('Invalid input data. Please verify unique constraints');
|
||||
}
|
||||
|
||||
@ -28,7 +28,6 @@ const entityValidator = require('./services/entity-validator');
|
||||
const createTelemetry = require('./services/metrics');
|
||||
const createUpdateNotifier = require('./utils/update-notifier');
|
||||
const ee = require('./utils/ee');
|
||||
// const createPluginProvider = require('./core/plugins/plugin-provider');
|
||||
const createContainer = require('./core/container');
|
||||
const createConfigProvider = require('./core/base-providers/config-provider');
|
||||
|
||||
@ -62,7 +61,7 @@ class Strapi {
|
||||
this.admin = {};
|
||||
this.plugins = {};
|
||||
|
||||
const appConfig = loadConfiguration(this.dir, opts); //
|
||||
const appConfig = loadConfiguration(this.dir, opts);
|
||||
this.config = createConfigProvider(appConfig);
|
||||
this.container = createContainer(this);
|
||||
this.app.proxy = this.config.get('server.proxy');
|
||||
@ -302,7 +301,6 @@ class Strapi {
|
||||
}
|
||||
|
||||
stopWithError(err, customMessage) {
|
||||
console.log(err);
|
||||
this.log.debug(`⛔️ Server wasn't able to start properly.`);
|
||||
if (customMessage) {
|
||||
this.log.error(customMessage);
|
||||
@ -471,18 +469,6 @@ class Strapi {
|
||||
} else if (lifecycleName === LIFECYCLES.REGISTER) {
|
||||
await this.container.register();
|
||||
}
|
||||
//
|
||||
// await Promise.all(
|
||||
// Object.keys(this.plugins).map(plugin => {
|
||||
// const pluginFunc = _.get(this.plugins[plugin], `config.${configPath}`);
|
||||
//
|
||||
// return execLifecycle(pluginFunc).catch(err => {
|
||||
// strapi.log.error(`${lifecycleName} function in plugin "${plugin}" failed`);
|
||||
// strapi.log.error(err);
|
||||
// strapi.stop();
|
||||
// });
|
||||
// })
|
||||
// );
|
||||
|
||||
// user
|
||||
await execLifecycle(this.config.get(configPath));
|
||||
|
||||
@ -1,99 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const _ = require('lodash');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
dotenv.config({ path: process.env.ENV_PATH });
|
||||
|
||||
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
||||
|
||||
const createConfigProvider = require('../base-providers/config-provider');
|
||||
// const getPrefixedDeps = require('../../utils/get-prefixed-dependencies');
|
||||
// const loadPolicies = require('../load-policies');
|
||||
// const loadFunctions = require('../load-functions');
|
||||
const loadConfigDir = require('./config-loader');
|
||||
|
||||
// const { version: strapiVersion } = require(path.join(__dirname, '../../../package.json'));
|
||||
|
||||
// const CONFIG_PATHS = {
|
||||
// admin: 'admin',
|
||||
// api: 'api',
|
||||
// config: 'config',
|
||||
// controllers: 'controllers',
|
||||
// models: 'models',
|
||||
// plugins: 'plugins',
|
||||
// policies: 'policies',
|
||||
// tmp: '.tmp',
|
||||
// services: 'services',
|
||||
// static: 'public',
|
||||
// validators: 'validators',
|
||||
// views: 'views',
|
||||
// };
|
||||
|
||||
const defaultConfig = {
|
||||
server: {
|
||||
host: process.env.HOST || os.hostname() || 'localhost',
|
||||
port: process.env.PORT || 1337,
|
||||
proxy: false,
|
||||
cron: { enabled: false },
|
||||
admin: { autoOpen: false },
|
||||
},
|
||||
admin: {},
|
||||
middleware: {
|
||||
timeout: 1000,
|
||||
load: {
|
||||
before: ['responseTime', 'logger', 'cors', 'responses', 'gzip'],
|
||||
order: [],
|
||||
after: ['parser', 'router'],
|
||||
},
|
||||
settings: {},
|
||||
},
|
||||
// hook: {
|
||||
// timeout: 1000,
|
||||
// load: { before: [], order: [], after: [] },
|
||||
// settings: {},
|
||||
// },
|
||||
// routes: {},
|
||||
// functions: {},
|
||||
// policies: {},
|
||||
};
|
||||
|
||||
module.exports = (dir /* initialConfig = {} */) => {
|
||||
// const { autoReload = false, serveAdminPanel = true } = initialConfig;
|
||||
|
||||
// const pkgJSON = require(path.resolve(dir, 'package.json'));
|
||||
|
||||
const configDir = path.resolve(dir || process.cwd(), 'config');
|
||||
|
||||
const rootConfig = {
|
||||
// launchedAt: Date.now(),
|
||||
// appPath: dir,
|
||||
// paths: CONFIG_PATHS,
|
||||
// serveAdminPanel,
|
||||
// autoReload,
|
||||
// environment: process.env.NODE_ENV,
|
||||
// uuid: _.get(pkgJSON, 'strapi.uuid'),
|
||||
// packageJsonStrapi: _.omit(_.get(pkgJSON, 'strapi', {}), 'uuid'),
|
||||
// info: {
|
||||
// ...pkgJSON,
|
||||
// strapi: strapiVersion,
|
||||
// },
|
||||
// installedPlugins: getPrefixedDeps('@strapi/plugin', pkgJSON),
|
||||
// installedMiddlewares: getPrefixedDeps('@strapi/middleware', pkgJSON),
|
||||
// installedHooks: getPrefixedDeps('@strapi/hook', pkgJSON),
|
||||
// installedProviders: getPrefixedDeps('@strapi/provider', pkgJSON),
|
||||
};
|
||||
|
||||
const baseConfig = {
|
||||
...loadConfigDir(configDir),
|
||||
// policies: loadPolicies(path.resolve(configDir, 'policies')),
|
||||
// functions: loadFunctions(path.resolve(configDir, 'functions')),
|
||||
};
|
||||
|
||||
const envDir = path.resolve(configDir, 'env', process.env.NODE_ENV);
|
||||
const envConfig = loadConfigDir(envDir);
|
||||
|
||||
return createConfigProvider(_.merge(rootConfig, defaultConfig, baseConfig, envConfig));
|
||||
};
|
||||
@ -52,13 +52,6 @@ const createContainer = strapi => {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
// on ne passe plus l'uid en entier
|
||||
// on parse comme au dessus avec un saut de niveau
|
||||
// on enlève keys
|
||||
// eventuellement cache system
|
||||
//
|
||||
|
||||
getAll() {
|
||||
const pluginContentTypes = container.plugins.contentTypes.getAll();
|
||||
return [...pluginContentTypes];
|
||||
|
||||
@ -20,12 +20,10 @@ const contentTypeSchemaValidator = yup.object().shape({
|
||||
singularName: yup
|
||||
.string()
|
||||
.isCamelCase()
|
||||
// .isazAZ()
|
||||
.required(),
|
||||
pluralName: yup
|
||||
.string()
|
||||
.isCamelCase()
|
||||
// .isazAZ()
|
||||
.required(),
|
||||
displayName: yup.string().required(),
|
||||
})
|
||||
|
||||
@ -60,7 +60,6 @@ module.exports = function(strapi) {
|
||||
strapi.controllers = Object.keys(strapi.api || []).reduce((acc, key) => {
|
||||
for (let index in strapi.api[key].controllers) {
|
||||
let controller = strapi.api[key].controllers[index];
|
||||
// controller.identity = controller.identity || _.upperFirst(index);
|
||||
acc[index] = controller;
|
||||
}
|
||||
|
||||
@ -81,13 +80,6 @@ module.exports = function(strapi) {
|
||||
return acc.concat(_.get(strapi.api[key], 'config.routes') || {});
|
||||
}, []);
|
||||
|
||||
// Init admin controllers.
|
||||
// Object.keys(strapi.admin.controllers || []).forEach(key => {
|
||||
// if (!strapi.admin.controllers[key].identity) {
|
||||
// strapi.admin.controllers[key].identity = key;
|
||||
// }
|
||||
// });
|
||||
|
||||
// Init admin models.
|
||||
Object.keys(strapi.admin.models || []).forEach(modelName => {
|
||||
let model = strapi.admin.models[modelName];
|
||||
@ -113,14 +105,6 @@ module.exports = function(strapi) {
|
||||
// models: plugin.models || [],
|
||||
// });
|
||||
|
||||
// Object.keys(plugin.controllers).forEach(key => {
|
||||
// let controller = plugin.controllers[key];
|
||||
|
||||
// Object.assign(controller, {
|
||||
// identity: controller.identity || key,
|
||||
// });
|
||||
// });
|
||||
|
||||
// Object.keys(plugin.models || []).forEach(modelName => {
|
||||
// let model = plugin.models[modelName];
|
||||
|
||||
@ -152,14 +136,6 @@ module.exports = function(strapi) {
|
||||
Object.assign(strapi.plugins[plugin].config.policies, mapKeys(toLower, policies[plugin]));
|
||||
}
|
||||
|
||||
// const pluginServices = strapi.container.plugins.services.getAll();
|
||||
// for (const plugin in pluginServices) {
|
||||
// strapi.plugins[plugin] = strapi.plugins[plugin] || {};
|
||||
// strapi.plugins[plugin].services = pluginServices[plugin];
|
||||
// }
|
||||
|
||||
// });
|
||||
|
||||
// Preset config in alphabetical order.
|
||||
strapi.config.middleware.settings = Object.keys(strapi.middleware).reduce((acc, current) => {
|
||||
// Try to find the settings in the current environment, then in the main configurations.
|
||||
|
||||
@ -10,17 +10,16 @@ const findPackagePath = require('../../load/package-path');
|
||||
/**
|
||||
* Load hooks
|
||||
*/
|
||||
module.exports = async function() {
|
||||
module.exports = async function({ installedHooks, installedPlugins, appPath }) {
|
||||
let hooks = {};
|
||||
const installedHooks = strapi.config.get('installedHooks');
|
||||
const appPath = strapi.config.get('appPath');
|
||||
|
||||
await Promise.all([
|
||||
loadHookDependencies(installedHooks, hooks),
|
||||
// local middleware
|
||||
loadLocalHooks(appPath, hooks),
|
||||
// admin hooks
|
||||
loadAdminHooks(hooks),
|
||||
// plugins middlewares
|
||||
loadPluginsHooks(installedPlugins, hooks),
|
||||
// local plugin middlewares
|
||||
loadLocalPluginsHooks(appPath, hooks),
|
||||
]);
|
||||
@ -41,12 +40,12 @@ const loadHooksInDir = async (dir, hooks) => {
|
||||
|
||||
const loadLocalHooks = (appPath, hooks) => loadHooksInDir(path.resolve(appPath, 'hooks'), hooks);
|
||||
|
||||
// const loadPluginsHooks = async (plugins, hooks) => {
|
||||
// for (let pluginName of plugins) {
|
||||
// const dir = path.resolve(findPackagePath(`@strapi/plugin-${pluginName}`), 'hooks');
|
||||
// await loadHooksInDir(dir, hooks);
|
||||
// }
|
||||
// };
|
||||
const loadPluginsHooks = async (plugins, hooks) => {
|
||||
for (let pluginName of plugins) {
|
||||
const dir = path.resolve(findPackagePath(`@strapi/plugin-${pluginName}`), 'hooks');
|
||||
await loadHooksInDir(dir, hooks);
|
||||
}
|
||||
};
|
||||
|
||||
const loadAdminHooks = async hooks => {
|
||||
const hooksDir = 'hooks';
|
||||
|
||||
@ -2,36 +2,14 @@
|
||||
|
||||
const bootstrap = require('./server/bootstrap');
|
||||
const contentTypes = require('./server/content-types');
|
||||
// const policies = require('./server/policies');
|
||||
const services = require('./server/services');
|
||||
const routes = require('./server/routes');
|
||||
const config = require('./server/config');
|
||||
const controllers = require('./server/controllers');
|
||||
|
||||
// object or function. If function then pass strapi.
|
||||
module.exports = () => {
|
||||
return {
|
||||
register: () => {
|
||||
// extend entityService
|
||||
// route.add('/giveBestCountries', { action: giveBestCountries });
|
||||
// route.add('/giveBestCountries', [policies.get('plugins::users-permissions.permissions')],
|
||||
// handler: giveBestCountries,
|
||||
// });
|
||||
// route.add('/giveBestCountries', (ctx, { }) => {
|
||||
// ctx.entityService('countries').giveBestCountries();
|
||||
// });
|
||||
//
|
||||
// addQuery('giveBestCountries', {
|
||||
// args: ,
|
||||
// resolve: ,
|
||||
// type: ,
|
||||
// });
|
||||
//
|
||||
// registerRoute('/countries', {
|
||||
// method: 'get',
|
||||
// handler: () => {},
|
||||
// })
|
||||
},
|
||||
register: () => {},
|
||||
bootstrap,
|
||||
config,
|
||||
routes,
|
||||
@ -40,13 +18,5 @@ module.exports = () => {
|
||||
contentTypes,
|
||||
policies: {},
|
||||
services,
|
||||
// middlewares,
|
||||
};
|
||||
};
|
||||
|
||||
// create, update, delete, read
|
||||
|
||||
// modifier une route existance CRUD
|
||||
// Ajouter des nouvelles routes / query graphql
|
||||
|
||||
//
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = [
|
||||
//
|
||||
{
|
||||
method: 'GET',
|
||||
path: '/iso-locales',
|
||||
|
||||
@ -7,46 +7,14 @@ const services = require('./server/services');
|
||||
const routes = require('./server/routes');
|
||||
const controllers = require('./server/controllers');
|
||||
const middlewares = require('./server/middlewares');
|
||||
// const routes = require('./server/routes');
|
||||
|
||||
// object or function. If function then pass strapi.
|
||||
module.exports = () => {
|
||||
return {
|
||||
register: () => {
|
||||
// extend entityService
|
||||
// route.add('/giveBestCountries', { action: giveBestCountries });
|
||||
// route.add('/giveBestCountries', [policies.get('plugins::users-permissions.permissions')],
|
||||
// handler: giveBestCountries,
|
||||
// });
|
||||
// route.add('/giveBestCountries', (ctx, { }) => {
|
||||
// ctx.entityService('countries').giveBestCountries();
|
||||
// });
|
||||
//
|
||||
// addQuery('giveBestCountries', {
|
||||
// args: ,
|
||||
// resolve: ,
|
||||
// type: ,
|
||||
// });
|
||||
//
|
||||
// registerRoute('/countries', {
|
||||
// method: 'get',
|
||||
// handler: () => {},
|
||||
// })
|
||||
},
|
||||
bootstrap,
|
||||
routes,
|
||||
controllers,
|
||||
middlewares,
|
||||
contentTypes,
|
||||
policies,
|
||||
services,
|
||||
// middlewares,
|
||||
};
|
||||
};
|
||||
|
||||
// create, update, delete, read
|
||||
|
||||
// modifier une route existance CRUD
|
||||
// Ajouter des nouvelles routes / query graphql
|
||||
|
||||
//
|
||||
module.exports = () => ({
|
||||
register: () => {},
|
||||
bootstrap,
|
||||
routes,
|
||||
controllers,
|
||||
middlewares,
|
||||
contentTypes,
|
||||
policies,
|
||||
services,
|
||||
});
|
||||
|
||||
@ -8,44 +8,13 @@ const routes = require('./server/routes');
|
||||
const controllers = require('./server/controllers');
|
||||
const middlewares = require('./server/middlewares');
|
||||
|
||||
// object or function. If function then pass strapi.
|
||||
module.exports = () => {
|
||||
return {
|
||||
register: () => {
|
||||
// extend entityService
|
||||
// route.add('/giveBestCountries', { action: giveBestCountries });
|
||||
// route.add('/giveBestCountries', [policies.get('plugins::users-permissions.permissions')],
|
||||
// handler: giveBestCountries,
|
||||
// });
|
||||
// route.add('/giveBestCountries', (ctx, { }) => {
|
||||
// ctx.entityService('countries').giveBestCountries();
|
||||
// });
|
||||
//
|
||||
// addQuery('giveBestCountries', {
|
||||
// args: ,
|
||||
// resolve: ,
|
||||
// type: ,
|
||||
// });
|
||||
//
|
||||
// registerRoute('/countries', {
|
||||
// method: 'get',
|
||||
// handler: () => {},
|
||||
// })
|
||||
},
|
||||
bootstrap,
|
||||
routes,
|
||||
controllers,
|
||||
middlewares,
|
||||
contentTypes,
|
||||
policies,
|
||||
services,
|
||||
// middlewares,
|
||||
};
|
||||
};
|
||||
|
||||
// create, update, delete, read
|
||||
|
||||
// modifier une route existance CRUD
|
||||
// Ajouter des nouvelles routes / query graphql
|
||||
|
||||
//
|
||||
module.exports = () => ({
|
||||
register: () => {},
|
||||
bootstrap,
|
||||
routes,
|
||||
controllers,
|
||||
middlewares,
|
||||
contentTypes,
|
||||
policies,
|
||||
services,
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user