mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
Fix uncaught error. Symlink not working with scoped packages (#6233)
This commit is contained in:
parent
34fc855dd1
commit
9e6549db2e
3 changed files with 71 additions and 59 deletions
|
@ -35,7 +35,6 @@ export class LinkInstaller {
|
|||
this.dependenciesMap.set(dependency, new Set([name]))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async installFromPath(path: string) {
|
||||
|
@ -177,9 +176,10 @@ export class LinkInstaller {
|
|||
// We already added the sub dependency
|
||||
this.dependenciesMap.get(dependency)?.add(plugin)
|
||||
} else {
|
||||
this.linkDependency(dependency)
|
||||
// Read sub dependencies
|
||||
|
||||
try {
|
||||
this.linkDependency(dependency)
|
||||
// Read sub dependencies
|
||||
const json:IPluginInfo = JSON.parse(
|
||||
readFileSync(pathToFileURL(path.join(pluginInstallPath, dependency, 'package.json'))) as unknown as string);
|
||||
if(json.dependencies){
|
||||
|
@ -199,7 +199,16 @@ export class LinkInstaller {
|
|||
// Check if the dependency is already installed
|
||||
accessSync(path.join(node_modules, dependency), constants.F_OK)
|
||||
} catch (err) {
|
||||
symlinkSync(path.join(pluginInstallPath, dependency), path.join(node_modules, dependency), 'dir')
|
||||
try {
|
||||
if(dependency.startsWith("@")){
|
||||
const newDependency = dependency.split("@")[0]
|
||||
symlinkSync(path.join(pluginInstallPath, dependency), path.join(node_modules, newDependency), 'dir')
|
||||
} else {
|
||||
symlinkSync(path.join(pluginInstallPath, dependency), path.join(node_modules, dependency), 'dir')
|
||||
}
|
||||
} catch (e) {
|
||||
// Nothing to do. We're all set
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,8 +79,6 @@ export const checkForMigration = async () => {
|
|||
// Initialize linkInstaller
|
||||
await linkInstaller.init()
|
||||
|
||||
|
||||
|
||||
try {
|
||||
await fs.access(installedPluginsPath, fs.constants.F_OK);
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue