mirror of
https://github.com/strapi/strapi.git
synced 2025-11-13 00:29:51 +00:00
Build upload
This commit is contained in:
parent
f14ad13481
commit
06eeca0f65
@ -16,6 +16,29 @@ window.strapi = Object.assign(window.strapi || {}, {
|
|||||||
injectSaga,
|
injectSaga,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// const plugins = [
|
||||||
|
// // 'content-manager',
|
||||||
|
// // 'content-type-builder',
|
||||||
|
// // 'email',
|
||||||
|
// // 'settings-manager',
|
||||||
|
// // 'upload',
|
||||||
|
// 'users-permissions',
|
||||||
|
// ].reduce((acc, curr) => {
|
||||||
|
// const suffix =
|
||||||
|
// process.env.NODE_ENV === 'development'
|
||||||
|
// ? '/src'
|
||||||
|
// : `dist/${current}.esm.min.js`;
|
||||||
|
|
||||||
|
// acc[curr] = require(`../../../strapi-plugin-${current}/admin/${suffix}`);
|
||||||
|
|
||||||
|
// return acc;
|
||||||
|
// });
|
||||||
|
|
||||||
|
// console.log(plugins);
|
||||||
|
|
||||||
|
// module.exports = {};
|
||||||
|
// module.exports = plugins;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// 'content-manager': require('../../../strapi-plugin-content-manager/admin/src')
|
// 'content-manager': require('../../../strapi-plugin-content-manager/admin/src')
|
||||||
// .default,
|
// .default,
|
||||||
@ -25,8 +48,10 @@ module.exports = {
|
|||||||
// 'settings-manager': require('../../../strapi-plugin-settings-manager/admin/src')
|
// 'settings-manager': require('../../../strapi-plugin-settings-manager/admin/src')
|
||||||
// .default,
|
// .default,
|
||||||
// upload: require('../../../strapi-plugin-upload/admin/src').default,
|
// upload: require('../../../strapi-plugin-upload/admin/src').default,
|
||||||
|
upload: require('../../../strapi-plugin-upload/admin/dist/strapi-plugin-upload.esm.min.js')
|
||||||
|
.default,
|
||||||
// 'users-permissions': require('../../../strapi-plugin-users-permissions/admin/src')
|
// 'users-permissions': require('../../../strapi-plugin-users-permissions/admin/src')
|
||||||
// .default,
|
// .default,
|
||||||
'users-permissions': require('../../../strapi-plugin-users-permissions/admin/dist/strapi-us.esm.min.js')
|
'users-permissions': require('../../../strapi-plugin-users-permissions/admin/dist/strapi-users-permissions.esm.min.js')
|
||||||
.default,
|
.default,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -86,4 +86,4 @@
|
|||||||
"react-datetime": "^2.15.0",
|
"react-datetime": "^2.15.0",
|
||||||
"whatwg-fetch": "^2.0.3"
|
"whatwg-fetch": "^2.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -51,4 +51,4 @@
|
|||||||
"npm": ">= 6.0.0"
|
"npm": ">= 6.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
19
packages/strapi-plugin-upload/.babelrc
Normal file
19
packages/strapi-plugin-upload/.babelrc
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"@babel/preset-env",
|
||||||
|
{
|
||||||
|
"modules": false,
|
||||||
|
"loose": true,
|
||||||
|
"targets": {
|
||||||
|
"browsers": ["since 2017"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@babel/preset-react"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"@babel/plugin-proposal-class-properties",
|
||||||
|
"@babel/plugin-syntax-dynamic-import"
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -1,42 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { reduce } from 'lodash';
|
|
||||||
import pluginPkg from '../../package.json';
|
import pluginPkg from '../../package.json';
|
||||||
|
import App from './containers/App';
|
||||||
|
import Initializer from './containers/Initializer';
|
||||||
|
|
||||||
|
import lifecycles from './lifecycles';
|
||||||
|
import trads from './translations';
|
||||||
import pluginId from './pluginId';
|
import pluginId from './pluginId';
|
||||||
|
|
||||||
import App from './containers/App';
|
|
||||||
|
|
||||||
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
|
const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
|
||||||
|
|
||||||
const formatMessages = messages =>
|
|
||||||
reduce(
|
|
||||||
messages,
|
|
||||||
(result, value, key) => {
|
|
||||||
result[`${pluginId}.${key}`] = value;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
);
|
|
||||||
const requireTranslations = language => {
|
|
||||||
try {
|
|
||||||
return require(`./translations/${language}.json`); // eslint-disable-line global-require
|
|
||||||
} catch (error) {
|
|
||||||
console.error(
|
|
||||||
`Unable to load "${language}" translation for the plugin ${pluginId}. Please make sure "${language}.json" file exists in "pluginPath/admin/src/translations" folder.`,
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const translationMessages = reduce(
|
|
||||||
strapi.languages,
|
|
||||||
(result, language) => {
|
|
||||||
result[language] = formatMessages(requireTranslations(language));
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
{},
|
|
||||||
);
|
|
||||||
|
|
||||||
function Comp(props) {
|
function Comp(props) {
|
||||||
return <App {...props} />;
|
return <App {...props} />;
|
||||||
}
|
}
|
||||||
@ -47,16 +19,16 @@ const plugin = {
|
|||||||
description: pluginDescription,
|
description: pluginDescription,
|
||||||
icon: pluginPkg.strapi.icon,
|
icon: pluginPkg.strapi.icon,
|
||||||
id: pluginId,
|
id: pluginId,
|
||||||
initializer: require('./initializer'),
|
initializer: Initializer,
|
||||||
injectedComponents: require('./injectedComponents').default,
|
injectedComponents: [],
|
||||||
layout: null,
|
layout: null,
|
||||||
lifecycles: require('./lifecycles'),
|
lifecycles,
|
||||||
leftMenuLinks: [],
|
leftMenuLinks: [],
|
||||||
leftMenuSections: [],
|
leftMenuSections: [],
|
||||||
mainComponent: Comp,
|
mainComponent: Comp,
|
||||||
name: pluginPkg.strapi.name,
|
name: pluginPkg.strapi.name,
|
||||||
preventComponentRendering: false,
|
preventComponentRendering: false,
|
||||||
translationMessages,
|
trads,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default plugin;
|
export default plugin;
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
* Initializers
|
|
||||||
*
|
|
||||||
* ------------
|
|
||||||
*
|
|
||||||
* Execute logic to make your plugin ready to be displayed
|
|
||||||
* The app will wait until all the plugins are ready before rendering
|
|
||||||
* the admin.
|
|
||||||
*
|
|
||||||
* These components will be mounted only once when the app is loaded.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
const Initializer = require('./containers/Initializer');
|
|
||||||
|
|
||||||
module.exports = Initializer.default;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
export default [];
|
|
||||||
@ -8,4 +8,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = function lifecycles() {};
|
function lifecycles() {}
|
||||||
|
|
||||||
|
export default lifecycles;
|
||||||
|
|||||||
@ -0,0 +1,37 @@
|
|||||||
|
import ar from './ar.json';
|
||||||
|
import de from './de.json';
|
||||||
|
import en from './en.json';
|
||||||
|
import es from './es.json';
|
||||||
|
import fr from './fr.json';
|
||||||
|
import it from './it.json';
|
||||||
|
import ja from './ja.json';
|
||||||
|
import ko from './ko.json';
|
||||||
|
import nl from './nl.json';
|
||||||
|
import pl from './pl.json';
|
||||||
|
import ptBR from './pt-BR.json';
|
||||||
|
import pt from './pt.json';
|
||||||
|
import ru from './ru.json';
|
||||||
|
import tr from './tr.json';
|
||||||
|
import zhHans from './zh-hans.json';
|
||||||
|
import zh from './zh.json';
|
||||||
|
|
||||||
|
const trads = {
|
||||||
|
ar,
|
||||||
|
de,
|
||||||
|
en,
|
||||||
|
es,
|
||||||
|
fr,
|
||||||
|
it,
|
||||||
|
ja,
|
||||||
|
ko,
|
||||||
|
nl,
|
||||||
|
pl,
|
||||||
|
'pt-BR': ptBR,
|
||||||
|
pt,
|
||||||
|
ru,
|
||||||
|
tr,
|
||||||
|
'zh-Hans': zhHans,
|
||||||
|
zh,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default trads;
|
||||||
@ -13,8 +13,8 @@
|
|||||||
"analyze": "node ./node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
"analyze": "node ./node_modules/strapi-helper-plugin/lib/internals/scripts/analyze.js",
|
||||||
"prebuild": "npm run build:clean",
|
"prebuild": "npm run build:clean",
|
||||||
"build:dev": "cross-env NODE_ENV=development ./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:dev": "cross-env NODE_ENV=development ./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": "cross-env NODE_ENV=production 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": "rollup -c",
|
||||||
"build:clean": "rimraf admin/build",
|
"build:clean": "rimraf admin/dist",
|
||||||
"start": "cross-env NODE_ENV=development ./node_modules/strapi-helper-plugin/lib/server",
|
"start": "cross-env NODE_ENV=development ./node_modules/strapi-helper-plugin/lib/server",
|
||||||
"generate": "node ./node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
"generate": "node ./node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js",
|
||||||
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"",
|
||||||
@ -22,13 +22,51 @@
|
|||||||
"prepublishOnly": "IS_MONOREPO=true npm run build"
|
"prepublishOnly": "IS_MONOREPO=true npm run build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"redux-saga": "^1.0.2",
|
||||||
"strapi-provider-upload-local": "3.0.0-alpha.25.2",
|
"strapi-provider-upload-local": "3.0.0-alpha.25.2",
|
||||||
"strapi-utils": "3.0.0-alpha.25.2",
|
"strapi-utils": "3.0.0-alpha.25.2",
|
||||||
"stream-to-array": "^2.3.0",
|
"stream-to-array": "^2.3.0",
|
||||||
"uuid": "^3.2.1"
|
"uuid": "^3.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"strapi-helper-plugin": "3.0.0-alpha.25.2"
|
"@babel/core": "^7.4.3",
|
||||||
|
"@babel/plugin-external-helpers": "^7.2.0",
|
||||||
|
"@babel/plugin-proposal-class-properties": "^7.4.0",
|
||||||
|
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
|
||||||
|
"@babel/preset-env": "^7.4.3",
|
||||||
|
"@babel/preset-react": "^7.0.0",
|
||||||
|
"autoprefixer": "^9.5.1",
|
||||||
|
"node-sass": "^4.11.0",
|
||||||
|
"postcss-smart-import": "^0.7.6",
|
||||||
|
"precss": "^4.0.0",
|
||||||
|
"rimraf": "^2.6.3",
|
||||||
|
"rollup": "^1.10.0",
|
||||||
|
"rollup-plugin-babel": "^4.3.2",
|
||||||
|
"rollup-plugin-commonjs": "^9.3.4",
|
||||||
|
"rollup-plugin-image": "^1.0.2",
|
||||||
|
"rollup-plugin-json": "^4.0.0",
|
||||||
|
"rollup-plugin-node-resolve": "^4.2.3",
|
||||||
|
"rollup-plugin-postcss": "^2.0.3",
|
||||||
|
"rollup-plugin-rebase": "^3.1.1",
|
||||||
|
"rollup-plugin-sizes": "^0.5.1",
|
||||||
|
"rollup-plugin-svg": "^1.0.1",
|
||||||
|
"rollup-plugin-terser": "^4.0.4",
|
||||||
|
"rollup-plugin-url": "^2.2.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"immutable": "^3.8.2",
|
||||||
|
"invariant": "^2.2.1",
|
||||||
|
"lodash": "^4.17.11",
|
||||||
|
"react": "^16.0.0",
|
||||||
|
"reactstrap": "^5.0.0",
|
||||||
|
"react-dom": "^16.0.0",
|
||||||
|
"react-intl": "^2.8.0",
|
||||||
|
"react-redux": "^7.0.2",
|
||||||
|
"redux-saga": "^0.16.0",
|
||||||
|
"react-router": "^5.0.0",
|
||||||
|
"react-router-dom": "^5.0.0",
|
||||||
|
"react-transition-group": "^2.5.0",
|
||||||
|
"strapi-helper-plugin": "^3.0.0-alpha.25.2"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "A Strapi developer",
|
"name": "A Strapi developer",
|
||||||
|
|||||||
60
packages/strapi-plugin-upload/rollup.config.js
Normal file
60
packages/strapi-plugin-upload/rollup.config.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import babel from 'rollup-plugin-babel';
|
||||||
|
import resolve from 'rollup-plugin-node-resolve';
|
||||||
|
import commonjs from 'rollup-plugin-commonjs';
|
||||||
|
import svg from 'rollup-plugin-svg';
|
||||||
|
import postcss from 'rollup-plugin-postcss';
|
||||||
|
import { terser } from 'rollup-plugin-terser';
|
||||||
|
import url from 'rollup-plugin-url';
|
||||||
|
import json from 'rollup-plugin-json';
|
||||||
|
import pkg from './package.json';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
input: './admin/src/index.js',
|
||||||
|
output: [
|
||||||
|
{
|
||||||
|
exports: 'named',
|
||||||
|
file: `admin/dist/${pkg.name}.cjs.min.js`,
|
||||||
|
format: 'cjs',
|
||||||
|
sourceMap: true,
|
||||||
|
name: pkg.name,
|
||||||
|
compact: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
exports: 'named',
|
||||||
|
sourceMap: true,
|
||||||
|
file: `admin/dist/${pkg.name}.esm.min.js`,
|
||||||
|
format: 'es',
|
||||||
|
name: pkg.name,
|
||||||
|
compact: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
plugins: [
|
||||||
|
postcss({
|
||||||
|
modules: true,
|
||||||
|
minimize: true,
|
||||||
|
}),
|
||||||
|
url({
|
||||||
|
limit: 10 * 1024,
|
||||||
|
emitFiles: true,
|
||||||
|
}),
|
||||||
|
babel({
|
||||||
|
exclude: 'node_modules/**',
|
||||||
|
}),
|
||||||
|
commonjs(),
|
||||||
|
resolve(),
|
||||||
|
json({
|
||||||
|
exclude: 'node_modules/**',
|
||||||
|
compact: true, // Default: false
|
||||||
|
}),
|
||||||
|
|
||||||
|
svg(),
|
||||||
|
require('rollup-plugin-sizes')(),
|
||||||
|
terser(),
|
||||||
|
],
|
||||||
|
|
||||||
|
external: [
|
||||||
|
...Object.keys(pkg.dependencies || {}),
|
||||||
|
...Object.keys(pkg.peerDependencies || {}),
|
||||||
|
],
|
||||||
|
};
|
||||||
@ -1,15 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
* Initializers
|
|
||||||
*
|
|
||||||
* ------------
|
|
||||||
*
|
|
||||||
* Execute logic to make your plugin ready to be displayed
|
|
||||||
* The app will wait until all the plugins are ready before rendering
|
|
||||||
* the admin.
|
|
||||||
*
|
|
||||||
* These components will be mounted only once when the app is loaded.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = require('./containers/Initializer').default;
|
|
||||||
@ -94,4 +94,4 @@
|
|||||||
"npm": ">= 6.0.0"
|
"npm": ">= 6.0.0"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
@ -14,7 +14,7 @@ export default {
|
|||||||
output: [
|
output: [
|
||||||
{
|
{
|
||||||
exports: 'named',
|
exports: 'named',
|
||||||
file: 'admin/dist/strapi-us.cjs.min.js',
|
file: 'admin/dist/strapi-users-permissions.cjs.min.js',
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
name: 'strapi-plugin-users-permissions',
|
name: 'strapi-plugin-users-permissions',
|
||||||
@ -23,7 +23,7 @@ export default {
|
|||||||
{
|
{
|
||||||
exports: 'named',
|
exports: 'named',
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
file: 'admin/dist/strapi-us.esm.min.js',
|
file: 'admin/dist/strapi-users-permissions.esm.min.js',
|
||||||
format: 'es',
|
format: 'es',
|
||||||
name: 'strapi-plugin-users-permissions',
|
name: 'strapi-plugin-users-permissions',
|
||||||
compact: true,
|
compact: true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user