mirror of
https://github.com/strapi/strapi.git
synced 2025-12-25 22:23:10 +00:00
Merge branch 'auth-provider/update-user-models' of github.com:strapi/strapi into auth-provider/configs
This commit is contained in:
commit
66617e31c8
@ -6,7 +6,7 @@ git:
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- "8"
|
||||
- "9"
|
||||
|
||||
before_install:
|
||||
- export CHROME_BIN=chromium-browser
|
||||
|
||||
@ -111,51 +111,73 @@ This will replace the folder's content located at `./admin/admin/build`. Visit h
|
||||
|
||||
## Deployment
|
||||
|
||||
There is three cases to deploy the administration panel:
|
||||
1. On the same server as the API.
|
||||
2. Without the plugins on another server (AWS S3, Azure, etc) as the API.
|
||||
3. With the plugins on different servers as the API.
|
||||
The administration is nothing more than a React front-end application calling an API. The front-end and the back-end are independent and can be deployed on different servers which brings us to different scenarios:
|
||||
|
||||
Let's dive into the build configurations. The file should look like this:
|
||||
1. Deploy the entire project on the same server.
|
||||
2. Deploy the administration panel on another server (AWS S3, Azure, etc) than the API.
|
||||
3. Deploy the administration panel and the plugins on another server than the API.
|
||||
|
||||
Let's dive into the build configurations for each case.
|
||||
|
||||
#### Deploy the entire project on the same server.
|
||||
|
||||
You don't need to touch anything in your configuration file. This is the default behaviour and the build configurations will be automatically set. The server will start on the defined port and the administration panel will be accessible through http://yourdomain.com:1337/dashboard.
|
||||
|
||||
You might want to change the path to access to the administration panel. Here the required configurations to change the path:
|
||||
|
||||
**Path —** `./config/environment/**/server.json`.
|
||||
```json
|
||||
```js
|
||||
{
|
||||
"host": "localhost",
|
||||
"port": 1337,
|
||||
"autoReload": {
|
||||
"enabled": false
|
||||
},
|
||||
"cron": {
|
||||
"enabled": false
|
||||
},
|
||||
"admin": {
|
||||
"path": "/dashboard" // We change the path to access to the admin (highly recommended for security reasons).
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**You have to rebuild the administration panel to make this work.** Please follow the [step #2 of the deployment guide](../guides/deployment.md).
|
||||
|
||||
#### Deploy the administration panel on another server (AWS S3, Azure, etc) than the API.
|
||||
|
||||
It's very common to deploy the front-end and the back-end on different servers. Here the required configurations to handle this case:
|
||||
|
||||
**Path —** `./config/environment/**/server.json`.
|
||||
```js
|
||||
{
|
||||
"host": "localhost",
|
||||
"port": 1337,
|
||||
"autoReload": {
|
||||
"enabled": false
|
||||
},
|
||||
"cron": {
|
||||
"enabled": false
|
||||
},
|
||||
"admin": {
|
||||
"path": "/dashboard",
|
||||
"build": {
|
||||
"host": "https://admin.myapp.com",
|
||||
"backend": "https://api.myapp.com:8080",
|
||||
"host": "/", // Note: The administration will be accessible from the root of the domain (ex: http//yourfrontend.com/)
|
||||
"backend": "http://yourbackend.com",
|
||||
"plugins": {
|
||||
"source": "host",
|
||||
"folder": "/plugins"
|
||||
"source": "backend" // What does it means? The script tags in the index.html will use the backend value to load the plugins (ex: http://yourbackend.com/dashboard/content-manager/main.js).
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### On the same server as the API
|
||||
The administration URL will be http://yourfrontend.com and every request from the panel will hit the backend at http://yourbackend.com. The plugins will be injected through the `origin` (means the API itself). In other words, the plugins URLs will be `http://yourbackend.com/dashboard/content-manager/main.js`.
|
||||
|
||||
You don't need to touch anything in your configuration file. This is the default behaviour and the build configurations will be automatically set.
|
||||
> Note: How it is possible? The API (the Strapi server) owns the plugin and these plugins are exposed through `http://yourbackend.com/admin/**/main.js`
|
||||
|
||||
#### Without the plugins on another server
|
||||
|
||||
**Path —** `./config/environment/**/server.json`.
|
||||
```json
|
||||
{
|
||||
"admin": {
|
||||
"build": {
|
||||
"host": "https://admin.myapp.com",
|
||||
"backend": "https://api.myapp.com:8080",
|
||||
"plugins": {
|
||||
"source": "origin"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The administration URL will be https://admin.myapp.com and every request from the panel will hit the backend at https://api.myapp.com:8080. The plugins will be injected through the `origin` (means the API itself). In other words, the plugins URLs will be `https://api.myapp.com:8080/admin/content-manager/main.js`.
|
||||
The DOM should look like this:
|
||||
|
||||
**Path —** `./admin/admin/build/index.html`.
|
||||
```html
|
||||
@ -163,38 +185,46 @@ The administration URL will be https://admin.myapp.com and every request from th
|
||||
<head></head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="text/javascript" src="https://admin.myapp.com/admin/vendor.dll.js"></script>
|
||||
<script type="text/javascript" src="https://admin.myapp.com/admin/main.js"></script>
|
||||
<script src="https://api.myapp.com:8080/admin/content-manager/main.js"></script>
|
||||
<script src="https://api.myapp.com:8080/admin/settings-manager/main.js"></script>
|
||||
<script src="https://api.myapp.com:8080/admin/content-type-builder/main.js"></script>
|
||||
<script type="text/javascript" src="/vendor.dll.js"></script>
|
||||
<script type="text/javascript" src="/main.js"></script>
|
||||
<script src="http://yourbackend.com/dashboard/content-manager/main.js"></script>
|
||||
<script src="http://yourbackend.com/dashboard/settings-manager/main.js"></script>
|
||||
<script src="http://yourbackend.com/dashboard/content-type-builder/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
> Note: The plugins are injected using the `./admin/admin/build/config/plugins.json`. To see the plugins URLs in the `index.html`, you need to launch the administration panel in the browser.
|
||||
|
||||
#### With the plugins on another server
|
||||
#### Deploy the administration panel and the plugins on another server than the API
|
||||
|
||||
In this case, we suppose that you decided to put your administration and the plugins on the same server but on a different server as the API.
|
||||
|
||||
**Path —** `./config/environment/**/server.json`.
|
||||
```json
|
||||
```js
|
||||
{
|
||||
"host": "localhost",
|
||||
"port": 1337,
|
||||
"autoReload": {
|
||||
"enabled": false
|
||||
},
|
||||
"cron": {
|
||||
"enabled": false
|
||||
},
|
||||
"admin": {
|
||||
"build": {
|
||||
"host": "https://admin.myapp.com",
|
||||
"backend": "https://api.myapp.com:8080",
|
||||
"host": "http://yourfrontend.com/dashboard", // Note: The custom path has moved directly in the host URL.
|
||||
"backend": "http://yourbackend.com",
|
||||
"plugins": {
|
||||
"source": "host",
|
||||
"folder": "plugins"
|
||||
"source": "host", // What does it means? The script tags in the index.html will use the host value to load the plugins (ex: http://yourfrontend.com/dashboard/plugins/content-manager/main.js).
|
||||
"folder": "/plugins"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The administration URL will be https://admin.myapp.com and every request from the panel will hit the backend at https://api.myapp.com:8080. The plugins will be injected through the `host`. It means that the plugins URLs will use the host URL as the origin. So the plugins URLs will be `https://admin.myapp.com/plugins/content-manager/main.js`.
|
||||
The administration URL will be http://yourfrontend.com/dashboard and every request from the panel will hit the backend at http://yourbackend.com. The plugins will be injected through the `host`. It means that the plugins URLs will use the host URL as the origin. So the plugins URLs will be `http://yourfrontend.com/dashboard/plugins/content-manager/main.js`.
|
||||
|
||||
We also added a `folder` setting to separate the plugins from the administration build. In your server, the files structure should look like this:
|
||||
```
|
||||
@ -233,11 +263,11 @@ The generated `index.html` will look like this:
|
||||
<head></head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="text/javascript" src="https://admin.myapp.com/admin/vendor.dll.js"></script>
|
||||
<script type="text/javascript" src="https://admin.myapp.com/admin/main.js"></script>
|
||||
<script src="https://admin.myapp.com/plugins/content-manager/main.js"></script>
|
||||
<script src="https://admin.myapp.com/plugins/settings-manager/main.js"></script>
|
||||
<script src="https://admin.myapp.com/plugins/content-type-builder/main.js"></script>
|
||||
<script type="text/javascript" src="/dashboard/vendor.dll.js"></script>
|
||||
<script type="text/javascript" src="/dashboard/main.js"></script>
|
||||
<script src="/dashboard/plugins/content-manager/main.js"></script>
|
||||
<script src="/dashboard/plugins/settings-manager/main.js"></script>
|
||||
<script src="/dashboard/plugins/content-type-builder/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
# Authentification
|
||||
# Authentication
|
||||
|
||||
## Register a new user.
|
||||
|
||||
@ -79,7 +79,7 @@ Response payload:
|
||||
}
|
||||
```
|
||||
|
||||
## Use your token to be identify as user.
|
||||
## Use your token to be identified as a user.
|
||||
|
||||
By default, each API request is identified as `guest` role (see permissions of `guest`'s role in your admin dashboard). To make a request as a user, you have to set the `Authorization` token in your request headers. You receive a 401 error if you are not authorized to make this request or if your authorization header is not correct.
|
||||
|
||||
@ -13,23 +13,23 @@ Update the `production` settings with the IP and domain name where the project w
|
||||
"enabled": false
|
||||
},
|
||||
"admin": {
|
||||
"build": {
|
||||
"path": "/dashboard" // We highly recommend to change the default `/admin` path for security reasons.
|
||||
}
|
||||
"path": "/dashboard" // We highly recommend to change the default `/admin` path for security reasons.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### #2 - Setup
|
||||
**⚠️ If you changed the path to access to the administration, the step #2 is required.**
|
||||
|
||||
Run this following command to install the dependencies and build the project.
|
||||
#### #2 - Setup (optional)
|
||||
|
||||
Run this following command to install the dependencies and build the project with your custom configurations.
|
||||
|
||||
```bash
|
||||
cd /path/to/the/project
|
||||
npm run setup
|
||||
```
|
||||
|
||||
> Note: The `build` folders are ignored (.gitignore). If you're cloning your git repository on your server, you need to run this command on your server.
|
||||
> Note: To display the build logs use the --debug option `npm run setup --debug`.
|
||||
|
||||
#### #3 - Launch the server
|
||||
|
||||
@ -43,4 +43,4 @@ NODE_ENV=production npm start
|
||||
|
||||
### Advanced configurations
|
||||
|
||||
If you want to host the administration on another server than the API, [please take a look at this dedicated section](advanced/customize-admin.md#deployment).
|
||||
If you want to host the administration on another server than the API, [please take a look at this dedicated section](../advanced/customize-admin.md#deployment).
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"devDependencies": {
|
||||
"assert": "~1.3.0",
|
||||
"babel-eslint": "^6.1.2",
|
||||
|
||||
@ -6,18 +6,6 @@
|
||||
*/
|
||||
|
||||
/* eslint-disable */
|
||||
// Retrieve remote and backend URLs.
|
||||
const remoteURL = window.location.port === '4000' ? 'http://localhost:4000/admin' : process.env.REMOTE_URL || 'http://localhost:1337/admin';
|
||||
const backendURL = process.env.BACKEND_URL || 'http://localhost:1337';
|
||||
|
||||
// Retrieve development URL to avoid to re-build.
|
||||
const $body = document.getElementsByTagName('body')[0];
|
||||
const devFrontURL = $body.getAttribute('front');
|
||||
const devBackendURL = $body.getAttribute('back');
|
||||
|
||||
$body.removeAttribute('front');
|
||||
$body.removeAttribute('back');
|
||||
|
||||
import './public-path';
|
||||
import 'babel-polyfill';
|
||||
|
||||
@ -35,7 +23,7 @@ import LanguageProvider from 'containers/LanguageProvider';
|
||||
|
||||
import App from 'containers/App';
|
||||
import { showNotification } from 'containers/NotificationProvider/actions';
|
||||
import { pluginLoaded, updatePlugin, setHasUserPlugin } from 'containers/App/actions';
|
||||
import { pluginLoaded, updatePlugin, unsetHasUserPlugin } from 'containers/App/actions';
|
||||
import auth from 'utils/auth';
|
||||
import configureStore from './store';
|
||||
import { translationMessages, languages } from './i18n';
|
||||
@ -51,11 +39,11 @@ const plugins = (() => {
|
||||
/* eslint-enable */
|
||||
|
||||
// Create redux store with history
|
||||
const initialState = {};
|
||||
const basename = strapi.remoteURL.replace(window.location.origin, '');
|
||||
const history = createHistory({
|
||||
basename: (devFrontURL || remoteURL).replace(window.location.origin, ''),
|
||||
basename,
|
||||
});
|
||||
const store = configureStore(initialState, history);
|
||||
const store = configureStore({}, history);
|
||||
|
||||
const render = (translatedMessages) => {
|
||||
ReactDOM.render(
|
||||
@ -94,21 +82,23 @@ window.onload = function onLoad() {
|
||||
|
||||
// Don't inject plugins in development mode.
|
||||
if (window.location.port !== '4000') {
|
||||
fetch(`${devFrontURL || remoteURL}/config/plugins.json`)
|
||||
fetch(`${strapi.remoteURL}/config/plugins.json`)
|
||||
.then(response => {
|
||||
return response.json();
|
||||
})
|
||||
.then(plugins => {
|
||||
if (findIndex(plugins, ['id', 'users-permissions']) === -1) {
|
||||
store.dispatch(setHasUserPlugin());
|
||||
store.dispatch(unsetHasUserPlugin());
|
||||
}
|
||||
|
||||
const $body = document.getElementsByTagName('body')[0];
|
||||
|
||||
(plugins || []).forEach(plugin => {
|
||||
const script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.onerror = function (oError) {
|
||||
const source = new URL(oError.target.src);
|
||||
const url = new URL(`${devFrontURL || remoteURL}`);
|
||||
const url = new URL(`${strapi.remoteURL}`);
|
||||
|
||||
if (!source || !url) {
|
||||
throw new Error(`Impossible to load: ${oError.target.src}`);
|
||||
@ -124,7 +114,10 @@ if (window.location.port !== '4000') {
|
||||
$body.appendChild(newScript);
|
||||
};
|
||||
|
||||
script.src = plugin.source[process.env.NODE_ENV];
|
||||
script.src = plugin.source[process.env.NODE_ENV].indexOf('://') === -1 ?
|
||||
`${basename}${plugin.source[process.env.NODE_ENV]}`.replace('//', '/'): // relative
|
||||
plugin.source[process.env.NODE_ENV]; // absolute
|
||||
|
||||
$body.appendChild(script);
|
||||
});
|
||||
})
|
||||
@ -132,7 +125,7 @@ if (window.location.port !== '4000') {
|
||||
console.log(err);
|
||||
});
|
||||
} else if (findIndex(plugins, ['id', 'users-permissions']) === -1) {
|
||||
store.dispatch(setHasUserPlugin());
|
||||
store.dispatch(unsetHasUserPlugin());
|
||||
}
|
||||
|
||||
// const isPluginAllowedToRegister = (plugin) => true;
|
||||
@ -188,8 +181,7 @@ const displayNotification = (message, status) => {
|
||||
*/
|
||||
|
||||
window.strapi = Object.assign(window.strapi || {}, {
|
||||
remoteURL: devFrontURL || remoteURL,
|
||||
backendURL: devBackendURL || backendURL,
|
||||
mode: process.env.MODE || 'host',
|
||||
registerPlugin,
|
||||
notification: {
|
||||
success: (message) => {
|
||||
|
||||
@ -19,7 +19,10 @@ import styles from './styles.scss';
|
||||
class InstallPluginPopup extends React.Component {
|
||||
handleClick = () => {
|
||||
this.props.history.push({ pathname: this.props.history.location.pathname });
|
||||
this.context.downloadPlugin(this.props.plugin.id);
|
||||
|
||||
if (!this.props.isAlreadyInstalled) {
|
||||
this.context.downloadPlugin(this.props.plugin.id);
|
||||
}
|
||||
}
|
||||
|
||||
toggle = () => {
|
||||
@ -56,6 +59,7 @@ class InstallPluginPopup extends React.Component {
|
||||
short: this.props.plugin.id === 'support-us' ? <FormattedMessage id={this.props.plugin.description.short} /> : this.props.plugin.description.short,
|
||||
long: this.props.plugin.id === 'support-us' ? <FormattedMessage id={this.props.plugin.description.long || this.props.plugin.description.short} /> : this.props.plugin.description.long || this.props.plugin.description.short,
|
||||
};
|
||||
const buttonName = this.props.isAlreadyInstalled ? 'app.components.PluginCard.Button.label.install' : 'app.components.InstallPluginPopup.downloads';
|
||||
|
||||
return (
|
||||
<Modal isOpen={this.props.isOpen} toggle={this.toggle} className={styles.modalPosition}>
|
||||
@ -93,7 +97,7 @@ class InstallPluginPopup extends React.Component {
|
||||
</div>
|
||||
<div className={styles.buttonWrapper} onClick={this.handleClick}>
|
||||
<div>
|
||||
<FormattedMessage id="app.components.InstallPluginPopup.downloads" />
|
||||
<FormattedMessage id={buttonName} />
|
||||
</div>
|
||||
{/* Uncomment whebn prices are running}
|
||||
<div>{this.props.plugin.price} €</div>
|
||||
@ -149,6 +153,7 @@ InstallPluginPopup.propTypes = {
|
||||
short: PropTypes.string,
|
||||
}),
|
||||
history: PropTypes.object.isRequired,
|
||||
isAlreadyInstalled: PropTypes.bool.isRequired,
|
||||
isOpen: PropTypes.bool.isRequired,
|
||||
plugin: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
@ -23,10 +23,6 @@
|
||||
flex-grow: 2;
|
||||
}
|
||||
}
|
||||
// > div:last-child {
|
||||
// width: 50px;
|
||||
// border-left: 1px solid #0774D9;
|
||||
// }
|
||||
}
|
||||
|
||||
.headerButtonContainer {
|
||||
@ -102,6 +98,7 @@
|
||||
color: #C3C5C8;
|
||||
opacity: 1;
|
||||
outline: 0!important;
|
||||
cursor: pointer;
|
||||
}
|
||||
> span {
|
||||
display: none;
|
||||
|
||||
@ -63,8 +63,14 @@ class PluginCard extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
handleDownloadPlugin = () => {
|
||||
this.props.downloadPlugin();
|
||||
handleDownloadPlugin = (e) => {
|
||||
if (!this.props.isAlreadyInstalled && this.props.plugin.id !== 'support-us') {
|
||||
this.props.downloadPlugin(e);
|
||||
} else if (this.props.plugin.id === 'support-us') {
|
||||
this.aTag.click();
|
||||
} else {
|
||||
this.props.history.push('/list-plugins');
|
||||
}
|
||||
}
|
||||
|
||||
shouldOpenModal = (props) => {
|
||||
@ -132,9 +138,10 @@ class PluginCard extends React.Component {
|
||||
onClick={this.handleDownloadPlugin}
|
||||
/>
|
||||
<a
|
||||
href="mailto:hi@strapi.io?subject=I'd like to support Strapi"
|
||||
href="https://strapi.io/shop"
|
||||
style={{ display: 'none' }}
|
||||
ref={(a) => { this.aTag = a; }}
|
||||
target="_blank"
|
||||
>
|
||||
|
||||
</a>
|
||||
|
||||
@ -13,10 +13,6 @@ import { FormattedMessage } from 'react-intl';
|
||||
import Ico from 'components/Ico';
|
||||
import ListRow from 'components/ListRow';
|
||||
import PopUpWarning from 'components/PopUpWarning';
|
||||
import IconAuth from 'assets/icons/icon_auth-permissions.svg';
|
||||
import IconCtb from 'assets/icons/icon_content-type-builder.svg';
|
||||
import IconCm from 'assets/icons/icon_content-manager.svg';
|
||||
import IconSettings from 'assets/icons/icon_settings-manager.svg';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
@ -34,30 +30,16 @@ class Row extends React.Component {
|
||||
this.props.onDeleteClick(e);
|
||||
}
|
||||
|
||||
renderImg = () => {
|
||||
switch (this.props.plugin.name) {
|
||||
case 'Auth & Permissions':
|
||||
return <img src={IconAuth} alt="logo" />;
|
||||
case 'Content Manager':
|
||||
return <img src={IconCm} alt="logo" />;
|
||||
case 'Settings Manager':
|
||||
return <img src={IconSettings} alt="logo" />;
|
||||
case 'Content Type Builder':
|
||||
return <img src={IconCtb} alt="logo" />;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<ListRow>
|
||||
<div className={cn("col-md-11", styles.nameWrapper)}>
|
||||
<div className={styles.icoContainer} style={{ marginRight: '30px' }}>
|
||||
<div className={styles.icoContainer} style={{ marginRight: '14px' }}>
|
||||
<img src={`${this.props.plugin.logo}`} alt="icon" />
|
||||
</div>
|
||||
<div className={styles.pluginContent}>
|
||||
<span>{this.props.plugin.name} — </span>
|
||||
<FormattedMessage id={this.props.plugin.description} />
|
||||
<FormattedMessage id={`${this.props.plugin.description}.short`} />
|
||||
</div>
|
||||
</div>
|
||||
<div className="col-md-1">
|
||||
|
||||
@ -9,7 +9,7 @@ import {
|
||||
UPDATE_PLUGIN,
|
||||
PLUGIN_LOADED,
|
||||
PLUGIN_DELETED,
|
||||
SET_HAS_USERS_PLUGIN,
|
||||
UNSET_HAS_USERS_PLUGIN,
|
||||
} from './constants';
|
||||
|
||||
export function loadPlugin(newPlugin) {
|
||||
@ -42,8 +42,8 @@ export function pluginDeleted(plugin) {
|
||||
};
|
||||
}
|
||||
|
||||
export function setHasUserPlugin() {
|
||||
export function unsetHasUserPlugin() {
|
||||
return {
|
||||
type: SET_HAS_USERS_PLUGIN,
|
||||
type: UNSET_HAS_USERS_PLUGIN,
|
||||
};
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
export const SET_HAS_USERS_PLUGIN = 'app/App/SET_HAS_USERS_PLUGIN';
|
||||
export const UNSET_HAS_USERS_PLUGIN = 'app/App/UNSET_HAS_USERS_PLUGIN';
|
||||
export const LOAD_PLUGIN = 'app/App/LOAD_PLUGIN';
|
||||
export const UPDATE_PLUGIN = 'app/App/UPDATE_PLUGIN';
|
||||
export const PLUGIN_LOADED = 'app/App/PLUGIN_LOADED';
|
||||
|
||||
@ -3,7 +3,7 @@ import {
|
||||
UPDATE_PLUGIN,
|
||||
PLUGIN_DELETED,
|
||||
PLUGIN_LOADED,
|
||||
SET_HAS_USERS_PLUGIN,
|
||||
UNSET_HAS_USERS_PLUGIN,
|
||||
} from './constants';
|
||||
|
||||
const initialState = fromJS({
|
||||
@ -19,7 +19,7 @@ function appReducer(state = initialState, action) {
|
||||
return state.setIn(['plugins', action.pluginId, action.updatedKey], fromJS(action.updatedValue));
|
||||
case PLUGIN_DELETED:
|
||||
return state.deleteIn(['plugins', action.plugin]);
|
||||
case SET_HAS_USERS_PLUGIN:
|
||||
case UNSET_HAS_USERS_PLUGIN:
|
||||
return state.set('hasUserPlugin', false);
|
||||
default:
|
||||
return state;
|
||||
|
||||
@ -34,11 +34,15 @@ export function* pluginDownload() {
|
||||
const response = yield call(request, '/admin/plugins/install', opts, true);
|
||||
|
||||
if (response.ok) {
|
||||
yield put(downloadPluginSucceeded());
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
yield new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 8000);
|
||||
});
|
||||
|
||||
yield put(downloadPluginSucceeded());
|
||||
window.location.reload();
|
||||
}
|
||||
} catch(err) {
|
||||
yield put(downloadPluginError());
|
||||
|
||||
@ -1,5 +1,29 @@
|
||||
// Retrieve URLs.
|
||||
const remoteURL = window.location.port === '4000' ? 'http://localhost:4000/admin' : process.env.REMOTE_URL || 'http://localhost:1337/admin';
|
||||
const devURL = document.getElementsByTagName('body')[0].getAttribute('front');
|
||||
// Retrieve remote and backend URLs.
|
||||
const remoteURL = (() => {
|
||||
if (window.location.port === '4000') {
|
||||
return 'http://localhost:4000/admin';
|
||||
}
|
||||
|
||||
__webpack_public_path__ = window.location.port === '4000' ? `${window.location.origin}/` : `${(devURL || remoteURL).replace(window.location.origin, '')}/`;
|
||||
// Relative URL (ex: /dashboard)
|
||||
if (process.env.REMOTE_URL[0] === '/') {
|
||||
return (window.location.origin + process.env.REMOTE_URL).replace(/\/$/, '');
|
||||
}
|
||||
|
||||
return process.env.REMOTE_URL.replace(/\/$/, '');
|
||||
})();
|
||||
const backendURL = (process.env.BACKEND_URL === '/' ? window.location.origin : process.env.BACKEND_URL);
|
||||
|
||||
// Retrieve development URL to avoid to re-build.
|
||||
const $body = document.getElementsByTagName('body')[0];
|
||||
const devFrontURL = $body.getAttribute('front') ? window.location.origin + $body.getAttribute('front').replace(/\/$/, '') : null;
|
||||
const devBackendURL = $body.getAttribute('back') ? window.location.origin + $body.getAttribute('back').replace(/\/$/, '') : null;
|
||||
|
||||
$body.removeAttribute('front');
|
||||
$body.removeAttribute('back');
|
||||
|
||||
window.strapi = {
|
||||
remoteURL: devFrontURL || remoteURL,
|
||||
backendURL: devBackendURL || backendURL,
|
||||
};
|
||||
|
||||
__webpack_public_path__ = window.location.port === '4000' ? `${window.location.origin}/` : `${(strapi.remoteURL).replace(window.location.origin, '')}/`;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-admin",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Strapi Admin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -11,8 +11,8 @@
|
||||
"preanalyze": "npm run analyze:clean",
|
||||
"analyze": "node ./node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||
"build:dev": "npm run build:dll && node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build": "npm run build:dll && node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:dll": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.dll.babel.js --color -p --progress",
|
||||
"build": "APP_PATH=$APP_PATH npm run build:dll && node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.prod.babel.js --color -p --progress",
|
||||
"build:dll": "APP_PATH=$APP_PATH node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=production IS_ADMIN=true node ./node_modules/strapi-helper-plugin/node_modules/.bin/webpack --config ./node_modules/strapi-helper-plugin/lib/internals/webpack/webpack.dll.babel.js --color -p --progress",
|
||||
"build:clean": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/rimraf admin/build",
|
||||
"start": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/cross-env NODE_ENV=development PORT=4000 IS_ADMIN=true node ./node_modules/strapi-helper-plugin/lib/server",
|
||||
"generate": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/plop --plopfile ./node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||
@ -21,13 +21,15 @@
|
||||
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||
"test": "echo Tests are not implemented.",
|
||||
"prepublishOnly": "npm run build",
|
||||
"setup": "npm install && node ./scripts/setup.js"
|
||||
"setup": "node ./scripts/setup.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"shelljs": "^0.7.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"sanitize.css": "^4.1.0",
|
||||
"shelljs": "^0.7.8",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.7.3",
|
||||
"strapi-utils": "3.0.0-alpha.7.3"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.8",
|
||||
"strapi-utils": "3.0.0-alpha.8"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi",
|
||||
|
||||
@ -4,45 +4,78 @@ const _ = require('lodash');
|
||||
|
||||
shell.echo('');
|
||||
shell.echo('🕓 The setup process can take few minutes.');
|
||||
shell.echo('📦 Installing admin packages...');
|
||||
shell.echo('');
|
||||
shell.echo(`🔸 Administration Panel`);
|
||||
shell.echo('📦 Installing packages...');
|
||||
|
||||
const pwd = shell.pwd();
|
||||
|
||||
shell.exec(`cd ${path.resolve(pwd.stdout, 'node_modules', 'strapi-helper-plugin')} && npm install`, {
|
||||
silent: true
|
||||
const silent = process.env.npm_config_debug !== 'true';
|
||||
const isDevelopmentMode = path.resolve(pwd.stdout).indexOf('strapi-admin') !== -1;
|
||||
const appPath = isDevelopmentMode ? path.resolve(process.env.PWD, '..') : path.resolve(pwd.stdout, '..');
|
||||
|
||||
// Remove package-lock.json.
|
||||
shell.rm('-rf', path.resolve(appPath, 'package-lock.json'));
|
||||
shell.rm('-rf', path.resolve(appPath, 'admin', 'package-lock.json'));
|
||||
|
||||
// Install the project dependencies.
|
||||
shell.exec(`cd ${appPath} && npm install --ignore-scripts`, {
|
||||
silent
|
||||
});
|
||||
|
||||
// Install the administration dependencies.
|
||||
shell.exec(`cd ${path.resolve(appPath, 'admin')} && npm install`, {
|
||||
silent
|
||||
});
|
||||
|
||||
if (isDevelopmentMode) {
|
||||
shell.exec(`cd ${path.resolve(appPath, 'admin')} && npm link strapi-helper-plugin && npm link strapi-utils`, {
|
||||
silent
|
||||
});
|
||||
} else {
|
||||
shell.exec(`cd ${path.resolve(appPath, 'admin', 'node_modules', 'strapi-helper-plugin')} && npm install`, {
|
||||
silent
|
||||
});
|
||||
}
|
||||
|
||||
shell.echo('🏗 Building...');
|
||||
|
||||
const build = shell.exec(`cd ${path.resolve(pwd.stdout)} && npm run build`, {
|
||||
silent: true
|
||||
const build = shell.exec(`cd ${path.resolve(appPath, 'admin')} && APP_PATH=${appPath} npm run build`, {
|
||||
silent
|
||||
});
|
||||
|
||||
if (build.stderr) {
|
||||
if (build.stderr && build.code !== 0) {
|
||||
console.error(build.stderr);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const plugins = path.resolve(pwd.stdout, '..', 'plugins');
|
||||
shell.echo('✅ Success');
|
||||
shell.echo('');
|
||||
|
||||
shell.ls('* -d', plugins).forEach(function (plugin) {
|
||||
shell.echo(`🔸 ${_.upperFirst(plugin)} (plugin)`);
|
||||
shell.echo('📦 Installing packages...');
|
||||
shell.exec(`cd ${path.resolve(plugins, plugin)} && npm install`, {
|
||||
silent: true
|
||||
if (process.env.npm_config_plugins === 'true') {
|
||||
const plugins = path.resolve(appPath, 'plugins');
|
||||
|
||||
shell.ls('* -d', plugins).forEach(function (plugin) {
|
||||
shell.echo(`🔸 Plugin - ${_.upperFirst(plugin)}`);
|
||||
shell.echo('📦 Installing packages...');
|
||||
shell.exec(`cd ${path.resolve(plugins, plugin)} && npm install`, {
|
||||
silent
|
||||
});
|
||||
shell.exec(`cd ${path.resolve(plugins, plugin, 'node_modules', 'strapi-helper-plugin')} && npm install`, {
|
||||
silent
|
||||
});
|
||||
shell.echo('🏗 Building...');
|
||||
|
||||
const build = shell.exec(`cd ${path.resolve(plugins, plugin)} && APP_PATH=${appPath} npm run build`, {
|
||||
silent
|
||||
});
|
||||
|
||||
if (build.stderr && build.code !== 0) {
|
||||
console.error(build.stderr);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
shell.echo('✅ Success');
|
||||
shell.echo('');
|
||||
});
|
||||
shell.exec(`cd ${path.resolve(plugins, plugin, 'node_modules', 'strapi-helper-plugin')} && npm install`, {
|
||||
silent: true
|
||||
});
|
||||
shell.echo('🏗 Building...');
|
||||
|
||||
const build = shell.exec(`cd ${path.resolve(plugins, plugin)} && npm run build`, {
|
||||
silent: true
|
||||
});
|
||||
|
||||
if (build.stderr) {
|
||||
console.error(build.stderr);
|
||||
}
|
||||
|
||||
shell.echo('');
|
||||
});
|
||||
}
|
||||
|
||||
@ -457,7 +457,7 @@ module.exports = function(strapi) {
|
||||
result.value = parseFloat(value);
|
||||
break;
|
||||
default:
|
||||
result = undefined;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -622,7 +622,7 @@ module.exports = function(strapi) {
|
||||
switch (association.nature) {
|
||||
case 'oneToOne':
|
||||
case 'oneToMany':
|
||||
return this.manageRelations(model, params)
|
||||
return this.manageRelations(model, params);
|
||||
case 'manyToMany':
|
||||
return Model.forge({
|
||||
[Model.primaryKey]: parseFloat(params[Model.primaryKey])
|
||||
@ -645,7 +645,7 @@ module.exports = function(strapi) {
|
||||
switch (association.nature) {
|
||||
case 'oneToOne':
|
||||
case 'oneToMany':
|
||||
return this.manageRelations(model, params)
|
||||
return this.manageRelations(model, params);
|
||||
case 'manyToMany':
|
||||
return Model.forge({
|
||||
[Model.primaryKey]: parseFloat(params[Model.primaryKey])
|
||||
|
||||
@ -10,8 +10,8 @@ const logger = require('strapi-utils').logger;
|
||||
module.exports = (scope, success, error) => {
|
||||
const knex = require(path.resolve(`${scope.rootPath}/node_modules/knex`))({
|
||||
client: scope.client.module,
|
||||
connection: Object.assign(scope.database, {
|
||||
user: scope.database.username
|
||||
connection: Object.assign(scope.database.settings, {
|
||||
user: scope.database.settings.username
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-bookshelf",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Bookshelf hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -19,8 +19,8 @@
|
||||
"bookshelf": "^0.10.3",
|
||||
"lodash": "^4.17.4",
|
||||
"pluralize": "^6.0.0",
|
||||
"strapi-knex": "3.0.0-alpha.7.3",
|
||||
"strapi-utils": "3.0.0-alpha.7.3"
|
||||
"strapi-knex": "3.0.0-alpha.8",
|
||||
"strapi-utils": "3.0.0-alpha.8"
|
||||
},
|
||||
"strapi": {
|
||||
"isHook": true,
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-ejs",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "EJS hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-admin",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Generate the default admin panel for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -15,7 +15,7 @@
|
||||
"dependencies": {
|
||||
"fs-extra": "^4.0.1",
|
||||
"lodash": "^4.17.4",
|
||||
"strapi-admin": "3.0.0-alpha.7.3"
|
||||
"strapi-admin": "3.0.0-alpha.8"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-api",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Generate an API for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-controller",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Generate a controller for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-model",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Generate a model for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
"connector": "strapi-mongoose",
|
||||
"settings": {
|
||||
"client": "mongo",
|
||||
"host": "localhost",
|
||||
"port": 27017,
|
||||
"database": "production",
|
||||
"host": "${process.env.DATABASE_HOST || 'localhost'}",
|
||||
"port": "${process.env.DATABASE_PORT || 27017}",
|
||||
"database": "${process.env.DATABASE_NAME || 'production'}",
|
||||
"username": "",
|
||||
"password": ""
|
||||
},
|
||||
|
||||
@ -24,7 +24,7 @@ module.exports = scope => {
|
||||
'description': 'A Strapi application.',
|
||||
'main': './server.js',
|
||||
'scripts': {
|
||||
'setup': 'npm install --ignore-scripts && cd admin && npm run setup', // Ready to deploy setup
|
||||
'setup': 'cd admin && npm run setup', // Ready to deploy setup
|
||||
'start': 'node server.js',
|
||||
'strapi': 'node_modules/strapi/bin/strapi.js', // Allow to use `npm run strapi` CLI,
|
||||
'lint': 'node_modules/.bin/eslint api/**/*.js config/**/*.js plugins/**/*.js',
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-new",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Generate a new Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -18,7 +18,7 @@
|
||||
"get-installed-path": "^3.0.1",
|
||||
"inquirer": "^4.0.2",
|
||||
"lodash": "^4.17.4",
|
||||
"strapi-utils": "3.0.0-alpha.7.3",
|
||||
"strapi-utils": "3.0.0-alpha.8",
|
||||
"uuid": "^3.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@ -91,7 +91,6 @@ lcov.info
|
||||
pids
|
||||
logs
|
||||
results
|
||||
build
|
||||
node_modules
|
||||
.node_history
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-plugin",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Generate an plugin for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-policy",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Generate a policy for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-service",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Generate a service for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Master of ceremonies for the Strapi generators.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -17,7 +17,7 @@
|
||||
"fs-extra": "^4.0.0",
|
||||
"lodash": "^4.17.4",
|
||||
"reportback": "^2.0.1",
|
||||
"strapi-utils": "3.0.0-alpha.7.3"
|
||||
"strapi-utils": "3.0.0-alpha.8"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -11,8 +11,21 @@ const pkg = require(path.resolve(process.cwd(), 'package.json'));
|
||||
const pluginId = pkg.name.replace(/^strapi-/i, '');
|
||||
const isAdmin = process.env.IS_ADMIN === 'true';
|
||||
|
||||
const appPath = isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
const appPath = (() => {
|
||||
if (process.env.APP_PATH) {
|
||||
return process.env.APP_PATH;
|
||||
}
|
||||
|
||||
return isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
})();
|
||||
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
||||
const adminPath = (() => {
|
||||
if (isSetup) {
|
||||
return isAdmin ? path.resolve(appPath, 'strapi-admin') : path.resolve(process.env.PWD);
|
||||
}
|
||||
|
||||
return path.resolve(appPath, 'admin');
|
||||
})();
|
||||
|
||||
if (!isSetup) {
|
||||
try {
|
||||
@ -23,7 +36,9 @@ if (!isSetup) {
|
||||
strapi.log.level = 'silent';
|
||||
|
||||
(async () => {
|
||||
await strapi.load();
|
||||
await strapi.load({
|
||||
environment: process.env.NODE_ENV
|
||||
});
|
||||
})();
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
@ -33,8 +48,10 @@ if (!isSetup) {
|
||||
|
||||
// Define remote and backend URLs.
|
||||
const URLs = {
|
||||
host: null,
|
||||
backend: null
|
||||
host: '/admin',
|
||||
backend: '/',
|
||||
publicPath: null,
|
||||
mode: 'host'
|
||||
};
|
||||
|
||||
if (isAdmin && !isSetup) {
|
||||
@ -43,11 +60,24 @@ if (isAdmin && !isSetup) {
|
||||
|
||||
try {
|
||||
const server = require(serverConfig);
|
||||
const path = _.get(server, 'admin.path', '/admin');
|
||||
|
||||
if (process.env.PWD.indexOf('/admin') !== -1) {
|
||||
URLs.host = _.get(server, 'admin.build.host', `http://${_.get(server, 'host', 'localhost')}:${_.get(server, 'port', 1337)}${path}`);
|
||||
URLs.backend = _.get(server, 'admin.build.backend', `http://${_.get(server, 'host', 'localhost')}:${_.get(server, 'port', 1337)}`);
|
||||
if (_.get(server, 'admin.build.host')) {
|
||||
URLs.host = _.get(server, 'admin.build.host', '/admin').replace(/\/$/, '') || '/';
|
||||
} else {
|
||||
URLs.host = _.get(server, 'admin.path', '/admin');
|
||||
}
|
||||
|
||||
URLs.publicPath = URLs.host;
|
||||
URLs.backend = _.get(server, 'admin.build.backend', `/`);
|
||||
|
||||
if (_.get(server, 'admin.build.plugins.source') === 'backend') {
|
||||
URLs.mode = 'backend';
|
||||
}
|
||||
|
||||
if (process.env.npm_lifecycle_event === 'start') {
|
||||
URLs.backend = `http://${_.get(server, 'host', 'localhost')}:${_.get(server, 'port', 1337)}`;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(`Impossible to access to ${serverConfig}`)
|
||||
@ -83,7 +113,7 @@ if (process.env.npm_lifecycle_event === 'start') {
|
||||
module.exports = (options) => ({
|
||||
entry: options.entry,
|
||||
output: Object.assign({ // Compile into js/build.js
|
||||
path: path.join(process.env.PWD, 'admin', 'build')
|
||||
path: path.join(adminPath, 'admin', 'build')
|
||||
}, options.output), // Merge with env dependent settings
|
||||
module: {
|
||||
loaders: [{
|
||||
@ -111,13 +141,13 @@ module.exports = (options) => ({
|
||||
},
|
||||
},
|
||||
},
|
||||
include: [path.join(process.env.PWD, 'admin', 'src')]
|
||||
include: [path.join(adminPath, 'admin', 'src')]
|
||||
.concat(plugins.src.reduce((acc, current) => {
|
||||
acc.push(path.resolve(appPath, 'plugins', current, 'admin', 'src'), plugins.folders[current]);
|
||||
|
||||
return acc;
|
||||
}, []))
|
||||
.concat([path.join(process.env.PWD, 'node_modules', 'strapi-helper-plugin', 'lib', 'src')])
|
||||
.concat([path.join(adminPath, 'node_modules', 'strapi-helper-plugin', 'lib', 'src')])
|
||||
}, {
|
||||
// Transform our own .scss files
|
||||
test: /\.scss$/,
|
||||
@ -205,6 +235,7 @@ module.exports = (options) => ({
|
||||
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
|
||||
REMOTE_URL: JSON.stringify(URLs.host),
|
||||
BACKEND_URL: JSON.stringify(URLs.backend),
|
||||
MODE: JSON.stringify(URLs.mode), // Allow us to define the public path for the plugins assets.
|
||||
},
|
||||
}),
|
||||
new webpack.NamedModulesPlugin()
|
||||
|
||||
@ -15,7 +15,13 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
|
||||
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
|
||||
|
||||
const isAdmin = process.env.IS_ADMIN === 'true';
|
||||
const appPath = isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
const appPath = (() => {
|
||||
if (process.env.APP_PATH) {
|
||||
return process.env.APP_PATH;
|
||||
}
|
||||
|
||||
return isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
})();
|
||||
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
||||
|
||||
// Load plugins into the same build in development mode.
|
||||
|
||||
@ -12,7 +12,13 @@ const path = require('path');
|
||||
const webpack = require('webpack');
|
||||
const isAdmin = process.env.IS_ADMIN === 'true';
|
||||
|
||||
const appPath = isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
const appPath = (() => {
|
||||
if (process.env.APP_PATH) {
|
||||
return process.env.APP_PATH;
|
||||
}
|
||||
|
||||
return isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
})();
|
||||
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
||||
|
||||
module.exports = {
|
||||
|
||||
@ -2,6 +2,8 @@
|
||||
const _ = require('lodash');
|
||||
const path = require('path');
|
||||
|
||||
const base = require('./webpack.base.babel');
|
||||
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const cssnext = require('postcss-cssnext');
|
||||
@ -10,7 +12,7 @@ const postcssReporter = require('postcss-reporter');
|
||||
const webpack = require('webpack');
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
|
||||
const WriteJsonPlugin = require('write-json-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
const pkg = require(path.resolve(process.cwd(), 'package.json'));
|
||||
const pluginId = pkg.name.replace(/^strapi-plugin-/i, '');
|
||||
@ -18,15 +20,19 @@ const dllPlugin = pkg.dllPlugin;
|
||||
|
||||
const isAdmin = process.env.IS_ADMIN === 'true';
|
||||
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
||||
const appPath = isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
|
||||
// Necessary configuration file to ensure that plugins will be loaded.
|
||||
const pluginsToInitialize = (() => {
|
||||
try {
|
||||
return require(path.resolve(appPath, 'admin', 'src', 'config', 'plugins.json'));
|
||||
} catch (e) {
|
||||
return [];
|
||||
const appPath = (() => {
|
||||
if (process.env.APP_PATH) {
|
||||
return process.env.APP_PATH;
|
||||
}
|
||||
|
||||
return isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||
})();
|
||||
const adminPath = (() => {
|
||||
if (isSetup) {
|
||||
return isAdmin ? path.resolve(appPath, 'strapi-admin') : path.resolve(process.env.PWD, '..');
|
||||
}
|
||||
|
||||
return path.resolve(appPath, 'admin');
|
||||
})();
|
||||
|
||||
const plugins = [
|
||||
@ -54,25 +60,32 @@ const plugins = [
|
||||
// new BundleAnalyzerPlugin(),
|
||||
];
|
||||
|
||||
// Default configurations.
|
||||
const settings = {
|
||||
path: 'admin',
|
||||
folder: 'plugins',
|
||||
host: 'http://localhost:1337'
|
||||
};
|
||||
let publicPath;
|
||||
|
||||
if (!isSetup) {
|
||||
// Load server configurations.
|
||||
if (isAdmin && !isSetup) {
|
||||
// Load server configuration.
|
||||
const serverConfig = path.resolve(appPath, 'config', 'environments', _.lowerCase(process.env.NODE_ENV), 'server.json');
|
||||
|
||||
const server = require(serverConfig);
|
||||
const pathAccess = _.get(server, 'admin.path', 'admin');
|
||||
try {
|
||||
const server = require(serverConfig);
|
||||
|
||||
Object.assign(settings, {
|
||||
path: pathAccess[0] === '/' ? pathAccess.substring(1) : pathAccess,
|
||||
folder: _.get(server, 'admin.build.plugins.folder', 'plugins'),
|
||||
host: _.get(server, 'admin.build.host', 'http://localhost:1337')
|
||||
});
|
||||
if (process.env.PWD.indexOf('/admin') !== -1) {
|
||||
if (_.get(server, 'admin.build.host')) {
|
||||
publicPath = _.get(server, 'admin.build.host', '/admin').replace(/\/$/, '') || '/';
|
||||
} else {
|
||||
publicPath = _.get(server, 'admin.path', '/admin');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
throw new Error(`Impossible to access to ${serverConfig}`);
|
||||
}
|
||||
|
||||
// Note: Travis failed with it.
|
||||
plugins.push(new CopyWebpackPlugin([{
|
||||
from: 'config/plugins.json',
|
||||
context: path.resolve(adminPath, 'admin', 'src'),
|
||||
to: 'config/plugins.json'
|
||||
}]));
|
||||
}
|
||||
|
||||
// Build the `index.html file`
|
||||
@ -99,12 +112,6 @@ if (isAdmin) {
|
||||
plugins.push(new AddAssetHtmlPlugin({
|
||||
filepath: path.resolve(__dirname, 'dist/*.dll.js')
|
||||
}));
|
||||
plugins.push(new WriteJsonPlugin({
|
||||
object: pluginsToInitialize,
|
||||
path: 'config',
|
||||
// default output is timestamp.json
|
||||
filename: 'plugins.json',
|
||||
}));
|
||||
}
|
||||
|
||||
const main = (() => {
|
||||
@ -117,17 +124,18 @@ const main = (() => {
|
||||
return path.join(process.env.PWD, 'node_modules', 'strapi-helper-plugin', 'lib', 'src', 'app.js');
|
||||
})();
|
||||
|
||||
module.exports = require('./webpack.base.babel')({
|
||||
module.exports = base({
|
||||
// In production, we skip all hot-reloading stuff
|
||||
entry: {
|
||||
main
|
||||
},
|
||||
|
||||
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
|
||||
output: {
|
||||
output: _.omitBy({
|
||||
filename: '[name].js',
|
||||
chunkFilename: '[name].[chunkhash].chunk.js'
|
||||
},
|
||||
chunkFilename: '[name].[chunkhash].chunk.js',
|
||||
publicPath,
|
||||
}, _.isUndefined),
|
||||
|
||||
// In production, we minify our CSS with cssnano
|
||||
postcssPlugins: [
|
||||
|
||||
@ -57,9 +57,8 @@ function PopUpWarning({ content, isOpen, onConfirm, onlyConfirmButton, popUpWarn
|
||||
<ModalHeader toggle={toggleModal} className={styles.header}>
|
||||
<FormattedMessage id={content.title || 'components.popUpWarning.title'} />
|
||||
</ModalHeader>
|
||||
<div className={styles.bordered} />
|
||||
<ModalBody>
|
||||
<div className={styles.modalDangerBodyContainer}>
|
||||
<ModalBody className={styles.modalBody}>
|
||||
<div className={styles.modalBodyContainer}>
|
||||
<img src={icons[popUpWarningType]} alt="icon" />
|
||||
<FormattedMessage id={content.message || 'components.popUpWarning.message'}>
|
||||
{(message) => (
|
||||
|
||||
@ -1,9 +1,14 @@
|
||||
.popUpWarning { /* stylelint-disable */
|
||||
width: 37.5rem!important;
|
||||
-webkit-font-smoothing: antialiased !important;
|
||||
}
|
||||
|
||||
.header {
|
||||
border: none!important;
|
||||
margin-left: 30px;
|
||||
margin-right: 30px;
|
||||
padding-bottom: 11px !important;
|
||||
border-bottom: 1px solid #F6F6F6;
|
||||
|
||||
> h4 {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
@ -11,104 +16,136 @@
|
||||
font-weight: bold!important;
|
||||
font-size: 1.8rem!important;
|
||||
}
|
||||
|
||||
> button {
|
||||
margin-right: 0!important;
|
||||
color: #C3C5C8;
|
||||
opacity: 1;
|
||||
font-size: 1.8rem;
|
||||
font-weight: 100;
|
||||
z-index: 999;
|
||||
cursor: pointer;
|
||||
|
||||
> span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&:hover, &:focus {
|
||||
color: #C3C5C8;
|
||||
opacity: 1;
|
||||
outline: 0!important;
|
||||
}
|
||||
|
||||
&:before {
|
||||
content: '\F00d';
|
||||
position: absolute;
|
||||
top: 14px;
|
||||
right: 14px;
|
||||
font-family: 'FontAwesome';
|
||||
font-weight: 400;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
.modalPosition {
|
||||
top: 16.8rem;
|
||||
left: 18.2rem;
|
||||
margin-top: 0 !important;
|
||||
|
||||
.modalPosition {
|
||||
> div {
|
||||
width: 37.5rem;
|
||||
padding: 0 !important;
|
||||
border:none;
|
||||
border-radius: 2px;
|
||||
width: 37.5rem;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
.modalDangerBodyContainer {
|
||||
padding-top: .1rem;
|
||||
> img {
|
||||
width: 2.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
> p {
|
||||
line-height: 1.8rem;
|
||||
}
|
||||
|
||||
.modalBodyContainer {
|
||||
padding: .1rem;
|
||||
color: #F64D0A;
|
||||
text-align: center;
|
||||
font-family: Lato;
|
||||
font-size: 1.3rem;
|
||||
|
||||
> img {
|
||||
width: 2.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
> p {
|
||||
line-height: 1.8rem;
|
||||
}
|
||||
}
|
||||
|
||||
.modalBody {
|
||||
padding: 16px 30px 15px 30px !important;
|
||||
}
|
||||
|
||||
|
||||
.buttonContainer {
|
||||
width: 100%;
|
||||
padding: 0 .5rem;
|
||||
display: flex;
|
||||
margin-top: 3.5rem;
|
||||
width: 100%;
|
||||
margin-top: 37px;
|
||||
justify-content: space-between;
|
||||
|
||||
> button {
|
||||
position: relative;
|
||||
height: 3rem;
|
||||
width: 15rem;
|
||||
position: relative;
|
||||
border-radius: 0.3rem;
|
||||
text-transform: capitalize;
|
||||
background-color: transparent;
|
||||
cursor: pointer;
|
||||
text-transform: capitalize;
|
||||
font-family: Lato;
|
||||
&:focus {
|
||||
outline: 0;
|
||||
}
|
||||
cursor: pointer;
|
||||
|
||||
> i {
|
||||
margin-right: 1.3rem;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: 0;
|
||||
}
|
||||
&:hover {
|
||||
&::after {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border-radius: 0.3rem;
|
||||
content: '';
|
||||
opacity: 0.1;
|
||||
background: #FFFFFF;
|
||||
}
|
||||
}
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 0.3rem;
|
||||
background: #FFFFFF;
|
||||
opacity: 0.1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.primary {
|
||||
font-weight: 500;
|
||||
background: linear-gradient(315deg, #0097F6 0%, #005EEA 100%);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
color: white !important;
|
||||
border: none !important;
|
||||
background: linear-gradient(315deg, #0097F6 0%, #005EEA 100%);
|
||||
color: white !important;
|
||||
font-weight: 500;
|
||||
|
||||
&:active, &:focus, &:hover {
|
||||
box-shadow: inset 1px 1px 3px rgba(0,0,0,.15);
|
||||
background: linear-gradient(315deg, #0097F6 0%, #005EEA 100%);
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
background-color: transparent;
|
||||
background: linear-gradient(315deg, #0097F6 0%, #005EEA 100%);
|
||||
box-shadow: inset 1px 1px 3px rgba(0,0,0,.15);
|
||||
}
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
.secondary {
|
||||
// height: 32px !important;
|
||||
color: #F64D0A !important;
|
||||
border: 0.1rem solid #F64D0A !important;
|
||||
position: relative;
|
||||
border: 0.1rem solid #F64D0A !important;
|
||||
border-radius: 3px;
|
||||
color: #F64D0A !important;
|
||||
overflow: hidden;
|
||||
|
||||
&:active {
|
||||
border: 0.15rem solid #F64D0A;
|
||||
}
|
||||
&:focus, &:hover {
|
||||
background-color: transparent !important;
|
||||
color: #F64D0A;
|
||||
border: 0.1rem solid #F64D0A;
|
||||
}
|
||||
}
|
||||
.bordered {
|
||||
margin-top: -.4rem;
|
||||
margin-left: 3rem;
|
||||
margin-right: 3rem;
|
||||
border: 1px solid #F6F6F6;
|
||||
border: 0.15rem solid #F64D0A;
|
||||
}
|
||||
|
||||
&:focus, &:hover {
|
||||
border: 0.1rem solid #F64D0A;
|
||||
background-color: transparent !important;
|
||||
color: #F64D0A;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,4 +2,12 @@ const pluginPkg = require('../../../../package.json');
|
||||
const pluginId = pluginPkg.name.replace(/^strapi-plugin-/i, '');
|
||||
const publicPath = `plugins/${pluginId}/`;
|
||||
|
||||
__webpack_public_path__ = window.location.port === '4000' ? `${window.location.origin}/` : `${(strapi.remoteURL).replace(window.location.origin, '')}/${publicPath}`;
|
||||
__webpack_public_path__ = (() => {
|
||||
if (window.location.port === '4000') {
|
||||
return `${window.location.origin}/`;
|
||||
} else if (strapi.mode === 'backend') {
|
||||
return `${strapi.backendURL}/${publicPath}`;
|
||||
}
|
||||
|
||||
return `${(strapi.remoteURL).replace(window.location.origin, '')}/${publicPath}`;
|
||||
})();
|
||||
|
||||
@ -18,11 +18,15 @@ function parseJSON(response) {
|
||||
*
|
||||
* @return {object|undefined} Returns either the response, or throws an error
|
||||
*/
|
||||
function checkStatus(response) {
|
||||
function checkStatus(response, checkToken = true) {
|
||||
if (response.status >= 200 && response.status < 300) {
|
||||
return response;
|
||||
}
|
||||
|
||||
if (response.status === 401 && auth.getToken() && checkToken) {
|
||||
return checkTokenValidity(response);
|
||||
}
|
||||
|
||||
return parseJSON(response).then(responseFormatted => {
|
||||
const error = new Error(response.statusText);
|
||||
error.response = response;
|
||||
@ -31,6 +35,29 @@ function checkStatus(response) {
|
||||
});
|
||||
}
|
||||
|
||||
function checkTokenValidity(response) {
|
||||
const options = {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${auth.getToken()}`,
|
||||
},
|
||||
};
|
||||
|
||||
if (auth.getToken()) {
|
||||
return fetch(`${strapi.backendURL}/user/me`, options)
|
||||
.then(resp => {
|
||||
if (response.status === 401) {
|
||||
window.location = `${strapi.remoteURL}/plugins/users-permissions/auth/login`;
|
||||
|
||||
auth.clearAppStorage();
|
||||
}
|
||||
|
||||
return checkStatus(response, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Format query params
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-helper-plugin",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Helper for Strapi plugins development",
|
||||
"engines": {
|
||||
"node": ">= 8.0.0",
|
||||
@ -46,6 +46,7 @@
|
||||
"bootstrap": "^4.0.0-alpha.6",
|
||||
"chalk": "^2.1.0",
|
||||
"classnames": "^2.2.5",
|
||||
"copy-webpack-plugin": "^4.3.1",
|
||||
"cross-env": "^5.0.5",
|
||||
"css-loader": "^0.28.5",
|
||||
"eslint": "^4.4.1",
|
||||
@ -108,7 +109,6 @@
|
||||
"webpack-bundle-analyzer": "^2.9.0",
|
||||
"webpack-dev-middleware": "^1.12.0",
|
||||
"webpack-hot-middleware": "^2.18.2",
|
||||
"whatwg-fetch": "^2.0.3",
|
||||
"write-json-webpack-plugin": "^1.0.2"
|
||||
"whatwg-fetch": "^2.0.3"
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-knex",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Knex hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-middleware-views",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Views hook to enable server-side rendering for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -10,7 +10,7 @@ const logger = require('strapi-utils').logger;
|
||||
module.exports = (scope, success, error) => {
|
||||
const Mongoose = require(path.resolve(`${scope.rootPath}/node_modules/mongoose`));
|
||||
|
||||
Mongoose.connect(`mongodb://${ (scope.database.username && scope.database.password) ? `${scope.database.username}:${scope.database.password}@` : '' }${scope.database.host}:${scope.database.port}/${scope.database.database}`, function (err) {
|
||||
Mongoose.connect(`mongodb://${ (scope.database.settings.username && scope.database.settings.password) ? `${scope.database.settings.username}:${scope.database.settings.password}@` : '' }${scope.database.settings.host}:${scope.database.settings.port}/${scope.database.settings.database}`, function (err) {
|
||||
if (err) {
|
||||
logger.warn('Database connection has failed! Make sure your database is running.');
|
||||
return error();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-mongoose",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Mongoose hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -19,7 +19,7 @@
|
||||
"mongoose": "^5.0.0-rc1",
|
||||
"mongoose-float": "^1.0.2",
|
||||
"pluralize": "^6.0.0",
|
||||
"strapi-utils": "3.0.0-alpha.7.3"
|
||||
"strapi-utils": "3.0.0-alpha.8"
|
||||
},
|
||||
"strapi": {
|
||||
"isHook": true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-content-manager",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "A powerful UI to easily manage your data.",
|
||||
"engines": {
|
||||
"node": ">= 8.0.0",
|
||||
@ -46,6 +46,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"react-select": "^1.0.0-rc.5",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.7.3"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.8"
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-content-type-builder",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Strapi plugin to create content type (API).",
|
||||
"strapi": {
|
||||
"name": "Content Type Builder",
|
||||
@ -25,11 +25,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"pluralize": "^7.0.0",
|
||||
"strapi-generate": "3.0.0-alpha.7.3",
|
||||
"strapi-generate-api": "3.0.0-alpha.7.3"
|
||||
"strapi-generate": "3.0.0-alpha.8",
|
||||
"strapi-generate-api": "3.0.0-alpha.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.7.3"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.8"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-email",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "This is the description of the plugin.",
|
||||
"strapi": {
|
||||
"name": "Email",
|
||||
@ -27,7 +27,7 @@
|
||||
"sendmail": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.7.3"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.8"
|
||||
},
|
||||
"author": {
|
||||
"name": "A Strapi developer",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-settings-manager",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Strapi plugin to manage settings.",
|
||||
"strapi": {
|
||||
"name": "Settings Manager",
|
||||
@ -26,7 +26,7 @@
|
||||
"devDependencies": {
|
||||
"flag-icon-css": "^2.8.0",
|
||||
"react-select": "^1.0.0-rc.5",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.7.3"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.8"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -118,7 +118,7 @@ Plugin.propTypes = {
|
||||
description: PropTypes.string,
|
||||
information: PropTypes.shape({
|
||||
logo: PropTypes.string.isRequired,
|
||||
}).isRequired,
|
||||
}),
|
||||
}),
|
||||
pluginSelected: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
@ -35,6 +35,11 @@ module.exports = {
|
||||
|
||||
me: async (ctx) => {
|
||||
const user = ctx.state.user;
|
||||
|
||||
if (!user) {
|
||||
return ctx.badRequest(null, [{ messages: [{ id: 'No authorization header was found' }] }]);
|
||||
}
|
||||
|
||||
const data = _.omit(user.toJSON ? user.toJSON() : user, ['password', 'resetPasswordToken']);
|
||||
|
||||
// Send 200 `ok`
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-users-permissions",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "This is the description of the plugin.",
|
||||
"strapi": {
|
||||
"name": "Auth & Permissions",
|
||||
@ -34,7 +34,7 @@
|
||||
"uuid": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.7.3"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.8"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
||||
@ -39,7 +39,9 @@ module.exports = {
|
||||
issue: (payload) => {
|
||||
return jwt.sign(
|
||||
_.clone(payload.toJSON ? payload.toJSON() : payload),
|
||||
process.env.JWT_SECRET || _.get(strapi.plugins['users-permissions'], 'config.jwtSecret') || 'oursecret'
|
||||
process.env.JWT_SECRET || _.get(strapi.plugins['users-permissions'], 'config.jwtSecret') || 'oursecret', {
|
||||
expiresIn: '30d'
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@ -169,9 +169,10 @@ module.exports = {
|
||||
const isCallback = actionName === 'callback' && controllerName === 'auth' && pluginName === 'users-permissions' && roleId === '1';
|
||||
const isRegister = actionName === 'register' && controllerName === 'auth' && pluginName === 'users-permissions' && roleId === '1';
|
||||
const isPassword = actionName === 'forgotPassword' && controllerName === 'auth' && pluginName === 'users-permissions' && roleId === '1';
|
||||
const isNewPassword = actionName === 'changePassword-password' && controllerName === 'auth' && pluginName === 'users-permissions' && roleId === '1';
|
||||
const isNewPassword = actionName === 'changePassword' && controllerName === 'auth' && pluginName === 'users-permissions' && roleId === '1';
|
||||
const isInit = actionName === 'init' && controllerName === 'userspermissions';
|
||||
const enabled = isCallback || isRegister || roleId === '0' || isInit || isPassword || isNewPassword;
|
||||
const isMe = actionName === 'me' && controllerName === 'user' && pluginName === 'users-permissions';
|
||||
const enabled = isCallback || isRegister || roleId === '0' || isInit || isPassword || isNewPassword || isMe;
|
||||
|
||||
_.set(data, [roleId, 'permissions', pluginName, 'controllers', controllerName, actionName], { enabled, policy: '' })
|
||||
}
|
||||
@ -277,14 +278,15 @@ module.exports = {
|
||||
1️⃣ EXECUTE THE FOLLOWING SQL QUERY
|
||||
|
||||
CREATE TABLE "${tableName}" (
|
||||
id integer NOT NULL,
|
||||
id ${Model.client === 'pg' ? 'SERIAL' : 'INT AUTO_INCREMENT'} NOT NULL PRIMARY KEY,
|
||||
username text,
|
||||
email text,
|
||||
provider text,
|
||||
role text,
|
||||
"resetPasswordToken" text,
|
||||
${Model.client === 'pg' ? '"resetPasswordToken"' : 'resetPasswordToken'} text,
|
||||
password text,
|
||||
updated_at timestamp with time zone,
|
||||
created_at timestamp with time zone
|
||||
updated_at ${Model.client === 'pg' ? 'timestamp with time zone' : 'timestamp'},
|
||||
created_at ${Model.client === 'pg' ? 'timestamp with time zone' : 'timestamp'}
|
||||
);
|
||||
|
||||
2️⃣ RESTART YOUR SERVER
|
||||
@ -299,10 +301,10 @@ CREATE TABLE "${tableName}" (
|
||||
.then(() => {
|
||||
const attributes = _.cloneDeep(Model.attributes);
|
||||
attributes.id = {
|
||||
type: 'integer'
|
||||
type: Model.client === 'pg' ? 'integer' : 'int'
|
||||
};
|
||||
attributes.updated_at = attributes.created_at = {
|
||||
type: 'timestamp with time zone'
|
||||
type: Model.client === 'pg' ? 'timestamp with time zone' : 'timestamp'
|
||||
};
|
||||
|
||||
let commands = '';
|
||||
@ -316,7 +318,7 @@ CREATE TABLE "${tableName}" (
|
||||
description.type = 'text';
|
||||
}
|
||||
|
||||
commands += `\r\nALTER TABLE "${tableName}" ADD "${attribute}" ${description.type};`;
|
||||
commands += `\r\nALTER TABLE "${tableName}" ADD ${Model.client === 'pg' ? `"${attribute}"` : `${attribute}`} ${description.type};`;
|
||||
}
|
||||
|
||||
resolve();
|
||||
|
||||
@ -10,10 +10,10 @@ const logger = require('strapi-utils').logger;
|
||||
module.exports = (scope, success, error) => {
|
||||
const Redis = require(`${scope.rootPath}/node_modules/ioredis`);
|
||||
const redis = new Redis({
|
||||
port: scope.database.port,
|
||||
host: scope.database.host,
|
||||
password: scope.database.password,
|
||||
db: scope.database.database
|
||||
port: scope.database.settings.port,
|
||||
host: scope.database.settings.host,
|
||||
password: scope.database.settings.password,
|
||||
db: scope.database.settings.database
|
||||
});
|
||||
|
||||
redis.connect((err) => {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-redis",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Redis hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -18,7 +18,7 @@
|
||||
"ioredis": "^3.1.2",
|
||||
"lodash": "^4.17.4",
|
||||
"stack-trace": "0.0.10",
|
||||
"strapi-utils": "3.0.0-alpha.7.3"
|
||||
"strapi-utils": "3.0.0-alpha.8"
|
||||
},
|
||||
"strapi": {
|
||||
"isHook": true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-utils",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "Shared utilities for the Strapi packages",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
||||
@ -24,7 +24,7 @@ class Strapi extends EventEmitter {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.setMaxListeners(15);
|
||||
this.setMaxListeners(100);
|
||||
|
||||
this.reload = this.reload();
|
||||
|
||||
|
||||
@ -4,12 +4,15 @@
|
||||
const _ = require('lodash');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const cheerio = require('cheerio')
|
||||
const cheerio = require('cheerio');
|
||||
const URL = require('url');
|
||||
|
||||
module.exports = function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
if (this.config.environment === 'test') {
|
||||
const environment = this.config.environment;
|
||||
|
||||
if (environment === 'test') {
|
||||
return resolve();
|
||||
}
|
||||
|
||||
@ -39,14 +42,21 @@ module.exports = function() {
|
||||
$('script').each(function(i, elem) {
|
||||
if ($(this).attr('src')) {
|
||||
const parse = path.parse($(this).attr('src'));
|
||||
const url = URL.parse(_.get(strapi.config.currentEnvironment.server, 'admin.build.host', _.get(strapi.config.currentEnvironment.server, 'admin.path', '/admin')));
|
||||
|
||||
$(this).attr('src', `${_.get(strapi.config.currentEnvironment.server, 'admin.path', '/admin')}/${parse.base}`);
|
||||
$(this).attr('src', `${url.pathname.replace(/\/$/, '')}/${parse.base}`);
|
||||
}
|
||||
});
|
||||
|
||||
// Remove previous
|
||||
$('body').attr('front', `http://${strapi.config.currentEnvironment.server.host}:${strapi.config.currentEnvironment.server.port}${_.get(strapi.config.currentEnvironment.server, 'admin.path', '/admin')}`);
|
||||
$('body').attr('back', `http://${strapi.config.currentEnvironment.server.host}:${strapi.config.currentEnvironment.server.port}`);
|
||||
// Remove previous and use build configurations.
|
||||
if (environment === 'production') {
|
||||
$('body').removeAttr('front');
|
||||
$('body').removeAttr('back');
|
||||
} else {
|
||||
// Update attribute with the current server configurations.
|
||||
$('body').attr('front', `${_.get(strapi.config.currentEnvironment.server, 'admin.path', '/admin')}`);
|
||||
$('body').attr('back', `/`);
|
||||
}
|
||||
|
||||
fs.writeFile(sourcePath, $.html(), (err) => {
|
||||
if (err) {
|
||||
|
||||
@ -364,19 +364,18 @@ const enableHookNestedDependencies = function (name, flattenHooksConfig, force =
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
/**
|
||||
* Allow dynamic config values through
|
||||
* the native ES6 template string function.
|
||||
*/
|
||||
const regex = /\$\{[^()]*\}/g;
|
||||
const templateConfigurations = function (obj) {
|
||||
// Allow values which looks like such as
|
||||
// an ES6 literal string without parenthesis inside (aka function call).
|
||||
const regex = /\$\{[^()]*\}/g;
|
||||
|
||||
return Object.keys(obj).reduce((acc, key) => {
|
||||
if (isPlainObject(obj[key])) {
|
||||
if (isPlainObject(obj[key]) && !isString(obj[key])) {
|
||||
acc[key] = templateConfigurations(obj[key]);
|
||||
} else if (isString(obj[key]) && regex.test(obj[key])) {
|
||||
} else if (isString(obj[key]) && obj[key].match(regex) !== null) {
|
||||
acc[key] = eval('`' + obj[key] + '`');
|
||||
} else {
|
||||
acc[key] = obj[key];
|
||||
|
||||
@ -9,12 +9,14 @@ module.exports = function() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const folder = ((url = _.get(strapi.config.currentEnvironment.server, 'admin.path', 'admin')) =>
|
||||
url[0] === '/' ? url.substring(1) : url
|
||||
)();
|
||||
)().replace(/\/$/, '') ;
|
||||
|
||||
const configuratePlugin = (acc, current, source, name) => {
|
||||
switch (source) {
|
||||
case 'host': {
|
||||
if (!_.get(this.config.environments[current].server, 'admin.build.host')) {
|
||||
const host = _.get(this.config.environments[current].server, 'admin.build.host').replace(/\/$/, '') || '/';
|
||||
|
||||
if (!host) {
|
||||
throw new Error(`You can't use \`remote\` as a source without set the \`host\` configuration.`);
|
||||
}
|
||||
|
||||
@ -23,10 +25,10 @@ module.exports = function() {
|
||||
if (_.isString(folder)) {
|
||||
const cleanFolder = folder[0] === '/' ? folder.substring(1) : folder;
|
||||
|
||||
return `${this.config.environments[current].server.admin.build.host}/${cleanFolder}/${name}/main.js`;
|
||||
return `/${host}/${cleanFolder}/${name}/main.js`.replace('//', '/');
|
||||
}
|
||||
|
||||
return `${this.config.environments[current].server.admin.build.host}/${name}/main.js`;
|
||||
return `/${host}/${name}/main.js`.replace('//', '/');
|
||||
}
|
||||
case 'custom':
|
||||
if (!_.isEmpty(_.get(this.plugins[name].config, `sources.${current}`, {}))) {
|
||||
@ -34,9 +36,12 @@ module.exports = function() {
|
||||
}
|
||||
|
||||
throw new Error(`You have to define the source URL for each environment in \`./plugins/**/config/sources.json\``);
|
||||
case 'origin':
|
||||
case 'backend':
|
||||
const backend = _.get(this.config.environments[current], 'server.admin.build.backend', `http://${this.config.environments[current].server.host}:${this.config.environments[current].server.port}`).replace(/\/$/, '');
|
||||
|
||||
return `${backend}/${folder.replace(/\/$/, '')}/${name}/main.js`;
|
||||
default:
|
||||
return `http://${this.config.environments[current].server.host}:${this.config.environments[current].server.port}/${folder}/${name}/main.js`;
|
||||
return `/${name}/main.js`;
|
||||
}
|
||||
};
|
||||
|
||||
@ -111,7 +116,7 @@ module.exports = function() {
|
||||
const data = Object.keys(this.plugins).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', 'origin');
|
||||
const source = _.get(this.config.environments[current].server, 'admin.build.plugins.source', 'default');
|
||||
|
||||
if (_.isString(source)) {
|
||||
acc[current] = configuratePlugin(acc, current, source, name);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"cors": {
|
||||
"enabled": false,
|
||||
"origin": true,
|
||||
"origin": "*",
|
||||
"expose": [
|
||||
"WWW-Authenticate",
|
||||
"Server-Authorization"
|
||||
@ -14,7 +14,8 @@
|
||||
"PUT",
|
||||
"PATCH",
|
||||
"DELETE",
|
||||
"HEAD"
|
||||
"HEAD",
|
||||
"OPTIONS"
|
||||
],
|
||||
"headers": [
|
||||
"Content-Type",
|
||||
|
||||
@ -8,7 +8,7 @@ const { after, includes, indexOf, drop, dropRight, uniq, defaultsDeep, get, set,
|
||||
module.exports = async function() {
|
||||
// Set if is admin destination for middleware application.
|
||||
this.app.use(async (ctx, next) => {
|
||||
if (ctx.request.header['origin'] === 'http://localhost:4000') {
|
||||
if (ctx.request.header['origin'] === 'http://localhost:4000' || ctx.request.method === 'OPTIONS') {
|
||||
ctx.request.header['x-forwarded-host'] = 'strapi';
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ module.exports = {
|
||||
loadFile: function(url) {
|
||||
try {
|
||||
// Clear cache.
|
||||
delete require.cache[path.resolve(this.config.appPath, url)];
|
||||
delete require.cache[require.resolve(path.resolve(this.config.appPath, url))];
|
||||
// Require without cache.
|
||||
return require(path.resolve(this.config.appPath, url));
|
||||
} catch (e) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi",
|
||||
"version": "3.0.0-alpha.7.3",
|
||||
"version": "3.0.0-alpha.8",
|
||||
"description": "An open source solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -55,14 +55,14 @@
|
||||
"rimraf": "^2.6.2",
|
||||
"semver": "^5.4.1",
|
||||
"stack-trace": "0.0.10",
|
||||
"strapi-generate": "3.0.0-alpha.7.3",
|
||||
"strapi-generate-admin": "3.0.0-alpha.7.3",
|
||||
"strapi-generate-api": "3.0.0-alpha.7.3",
|
||||
"strapi-generate-new": "3.0.0-alpha.7.3",
|
||||
"strapi-generate-plugin": "3.0.0-alpha.7.3",
|
||||
"strapi-generate-policy": "3.0.0-alpha.7.3",
|
||||
"strapi-generate-service": "3.0.0-alpha.7.3",
|
||||
"strapi-utils": "3.0.0-alpha.7.3"
|
||||
"strapi-generate": "3.0.0-alpha.8",
|
||||
"strapi-generate-admin": "3.0.0-alpha.8",
|
||||
"strapi-generate-api": "3.0.0-alpha.8",
|
||||
"strapi-generate-new": "3.0.0-alpha.8",
|
||||
"strapi-generate-plugin": "3.0.0-alpha.8",
|
||||
"strapi-generate-policy": "3.0.0-alpha.8",
|
||||
"strapi-generate-service": "3.0.0-alpha.8",
|
||||
"strapi-utils": "3.0.0-alpha.8"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
||||
@ -2,79 +2,100 @@ const shell = require('shelljs');
|
||||
|
||||
// Store installation start date.
|
||||
const installationStartDate = new Date();
|
||||
const watcher = (label, cmd, withSuccess = true) => {
|
||||
if (label.length > 0) {
|
||||
shell.echo(`📦 ${label}`);
|
||||
}
|
||||
|
||||
const data = shell.exec(cmd, {
|
||||
silent: true
|
||||
});
|
||||
|
||||
if (data.stderr && data.code !== 0) {
|
||||
console.error(data.stderr);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (label.length > 0 && withSuccess) {
|
||||
shell.echo('✅ Success');
|
||||
shell.echo('');
|
||||
}
|
||||
};
|
||||
|
||||
shell.echo('');
|
||||
shell.echo('🕓 The setup process can take few minutes.');
|
||||
shell.echo('');
|
||||
|
||||
// Remove existing binary.
|
||||
shell.rm('-f', '/usr/local/bin/strapi.js');
|
||||
|
||||
shell.echo('Linking Strapi CLI...');
|
||||
|
||||
shell.cd('packages/strapi-utils');
|
||||
shell.exec('npm link');
|
||||
watcher('Linking strapi-utils...', 'npm link');
|
||||
|
||||
shell.cd('../strapi-generate');
|
||||
shell.exec('npm install ../strapi-utils');
|
||||
shell.exec('npm link');
|
||||
watcher('', 'npm install ../strapi-utils');
|
||||
watcher('Linking strapi-generate...', 'npm link');
|
||||
|
||||
shell.cd('../strapi-generate-api');
|
||||
shell.exec('npm link');
|
||||
watcher('Linking strapi-generate-api...', 'npm link');
|
||||
|
||||
shell.cd('../strapi-helper-plugin');
|
||||
shell.exec('npm link');
|
||||
watcher('Linking strapi-helper-plugin...', 'npm link');
|
||||
|
||||
shell.cd('../strapi-admin');
|
||||
shell.exec('npm install ../strapi-helper-plugin');
|
||||
shell.exec('npm install ../strapi-utils');
|
||||
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
|
||||
watcher('', 'npm install ../strapi-utils --no-optional');
|
||||
shell.rm('-f', 'package-lock.json');
|
||||
shell.exec('npm link');
|
||||
shell.exec('npm run build');
|
||||
watcher('Linking strapi-admin', 'npm link --no-optional', false);
|
||||
watcher('Building...', 'npm run build');
|
||||
|
||||
shell.cd('../strapi-generate-admin');
|
||||
shell.exec('npm install ../strapi-admin');
|
||||
shell.exec('npm link');
|
||||
watcher('', 'npm install ../strapi-admin');
|
||||
watcher('Linking strapi-generate-admin...', 'npm link');
|
||||
|
||||
shell.cd('../strapi-generate-new');
|
||||
shell.exec('npm install ../strapi-utils');
|
||||
shell.exec('npm link');
|
||||
watcher('', 'npm install ../strapi-utils');
|
||||
watcher('Linking strapi-generate-new', 'npm link');
|
||||
|
||||
shell.cd('../strapi-mongoose');
|
||||
shell.exec('npm install ../strapi-utils');
|
||||
shell.exec('npm link');
|
||||
watcher('', 'npm install ../strapi-utils');
|
||||
watcher('Linking strapi-mongoose...', 'npm link');
|
||||
|
||||
shell.cd('../strapi');
|
||||
shell.exec('npm install ../strapi-generate ../strapi-generate-admin ../strapi-generate-api ../strapi-generate-new ../strapi-generate-plugin ../strapi-generate-policy ../strapi-generate-service ../strapi-utils');
|
||||
shell.exec('npm link');
|
||||
watcher('', 'npm install ../strapi-generate ../strapi-generate-admin ../strapi-generate-api ../strapi-generate-new ../strapi-generate-plugin ../strapi-generate-policy ../strapi-generate-service ../strapi-utils');
|
||||
watcher('Linking strapi...', 'npm link');
|
||||
|
||||
shell.cd('../strapi-plugin-email');
|
||||
shell.exec('npm install ../strapi-helper-plugin');
|
||||
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
|
||||
shell.rm('-f', 'package-lock.json');
|
||||
shell.exec('npm link');
|
||||
shell.exec('npm run build');
|
||||
watcher('Linking strapi-plugin-email...', 'npm link --no-optional', false);
|
||||
watcher('Building...', 'npm run build');
|
||||
|
||||
shell.cd('../strapi-plugin-users-permissions');
|
||||
shell.exec('npm install ../strapi-helper-plugin');
|
||||
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
|
||||
shell.rm('-f', 'package-lock.json');
|
||||
shell.exec('npm link');
|
||||
shell.exec('npm run build');
|
||||
watcher('Linking strapi-plugin-users-permissions...', 'npm link --no-optional', false);
|
||||
watcher('Building...', 'npm run build');
|
||||
|
||||
shell.cd('../strapi-plugin-content-manager');
|
||||
shell.exec('npm install ../strapi-helper-plugin');
|
||||
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
|
||||
shell.rm('-f', 'package-lock.json');
|
||||
shell.exec('npm link');
|
||||
shell.exec('npm run build');
|
||||
watcher('Linking strapi-plugin-content-manager...', 'npm link --no-optional', false);
|
||||
watcher('Building...', 'npm run build');
|
||||
|
||||
shell.cd('../strapi-plugin-settings-manager');
|
||||
shell.exec('npm install ../strapi-helper-plugin');
|
||||
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
|
||||
shell.rm('-f', 'package-lock.json');
|
||||
shell.exec('npm link');
|
||||
shell.exec('npm run build');
|
||||
watcher('Linking strapi-plugin-settings-manager...', 'npm link --no-optional', false);
|
||||
watcher('Building...', 'npm run build');
|
||||
|
||||
shell.cd('../strapi-plugin-content-type-builder');
|
||||
shell.exec('npm install ../strapi-helper-plugin');
|
||||
shell.exec('npm install ../strapi-generate');
|
||||
shell.exec('npm install ../strapi-generate-api');
|
||||
watcher('', 'npm install ../strapi-helper-plugin --no-optional');
|
||||
watcher('', 'npm install ../strapi-generate --no-optional');
|
||||
watcher('', 'npm install ../strapi-generate-api --no-optional');
|
||||
shell.rm('-f', 'package-lock.json');
|
||||
shell.exec('npm link');
|
||||
shell.exec('npm run build');
|
||||
watcher('Linking strapi-plugin-content-type-builder...', 'npm link --no-optional', false);
|
||||
watcher('Building...', 'npm run build');
|
||||
|
||||
// Log installation duration.
|
||||
const installationEndDate = new Date();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user