do-functions-cli 1.5.1 → 1.6.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/README.md +7 -5
- package/dist/constants.d.ts +3 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -3
- package/dist/constants.js.map +1 -1
- package/dist/schemas/createOptions.js +1 -1
- package/dist/schemas/createOptions.js.map +1 -1
- package/dist/utils/validators.d.ts +1 -1
- package/dist/utils/validators.d.ts.map +1 -1
- package/dist/utils/validators.js +1 -1
- package/dist/utils/validators.js.map +1 -1
- package/package.json +3 -2
- package/templates/functions/typescript/tsconfig.json +1 -1
package/README.md
CHANGED
|
@@ -21,16 +21,18 @@ A CLI tool for scaffolding [DigitalOcean Serverless Functions](https://docs.digi
|
|
|
21
21
|
# Global installation
|
|
22
22
|
npm install -g do-functions-cli
|
|
23
23
|
|
|
24
|
-
#
|
|
25
|
-
|
|
24
|
+
# Local installation
|
|
25
|
+
npm install -D do-functions-cli
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Quick Start
|
|
29
29
|
|
|
30
|
+
> **Note:** Both `dofcli` and `do-functions-cli` commands are available and work identically. The examples below use `dofcli` for brevity.
|
|
31
|
+
|
|
30
32
|
Create a new function interactively:
|
|
31
33
|
|
|
32
34
|
```bash
|
|
33
|
-
|
|
35
|
+
dofcli create
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
You'll be prompted to:
|
|
@@ -46,7 +48,7 @@ You'll be prompted to:
|
|
|
46
48
|
### Interactive Mode
|
|
47
49
|
|
|
48
50
|
```bash
|
|
49
|
-
|
|
51
|
+
dofcli create
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
### Non-Interactive Mode
|
|
@@ -54,7 +56,7 @@ do-functions-cli create
|
|
|
54
56
|
Use flags to skip prompts:
|
|
55
57
|
|
|
56
58
|
```bash
|
|
57
|
-
|
|
59
|
+
dofcli create --packages-dir ./packages --func api/hello --yes
|
|
58
60
|
```
|
|
59
61
|
|
|
60
62
|
### CLI Options
|
package/dist/constants.d.ts
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
export declare const DEFAULT_RUNTIME = "nodejs:18";
|
|
5
5
|
/**
|
|
6
6
|
* Regex pattern to validate function names.
|
|
7
|
-
* Function names must be in the format: package/name (e.g., 'myapp/hello')
|
|
8
|
-
* Both the package and function name must contain only lowercase
|
|
7
|
+
* Function names must be in the format: package/name (e.g., 'myapp/hello', 'MyApp/HelloWorld', or 'my-api/hello-world')
|
|
8
|
+
* Both the package and function name must contain only letters (uppercase or lowercase) and hyphens.
|
|
9
|
+
* Names must start and end with a letter.
|
|
9
10
|
*/
|
|
10
11
|
export declare const FUNCTION_NAME_REGEX: RegExp;
|
|
11
12
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,QAAmE,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
export const DEFAULT_RUNTIME = 'nodejs:18';
|
|
5
5
|
/**
|
|
6
6
|
* Regex pattern to validate function names.
|
|
7
|
-
* Function names must be in the format: package/name (e.g., 'myapp/hello')
|
|
8
|
-
* Both the package and function name must contain only lowercase
|
|
7
|
+
* Function names must be in the format: package/name (e.g., 'myapp/hello', 'MyApp/HelloWorld', or 'my-api/hello-world')
|
|
8
|
+
* Both the package and function name must contain only letters (uppercase or lowercase) and hyphens.
|
|
9
|
+
* Names must start and end with a letter.
|
|
9
10
|
*/
|
|
10
|
-
export const FUNCTION_NAME_REGEX = /^[a-
|
|
11
|
+
export const FUNCTION_NAME_REGEX = /^[a-zA-Z]([a-zA-Z-]*[a-zA-Z])?\/[a-zA-Z]([a-zA-Z-]*[a-zA-Z])?$/;
|
|
11
12
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gEAAgE,CAAC"}
|
|
@@ -3,7 +3,7 @@ export const CreateOptionsSchema = z.object({
|
|
|
3
3
|
packagesDir: z.string().optional(),
|
|
4
4
|
func: z
|
|
5
5
|
.string()
|
|
6
|
-
.regex(/^[a-
|
|
6
|
+
.regex(/^[a-zA-Z]([a-zA-Z-]*[a-zA-Z])?\/[a-zA-Z]([a-zA-Z-]*[a-zA-Z])?$/)
|
|
7
7
|
.optional(),
|
|
8
8
|
});
|
|
9
9
|
//# sourceMappingURL=createOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOptions.js","sourceRoot":"","sources":["../../src/schemas/createOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"createOptions.js","sourceRoot":"","sources":["../../src/schemas/createOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,KAAK,CAAC,gEAAgE,CAAC;SACvE,QAAQ,EAAE;CACd,CAAC,CAAC"}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* @param value - The function name input to validate
|
|
5
5
|
* @returns true if valid, or an error message string if invalid
|
|
6
6
|
*/
|
|
7
|
-
export declare function validateFunctionName(value: string): true | "Function name must be in the format \"package/name\" with
|
|
7
|
+
export declare function validateFunctionName(value: string): true | "Function name must be in the format \"package/name\" with letters and hyphens only";
|
|
8
8
|
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,+FAMjD"}
|
package/dist/utils/validators.js
CHANGED
|
@@ -7,7 +7,7 @@ import { FUNCTION_NAME_REGEX } from '../constants.js';
|
|
|
7
7
|
*/
|
|
8
8
|
export function validateFunctionName(value) {
|
|
9
9
|
if (!FUNCTION_NAME_REGEX.test(value)) {
|
|
10
|
-
return 'Function name must be in the format "package/name" with
|
|
10
|
+
return 'Function name must be in the format "package/name" with letters and hyphens only';
|
|
11
11
|
}
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/utils/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,kFAAkF,CAAC;IAC5F,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "do-functions-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "CLI tool for scaffolding DigitalOcean Serverless Functions with JavaScript and TypeScript templates, automatic dependency installation, and project.yml configuration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
"node": ">=20.12.0"
|
|
18
18
|
},
|
|
19
19
|
"bin": {
|
|
20
|
-
"do-functions-cli": "dist/cli.js"
|
|
20
|
+
"do-functions-cli": "dist/cli.js",
|
|
21
|
+
"dofcli": "dist/cli.js"
|
|
21
22
|
},
|
|
22
23
|
"scripts": {
|
|
23
24
|
"build": "tsc",
|