@kravc/dos 2.0.0-alpha.19 → 2.0.0-alpha.20
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/.claude/settings.local.json +7 -0
- package/bin/spec.js +3 -0
- package/package.json +5 -1
- package/scripts/spec.ts +23 -0
package/bin/spec.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kravc/dos",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.20",
|
|
4
4
|
"description": "Convention-based, easy-to-use library for building API-driven serverless services.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Service",
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
],
|
|
14
14
|
"main": "dist/index.js",
|
|
15
15
|
"types": "dist/index.d.ts",
|
|
16
|
+
"bin": {
|
|
17
|
+
"spec": "bin/spec.js"
|
|
18
|
+
},
|
|
16
19
|
"repository": {
|
|
17
20
|
"type": "git",
|
|
18
21
|
"url": "git+ssh://git@github.com/alexkravets/dos.git"
|
|
@@ -21,6 +24,7 @@
|
|
|
21
24
|
"src": "src"
|
|
22
25
|
},
|
|
23
26
|
"scripts": {
|
|
27
|
+
"spec": "npx ts-node scripts/spec.ts ./example",
|
|
24
28
|
"start": "npx http example/index.ts",
|
|
25
29
|
"test": "eslint --fix src/ example/ && jest --coverage",
|
|
26
30
|
"prebuild": "rimraf dist",
|
package/scripts/spec.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env ts-node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
import { resolve } from 'path';
|
|
5
|
+
import { statSync } from 'fs';
|
|
6
|
+
|
|
7
|
+
const [,, servicePath] = process.argv;
|
|
8
|
+
|
|
9
|
+
if (!servicePath) {
|
|
10
|
+
process.stderr.write('Usage: specs <path-to-service>\n');
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let fullPath = resolve(process.cwd(), servicePath);
|
|
15
|
+
|
|
16
|
+
if (statSync(fullPath).isDirectory()) {
|
|
17
|
+
fullPath = resolve(fullPath, 'index.ts');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
21
|
+
const { service } = require(fullPath);
|
|
22
|
+
|
|
23
|
+
process.stdout.write(JSON.stringify(service.spec, null, 2));
|