@faable/faable 1.3.11 → 1.3.13
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/commands/configure/index.js +9 -3
- package/dist/commands/deploy/analyze_package.js +7 -4
- package/dist/commands/deploy/build_project.js +14 -10
- package/dist/commands/deploy/deploy_command.js +1 -3
- package/dist/commands/init/ConfigurationHelper.js +2 -2
- package/dist/config.js +10 -0
- package/dist/index.js +4 -0
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigStore } from '../../lib/ConfigStore.js';
|
|
2
|
-
import
|
|
2
|
+
import prompts from 'prompts';
|
|
3
3
|
|
|
4
4
|
const configure = {
|
|
5
5
|
command: "configure",
|
|
@@ -17,11 +17,17 @@ const configure = {
|
|
|
17
17
|
handler: async (args) => {
|
|
18
18
|
const { app_name, workdir, api, remove } = args;
|
|
19
19
|
const store = new ConfigStore();
|
|
20
|
-
const helper = new ConfigurationHelper();
|
|
21
20
|
if (remove) {
|
|
22
21
|
await store.deleteCredentials();
|
|
23
22
|
}
|
|
24
|
-
await
|
|
23
|
+
const { apikey } = await prompts([
|
|
24
|
+
{
|
|
25
|
+
type: "text",
|
|
26
|
+
name: "apikey",
|
|
27
|
+
message: "What is your Faable ApiKey?",
|
|
28
|
+
},
|
|
29
|
+
]);
|
|
30
|
+
await store.saveApiKey({ apikey });
|
|
25
31
|
},
|
|
26
32
|
};
|
|
27
33
|
|
|
@@ -12,10 +12,13 @@ const analyze_package = async (params) => {
|
|
|
12
12
|
throw new Error("Missing start script");
|
|
13
13
|
}
|
|
14
14
|
// Check if build is required to run
|
|
15
|
-
const build_script =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const build_script = process.env.FAABLE_NPM_BUILD_SCRIPT
|
|
16
|
+
? process.env.FAABLE_NPM_BUILD_SCRIPT
|
|
17
|
+
: pkg?.scripts["build"]
|
|
18
|
+
? "build"
|
|
19
|
+
: null;
|
|
20
|
+
if (!build_script) {
|
|
21
|
+
log.info(`No build script on package.json`);
|
|
19
22
|
}
|
|
20
23
|
// Detect deployment type
|
|
21
24
|
let type = "node";
|
|
@@ -2,16 +2,20 @@ import { log } from '../../log.js';
|
|
|
2
2
|
import { cmd } from './cmd.js';
|
|
3
3
|
|
|
4
4
|
const build_project = async (args) => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
const build_script = args.build_script;
|
|
6
|
+
if (build_script) {
|
|
7
|
+
const cwd = args.cwd || process.cwd();
|
|
8
|
+
log.info(`⚡️ Running build [${build_script}]...`);
|
|
9
|
+
const timeout = 1000 * 60 * 10; // 10 minute timeout
|
|
10
|
+
await cmd("yarn", ["run", build_script], {
|
|
11
|
+
timeout,
|
|
12
|
+
cwd,
|
|
13
|
+
enableOutput: true,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
log.info(`⚡️ No build step`);
|
|
18
|
+
}
|
|
15
19
|
};
|
|
16
20
|
|
|
17
21
|
export { build_project };
|
|
@@ -36,9 +36,7 @@ const deploy_command = async (args) => {
|
|
|
36
36
|
log.info(`🚀 Preparing to build ${app.name} [${app.id}]`);
|
|
37
37
|
// Analyze package.json to check if build is needed
|
|
38
38
|
const { build_script, type } = await analyze_package({ workdir });
|
|
39
|
-
|
|
40
|
-
await build_project({ app, build_script });
|
|
41
|
-
}
|
|
39
|
+
await build_project({ app, build_script });
|
|
42
40
|
// Bundle project inside a docker image
|
|
43
41
|
const { tagname } = await bundle_docker({
|
|
44
42
|
app,
|
|
@@ -16,12 +16,12 @@ class ConfigurationHelper {
|
|
|
16
16
|
get default_action() {
|
|
17
17
|
return path__default.join(this.workflows_dir, "deploy.yml");
|
|
18
18
|
}
|
|
19
|
-
async demandConfig() {
|
|
19
|
+
async demandConfig(force = false) {
|
|
20
20
|
const creds = await this.store.loadCredentials();
|
|
21
21
|
if (creds.apikey) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
const apikey = await prompts([
|
|
24
|
+
const { apikey } = await prompts([
|
|
25
25
|
{
|
|
26
26
|
type: "text",
|
|
27
27
|
name: "apikey",
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import path__default from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path__default.dirname(__filename);
|
|
7
|
+
const pkg = fs.readJSONSync(path__default.join(__dirname, "..", "package.json"));
|
|
8
|
+
const version = pkg.version;
|
|
9
|
+
|
|
10
|
+
export { version };
|
package/dist/index.js
CHANGED
|
@@ -5,9 +5,13 @@ import { configure } from './commands/configure/index.js';
|
|
|
5
5
|
import { deploy } from './commands/deploy/index.js';
|
|
6
6
|
import { log } from './log.js';
|
|
7
7
|
import { init } from './commands/init/index.js';
|
|
8
|
+
import { version } from './config.js';
|
|
8
9
|
|
|
9
10
|
const yg = yargs();
|
|
10
11
|
yg.scriptName("faable")
|
|
12
|
+
.middleware(function (argv) {
|
|
13
|
+
console.log(`Faable CLI ${version}`);
|
|
14
|
+
}, true)
|
|
11
15
|
.command(deploy)
|
|
12
16
|
.command(apps)
|
|
13
17
|
.command(configure)
|
package/package.json
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"yaml": "^2.2.2",
|
|
14
14
|
"yargs": "^17.6.2"
|
|
15
15
|
},
|
|
16
|
+
"version": "1.3.13",
|
|
16
17
|
"bin": {
|
|
17
18
|
"faable": "bin/faable.js"
|
|
18
19
|
},
|
|
@@ -26,6 +27,5 @@
|
|
|
26
27
|
"publishConfig": {
|
|
27
28
|
"access": "public"
|
|
28
29
|
},
|
|
29
|
-
"homepage": "https://github.com/faablecloud/faable#readme"
|
|
30
|
-
"version": "1.3.11"
|
|
30
|
+
"homepage": "https://github.com/faablecloud/faable#readme"
|
|
31
31
|
}
|