@lark-apaas/fullstack-cli 1.1.46-alpha.0 → 1.1.46-alpha.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-cli",
3
- "version": "1.1.46-alpha.0",
3
+ "version": "1.1.46-alpha.2",
4
4
  "description": "CLI tool for fullstack template management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@lark-apaas/http-client": "0.1.6-alpha.1",
34
+ "@lark-apaas/http-client": "^0.1.5",
35
35
  "@lydell/node-pty": "1.1.0",
36
36
  "@vercel/nft": "^0.30.3",
37
37
  "commander": "^13.0.0",
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ [ "$SKIP_GIT_HOOKS" = "1" ] && exit 0
3
+ export PATH="node_modules/.bin:$PATH"
4
+ npm run precommit
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ // FULLSTACK_PRECOMMIT_V1
3
+ 'use strict';
4
+
5
+ const { spawnSync } = require('node:child_process');
6
+
7
+ const SEP = ' ' + '─'.repeat(36);
8
+
9
+ function failAndExit(step, body) {
10
+ process.stderr.write('\n✗ pre-commit failed: ' + step + '\n');
11
+ process.stderr.write(SEP + '\n');
12
+ if (body && body.length > 0) {
13
+ process.stderr.write(body.replace(/\s+$/, '') + '\n');
14
+ }
15
+ process.stderr.write(SEP + '\n');
16
+ process.stderr.write(' bypass: git commit --no-verify\n');
17
+ process.exit(1);
18
+ }
19
+
20
+ function runLint() {
21
+ const cwd = process.cwd();
22
+ const res = spawnSync('npm', ['run', 'lint'], {
23
+ cwd,
24
+ stdio: ['ignore', 'pipe', 'pipe'],
25
+ env: process.env,
26
+ });
27
+ if (res.error) {
28
+ failAndExit('lint', String(res.error.message || res.error));
29
+ }
30
+ if (res.status !== 0) {
31
+ const stdout = res.stdout ? res.stdout.toString() : '';
32
+ const stderr = res.stderr ? res.stderr.toString() : '';
33
+ failAndExit('lint', stdout + '\n' + stderr);
34
+ }
35
+ }
36
+
37
+ runLint();