lowdefy 5.5.1 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,6 +13,7 @@
13
13
  See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  */ import addCustomPluginsAsDeps from '../../utils/addCustomPluginsAsDeps.js';
16
+ import ensurePnpmWorkspaceYaml from '../../utils/ensurePnpmWorkspaceYaml.js';
16
17
  import getServer from '../../utils/getServer.js';
17
18
  import installServer from '../../utils/installServer.js';
18
19
  import resetServerPackageJson from '../../utils/resetServerPackageJson.js';
@@ -38,6 +39,10 @@ async function build({ context }) {
38
39
  context,
39
40
  directory
40
41
  });
42
+ await ensurePnpmWorkspaceYaml({
43
+ context,
44
+ directory
45
+ });
41
46
  await installServer({
42
47
  context,
43
48
  directory
@@ -14,6 +14,7 @@
14
14
  limitations under the License.
15
15
  */ import addCustomPluginsAsDeps from '../../utils/addCustomPluginsAsDeps.js';
16
16
  import checkPortAvailable from '../../utils/checkPortAvailable.js';
17
+ import ensurePnpmWorkspaceYaml from '../../utils/ensurePnpmWorkspaceYaml.js';
17
18
  import installServer from '../../utils/installServer.js';
18
19
  import resetServerPackageJson from '../../utils/resetServerPackageJson.js';
19
20
  import runDevServer from './runDevServer.js';
@@ -37,6 +38,10 @@ async function dev({ context }) {
37
38
  context,
38
39
  directory
39
40
  });
41
+ await ensurePnpmWorkspaceYaml({
42
+ context,
43
+ directory
44
+ });
40
45
  await installServer({
41
46
  context,
42
47
  directory
@@ -0,0 +1,58 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import fs from 'fs';
16
+ import path from 'path';
17
+ import { writeFile } from '@lowdefy/node-utils';
18
+ import findPnpmWorkspaceRoot from './findPnpmWorkspaceRoot.js';
19
+ // pnpm no longer reads the "pnpm" field in package.json, and pnpm 11 fails
20
+ // installs with ERR_PNPM_IGNORED_BUILDS unless dependency build scripts are
21
+ // allowed in pnpm-workspace.yaml. The key differs by version:
22
+ // - packages is required by pnpm 9 and 10.0, and stops pnpm from treating the
23
+ // server as part of a parent workspace.
24
+ // - onlyBuiltDependencies is read by early pnpm 10 versions.
25
+ // - allowBuilds is read by pnpm >=10.29 and pnpm 11.
26
+ const pnpmWorkspaceYaml = `packages:
27
+ - '.'
28
+ onlyBuiltDependencies:
29
+ - better-sqlite3
30
+ - sharp
31
+ allowBuilds:
32
+ better-sqlite3: true
33
+ sharp: true
34
+ `;
35
+ async function ensurePnpmWorkspaceYaml({ context, directory }) {
36
+ // Local mode runs against the monorepo packages; writing a nested
37
+ // pnpm-workspace.yaml there would corrupt the monorepo workspace.
38
+ if (context.lowdefyVersion === 'local') {
39
+ return;
40
+ }
41
+ const filePath = path.join(directory, 'pnpm-workspace.yaml');
42
+ // Keep existing files so users can allow builds for their own plugin deps.
43
+ if (fs.existsSync(filePath)) {
44
+ return;
45
+ }
46
+ // Apps inside a pnpm workspace install the server as part of that workspace —
47
+ // custom plugins pinned as workspace:* only resolve there, and the root's
48
+ // overrides, packageExtensions and build allowlists must keep applying.
49
+ // Writing packages: ['.'] would isolate the server and break all of that,
50
+ // so build allowlists stay the workspace root's responsibility.
51
+ const workspaceRoot = findPnpmWorkspaceRoot(path.dirname(directory));
52
+ if (workspaceRoot !== null) {
53
+ context.logger.debug(`Found pnpm workspace at ${workspaceRoot}; the server installs as part of that workspace.`);
54
+ return;
55
+ }
56
+ await writeFile(filePath, pnpmWorkspaceYaml);
57
+ }
58
+ export default ensurePnpmWorkspaceYaml;
@@ -0,0 +1,29 @@
1
+ /*
2
+ Copyright 2020-2026 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import fs from 'fs';
16
+ import path from 'path';
17
+ // Mirrors how pnpm finds its workspace root: walk up from startDir and return
18
+ // the first directory containing pnpm-workspace.yaml, or null if none exists.
19
+ function findPnpmWorkspaceRoot(startDir) {
20
+ let dir = startDir;
21
+ while(dir !== path.dirname(dir)){
22
+ if (fs.existsSync(path.join(dir, 'pnpm-workspace.yaml'))) {
23
+ return dir;
24
+ }
25
+ dir = path.dirname(dir);
26
+ }
27
+ return null;
28
+ }
29
+ export default findPnpmWorkspaceRoot;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lowdefy",
3
- "version": "5.5.1",
3
+ "version": "5.6.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy CLI",
6
6
  "homepage": "https://lowdefy.com",
@@ -32,10 +32,10 @@
32
32
  ],
33
33
  "exports": "./dist/index.js",
34
34
  "dependencies": {
35
- "@lowdefy/errors": "5.5.1",
36
- "@lowdefy/helpers": "5.5.1",
37
- "@lowdefy/logger": "5.5.1",
38
- "@lowdefy/node-utils": "5.5.1",
35
+ "@lowdefy/errors": "5.6.0",
36
+ "@lowdefy/helpers": "5.6.0",
37
+ "@lowdefy/logger": "5.6.0",
38
+ "@lowdefy/node-utils": "5.6.0",
39
39
  "axios": "1.8.2",
40
40
  "commander": "11.1.0",
41
41
  "decompress": "4.2.1",