arcadible 1.0.40 → 1.0.41
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/action/build/tool.js +18 -6
- package/dist/action/predeploy/secrets.js +2 -5
- package/dist/action/predeploy/tool.js +20 -1
- package/dist/command/build.js +16 -2
- package/dist/command/deploy.js +7 -1
- package/dist/config/code.js +3 -0
- package/dist/phrase/function.js +1 -1
- package/dist/runner/bundle.js +1 -4
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -5,8 +5,8 @@ import { join, resolve as resolvePath } from "node:path";
|
|
|
5
5
|
// [import]
|
|
6
6
|
import { pathExists } from "fs-extra";
|
|
7
7
|
// [import]
|
|
8
|
-
import { BUILT, bundle } from "../../runner/bundle.js";
|
|
9
|
-
import { BUILD_FAILED } from "../../config/code.js";
|
|
8
|
+
import { BUILT, bundle, misimported } from "../../runner/bundle.js";
|
|
9
|
+
import { BUILD_FAILED, WARNING } from "../../config/code.js";
|
|
10
10
|
import { buildCommand } from "../../util/command.js";
|
|
11
11
|
import { ArcError } from "../../util/error.js";
|
|
12
12
|
import { detect } from "../../util/lockfile.js";
|
|
@@ -41,11 +41,22 @@ function build(command, { cwdPath, outputPath }) {
|
|
|
41
41
|
// [function]
|
|
42
42
|
// the game's function, bundled after the project's own build, which may have
|
|
43
43
|
// written the code it's made from: resolves with the bundle's path, or null
|
|
44
|
-
// for a game with none.
|
|
45
|
-
|
|
44
|
+
// for a game with none. `onWarning` hears each package the function imports
|
|
45
|
+
// that's meant for a game or a server of one's own (function_import_wrong).
|
|
46
|
+
function buildRunner(root, main, onWarning) {
|
|
46
47
|
return typeof main === "string"
|
|
47
48
|
? bundle({
|
|
48
49
|
main: resolvePath(root, main),
|
|
50
|
+
onPackages: onWarning
|
|
51
|
+
? (names) => {
|
|
52
|
+
misimported(names).forEach((each) => {
|
|
53
|
+
onWarning({
|
|
54
|
+
code: WARNING.FUNCTION_IMPORT_WRONG,
|
|
55
|
+
message: phrase.functionImportWrong(each),
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
: undefined,
|
|
49
60
|
outfile: resolvePath(root, BUILT),
|
|
50
61
|
})
|
|
51
62
|
: Promise.resolve(null);
|
|
@@ -95,13 +106,14 @@ async function explain(ex, root) {
|
|
|
95
106
|
// [function]
|
|
96
107
|
// builds the project: its own build, then its runner, when it has one. The
|
|
97
108
|
// result is the build's, with `function`, the bundle's path, beside it.
|
|
98
|
-
|
|
109
|
+
// `onWarning` gets each of the bundle's warnings (function_import_wrong).
|
|
110
|
+
export async function buildTool({ onWarning, project: { function: runner, workflow }, root, }) {
|
|
99
111
|
try {
|
|
100
112
|
const artifact = await build(buildCommand(workflow.build), {
|
|
101
113
|
cwdPath: root,
|
|
102
114
|
outputPath: resolvePath(root, workflow.deploy_dir),
|
|
103
115
|
});
|
|
104
|
-
const bundled = await buildRunner(root, runner?.main);
|
|
116
|
+
const bundled = await buildRunner(root, runner?.main, onWarning);
|
|
105
117
|
return bundled ? { ...artifact, function: bundled } : artifact;
|
|
106
118
|
}
|
|
107
119
|
catch (ex) {
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
// them, so a build can ship naming one (`[function] secrets`) with no value
|
|
3
3
|
// on its channel, and its function then reads nothing for it. A direct
|
|
4
4
|
// deploy can say so first, since it has the login that reads the game's
|
|
5
|
-
// secrets; `arc deploy git` has none, and never asks.
|
|
6
|
-
//
|
|
7
|
-
// Nothing calls this yet: what it finds is a warning, a warning has a code,
|
|
8
|
-
// and a code has an entry on the public Errors page, which says nothing of
|
|
9
|
-
// functions until they ship (TODO.md, Agreed next).
|
|
5
|
+
// secrets; `arc deploy git` has none, and never asks. `predeployTool` warns
|
|
6
|
+
// of each (secret_unset).
|
|
10
7
|
import { auth, gameFunctionSecrets } from "../../api.js";
|
|
11
8
|
import { channel } from "../../util/links.js";
|
|
12
9
|
// [function]
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
// [import]
|
|
2
2
|
import { ensureId, ensureUnpublished } from "./ac.js";
|
|
3
|
+
import { WARNING } from "../../config/code.js";
|
|
3
4
|
import { releasing } from "./game.js";
|
|
5
|
+
import { secretUnset } from "../../phrase/index.js";
|
|
6
|
+
import { unset } from "./secrets.js";
|
|
7
|
+
// [function]
|
|
8
|
+
// warns of each secret the project's function declares that has no value
|
|
9
|
+
// on the channel the version goes to (secret_unset): never a failure, since
|
|
10
|
+
// a value may be set after. Asked only when it declares some.
|
|
11
|
+
function warnUnset(current, game, declared, handler) {
|
|
12
|
+
return unset(current, game, declared).then(({ channel, names }) => {
|
|
13
|
+
for (const name of names) {
|
|
14
|
+
if (handler.onWarning) {
|
|
15
|
+
handler.onWarning({
|
|
16
|
+
code: WARNING.SECRET_UNSET,
|
|
17
|
+
message: secretUnset({ channel, name }),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
4
23
|
// [function]
|
|
5
24
|
// a direct deploy needs a login. Each lookup uses its token or not, as it
|
|
6
25
|
// needs, and its answer is true when it's asked.
|
|
@@ -10,5 +29,5 @@ export function predeployTool(current, conf, { onPredeployBegin, ...handler }) {
|
|
|
10
29
|
}
|
|
11
30
|
return ensureId(current, releasing(conf.project.game), handler)
|
|
12
31
|
.then((game) => ensureUnpublished(current, game))
|
|
13
|
-
.then((game) => ({ held: game.held, to: game.version }));
|
|
32
|
+
.then((game) => warnUnset(current, game, conf.project.function?.secrets, handler).then(() => ({ held: game.held, to: game.version })));
|
|
14
33
|
}
|
package/dist/command/build.js
CHANGED
|
@@ -5,7 +5,7 @@ import { checked } from "../action/validate/checked.js";
|
|
|
5
5
|
import { WARNING } from "../config/code.js";
|
|
6
6
|
import { defineCommand } from "../cli/command.js";
|
|
7
7
|
import { buildOutputMissing, buildSucceeded, nothingToDo, } from "../phrase/index.js";
|
|
8
|
-
import { hs, nlpw, result } from "../util/log.js";
|
|
8
|
+
import { hs, nlpw, pw, result } from "../util/log.js";
|
|
9
9
|
import { CWD, JSON_OUTPUT, QUIET } from "../cli/options.js";
|
|
10
10
|
import { print, warn, warning } from "../util/output.js";
|
|
11
11
|
import { SpinnerWheel } from "../util/spinner.js";
|
|
@@ -37,7 +37,21 @@ export default defineCommand({
|
|
|
37
37
|
sw = new SpinnerWheel("Building… %s");
|
|
38
38
|
aborting.sw = sw;
|
|
39
39
|
sw.start(json || quiet);
|
|
40
|
-
|
|
40
|
+
// the bundle's own, printed once it's built.
|
|
41
|
+
const bundled = [];
|
|
42
|
+
const artifact = await buildTool({
|
|
43
|
+
onWarning({ code, message }) {
|
|
44
|
+
bundled.push(warning(code, message));
|
|
45
|
+
},
|
|
46
|
+
project: parsed,
|
|
47
|
+
root,
|
|
48
|
+
});
|
|
49
|
+
warnings = [...warnings, ...bundled];
|
|
50
|
+
aborting.data = { warnings };
|
|
51
|
+
if (!json && !quiet && bundled.length) {
|
|
52
|
+
sw.stop(true);
|
|
53
|
+
bundled.forEach((each) => pw(each.message));
|
|
54
|
+
}
|
|
41
55
|
if (json) {
|
|
42
56
|
const missing = artifact?.missing
|
|
43
57
|
? [
|
package/dist/command/deploy.js
CHANGED
|
@@ -127,7 +127,13 @@ export default defineCommand({
|
|
|
127
127
|
const held = predeployed.held ?? false;
|
|
128
128
|
sw = spinner(aborting, "Building… %s");
|
|
129
129
|
sw.start(git || json || quiet);
|
|
130
|
-
const output = git
|
|
130
|
+
const output = git
|
|
131
|
+
? null
|
|
132
|
+
: await buildTool({
|
|
133
|
+
onWarning: handler({ json, pb, quiet, sw, warnings }).onWarning,
|
|
134
|
+
project: parsed,
|
|
135
|
+
root,
|
|
136
|
+
});
|
|
131
137
|
if (output) {
|
|
132
138
|
parsed = await rebuilt(root);
|
|
133
139
|
}
|
package/dist/config/code.js
CHANGED
|
@@ -73,6 +73,7 @@ export const RELEASE = {
|
|
|
73
73
|
PACKAGE_PATH_INVALID: "package_path_invalid",
|
|
74
74
|
RELEASE_EXPIRED: "release_expired",
|
|
75
75
|
REPO_NOT_CONNECTED: "repo_not_connected",
|
|
76
|
+
SERVERS_CHANGED: "servers_changed",
|
|
76
77
|
VERSION_EXISTS: "version_exists",
|
|
77
78
|
VERSION_MISMATCH: "version_mismatch",
|
|
78
79
|
ZIP_INVALID: "zip_invalid",
|
|
@@ -122,12 +123,14 @@ export const WARNING = {
|
|
|
122
123
|
DEPLOY_DIR_NOT_BUILT: "deploy_dir_not_built",
|
|
123
124
|
FIELD_UNKNOWN: "field_unknown",
|
|
124
125
|
FIELD_UNSET: "field_unset",
|
|
126
|
+
FUNCTION_IMPORT_WRONG: "function_import_wrong",
|
|
125
127
|
GAME_HANDLE_LAPSED: "game_handle_lapsed",
|
|
126
128
|
GAME_HANDLE_LIMIT_REACHED: "game_handle_limit_reached",
|
|
127
129
|
PACKAGE_FILE_DEV: "package_file_dev",
|
|
128
130
|
PACKAGE_FILE_PRIVATE: "package_file_private",
|
|
129
131
|
SCREENSHOT_NAME_INVALID: "screenshot_name_invalid",
|
|
130
132
|
SDK_SCRIPT_PATH: "sdk_script_path",
|
|
133
|
+
SECRET_UNSET: "secret_unset",
|
|
131
134
|
VERSION_UNCHECKED: "version_unchecked",
|
|
132
135
|
};
|
|
133
136
|
// every error code, for checking one exists.
|
package/dist/phrase/function.js
CHANGED
|
@@ -109,7 +109,7 @@ export function secretSet({ channel, name, }) {
|
|
|
109
109
|
}
|
|
110
110
|
// [function]
|
|
111
111
|
// a secret a build declares that has no value on the channel it goes to,
|
|
112
|
-
// which `arc deploy` warns of (
|
|
112
|
+
// which `arc deploy` warns of (action/predeploy/secrets.ts).
|
|
113
113
|
export function secretUnset({ channel, name, }) {
|
|
114
114
|
return `Secret ${name} has no value on ${channel}.\nSet it with \`arc unstable function secret set ${name} --${channel}\`.`;
|
|
115
115
|
}
|
package/dist/runner/bundle.js
CHANGED
|
@@ -37,10 +37,7 @@ export const WRONG = {
|
|
|
37
37
|
//
|
|
38
38
|
// `onPackages`, when given, hears the `@arcadible/` packages the bundle took
|
|
39
39
|
// in, by name, each once, so a build can say when a function imports one
|
|
40
|
-
// that isn't the Function SDK (`misimported
|
|
41
|
-
// finds is a warning, a warning has a code, and a code has an entry on the
|
|
42
|
-
// public Errors page, which says nothing of functions until they ship
|
|
43
|
-
// (TODO.md, Agreed next).
|
|
40
|
+
// that isn't the Function SDK (`misimported`, function_import_wrong).
|
|
44
41
|
//
|
|
45
42
|
// `onInputs`, when given, hears every file the bundle was made from, each a
|
|
46
43
|
// full path, so `arc serve` can run the function again when any of them
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"license": "Apache-2.0",
|
|
44
44
|
"name": "arcadible",
|
|
45
|
-
"version": "1.0.
|
|
45
|
+
"version": "1.0.41"
|
|
46
46
|
},
|
|
47
47
|
"node_modules/@cacheable/memory": {
|
|
48
48
|
"dependencies": {
|
|
@@ -2433,5 +2433,5 @@
|
|
|
2433
2433
|
}
|
|
2434
2434
|
},
|
|
2435
2435
|
"requires": true,
|
|
2436
|
-
"version": "1.0.
|
|
2436
|
+
"version": "1.0.41"
|
|
2437
2437
|
}
|
package/package.json
CHANGED