Skip to content

Commit 8018396

Browse files
committed
Merge branch 'release/16.0'
2 parents 445652d + 5161a2d commit 8018396

File tree

19 files changed

+754
-512
lines changed

19 files changed

+754
-512
lines changed

src/Umbraco.Cms.Api.Management/Middleware/BackOfficeAuthorizationInitializationMiddleware.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,21 @@ private async Task InitializeBackOfficeAuthorizationOnceAsync(HttpContext contex
6565
return;
6666
}
6767

68-
if (_knownHosts.Add($"{context.Request.Scheme}://{context.Request.Host}") is false)
68+
var host = $"{context.Request.Scheme}://{context.Request.Host}";
69+
if (_knownHosts.Contains(host))
6970
{
7071
return;
7172
}
7273

7374
await _firstBackOfficeRequestLocker.WaitAsync();
7475

76+
// NOTE: _knownHosts is not thread safe; check again after entering the semaphore
77+
if (_knownHosts.Add(host) is false)
78+
{
79+
_firstBackOfficeRequestLocker.Release();
80+
return;
81+
}
82+
7583
// ensure we explicitly add UmbracoApplicationUrl if configured (https://github.com/umbraco/Umbraco-CMS/issues/16179)
7684
if (_webRoutingSettings.UmbracoApplicationUrl.IsNullOrWhiteSpace() is false)
7785
{

src/Umbraco.Web.UI.Client/devops/publish/cleanse-pkg.js

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { readFileSync, writeFileSync } from 'fs';
1+
import { readFileSync, writeFileSync, existsSync } from 'fs';
2+
import { join } from 'path';
3+
import glob from 'tiny-glob'
24

35
console.log('[Prepublish] Cleansing package.json');
46

@@ -12,5 +14,40 @@ delete packageJson.devDependencies;
1214
packageJson.peerDependencies = { ...packageJson.dependencies };
1315
delete packageJson.dependencies;
1416

17+
// Iterate all workspaces and hoist the dependencies to the root package.json
18+
const workspaces = packageJson.workspaces || [];
19+
const workspacePromises = workspaces.map(async workspaceGlob => {
20+
// Use glob to find the workspace path
21+
const localWorkspace = workspaceGlob.replace(/\.\/src/, './dist-cms');
22+
const workspacePaths = await glob(localWorkspace, { cwd: './', absolute: true });
23+
24+
workspacePaths.forEach(workspace => {
25+
const workspacePackageFile = join(workspace, 'package.json');
26+
27+
// Ensure the workspace package.json exists
28+
if (!existsSync(workspacePackageFile)) {
29+
// If the package.json does not exist, log a warning and continue
30+
console.warn(`No package.json found in workspace: ${workspace}`);
31+
return;
32+
}
33+
34+
const workspacePackageJson = JSON.parse(readFileSync(workspacePackageFile, 'utf8'));
35+
36+
// Move dependencies from the workspace to the root package.json
37+
if (workspacePackageJson.dependencies) {
38+
Object.entries(workspacePackageJson.dependencies).forEach(([key, value]) => {
39+
console.log('Hoisting dependency:', key, 'from workspace:', workspace, 'with version:', value);
40+
packageJson.peerDependencies[key] = value;
41+
});
42+
}
43+
})
44+
});
45+
46+
// Wait for all workspace processing to complete
47+
await Promise.all(workspacePromises);
48+
49+
// Remove the workspaces field from the root package.json
50+
delete packageJson.workspaces;
51+
1552
// Write the package.json back to disk
1653
writeFileSync(packageFile, JSON.stringify(packageJson, null, 2), 'utf8');

0 commit comments

Comments
 (0)