mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 19:04:38 +00:00
Allow plugins without admin && fix babel polyfill error
This commit is contained in:
parent
588363dcd7
commit
0f2ebfa997
File diff suppressed because one or more lines are too long
@ -100,8 +100,18 @@ if (process.env.npm_lifecycle_event === 'start') {
|
||||
plugins.exist = true;
|
||||
}
|
||||
|
||||
// Read `plugins` directory.
|
||||
plugins.src = isAdmin && !plugins.exist ? fs.readdirSync(path.resolve(appPath, 'plugins')).filter(x => x[0] !== '.') : [];
|
||||
// Read `plugins` directory and check if the plugin comes with an UI.
|
||||
plugins.src = isAdmin && !plugins.exist ? fs.readdirSync(path.resolve(appPath, 'plugins')).filter(x => {
|
||||
let hasAdminFolder;
|
||||
|
||||
try {
|
||||
fs.accessSync(path.resolve(appPath, 'plugins', x, 'admin', 'src', 'containers', 'App'));
|
||||
hasAdminFolder = true;
|
||||
} catch(err) {
|
||||
hasAdminFolder = false;
|
||||
}
|
||||
return x[0] !== '.' && hasAdminFolder;
|
||||
}) : [];
|
||||
|
||||
// Construct object of plugin' paths.
|
||||
plugins.folders = plugins.src.reduce((acc, current) => {
|
||||
|
||||
@ -46,7 +46,18 @@ if (process.env.npm_lifecycle_event === 'start') {
|
||||
plugins.exist = true;
|
||||
}
|
||||
|
||||
plugins.src = process.env.IS_ADMIN === 'true' && !plugins.exist ? fs.readdirSync(path.resolve(appPath, 'plugins')).filter(x => x[0] !== '.') : [];
|
||||
plugins.src = process.env.IS_ADMIN === 'true' && !plugins.exist ? fs.readdirSync(path.resolve(appPath, 'plugins')).filter(x => {
|
||||
let hasAdminFolder;
|
||||
|
||||
try {
|
||||
fs.accessSync(path.resolve(appPath, 'plugins', x, 'admin', 'src', 'containers', 'App'));
|
||||
hasAdminFolder = true;
|
||||
} catch(err) {
|
||||
hasAdminFolder = false;
|
||||
}
|
||||
|
||||
return x[0] !== '.' && hasAdminFolder;
|
||||
}) : [];
|
||||
|
||||
plugins.folders = plugins.src.reduce((acc, current) => {
|
||||
acc[current] = path.resolve(appPath, 'plugins', current, 'node_modules', 'strapi-helper-plugin', 'lib', 'src');
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* App actions
|
||||
*
|
||||
*/
|
||||
@ -1,5 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* App constants
|
||||
*
|
||||
*/
|
||||
@ -1,39 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* This component is the skeleton around the actual pages, and should only
|
||||
* contain code that should be seen on all pages. (e.g. navigation bar)
|
||||
*
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { Switch, Route } from 'react-router-dom';
|
||||
import { bindActionCreators, compose } from 'redux';
|
||||
|
||||
|
||||
class App extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function mapDispatchToProps(dispatch) {
|
||||
return bindActionCreators(
|
||||
{},
|
||||
dispatch,
|
||||
);
|
||||
}
|
||||
|
||||
const mapStateToProps = createStructuredSelector({});
|
||||
|
||||
// Wrap the component to inject dispatch and state into it
|
||||
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
||||
|
||||
export default compose(
|
||||
withConnect,
|
||||
)(App);
|
||||
@ -1,18 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* App reducer
|
||||
*
|
||||
*/
|
||||
|
||||
import { fromJS } from 'immutable';
|
||||
|
||||
const initialState = fromJS({});
|
||||
|
||||
function appReducer(state = initialState, action) {
|
||||
switch (action.type) {
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
|
||||
export default appReducer;
|
||||
@ -1,9 +0,0 @@
|
||||
// import { createSelector } from 'reselect';
|
||||
|
||||
/**
|
||||
* Direct selector to the list state domain
|
||||
*/
|
||||
|
||||
// const selectGlobalDomain = () => state => state.get('global');
|
||||
|
||||
export {};
|
||||
@ -1 +0,0 @@
|
||||
{}
|
||||
@ -1 +0,0 @@
|
||||
{}
|
||||
@ -1 +0,0 @@
|
||||
{}
|
||||
@ -1 +0,0 @@
|
||||
{}
|
||||
@ -1 +0,0 @@
|
||||
{}
|
||||
@ -1 +0,0 @@
|
||||
{}
|
||||
@ -30,9 +30,6 @@
|
||||
"pluralize": "^7.0.0",
|
||||
"strapi-utils": "3.0.0-alpha.11.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.11.3"
|
||||
},
|
||||
"author": {
|
||||
"name": "A Strapi developer",
|
||||
"email": "",
|
||||
|
||||
@ -113,7 +113,20 @@ module.exports = function() {
|
||||
}
|
||||
|
||||
// Create `plugins.json` file.
|
||||
const data = Object.keys(this.plugins).map(name => ({
|
||||
// Don't inject the plugins without an Admin
|
||||
const data = Object.keys(this.plugins)
|
||||
.filter(plugin => {
|
||||
let hasAdminFolder;
|
||||
|
||||
try {
|
||||
fs.accessSync(path.resolve(this.config.appPath, 'plugins', plugin, 'admin', 'src', 'containers', 'App'));
|
||||
hasAdminFolder = true;
|
||||
} catch(err) {
|
||||
hasAdminFolder = false;
|
||||
}
|
||||
return hasAdminFolder;
|
||||
})
|
||||
.map(name => ({
|
||||
id: name,
|
||||
source: Object.keys(this.config.environments).reduce((acc, current) => {
|
||||
const source = _.get(this.config.environments[current].server, 'admin.build.plugins.source', 'default');
|
||||
|
||||
@ -130,7 +130,6 @@ watcher('🏗 Building...', 'npm run build');
|
||||
|
||||
shell.cd('../strapi-plugin-graphql');
|
||||
watcher('', 'npm install ../strapi-utils --no-optional');
|
||||
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
|
||||
shell.rm('-f', 'package-lock.json');
|
||||
watcher('📦 Linking strapi-plugin-graphql...', 'npm link --no-optional', false);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user