arcadible 0.1.12 → 0.1.14
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/bin/arc-build.js +124 -0
- package/bin/arc-deploy.js +102 -34
- package/bin/arc-init.js +17 -22
- package/bin/arc-login.js +33 -22
- package/bin/arc-pack.js +19 -8
- package/bin/arc-validate.js +1 -1
- package/bin/arc-whoami.js +3 -4
- package/package.json +6 -1
- package/src/account.js +4 -2
- package/src/action/build/tool.js +68 -0
- package/src/action/deploy/ac.js +58 -0
- package/src/action/deploy/git.js +13 -29
- package/src/action/deploy/tool-git.js +9 -7
- package/src/action/deploy/tool.js +54 -2
- package/src/action/init/manifest.js +2 -3
- package/src/action/init/tool-patch.js +23 -3
- package/src/action/init/tool.js +13 -6
- package/src/action/login/flow.js +22 -21
- package/src/action/pack/tool.js +16 -15
- package/src/action/whoami/tool.js +2 -2
- package/src/api.js +15 -3
- package/src/cli/build.js +15 -0
- package/src/cli/deploy.js +4 -3
- package/src/cli/index.js +2 -0
- package/src/parser/env.js +2 -3
- package/src/parser/manifest.js +2 -3
- package/src/parser/readme.js +2 -3
- package/src/phrase.js +147 -0
- package/src/util/delay.js +2 -1
- package/src/util/http.js +18 -0
- package/src/util/log.js +17 -17
- package/src/util/progress.js +81 -0
- package/src/util/request.js +6 -1
- package/src/util/s3.js +56 -0
- package/src/util/spinner.js +41 -0
- package/src/util/video.js +8 -4
package/bin/arc-build.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
// [import]
|
|
5
|
+
|
|
6
|
+
const path = require("node:path");
|
|
7
|
+
|
|
8
|
+
// [import]
|
|
9
|
+
|
|
10
|
+
const hideBin = require("yargs/helpers").hideBin;
|
|
11
|
+
const yargs = require("yargs/yargs");
|
|
12
|
+
|
|
13
|
+
// [import]
|
|
14
|
+
|
|
15
|
+
const build = require("../src/cli/build");
|
|
16
|
+
const log = require("../src/util/log");
|
|
17
|
+
const output = require("../src/util/output");
|
|
18
|
+
const phrase = require("../src/phrase");
|
|
19
|
+
const pkg = require("../package.json");
|
|
20
|
+
const rc = require("../src/util/rc");
|
|
21
|
+
const validate = require("../src/cli/validate");
|
|
22
|
+
|
|
23
|
+
// [use]
|
|
24
|
+
|
|
25
|
+
const findRc = rc.findRc;
|
|
26
|
+
const print = output.print;
|
|
27
|
+
const resolve = path.resolve;
|
|
28
|
+
|
|
29
|
+
// [declare]
|
|
30
|
+
|
|
31
|
+
const CMD = "arc";
|
|
32
|
+
const SUBCMD = "build";
|
|
33
|
+
|
|
34
|
+
// [define]
|
|
35
|
+
|
|
36
|
+
const conf = {
|
|
37
|
+
json: false,
|
|
38
|
+
quiet: false,
|
|
39
|
+
...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
// [function]
|
|
43
|
+
|
|
44
|
+
const start = function (argv) {
|
|
45
|
+
const json = argv.json;
|
|
46
|
+
const quiet = argv.quiet;
|
|
47
|
+
const root = resolve(process.cwd(), argv.cwd);
|
|
48
|
+
return validate({ root })
|
|
49
|
+
.then((issues) => {
|
|
50
|
+
const count = issues.length;
|
|
51
|
+
if (count) {
|
|
52
|
+
throw new Error(phrase.issuesFound(count));
|
|
53
|
+
}
|
|
54
|
+
return build({ root });
|
|
55
|
+
})
|
|
56
|
+
.then((artifact) => {
|
|
57
|
+
if (json) {
|
|
58
|
+
print({ artifact });
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!quiet) {
|
|
62
|
+
log.hs("Done.");
|
|
63
|
+
if (artifact) {
|
|
64
|
+
print(artifact, { toml: true });
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
log.p("Nothing to do.");
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
.catch((ex) => {
|
|
71
|
+
const message = ex.message;
|
|
72
|
+
if (json) {
|
|
73
|
+
print({ error: { message } });
|
|
74
|
+
} else {
|
|
75
|
+
log.hd("Build aborted.");
|
|
76
|
+
log.p(message);
|
|
77
|
+
}
|
|
78
|
+
process.exit(1);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// [function]
|
|
83
|
+
|
|
84
|
+
const main = function (argv) {
|
|
85
|
+
return start(
|
|
86
|
+
yargs(hideBin(argv))
|
|
87
|
+
.scriptName(`${CMD} ${SUBCMD}`)
|
|
88
|
+
.usage("$0 [options]")
|
|
89
|
+
.option("json", {
|
|
90
|
+
alias: "j",
|
|
91
|
+
default: conf.json,
|
|
92
|
+
describe: "Format output as JSON",
|
|
93
|
+
type: "boolean",
|
|
94
|
+
})
|
|
95
|
+
.option("quiet", {
|
|
96
|
+
alias: "q",
|
|
97
|
+
default: conf.quiet,
|
|
98
|
+
describe: "Output only errors",
|
|
99
|
+
type: "boolean",
|
|
100
|
+
})
|
|
101
|
+
.option("cwd", {
|
|
102
|
+
alias: "C",
|
|
103
|
+
default: ".",
|
|
104
|
+
describe: "Set the working directory",
|
|
105
|
+
type: "string",
|
|
106
|
+
})
|
|
107
|
+
.help("help")
|
|
108
|
+
.alias("help", "h")
|
|
109
|
+
.version(pkg.version)
|
|
110
|
+
.alias("version", "v")
|
|
111
|
+
.strict()
|
|
112
|
+
.parse(),
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// [main]
|
|
117
|
+
|
|
118
|
+
if (require.main === module) {
|
|
119
|
+
main(process.argv);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// [export]
|
|
123
|
+
|
|
124
|
+
module.exports = { main };
|
package/bin/arc-deploy.js
CHANGED
|
@@ -12,11 +12,16 @@ const yargs = require("yargs/yargs");
|
|
|
12
12
|
|
|
13
13
|
// [import]
|
|
14
14
|
|
|
15
|
+
const build = require("../src/cli/build");
|
|
15
16
|
const deploy = require("../src/cli/deploy");
|
|
16
17
|
const log = require("../src/util/log");
|
|
17
18
|
const output = require("../src/util/output");
|
|
19
|
+
const pack = require("../src/cli/pack");
|
|
20
|
+
const phrase = require("../src/phrase");
|
|
18
21
|
const pkg = require("../package.json");
|
|
22
|
+
const progress = require("../src/util/progress");
|
|
19
23
|
const rc = require("../src/util/rc");
|
|
24
|
+
const spinner = require("../src/util/spinner");
|
|
20
25
|
const validate = require("../src/cli/validate");
|
|
21
26
|
const whoami = require("../src/cli/whoami");
|
|
22
27
|
|
|
@@ -24,7 +29,9 @@ const whoami = require("../src/cli/whoami");
|
|
|
24
29
|
|
|
25
30
|
const findRc = rc.findRc;
|
|
26
31
|
const print = output.print;
|
|
32
|
+
const ProgressBar = progress.ProgressBar;
|
|
27
33
|
const resolve = path.resolve;
|
|
34
|
+
const SpinnerWheel = spinner.SpinnerWheel;
|
|
28
35
|
|
|
29
36
|
// [declare]
|
|
30
37
|
|
|
@@ -42,30 +49,36 @@ const conf = {
|
|
|
42
49
|
|
|
43
50
|
// [function]
|
|
44
51
|
|
|
45
|
-
const handler = function ({ json, quiet }) {
|
|
52
|
+
const handler = function ({ json, pb, quiet }) {
|
|
46
53
|
return {
|
|
47
|
-
|
|
54
|
+
onAccountRefresh(refresh) {
|
|
55
|
+
return refresh(true);
|
|
56
|
+
},
|
|
57
|
+
onDeployBegin() {
|
|
48
58
|
if (!json && !quiet) {
|
|
49
|
-
log.p("
|
|
59
|
+
log.p("Submitting...");
|
|
60
|
+
if (pb) {
|
|
61
|
+
pb.start();
|
|
62
|
+
}
|
|
50
63
|
}
|
|
51
64
|
},
|
|
52
|
-
|
|
53
|
-
if (json
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
log.p(`· ${message}`);
|
|
65
|
+
onLogInfo({ level, message }) {
|
|
66
|
+
if (!json && !quiet) {
|
|
67
|
+
switch (level) {
|
|
68
|
+
case "warn":
|
|
69
|
+
log.pw(`⚠ ${message}`);
|
|
70
|
+
return;
|
|
71
|
+
default:
|
|
72
|
+
log.p(`· ${message}`);
|
|
73
|
+
}
|
|
62
74
|
}
|
|
63
75
|
},
|
|
64
|
-
|
|
65
|
-
if (!json) {
|
|
66
|
-
|
|
76
|
+
onUploadProgress(step) {
|
|
77
|
+
if (!json && !quiet) {
|
|
78
|
+
if (pb) {
|
|
79
|
+
pb.increment(step);
|
|
80
|
+
}
|
|
67
81
|
}
|
|
68
|
-
return refresh(true);
|
|
69
82
|
},
|
|
70
83
|
};
|
|
71
84
|
};
|
|
@@ -73,37 +86,86 @@ const handler = function ({ json, quiet }) {
|
|
|
73
86
|
// [function]
|
|
74
87
|
|
|
75
88
|
const start = function (argv) {
|
|
89
|
+
const git = argv.git;
|
|
76
90
|
const json = argv.json;
|
|
77
91
|
const quiet = argv.quiet;
|
|
78
92
|
const root = resolve(process.cwd(), argv.cwd);
|
|
79
|
-
|
|
93
|
+
let pb = null;
|
|
94
|
+
let sw = new SpinnerWheel("Checking login... %s");
|
|
95
|
+
sw.start(git || json || quiet);
|
|
96
|
+
return whoami({ handler: handler({ json, pb, quiet }) })
|
|
80
97
|
.then((current) => {
|
|
81
|
-
if (!current || !current.
|
|
82
|
-
throw new Error(
|
|
98
|
+
if (!current || !current.session) {
|
|
99
|
+
throw new Error(phrase.notLoggedIn());
|
|
83
100
|
}
|
|
84
|
-
|
|
101
|
+
sw.stop();
|
|
102
|
+
sw = new SpinnerWheel("Validating... %s");
|
|
103
|
+
sw.start(git || json || quiet);
|
|
104
|
+
return Promise.all([
|
|
105
|
+
// whoami
|
|
106
|
+
current.session,
|
|
107
|
+
// validate
|
|
108
|
+
validate({ root }),
|
|
109
|
+
]);
|
|
85
110
|
})
|
|
86
|
-
.then((issues) => {
|
|
111
|
+
.then(([session, issues]) => {
|
|
87
112
|
const count = issues.length;
|
|
88
113
|
if (count) {
|
|
89
|
-
throw new Error(
|
|
90
|
-
|
|
91
|
-
|
|
114
|
+
throw new Error(phrase.issuesFound(count));
|
|
115
|
+
}
|
|
116
|
+
sw.stop();
|
|
117
|
+
sw = new SpinnerWheel("Building... %s");
|
|
118
|
+
sw.start(git || json || quiet);
|
|
119
|
+
return Promise.all([
|
|
120
|
+
// whoami
|
|
121
|
+
session,
|
|
122
|
+
// build
|
|
123
|
+
git ? null : build({ root }),
|
|
124
|
+
]);
|
|
125
|
+
})
|
|
126
|
+
.then(([session, artifact]) => {
|
|
127
|
+
sw.stop();
|
|
128
|
+
sw = new SpinnerWheel("Packing... %s");
|
|
129
|
+
sw.start(git || json || quiet);
|
|
130
|
+
return Promise.all([
|
|
131
|
+
// whoami
|
|
132
|
+
session,
|
|
133
|
+
// pack
|
|
134
|
+
git ? null : pack({ input: artifact?.path, root }),
|
|
135
|
+
]);
|
|
136
|
+
})
|
|
137
|
+
.then(([session, artifact]) => {
|
|
138
|
+
sw.stop(true);
|
|
139
|
+
if (!json && !quiet && !git) {
|
|
140
|
+
pb = new ProgressBar(artifact.size);
|
|
92
141
|
}
|
|
93
|
-
return
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
142
|
+
return git
|
|
143
|
+
? deploy({ handler: handler({ json, pb, quiet }), root })
|
|
144
|
+
: deploy({
|
|
145
|
+
artifact,
|
|
146
|
+
handler: handler({ json, pb, quiet }),
|
|
147
|
+
root,
|
|
148
|
+
session,
|
|
149
|
+
});
|
|
98
150
|
})
|
|
99
|
-
.then((
|
|
151
|
+
.then((version) => {
|
|
100
152
|
if (json) {
|
|
101
|
-
print({ version
|
|
153
|
+
print({ version });
|
|
102
154
|
return;
|
|
103
155
|
}
|
|
104
156
|
if (!quiet) {
|
|
105
|
-
|
|
106
|
-
|
|
157
|
+
if (pb) {
|
|
158
|
+
sw.stop();
|
|
159
|
+
pb.stop();
|
|
160
|
+
} else {
|
|
161
|
+
sw.stop(true);
|
|
162
|
+
}
|
|
163
|
+
log.hs("Done.");
|
|
164
|
+
if (version) {
|
|
165
|
+
log.p(`Build v${version.to} submitted.`);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
log.p("Nothing to do.");
|
|
107
169
|
}
|
|
108
170
|
})
|
|
109
171
|
.catch((ex) => {
|
|
@@ -111,6 +173,12 @@ const start = function (argv) {
|
|
|
111
173
|
if (json) {
|
|
112
174
|
print({ error: { message } });
|
|
113
175
|
} else {
|
|
176
|
+
if (pb) {
|
|
177
|
+
sw.stop();
|
|
178
|
+
pb.stop();
|
|
179
|
+
} else {
|
|
180
|
+
sw.stop(true);
|
|
181
|
+
}
|
|
114
182
|
log.hd("Deploy aborted.");
|
|
115
183
|
log.p(message);
|
|
116
184
|
}
|
package/bin/arc-init.js
CHANGED
|
@@ -14,7 +14,6 @@ const yargs = require("yargs/yargs");
|
|
|
14
14
|
|
|
15
15
|
// [import]
|
|
16
16
|
|
|
17
|
-
const cfgurl = require("../src/config/url");
|
|
18
17
|
const init = require("../src/cli/init");
|
|
19
18
|
const log = require("../src/util/log");
|
|
20
19
|
const output = require("../src/util/output");
|
|
@@ -28,7 +27,6 @@ const findRc = rc.findRc;
|
|
|
28
27
|
const join = path.join;
|
|
29
28
|
const pathExists = fs.pathExists;
|
|
30
29
|
const print = output.print;
|
|
31
|
-
const relative = path.relative;
|
|
32
30
|
const resolve = path.resolve;
|
|
33
31
|
const select = prompts.select;
|
|
34
32
|
|
|
@@ -51,12 +49,22 @@ const conf = {
|
|
|
51
49
|
|
|
52
50
|
const handler = function ({ json, quiet }) {
|
|
53
51
|
return {
|
|
54
|
-
|
|
52
|
+
onInitBegin() {
|
|
55
53
|
if (!json && !quiet) {
|
|
56
|
-
log.p("Initializing
|
|
54
|
+
log.p("Initializing...");
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
onLogInfo({ level, message }) {
|
|
58
|
+
if (!json && !quiet) {
|
|
59
|
+
switch (level) {
|
|
60
|
+
case "warn":
|
|
61
|
+
log.pw(`⚠ ${message}`);
|
|
62
|
+
return;
|
|
63
|
+
default:
|
|
64
|
+
log.p(`· ${message}`);
|
|
65
|
+
}
|
|
57
66
|
}
|
|
58
67
|
},
|
|
59
|
-
onInfo() {},
|
|
60
68
|
};
|
|
61
69
|
};
|
|
62
70
|
|
|
@@ -67,33 +75,20 @@ const start = function (argv) {
|
|
|
67
75
|
const quiet = argv.quiet;
|
|
68
76
|
const root = resolve(process.cwd(), argv.cwd);
|
|
69
77
|
return init({
|
|
70
|
-
force:
|
|
78
|
+
force: true,
|
|
71
79
|
handler: handler({ json, quiet }),
|
|
72
80
|
patch: argv.patch,
|
|
73
81
|
project: argv.project,
|
|
74
82
|
root,
|
|
75
83
|
template: argv.template,
|
|
76
84
|
})
|
|
77
|
-
.then((
|
|
78
|
-
const dir = relative(root, data.path);
|
|
85
|
+
.then((project) => {
|
|
79
86
|
if (json) {
|
|
80
|
-
print({ project
|
|
87
|
+
print({ project });
|
|
81
88
|
return;
|
|
82
89
|
}
|
|
83
90
|
if (!quiet) {
|
|
84
|
-
log.
|
|
85
|
-
log.h("Getting started:");
|
|
86
|
-
log.pnl(cfgurl.GETTING_STARTED);
|
|
87
|
-
log.h("Next steps:");
|
|
88
|
-
log.p(
|
|
89
|
-
[
|
|
90
|
-
data.path === root ? null : `cd ${dir}`,
|
|
91
|
-
"arc login",
|
|
92
|
-
"arc deploy (or: arc deploy --git)",
|
|
93
|
-
]
|
|
94
|
-
.filter(Boolean)
|
|
95
|
-
.map((step, i) => `${i + 1}. ${step}`),
|
|
96
|
-
);
|
|
91
|
+
log.hs("Done.");
|
|
97
92
|
}
|
|
98
93
|
// degit sometimes hangs
|
|
99
94
|
process.exit(0);
|
package/bin/arc-login.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
const hideBin = require("yargs/helpers").hideBin;
|
|
7
7
|
const open = require("open");
|
|
8
|
+
const qrcode = require("qrcode-terminal");
|
|
8
9
|
const yargs = require("yargs/yargs");
|
|
9
10
|
|
|
10
11
|
// [import]
|
|
@@ -27,12 +28,13 @@ const SUBCMD = "login";
|
|
|
27
28
|
|
|
28
29
|
const conf = {
|
|
29
30
|
browser: true,
|
|
31
|
+
qrcode: true,
|
|
30
32
|
...findRc(CMD, SUBCMD, process.argv, ["--cwd", "-C"]),
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
// [function]
|
|
34
36
|
|
|
35
|
-
const
|
|
37
|
+
const onLoginEnter = function (fn) {
|
|
36
38
|
const stdin = process.stdin;
|
|
37
39
|
if (!stdin.isTTY) {
|
|
38
40
|
return;
|
|
@@ -58,38 +60,43 @@ const onEnter = function (fn) {
|
|
|
58
60
|
|
|
59
61
|
// [function]
|
|
60
62
|
|
|
61
|
-
const handler = function ({ browser }) {
|
|
63
|
+
const handler = function ({ browser, qrcode: qr }) {
|
|
62
64
|
return {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
onLoginCreated({ code: dac, id, url }) {
|
|
66
|
+
const link = `${url}/${id}`;
|
|
67
|
+
qrcode.generate(link, { small: true }, (code) => {
|
|
68
|
+
if (qr) {
|
|
69
|
+
log.p(code);
|
|
70
|
+
}
|
|
71
|
+
log.nlp(url);
|
|
72
|
+
log.h(dac.toUpperCase());
|
|
73
|
+
if (browser) {
|
|
74
|
+
log.nlp("Press Enter to open the URL.");
|
|
75
|
+
onLoginEnter(() => {
|
|
76
|
+
open(link).catch(() => {});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
});
|
|
73
80
|
},
|
|
74
|
-
|
|
81
|
+
onLoginPoll() {},
|
|
75
82
|
};
|
|
76
83
|
};
|
|
77
84
|
|
|
78
85
|
// [function]
|
|
79
86
|
|
|
80
87
|
const start = function (argv) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
log.p("Logging in...");
|
|
89
|
+
return login({
|
|
90
|
+
handler: handler({ browser: argv.browser, qrcode: argv.qrcode }),
|
|
91
|
+
})
|
|
84
92
|
.then(({ profile }) => {
|
|
85
93
|
process.stdin.pause();
|
|
86
|
-
log.
|
|
87
|
-
log.p(
|
|
88
|
-
log.hs(profile.display_name);
|
|
94
|
+
log.nlhs("Logged in.");
|
|
95
|
+
log.p(profile.display_name);
|
|
89
96
|
})
|
|
90
97
|
.catch((ex) => {
|
|
91
98
|
process.stdin.pause();
|
|
92
|
-
log.
|
|
99
|
+
log.nlhd("Login aborted.");
|
|
93
100
|
log.p(ex.message);
|
|
94
101
|
process.exit(1);
|
|
95
102
|
});
|
|
@@ -104,8 +111,12 @@ const main = function (argv) {
|
|
|
104
111
|
.usage("$0 [options]")
|
|
105
112
|
.option("browser", {
|
|
106
113
|
default: conf.browser,
|
|
107
|
-
describe:
|
|
108
|
-
|
|
114
|
+
describe: "Open a web browser on Enter (disable with --no-browser)",
|
|
115
|
+
type: "boolean",
|
|
116
|
+
})
|
|
117
|
+
.option("qrcode", {
|
|
118
|
+
default: conf.qrcode,
|
|
119
|
+
describe: "Display a qrcode (disable with --no-qrcode)",
|
|
109
120
|
type: "boolean",
|
|
110
121
|
})
|
|
111
122
|
.help("help")
|
package/bin/arc-pack.js
CHANGED
|
@@ -15,6 +15,7 @@ const yargs = require("yargs/yargs");
|
|
|
15
15
|
const log = require("../src/util/log");
|
|
16
16
|
const output = require("../src/util/output");
|
|
17
17
|
const pack = require("../src/cli/pack");
|
|
18
|
+
const phrase = require("../src/phrase");
|
|
18
19
|
const pkg = require("../package.json");
|
|
19
20
|
const rc = require("../src/util/rc");
|
|
20
21
|
const validate = require("../src/cli/validate");
|
|
@@ -33,6 +34,7 @@ const SUBCMD = "pack";
|
|
|
33
34
|
// [define]
|
|
34
35
|
|
|
35
36
|
const conf = {
|
|
37
|
+
input: null,
|
|
36
38
|
json: false,
|
|
37
39
|
output: null,
|
|
38
40
|
quiet: false,
|
|
@@ -49,19 +51,22 @@ const start = function (argv) {
|
|
|
49
51
|
.then((issues) => {
|
|
50
52
|
const count = issues.length;
|
|
51
53
|
if (count) {
|
|
52
|
-
throw new Error(
|
|
53
|
-
`${count} ${count === 1 ? "issue" : "issues"} found. Run \`arc validate\` for details.`,
|
|
54
|
-
);
|
|
54
|
+
throw new Error(phrase.issuesFound(count));
|
|
55
55
|
}
|
|
56
|
-
return pack({ output: argv.output, root });
|
|
56
|
+
return pack({ input: argv.input, output: argv.output, root });
|
|
57
57
|
})
|
|
58
|
-
.then((
|
|
58
|
+
.then((artifact) => {
|
|
59
59
|
if (json) {
|
|
60
|
-
print({ artifact
|
|
60
|
+
print({ artifact });
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
if (!quiet) {
|
|
64
|
-
log.hs("
|
|
64
|
+
log.hs("Done.");
|
|
65
|
+
if (artifact) {
|
|
66
|
+
print(artifact, { toml: true });
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
log.p("Nothing to do.");
|
|
65
70
|
}
|
|
66
71
|
})
|
|
67
72
|
.catch((ex) => {
|
|
@@ -83,10 +88,16 @@ const main = function (argv) {
|
|
|
83
88
|
yargs(hideBin(argv))
|
|
84
89
|
.scriptName(`${CMD} ${SUBCMD}`)
|
|
85
90
|
.usage("$0 [options]")
|
|
91
|
+
.option("input", {
|
|
92
|
+
alias: "i",
|
|
93
|
+
default: conf.input,
|
|
94
|
+
describe: "Set the input directory",
|
|
95
|
+
type: "string",
|
|
96
|
+
})
|
|
86
97
|
.option("output", {
|
|
87
98
|
alias: "o",
|
|
88
99
|
default: conf.output,
|
|
89
|
-
describe: "Set the output
|
|
100
|
+
describe: "Set the output file",
|
|
90
101
|
type: "string",
|
|
91
102
|
})
|
|
92
103
|
.option("json", {
|
package/bin/arc-validate.js
CHANGED
|
@@ -51,7 +51,7 @@ const start = function (argv) {
|
|
|
51
51
|
log.hd(`${count} ${count === 1 ? "issue" : "issues"} found.`);
|
|
52
52
|
log.p(issues.map((error) => `✗ ${error}`));
|
|
53
53
|
} else if (!quiet) {
|
|
54
|
-
log.hs("
|
|
54
|
+
log.hs("No issues found.");
|
|
55
55
|
}
|
|
56
56
|
process.exit(count ? 1 : 0);
|
|
57
57
|
})
|
package/bin/arc-whoami.js
CHANGED
|
@@ -35,9 +35,9 @@ const conf = {
|
|
|
35
35
|
|
|
36
36
|
const handler = function ({ json }) {
|
|
37
37
|
return {
|
|
38
|
-
|
|
38
|
+
onAccountRefresh(refresh) {
|
|
39
39
|
if (!json) {
|
|
40
|
-
log.p("Checking login...");
|
|
40
|
+
// log.p("Checking login...");
|
|
41
41
|
}
|
|
42
42
|
return refresh(true);
|
|
43
43
|
},
|
|
@@ -62,8 +62,7 @@ const start = function (argv) {
|
|
|
62
62
|
if (json) {
|
|
63
63
|
print({ profile });
|
|
64
64
|
} else {
|
|
65
|
-
log.p(
|
|
66
|
-
log.hs(profile.display_name);
|
|
65
|
+
log.p(profile.display_name);
|
|
67
66
|
}
|
|
68
67
|
})
|
|
69
68
|
.catch((ex) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bin": {
|
|
3
3
|
"arc": "bin/arc.js",
|
|
4
|
+
"arc-build": "bin/arc-build.js",
|
|
4
5
|
"arc-deploy": "bin/arc-deploy.js",
|
|
5
6
|
"arc-init": "bin/arc-init.js",
|
|
6
7
|
"arc-inspect": "bin/arc-inspect.js",
|
|
@@ -14,6 +15,8 @@
|
|
|
14
15
|
"@inquirer/prompts": "^8.5.2",
|
|
15
16
|
"adm-zip": "^0.5.16",
|
|
16
17
|
"chalk": "^4.1.2",
|
|
18
|
+
"cli-progress": "^3.12.0",
|
|
19
|
+
"cli-spinner": "^0.2.10",
|
|
17
20
|
"degit": "^2.8.6",
|
|
18
21
|
"dompurify": "^3.3.1",
|
|
19
22
|
"dot-prop": "^6.0.1",
|
|
@@ -25,6 +28,7 @@
|
|
|
25
28
|
"mp4box": "^2.3.0",
|
|
26
29
|
"open": "^8.4.2",
|
|
27
30
|
"pretty-toml": "^1.0.0",
|
|
31
|
+
"qrcode-terminal": "^0.12.0",
|
|
28
32
|
"rc": "^1.2.8",
|
|
29
33
|
"semver": "^7.7.3",
|
|
30
34
|
"yargs": "^17.7.2",
|
|
@@ -35,6 +39,7 @@
|
|
|
35
39
|
"node": ">=24.11.1"
|
|
36
40
|
},
|
|
37
41
|
"exports": {
|
|
42
|
+
"./build": "./src/cli/build.js",
|
|
38
43
|
"./deploy": "./src/cli/deploy.js",
|
|
39
44
|
"./init": "./src/cli/init.js",
|
|
40
45
|
"./inspect": "./src/cli/inspect.js",
|
|
@@ -51,5 +56,5 @@
|
|
|
51
56
|
"license": "Apache-2.0",
|
|
52
57
|
"main": "./src/cli/index.js",
|
|
53
58
|
"name": "arcadible",
|
|
54
|
-
"version": "0.1.
|
|
59
|
+
"version": "0.1.14"
|
|
55
60
|
}
|
package/src/account.js
CHANGED
|
@@ -62,7 +62,7 @@ const refresh = function ({ session, ...account }) {
|
|
|
62
62
|
|
|
63
63
|
// [function]
|
|
64
64
|
|
|
65
|
-
const get = function (
|
|
65
|
+
const get = function (onRefresh) {
|
|
66
66
|
return readFile(file, "utf8")
|
|
67
67
|
.then(JSON.parse)
|
|
68
68
|
.catch((ex) => {
|
|
@@ -76,7 +76,9 @@ const get = function ({ onRefresh }) {
|
|
|
76
76
|
return null;
|
|
77
77
|
}
|
|
78
78
|
return expired(account.session)
|
|
79
|
-
? onRefresh
|
|
79
|
+
? (onRefresh &&
|
|
80
|
+
onRefresh((renew) => (renew ? refresh(account) : null))) ||
|
|
81
|
+
null
|
|
80
82
|
: account;
|
|
81
83
|
});
|
|
82
84
|
};
|