create-faas-app 0.0.3-beta.86 → 0.0.3-beta.88
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/dist/index.d.mts +3 -0
- package/dist/index.js +32 -55
- package/dist/index.mjs +8 -14
- package/package.json +2 -2
package/dist/index.d.mts
ADDED
package/dist/index.js
CHANGED
|
@@ -1,41 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
module.exports = __toCommonJS(src_exports);
|
|
26
|
-
var import_commander = require("commander");
|
|
3
|
+
var commander$1 = require('commander');
|
|
4
|
+
var enquirer = require('enquirer');
|
|
5
|
+
var fs = require('fs');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
var child_process = require('child_process');
|
|
27
8
|
|
|
28
|
-
// src/
|
|
29
|
-
var import_enquirer = require("enquirer");
|
|
30
|
-
var import_fs = require("fs");
|
|
31
|
-
var import_path = require("path");
|
|
32
|
-
var import_child_process = require("child_process");
|
|
9
|
+
// src/index.ts
|
|
33
10
|
var Validator = {
|
|
34
11
|
name(input) {
|
|
35
12
|
const match = /^[a-z0-9-_]+$/i.test(input) ? true : "Must be a-z, 0-9 or -_";
|
|
36
13
|
if (match !== true)
|
|
37
14
|
return match;
|
|
38
|
-
if (
|
|
15
|
+
if (fs.existsSync(input))
|
|
39
16
|
return `${input} folder exists, please try another name`;
|
|
40
17
|
return true;
|
|
41
18
|
}
|
|
@@ -43,7 +20,7 @@ var Validator = {
|
|
|
43
20
|
async function action(options = {}) {
|
|
44
21
|
const answers = Object.assign(options, {});
|
|
45
22
|
if (!options.name || Validator.name(options.name) !== true)
|
|
46
|
-
answers.name = await
|
|
23
|
+
answers.name = await enquirer.prompt({
|
|
47
24
|
type: "input",
|
|
48
25
|
name: "value",
|
|
49
26
|
message: "Project name",
|
|
@@ -51,7 +28,7 @@ async function action(options = {}) {
|
|
|
51
28
|
validate: Validator.name
|
|
52
29
|
}).then((res) => res.value);
|
|
53
30
|
if (typeof answers.example === "undefined")
|
|
54
|
-
answers.example = await
|
|
31
|
+
answers.example = await enquirer.prompt({
|
|
55
32
|
type: "confirm",
|
|
56
33
|
name: "value",
|
|
57
34
|
message: "Add example files",
|
|
@@ -59,9 +36,9 @@ async function action(options = {}) {
|
|
|
59
36
|
}).then((res) => res.value);
|
|
60
37
|
if (!answers.name)
|
|
61
38
|
return;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
39
|
+
fs.mkdirSync(answers.name);
|
|
40
|
+
fs.writeFileSync(
|
|
41
|
+
path.join(answers.name, "faas.yaml"),
|
|
65
42
|
`defaults:
|
|
66
43
|
plugins:
|
|
67
44
|
development:
|
|
@@ -70,8 +47,8 @@ staging:
|
|
|
70
47
|
production:
|
|
71
48
|
`
|
|
72
49
|
);
|
|
73
|
-
|
|
74
|
-
|
|
50
|
+
fs.writeFileSync(
|
|
51
|
+
path.join(answers.name, "package.json"),
|
|
75
52
|
`{
|
|
76
53
|
"name": "${answers.name}",
|
|
77
54
|
"version": "0.0.0",
|
|
@@ -113,7 +90,7 @@ production:
|
|
|
113
90
|
}
|
|
114
91
|
}`
|
|
115
92
|
);
|
|
116
|
-
|
|
93
|
+
fs.writeFileSync(path.join(answers.name, "tsconfig.json"), `{
|
|
117
94
|
"compilerOptions": {
|
|
118
95
|
"downlevelIteration": true,
|
|
119
96
|
"esModuleInterop": true,
|
|
@@ -124,14 +101,14 @@ production:
|
|
|
124
101
|
}
|
|
125
102
|
}
|
|
126
103
|
`);
|
|
127
|
-
|
|
104
|
+
fs.writeFileSync(path.join(answers.name, ".gitignore"), `node_modules/
|
|
128
105
|
tmp/
|
|
129
106
|
coverage/
|
|
130
107
|
*.tmp.js
|
|
131
108
|
`);
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
109
|
+
fs.mkdirSync(path.join(answers.name, ".vscode"));
|
|
110
|
+
fs.writeFileSync(
|
|
111
|
+
path.join(answers.name, ".vscode", "settings.json"),
|
|
135
112
|
`{
|
|
136
113
|
"editor.detectIndentation": true,
|
|
137
114
|
"editor.insertSpaces": true,
|
|
@@ -147,8 +124,8 @@ coverage/
|
|
|
147
124
|
}
|
|
148
125
|
`
|
|
149
126
|
);
|
|
150
|
-
|
|
151
|
-
|
|
127
|
+
fs.writeFileSync(
|
|
128
|
+
path.join(answers.name, ".vscode", "extensions.json"),
|
|
152
129
|
`{
|
|
153
130
|
"recommendations": [
|
|
154
131
|
"dbaeumer.vscode-eslint",
|
|
@@ -157,10 +134,10 @@ coverage/
|
|
|
157
134
|
}
|
|
158
135
|
`
|
|
159
136
|
);
|
|
160
|
-
|
|
137
|
+
child_process.execSync(`cd ${answers.name} && npm install`, { stdio: "inherit" });
|
|
161
138
|
if (answers.example) {
|
|
162
|
-
|
|
163
|
-
|
|
139
|
+
fs.writeFileSync(
|
|
140
|
+
path.join(answers.name, "index.func.ts"),
|
|
164
141
|
`import { useFunc } from '@faasjs/func'
|
|
165
142
|
import { useHttp } from '@faasjs/http'
|
|
166
143
|
|
|
@@ -173,9 +150,9 @@ export default useFunc(function () {
|
|
|
173
150
|
})
|
|
174
151
|
`
|
|
175
152
|
);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
153
|
+
fs.mkdirSync(path.join(answers.name, "__tests__"));
|
|
154
|
+
fs.writeFileSync(
|
|
155
|
+
path.join(answers.name, "__tests__", "index.test.ts"),
|
|
179
156
|
`import { test } from '@faasjs/test'
|
|
180
157
|
|
|
181
158
|
describe('hello', function () {
|
|
@@ -190,7 +167,7 @@ describe('hello', function () {
|
|
|
190
167
|
})
|
|
191
168
|
`
|
|
192
169
|
);
|
|
193
|
-
|
|
170
|
+
child_process.execSync(`cd ${answers.name} && npm exec jest`, { stdio: "inherit" });
|
|
194
171
|
}
|
|
195
172
|
}
|
|
196
173
|
function action_default(program) {
|
|
@@ -202,7 +179,7 @@ Examples:
|
|
|
202
179
|
}
|
|
203
180
|
|
|
204
181
|
// src/index.ts
|
|
205
|
-
var commander = new
|
|
182
|
+
var commander = new commander$1.Command();
|
|
206
183
|
commander.storeOptionsAsProperties(false).allowUnknownOption(true).version("beta").name("create-faas-app");
|
|
207
184
|
action_default(commander);
|
|
208
185
|
async function main() {
|
|
@@ -215,5 +192,5 @@ async function main() {
|
|
|
215
192
|
}
|
|
216
193
|
}
|
|
217
194
|
var src_default = main();
|
|
218
|
-
|
|
219
|
-
|
|
195
|
+
|
|
196
|
+
module.exports = src_default;
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { prompt } from 'enquirer';
|
|
3
|
+
import { mkdirSync, writeFileSync, existsSync } from 'fs';
|
|
4
|
+
import { join } from 'path';
|
|
5
|
+
import { execSync } from 'child_process';
|
|
3
6
|
|
|
4
|
-
// src/
|
|
5
|
-
import { prompt } from "enquirer";
|
|
6
|
-
import {
|
|
7
|
-
mkdirSync,
|
|
8
|
-
writeFileSync,
|
|
9
|
-
existsSync
|
|
10
|
-
} from "fs";
|
|
11
|
-
import { join } from "path";
|
|
12
|
-
import { execSync } from "child_process";
|
|
7
|
+
// src/index.ts
|
|
13
8
|
var Validator = {
|
|
14
9
|
name(input) {
|
|
15
10
|
const match = /^[a-z0-9-_]+$/i.test(input) ? true : "Must be a-z, 0-9 or -_";
|
|
@@ -195,6 +190,5 @@ async function main() {
|
|
|
195
190
|
}
|
|
196
191
|
}
|
|
197
192
|
var src_default = main();
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
};
|
|
193
|
+
|
|
194
|
+
export { src_default as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-faas-app",
|
|
3
|
-
"version": "0.0.3-beta.
|
|
3
|
+
"version": "0.0.3-beta.88",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"funding": "https://github.com/sponsors/faasjs",
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "tsup-node src/index.ts --
|
|
20
|
+
"build": "tsup-node src/index.ts --config ../../tsup.config.json"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist",
|