create-faas-app 0.0.2-beta.390 → 0.0.2-beta.393

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.js CHANGED
@@ -29,13 +29,6 @@ var import_enquirer = require("enquirer");
29
29
  var import_fs = require("fs");
30
30
  var import_path = require("path");
31
31
  var import_child_process = require("child_process");
32
- var Provider = ["tencentcloud", null];
33
- var Region = [
34
- "ap-beijing",
35
- "ap-shanghai",
36
- "ap-guangzhou",
37
- "ap-hongkong"
38
- ];
39
32
  var Validator = {
40
33
  name(input) {
41
34
  const match = /^[a-z0-9-_]+$/i.test(input) ? true : "Must be a-z, 0-9 or -_";
@@ -44,21 +37,6 @@ var Validator = {
44
37
  if ((0, import_fs.existsSync)(input))
45
38
  return `${input} folder exists, please try another name`;
46
39
  return true;
47
- },
48
- provider(input) {
49
- return Provider.includes(input) ? true : "Unknown provider";
50
- },
51
- region(input) {
52
- return Region.includes(input) ? true : "Unknown region";
53
- },
54
- appId(input) {
55
- return /^[0-9]+$/.test(input) ? true : "Wrong format";
56
- },
57
- secretId(input) {
58
- return /^[a-zA-Z0-9]+$/.test(input) ? true : "Wrong format";
59
- },
60
- secretKey(input) {
61
- return /^[a-zA-Z0-9]+$/.test(input) ? true : "Wrong format";
62
40
  }
63
41
  };
64
42
  async function action(options = {}) {
@@ -70,55 +48,6 @@ async function action(options = {}) {
70
48
  message: "Project name",
71
49
  validate: Validator.name
72
50
  }).then((res) => res.value);
73
- if (!options.noprovider) {
74
- if (!answers.provider || Validator.provider(answers.provider) !== true)
75
- answers.provider = await (0, import_enquirer.prompt)({
76
- type: "select",
77
- name: "value",
78
- message: "Provider",
79
- choices: [
80
- {
81
- name: "null",
82
- message: "\u6682\u4E0D\u914D\u7F6E"
83
- },
84
- {
85
- name: "tencentcloud",
86
- message: "\u817E\u8BAF\u4E91"
87
- }
88
- ]
89
- }).then((res) => res.value);
90
- if (answers.provider === "tencentcloud") {
91
- if (!answers.region || Validator.region(answers.region) !== true)
92
- answers.region = await (0, import_enquirer.prompt)({
93
- type: "select",
94
- name: "value",
95
- message: "Region",
96
- choices: Region.concat([]),
97
- validate: Validator.region
98
- }).then((res) => res.value);
99
- if (!answers.appId || Validator.appId(answers.appId) !== true)
100
- answers.appId = await (0, import_enquirer.prompt)({
101
- type: "input",
102
- name: "value",
103
- message: "appId (from https://console.cloud.tencent.com/developer)",
104
- validate: Validator.appId
105
- }).then((res) => res.value);
106
- if (!answers.secretId || Validator.secretId(answers.secretId) !== true)
107
- answers.secretId = await (0, import_enquirer.prompt)({
108
- type: "input",
109
- name: "value",
110
- message: "secretId (from https://console.cloud.tencent.com/cam/capi)",
111
- validate: Validator.secretId
112
- }).then((res) => res.value);
113
- if (!answers.secretKey || Validator.secretKey(answers.secretKey) !== true)
114
- answers.secretKey = await (0, import_enquirer.prompt)({
115
- type: "input",
116
- name: "value",
117
- message: "secretKey (from https://console.cloud.tencent.com/cam/capi)",
118
- validate: Validator.secretKey
119
- }).then((res) => res.value);
120
- }
121
- }
122
51
  if (typeof answers.example === "undefined")
123
52
  answers.example = await (0, import_enquirer.prompt)({
124
53
  type: "confirm",
@@ -130,21 +59,7 @@ async function action(options = {}) {
130
59
  return;
131
60
  (0, import_fs.mkdirSync)(answers.name);
132
61
  (0, import_fs.writeFileSync)((0, import_path.join)(answers.name, "faas.yaml"), `defaults:
133
- providers:
134
- tencentcloud:
135
- type: '@faasjs/tencentcloud'
136
- config: # https://faasjs.com/guide/tencentcloud.html
137
- appId: ${answers.appId || ""}
138
- secretId: ${answers.secretId || ""}
139
- secretKey: ${answers.secretKey || ""}
140
- region: ${answers.region || ""}
141
62
  plugins:
142
- cloud_function:
143
- provider: tencentcloud
144
- type: cloud_function
145
- http:
146
- provider: tencentcloud
147
- type: http
148
63
  development:
149
64
  testing:
150
65
  staging:
@@ -173,7 +88,6 @@ production:
173
88
  "coverage"
174
89
  ],
175
90
  "jest": {
176
- "verbose": false,
177
91
  "transform": {
178
92
  ".(jsx|tsx?)": "@faasjs/jest"
179
93
  },
@@ -212,32 +126,11 @@ coverage/
212
126
  "editor.codeActionsOnSave": {
213
127
  "source.fixAll": true
214
128
  },
129
+ "editor.wordWrap": "on",
215
130
  "files.insertFinalNewline": true,
216
131
  "files.trimFinalNewlines": true,
217
- "editor.wordWrap": "on",
218
132
  "files.trimTrailingWhitespace": true,
219
- "editor.minimap.renderCharacters": false,
220
- "editor.minimap.maxColumn": 200,
221
- "editor.smoothScrolling": true,
222
- "editor.cursorBlinking": "phase",
223
- "search.exclude": {
224
- "**/node_modules": true,
225
- "**/coverage": true,
226
- "**/dist": true,
227
- "**/tmp": true
228
- },
229
- "eslint.packageManager": "npm",
230
- "eslint.validate": [
231
- "javascript",
232
- "javascriptreact",
233
- "typescript",
234
- "typescriptreact",
235
- "vue"
236
- ],
237
- "grunt.autoDetect": "off",
238
- "jake.autoDetect": "off",
239
- "gulp.autoDetect": "off",
240
- "npm.autoDetect": "off"
133
+ "eslint.packageManager": "npm"
241
134
  }`);
242
135
  (0, import_child_process.execSync)(`cd ${answers.name} && npm install`, { stdio: "inherit" });
243
136
  if (answers.example) {
@@ -273,7 +166,7 @@ function action_default(program) {
273
166
  console.log(`
274
167
  Examples:
275
168
  npx create-faas-app`);
276
- }).option("--name <name>", "\u9879\u76EE\u540D\u5B57").option("--region <region>", "\u53EF\u7528\u533A").option("--appId <appid>", "appId").option("--secretId <secretId>", "secretId").option("--secretKey <secretKey>", "secretKey").option("--example", "\u521B\u5EFA\u793A\u4F8B\u6587\u4EF6").option("--noprovider", "\u6682\u4E0D\u914D\u7F6E\u670D\u52A1\u5546").action(action);
169
+ }).option("--name <name>", "\u9879\u76EE\u540D\u5B57").action(action);
277
170
  }
278
171
 
279
172
  // src/index.ts
package/dist/index.mjs CHANGED
@@ -10,13 +10,6 @@ import {
10
10
  } from "fs";
11
11
  import { join } from "path";
12
12
  import { execSync } from "child_process";
13
- var Provider = ["tencentcloud", null];
14
- var Region = [
15
- "ap-beijing",
16
- "ap-shanghai",
17
- "ap-guangzhou",
18
- "ap-hongkong"
19
- ];
20
13
  var Validator = {
21
14
  name(input) {
22
15
  const match = /^[a-z0-9-_]+$/i.test(input) ? true : "Must be a-z, 0-9 or -_";
@@ -25,21 +18,6 @@ var Validator = {
25
18
  if (existsSync(input))
26
19
  return `${input} folder exists, please try another name`;
27
20
  return true;
28
- },
29
- provider(input) {
30
- return Provider.includes(input) ? true : "Unknown provider";
31
- },
32
- region(input) {
33
- return Region.includes(input) ? true : "Unknown region";
34
- },
35
- appId(input) {
36
- return /^[0-9]+$/.test(input) ? true : "Wrong format";
37
- },
38
- secretId(input) {
39
- return /^[a-zA-Z0-9]+$/.test(input) ? true : "Wrong format";
40
- },
41
- secretKey(input) {
42
- return /^[a-zA-Z0-9]+$/.test(input) ? true : "Wrong format";
43
21
  }
44
22
  };
45
23
  async function action(options = {}) {
@@ -51,55 +29,6 @@ async function action(options = {}) {
51
29
  message: "Project name",
52
30
  validate: Validator.name
53
31
  }).then((res) => res.value);
54
- if (!options.noprovider) {
55
- if (!answers.provider || Validator.provider(answers.provider) !== true)
56
- answers.provider = await prompt({
57
- type: "select",
58
- name: "value",
59
- message: "Provider",
60
- choices: [
61
- {
62
- name: "null",
63
- message: "\u6682\u4E0D\u914D\u7F6E"
64
- },
65
- {
66
- name: "tencentcloud",
67
- message: "\u817E\u8BAF\u4E91"
68
- }
69
- ]
70
- }).then((res) => res.value);
71
- if (answers.provider === "tencentcloud") {
72
- if (!answers.region || Validator.region(answers.region) !== true)
73
- answers.region = await prompt({
74
- type: "select",
75
- name: "value",
76
- message: "Region",
77
- choices: Region.concat([]),
78
- validate: Validator.region
79
- }).then((res) => res.value);
80
- if (!answers.appId || Validator.appId(answers.appId) !== true)
81
- answers.appId = await prompt({
82
- type: "input",
83
- name: "value",
84
- message: "appId (from https://console.cloud.tencent.com/developer)",
85
- validate: Validator.appId
86
- }).then((res) => res.value);
87
- if (!answers.secretId || Validator.secretId(answers.secretId) !== true)
88
- answers.secretId = await prompt({
89
- type: "input",
90
- name: "value",
91
- message: "secretId (from https://console.cloud.tencent.com/cam/capi)",
92
- validate: Validator.secretId
93
- }).then((res) => res.value);
94
- if (!answers.secretKey || Validator.secretKey(answers.secretKey) !== true)
95
- answers.secretKey = await prompt({
96
- type: "input",
97
- name: "value",
98
- message: "secretKey (from https://console.cloud.tencent.com/cam/capi)",
99
- validate: Validator.secretKey
100
- }).then((res) => res.value);
101
- }
102
- }
103
32
  if (typeof answers.example === "undefined")
104
33
  answers.example = await prompt({
105
34
  type: "confirm",
@@ -111,21 +40,7 @@ async function action(options = {}) {
111
40
  return;
112
41
  mkdirSync(answers.name);
113
42
  writeFileSync(join(answers.name, "faas.yaml"), `defaults:
114
- providers:
115
- tencentcloud:
116
- type: '@faasjs/tencentcloud'
117
- config: # https://faasjs.com/guide/tencentcloud.html
118
- appId: ${answers.appId || ""}
119
- secretId: ${answers.secretId || ""}
120
- secretKey: ${answers.secretKey || ""}
121
- region: ${answers.region || ""}
122
43
  plugins:
123
- cloud_function:
124
- provider: tencentcloud
125
- type: cloud_function
126
- http:
127
- provider: tencentcloud
128
- type: http
129
44
  development:
130
45
  testing:
131
46
  staging:
@@ -154,7 +69,6 @@ production:
154
69
  "coverage"
155
70
  ],
156
71
  "jest": {
157
- "verbose": false,
158
72
  "transform": {
159
73
  ".(jsx|tsx?)": "@faasjs/jest"
160
74
  },
@@ -193,32 +107,11 @@ coverage/
193
107
  "editor.codeActionsOnSave": {
194
108
  "source.fixAll": true
195
109
  },
110
+ "editor.wordWrap": "on",
196
111
  "files.insertFinalNewline": true,
197
112
  "files.trimFinalNewlines": true,
198
- "editor.wordWrap": "on",
199
113
  "files.trimTrailingWhitespace": true,
200
- "editor.minimap.renderCharacters": false,
201
- "editor.minimap.maxColumn": 200,
202
- "editor.smoothScrolling": true,
203
- "editor.cursorBlinking": "phase",
204
- "search.exclude": {
205
- "**/node_modules": true,
206
- "**/coverage": true,
207
- "**/dist": true,
208
- "**/tmp": true
209
- },
210
- "eslint.packageManager": "npm",
211
- "eslint.validate": [
212
- "javascript",
213
- "javascriptreact",
214
- "typescript",
215
- "typescriptreact",
216
- "vue"
217
- ],
218
- "grunt.autoDetect": "off",
219
- "jake.autoDetect": "off",
220
- "gulp.autoDetect": "off",
221
- "npm.autoDetect": "off"
114
+ "eslint.packageManager": "npm"
222
115
  }`);
223
116
  execSync(`cd ${answers.name} && npm install`, { stdio: "inherit" });
224
117
  if (answers.example) {
@@ -254,7 +147,7 @@ function action_default(program) {
254
147
  console.log(`
255
148
  Examples:
256
149
  npx create-faas-app`);
257
- }).option("--name <name>", "\u9879\u76EE\u540D\u5B57").option("--region <region>", "\u53EF\u7528\u533A").option("--appId <appid>", "appId").option("--secretId <secretId>", "secretId").option("--secretKey <secretKey>", "secretKey").option("--example", "\u521B\u5EFA\u793A\u4F8B\u6587\u4EF6").option("--noprovider", "\u6682\u4E0D\u914D\u7F6E\u670D\u52A1\u5546").action(action);
150
+ }).option("--name <name>", "\u9879\u76EE\u540D\u5B57").action(action);
258
151
  }
259
152
 
260
153
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-faas-app",
3
- "version": "0.0.2-beta.390",
3
+ "version": "0.0.2-beta.393",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",