mirror of
https://github.com/strapi/strapi.git
synced 2025-11-10 15:19:00 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
a28eadf67f
@ -29,6 +29,7 @@ const Content = styled.div`
|
|||||||
|
|
||||||
.icoWrapper {
|
.icoWrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
|
|||||||
@ -249,6 +249,7 @@ async function watchFiles(dir, ignoreFiles = []) {
|
|||||||
const cacheDir = path.join(dir, '.cache');
|
const cacheDir = path.join(dir, '.cache');
|
||||||
const pkgJSON = require(path.join(dir, 'package.json'));
|
const pkgJSON = require(path.join(dir, 'package.json'));
|
||||||
const admin = path.join(dir, 'admin');
|
const admin = path.join(dir, 'admin');
|
||||||
|
const extensionsPath = path.join(dir, 'extensions');
|
||||||
|
|
||||||
const appPlugins = Object.keys(pkgJSON.dependencies).filter(
|
const appPlugins = Object.keys(pkgJSON.dependencies).filter(
|
||||||
dep =>
|
dep =>
|
||||||
@ -256,12 +257,7 @@ async function watchFiles(dir, ignoreFiles = []) {
|
|||||||
fs.existsSync(path.resolve(getPkgPath(dep), 'admin', 'src', 'index.js'))
|
fs.existsSync(path.resolve(getPkgPath(dep), 'admin', 'src', 'index.js'))
|
||||||
);
|
);
|
||||||
const pluginsToWatch = appPlugins.map(plugin =>
|
const pluginsToWatch = appPlugins.map(plugin =>
|
||||||
path.join(
|
path.join(extensionsPath, plugin.replace(/^strapi-plugin-/i, ''), 'admin')
|
||||||
dir,
|
|
||||||
'extensions',
|
|
||||||
plugin.replace(/^strapi-plugin-/i, ''),
|
|
||||||
'admin'
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
const filesToWatch = [admin, ...pluginsToWatch];
|
const filesToWatch = [admin, ...pluginsToWatch];
|
||||||
|
|
||||||
@ -272,20 +268,20 @@ async function watchFiles(dir, ignoreFiles = []) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
watcher.on('all', async (event, filePath) => {
|
watcher.on('all', async (event, filePath) => {
|
||||||
const re = /\/extensions\/([^\/]*)\/.*$/gm;
|
const isExtension = filePath.includes(extensionsPath);
|
||||||
const matched = re.exec(filePath);
|
const pluginName = isExtension
|
||||||
const isExtension = matched !== null;
|
? filePath.replace(extensionsPath, '').split(path.sep)[1]
|
||||||
const pluginName = isExtension ? matched[1] : '';
|
: '';
|
||||||
|
|
||||||
const packageName = isExtension
|
const packageName = isExtension
|
||||||
? `strapi-plugin-${pluginName}`
|
? `strapi-plugin-${pluginName}`
|
||||||
: 'strapi-admin';
|
: 'strapi-admin';
|
||||||
|
|
||||||
const targetPath = isExtension
|
const targetPath = isExtension
|
||||||
? filePath
|
? path.normalize(
|
||||||
.split(`${path.sep}extensions${path.sep}`)[1]
|
filePath.split(extensionsPath)[1].replace(pluginName, '')
|
||||||
.replace(pluginName, '')
|
)
|
||||||
: filePath.split(`${path.sep}admin`)[1];
|
: path.normalize(filePath.split(admin)[1]);
|
||||||
|
|
||||||
const destFolder = isExtension
|
const destFolder = isExtension
|
||||||
? path.join(cacheDir, 'plugins', packageName)
|
? path.join(cacheDir, 'plugins', packageName)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user