wspai 0.43.0 → 0.43.1

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.
package/bin/wspai.js CHANGED
@@ -1,12 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawnSync } from 'node:child_process';
4
+ import { existsSync } from 'node:fs';
4
5
  import { createRequire } from 'node:module';
5
6
  import path from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
6
8
 
7
9
  const require = createRequire(import.meta.url);
10
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
+
12
+ function resolveMonorepoEntrypoint() {
13
+ const candidate = path.resolve(__dirname, '..', '..', 'cli', 'dist', 'index.js');
14
+ return existsSync(candidate) ? candidate : null;
15
+ }
8
16
 
9
17
  function resolveWorkspaiEntrypoint() {
18
+ const monorepoEntrypoint = resolveMonorepoEntrypoint();
19
+ if (monorepoEntrypoint) {
20
+ return monorepoEntrypoint;
21
+ }
22
+
10
23
  const packageJsonPath = require.resolve('workspai/package.json');
11
24
  return path.join(path.dirname(packageJsonPath), 'dist', 'index.js');
12
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wspai",
3
- "version": "0.43.0",
3
+ "version": "0.43.1",
4
4
  "type": "module",
5
5
  "description": "Short npm alias for the Workspai CLI.",
6
6
  "keywords": [
@@ -23,13 +23,20 @@
23
23
  },
24
24
  "files": [
25
25
  "bin",
26
- "README.md"
26
+ "README.md",
27
+ "scripts"
27
28
  ],
28
29
  "dependencies": {
29
- "workspai": "0.43.0"
30
+ "workspai": "0.43.1"
30
31
  },
31
32
  "publishConfig": {
32
33
  "registry": "https://registry.npmjs.org",
33
34
  "access": "public"
35
+ },
36
+ "scripts": {
37
+ "smoke": "node scripts/smoke.mjs",
38
+ "check": "corepack npm run smoke",
39
+ "fix": "corepack npm run check",
40
+ "validate": "corepack npm run check"
34
41
  }
35
42
  }
@@ -0,0 +1,29 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { readFileSync } from 'node:fs';
3
+ import { dirname, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
7
+ const packageJson = JSON.parse(readFileSync(resolve(packageRoot, 'package.json'), 'utf8'));
8
+
9
+ const result = spawnSync(process.execPath, [resolve(packageRoot, 'bin', 'wspai.js'), '--version'], {
10
+ cwd: packageRoot,
11
+ encoding: 'utf8',
12
+ });
13
+
14
+ if (result.stdout) {
15
+ process.stdout.write(result.stdout);
16
+ }
17
+
18
+ if (result.stderr) {
19
+ process.stderr.write(result.stderr);
20
+ }
21
+
22
+ if (result.status !== 0) {
23
+ process.exit(result.status ?? 1);
24
+ }
25
+
26
+ if (result.stdout.trim() !== packageJson.version) {
27
+ console.error(`wspai smoke expected ${packageJson.version}, received ${result.stdout.trim() || '<empty>'}`);
28
+ process.exit(1);
29
+ }