@devvit/cli 0.11.1-next-2024-10-18-544029bd6.0 → 0.11.1
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/bundle/actor.d.ts.map +1 -1
- package/dist/commands/bundle/actor.js +12 -21
- package/dist/commands/playtest.d.ts +1 -1
- package/dist/commands/playtest.d.ts.map +1 -1
- package/dist/commands/playtest.js +21 -26
- package/dist/commands/upload.d.ts +2 -1
- package/dist/commands/upload.d.ts.map +1 -1
- package/dist/commands/upload.js +8 -7
- package/dist/util/Bundler.d.ts +2 -5
- package/dist/util/Bundler.d.ts.map +1 -1
- package/dist/util/Bundler.js +3 -3
- package/dist/util/Bundler.test.js +2 -3
- package/dist/util/Playtest.test.js +2 -2
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/actor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAKvE,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,cAAc;;IACrD,OAAgB,WAAW,SAAsC;IAEjE,OAAgB,QAAQ,WAAsC;IAE9D,OAAgB,IAAI;;MAOlB;IAEF,OAAgB,MAAM,UAAQ;IAExB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../../src/commands/bundle/actor.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAKvE,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,cAAc;;IACrD,OAAgB,WAAW,SAAsC;IAEjE,OAAgB,QAAQ,WAAsC;IAE9D,OAAgB,IAAI;;MAOlB;IAEF,OAAgB,MAAM,UAAQ;IAExB,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA8C3B"}
|
|
@@ -3,11 +3,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
3
3
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
|
-
var _BundleActor_instances,
|
|
6
|
+
var _BundleActor_instances, _BundleActor_getOwnerUsername;
|
|
7
7
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { Bundle } from '@devvit/protos/types/devvit/plugin/buildpack/buildpack_common.js';
|
|
10
|
-
import { ActorSpec
|
|
10
|
+
import { ActorSpec } from '@devvit/protos/types/devvit/runtime/bundle.js';
|
|
11
11
|
import { Args } from '@oclif/core';
|
|
12
12
|
import { getAccessToken } from '../../util/auth.js';
|
|
13
13
|
import { Bundler } from '../../util/Bundler.js';
|
|
@@ -25,29 +25,20 @@ class BundleActor extends ProjectCommand {
|
|
|
25
25
|
const { args } = await this.parse(BundleActor);
|
|
26
26
|
const username = await __classPrivateFieldGet(this, _BundleActor_instances, "m", _BundleActor_getOwnerUsername).call(this);
|
|
27
27
|
const config = await readDevvitConfig(this.projectRoot, this.configFile);
|
|
28
|
-
const
|
|
29
|
-
|
|
28
|
+
const actorName = args.name;
|
|
29
|
+
const actorBundler = new Bundler();
|
|
30
|
+
const bundle = await actorBundler.bundle(this.projectRoot, ActorSpec.fromPartial({
|
|
31
|
+
name: actorName,
|
|
30
32
|
owner: username,
|
|
31
33
|
version: config.version,
|
|
32
|
-
});
|
|
33
|
-
await __classPrivateFieldGet(this, _BundleActor_instances, "m", _BundleActor_makeBundles).call(this, actorSpec);
|
|
34
|
-
this.log(`Successfully bundled actor: ${actorSpec.name}`);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
_BundleActor_instances = new WeakSet(), _BundleActor_makeBundles = async function _BundleActor_makeBundles(actorSpec) {
|
|
38
|
-
const actorBundler = new Bundler();
|
|
39
|
-
const bundles = await actorBundler.bundle(this.projectRoot, actorSpec);
|
|
40
|
-
await Promise.all(bundles.map(async (bundle) => {
|
|
41
|
-
const target = bundle.buildInfo?.targetRuntime ?? TargetRuntime.UNIVERSAL;
|
|
42
|
-
let type = '';
|
|
43
|
-
if (target === TargetRuntime.CLIENT) {
|
|
44
|
-
type = '.client';
|
|
45
|
-
}
|
|
34
|
+
}));
|
|
46
35
|
await readAndInjectBundleProducts(this.projectRoot, bundle, false);
|
|
47
36
|
await mkdir(path.join(this.projectRoot, distDirFilename), { recursive: true });
|
|
48
|
-
await writeFile(path.join(this.projectRoot, distDirFilename, `${
|
|
49
|
-
|
|
50
|
-
}
|
|
37
|
+
await writeFile(path.join(this.projectRoot, distDirFilename, `${actorName}.bundle.json`), JSON.stringify(Bundle.toJSON(bundle)));
|
|
38
|
+
this.log(`Successfully bundled actor: ${actorName}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
_BundleActor_instances = new WeakSet(), _BundleActor_getOwnerUsername = async function _BundleActor_getOwnerUsername() {
|
|
51
42
|
let username = '';
|
|
52
43
|
try {
|
|
53
44
|
const token = await getAccessToken();
|
|
@@ -13,5 +13,5 @@ export default class Playtest extends Upload {
|
|
|
13
13
|
checkVersionBuildStatus(appVersionInfo: AppVersionInfo): Promise<boolean>;
|
|
14
14
|
run(): Promise<void>;
|
|
15
15
|
}
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function modifyBundleVersion(bundle: Bundle, version: string): void;
|
|
17
17
|
//# sourceMappingURL=playtest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playtest.d.ts","sourceRoot":"","sources":["../../src/commands/playtest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,6BAA6B,CAAC;AAWxF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kEAAkE,CAAC;AAc/F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAOtE,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAgB3C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,MAAM;;IAC1C,OAAgB,WAAW,SACgK;IAE3L,OAAgB,QAAQ,WAItB;IAEF,WAAoB,KAAK,IAAI,SAAS,CAoBrC;IAED,OAAgB,IAAI;;MAMlB;IAmCI,uBAAuB,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAyBhE,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"playtest.d.ts","sourceRoot":"","sources":["../../src/commands/playtest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAwB,MAAM,6BAA6B,CAAC;AAWxF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kEAAkE,CAAC;AAc/F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAOtE,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAgB3C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,MAAM;;IAC1C,OAAgB,WAAW,SACgK;IAE3L,OAAgB,QAAQ,WAItB;IAEF,WAAoB,KAAK,IAAI,SAAS,CAoBrC;IAED,OAAgB,IAAI;;MAMlB;IAmCI,uBAAuB,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAyBhE,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAkTpC;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAKzE"}
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
|
-
var _Playtest_instances, _a, _Playtest_installationsClient, _Playtest_appLogSub, _Playtest_bundler, _Playtest_existingInstallInfo, _Playtest_appInfo, _Playtest_version,
|
|
12
|
+
var _Playtest_instances, _a, _Playtest_installationsClient, _Playtest_appLogSub, _Playtest_bundler, _Playtest_existingInstallInfo, _Playtest_appInfo, _Playtest_version, _Playtest_lastBundle, _Playtest_lastQueuedBundle, _Playtest_isOnWatchExecuting, _Playtest_server, _Playtest_flags, _Playtest_watchAssets, _Playtest_getExistingInstallInfo, _Playtest_newAppLogSub, _Playtest_onWatch, _Playtest_onWatchError, _Playtest_onExit;
|
|
13
13
|
import { BuildStatus, GetAllWithInstallLocationRequest, InstallationCreationRequest, InstallationType, InstallationUpgradeRequest, UUID, VersionVisibility, } from '@devvit/protos/community.js';
|
|
14
14
|
import { Severity } from '@devvit/protos/types/devvit/plugin/logger/logger.js';
|
|
15
15
|
import { RemoteLogType } from '@devvit/protos/types/devvit/remote_logger/remote_logger.js';
|
|
@@ -47,13 +47,13 @@ class Playtest extends Upload {
|
|
|
47
47
|
_Playtest_existingInstallInfo.set(this, void 0);
|
|
48
48
|
_Playtest_appInfo.set(this, void 0);
|
|
49
49
|
_Playtest_version.set(this, void 0);
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
_Playtest_lastBundle.set(this, void 0);
|
|
51
|
+
_Playtest_lastQueuedBundle.set(this, void 0);
|
|
52
52
|
_Playtest_isOnWatchExecuting.set(this, false);
|
|
53
53
|
_Playtest_server.set(this, void 0);
|
|
54
54
|
_Playtest_flags.set(this, void 0);
|
|
55
55
|
_Playtest_watchAssets.set(this, void 0);
|
|
56
|
-
_Playtest_onWatch.set(this, async (
|
|
56
|
+
_Playtest_onWatch.set(this, async (bundle, subreddit) => {
|
|
57
57
|
/* We have to do this here because none of the rxjs functions fit this use case perfectly. What
|
|
58
58
|
* we need is something that serializes this whole pipeline, but also discards all but the most
|
|
59
59
|
* recent value once we resume processing. We would love to use one of these, but...
|
|
@@ -67,16 +67,13 @@ class Playtest extends Upload {
|
|
|
67
67
|
*/
|
|
68
68
|
if (__classPrivateFieldGet(this, _Playtest_isOnWatchExecuting, "f")) {
|
|
69
69
|
// if we're already executing, queue this watch to be executed after we're done
|
|
70
|
-
__classPrivateFieldSet(this,
|
|
70
|
+
__classPrivateFieldSet(this, _Playtest_lastQueuedBundle, bundle, "f");
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
if (!
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
__classPrivateFieldSet(this, _Playtest_lastBundles, result.bundles, "f");
|
|
77
|
-
if (!__classPrivateFieldGet(this, _Playtest_lastBundles, "f")) {
|
|
73
|
+
if (!bundle) {
|
|
78
74
|
return;
|
|
79
75
|
}
|
|
76
|
+
__classPrivateFieldSet(this, _Playtest_lastBundle, bundle, "f");
|
|
80
77
|
if (!__classPrivateFieldGet(this, _Playtest_appInfo, "f")?.app) {
|
|
81
78
|
this.error(`Something went wrong: App is not found`);
|
|
82
79
|
}
|
|
@@ -91,11 +88,11 @@ class Playtest extends Upload {
|
|
|
91
88
|
version: __classPrivateFieldGet(this, _Playtest_version, "f").toString(),
|
|
92
89
|
});
|
|
93
90
|
// 3. update bundle version:
|
|
94
|
-
|
|
91
|
+
modifyBundleVersion(bundle, __classPrivateFieldGet(this, _Playtest_version, "f").toString());
|
|
95
92
|
// 4. create new playtest version:
|
|
96
93
|
let appVersionInfo;
|
|
97
94
|
try {
|
|
98
|
-
appVersionInfo = await this.createVersion(__classPrivateFieldGet(this, _Playtest_appInfo, "f").app, __classPrivateFieldGet(this, _Playtest_version, "f"),
|
|
95
|
+
appVersionInfo = await this.createVersion(__classPrivateFieldGet(this, _Playtest_appInfo, "f").app, __classPrivateFieldGet(this, _Playtest_version, "f"), [bundle], VersionVisibility.PRIVATE);
|
|
99
96
|
}
|
|
100
97
|
catch (err) {
|
|
101
98
|
if (err instanceof Error) {
|
|
@@ -126,10 +123,10 @@ class Playtest extends Upload {
|
|
|
126
123
|
ux.action.stop(`✅\nSuccess! Please visit your test subreddit and refresh to see your latest changes:\n✨ ${playtestUrl}\n`);
|
|
127
124
|
__classPrivateFieldSet(this, _Playtest_isOnWatchExecuting, false, "f");
|
|
128
125
|
// If there's a queued watch, execute it now.
|
|
129
|
-
if (__classPrivateFieldGet(this,
|
|
130
|
-
const
|
|
131
|
-
__classPrivateFieldSet(this,
|
|
132
|
-
await __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this,
|
|
126
|
+
if (__classPrivateFieldGet(this, _Playtest_lastQueuedBundle, "f")) {
|
|
127
|
+
const newerBundle = __classPrivateFieldGet(this, _Playtest_lastQueuedBundle, "f");
|
|
128
|
+
__classPrivateFieldSet(this, _Playtest_lastQueuedBundle, undefined, "f");
|
|
129
|
+
await __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this, newerBundle, subreddit); // subreddit won't change between calls!
|
|
133
130
|
}
|
|
134
131
|
});
|
|
135
132
|
_Playtest_onWatchError.set(this, (err) => {
|
|
@@ -234,8 +231,8 @@ class Playtest extends Upload {
|
|
|
234
231
|
const assetPaths = [assetDir, webviewAssetDir, productsJSON];
|
|
235
232
|
__classPrivateFieldSet(this, _Playtest_watchAssets, chokidar.watch(assetPaths, { ignoreInitial: true }), "f");
|
|
236
233
|
__classPrivateFieldGet(this, _Playtest_watchAssets, "f").on('all', () => {
|
|
237
|
-
// asset changes don't result in a code change, so just re-send the last
|
|
238
|
-
void __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this,
|
|
234
|
+
// asset changes don't result in a code change, so just re-send the last bundle
|
|
235
|
+
void __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this, __classPrivateFieldGet(this, _Playtest_lastBundle, "f"), subreddit);
|
|
239
236
|
});
|
|
240
237
|
// before starting playtest session, make sure app has been installed to the test subreddit:
|
|
241
238
|
const appWithVersion = `${appName}@${__classPrivateFieldGet(this, _Playtest_version, "f")}`;
|
|
@@ -267,7 +264,7 @@ class Playtest extends Upload {
|
|
|
267
264
|
// bundles through an asynchronous observable and only open a subscription
|
|
268
265
|
// for errors. We just dispose the source (bundler) to unsubscribe.
|
|
269
266
|
watchSrc
|
|
270
|
-
.pipe(map((
|
|
267
|
+
.pipe(map((bundle) => __classPrivateFieldGet(this, _Playtest_onWatch, "f").call(this, bundle, subreddit)))
|
|
271
268
|
.subscribe({ error: __classPrivateFieldGet(this, _Playtest_onWatchError, "f") });
|
|
272
269
|
// We don't know when the user is done. If connected to a terminal, end when
|
|
273
270
|
// stdin is closed. Otherwise, close immediately to avoid the chance that
|
|
@@ -278,7 +275,7 @@ class Playtest extends Upload {
|
|
|
278
275
|
}
|
|
279
276
|
}
|
|
280
277
|
}
|
|
281
|
-
_a = Playtest, _Playtest_installationsClient = new WeakMap(), _Playtest_appLogSub = new WeakMap(), _Playtest_bundler = new WeakMap(), _Playtest_existingInstallInfo = new WeakMap(), _Playtest_appInfo = new WeakMap(), _Playtest_version = new WeakMap(),
|
|
278
|
+
_a = Playtest, _Playtest_installationsClient = new WeakMap(), _Playtest_appLogSub = new WeakMap(), _Playtest_bundler = new WeakMap(), _Playtest_existingInstallInfo = new WeakMap(), _Playtest_appInfo = new WeakMap(), _Playtest_version = new WeakMap(), _Playtest_lastBundle = new WeakMap(), _Playtest_lastQueuedBundle = new WeakMap(), _Playtest_isOnWatchExecuting = new WeakMap(), _Playtest_server = new WeakMap(), _Playtest_flags = new WeakMap(), _Playtest_watchAssets = new WeakMap(), _Playtest_onWatch = new WeakMap(), _Playtest_onWatchError = new WeakMap(), _Playtest_instances = new WeakSet(), _Playtest_getExistingInstallInfo = async function _Playtest_getExistingInstallInfo(subreddit) {
|
|
282
279
|
const existingInstalls = await __classPrivateFieldGet(this, _Playtest_installationsClient, "f").GetAllWithInstallLocation(GetAllWithInstallLocationRequest.fromPartial({
|
|
283
280
|
type: InstallationType.SUBREDDIT,
|
|
284
281
|
location: subreddit,
|
|
@@ -339,13 +336,11 @@ Playtest.args = {
|
|
|
339
336
|
}),
|
|
340
337
|
};
|
|
341
338
|
export default Playtest;
|
|
342
|
-
export function
|
|
339
|
+
export function modifyBundleVersion(bundle, version) {
|
|
343
340
|
var _b;
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
bundle.dependencies.actor.version = version.toString();
|
|
348
|
-
}
|
|
341
|
+
bundle.dependencies ?? (bundle.dependencies = DependencySpec.fromPartial({}));
|
|
342
|
+
(_b = bundle.dependencies).actor ?? (_b.actor = ActorSpec.fromPartial({}));
|
|
343
|
+
bundle.dependencies.actor.version = version.toString();
|
|
349
344
|
}
|
|
350
345
|
function sleep(ms) {
|
|
351
346
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AppInfo, AppVersionInfo } from '@devvit/protos/community.js';
|
|
2
|
+
import { FullAppInfo, VersionVisibility } from '@devvit/protos/community.js';
|
|
2
3
|
import type { Bundle } from '@devvit/protos/types/devvit/plugin/buildpack/buildpack_common.js';
|
|
3
4
|
import { DevvitVersion, VersionBumpType } from '@devvit/shared-types/Version.js';
|
|
4
5
|
import type { CommandError } from '@oclif/core/lib/interfaces/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/commands/upload.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../src/commands/upload.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EAIf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,WAAW,EAGX,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kEAAkE,CAAC;AAmB/F,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AActE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAa5D,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,cAAc;;IAChD,OAAgB,WAAW,SAA+M;IAE1O,OAAgB,KAAK,EAAE,SAAS,CAgD9B;IAEF,QAAQ,CAAC,SAAS,kDAAqB;IACvC,QAAQ,CAAC,gBAAgB,yDAA4B;IAe/C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IA4JpB,YAAY,CAChB,aAAa,EAAE,YAAY,EAC3B,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,OAAO,GAChB,OAAO,CAAC,WAAW,CAAC;IA2FjB,cAAc,CAClB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,eAAe,GAAG,SAAS,EACjC,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,aAAa,CAAC;IAuBnB,aAAa,CACjB,GAAG,EAAE,OAAO,EACZ,UAAU,EAAE,aAAa,EACzB,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,EAAE,iBAAiB,GAC5B,OAAO,CAAC,cAAc,CAAC;IAoOX,KAAK,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC;CA4M1D"}
|
package/dist/commands/upload.js
CHANGED
|
@@ -14,7 +14,7 @@ import { exec } from 'node:child_process';
|
|
|
14
14
|
import fs from 'node:fs';
|
|
15
15
|
import fsp from 'node:fs/promises';
|
|
16
16
|
import path from 'node:path';
|
|
17
|
-
import { AppCapability, AppCreationRequest,
|
|
17
|
+
import { AppCapability, AppCreationRequest, FullAppInfo, InstallationType, UploadNewMediaRequest, VersionVisibility, } from '@devvit/protos/community.js';
|
|
18
18
|
import { ALLOWED_ASSET_EXTENSIONS, ASSET_DIRNAME, MAX_ASSET_FOLDER_SIZE_BYTES, MAX_ASSET_GIF_SIZE, MAX_ASSET_NON_GIF_SIZE, prettyPrintSize, WEBVIEW_ASSET_DIRNAME, } from '@devvit/shared-types/Assets.js';
|
|
19
19
|
import { ACTOR_SRC_PRIMARY_NAME, ASSET_HASHING_ALGO, ASSET_UPLOAD_BATCH_SIZE, MAX_ALLOWED_SUBSCRIBER_COUNT, } from '@devvit/shared-types/constants.js';
|
|
20
20
|
import { APP_SLUG_BASE_MAX_LENGTH, makeSlug, sluggable } from '@devvit/shared-types/slug.js';
|
|
@@ -345,13 +345,14 @@ _Upload_event = new WeakMap(), _Upload_eventSent = new WeakMap(), _Upload_verbos
|
|
|
345
345
|
])).isNSFW;
|
|
346
346
|
}, _Upload_bundleActors = async function _Upload_bundleActors(username, version, typecheck = true) {
|
|
347
347
|
const bundler = new Bundler(typecheck);
|
|
348
|
-
const actorSpec = {
|
|
349
|
-
name: ACTOR_SRC_PRIMARY_NAME,
|
|
350
|
-
owner: username,
|
|
351
|
-
version: version,
|
|
352
|
-
};
|
|
353
348
|
try {
|
|
354
|
-
return
|
|
349
|
+
return [
|
|
350
|
+
await bundler.bundle(this.projectRoot, {
|
|
351
|
+
name: ACTOR_SRC_PRIMARY_NAME,
|
|
352
|
+
owner: username,
|
|
353
|
+
version: version,
|
|
354
|
+
}),
|
|
355
|
+
];
|
|
355
356
|
}
|
|
356
357
|
catch (err) {
|
|
357
358
|
this.error(StringUtil.caughtToString(err));
|
package/dist/util/Bundler.d.ts
CHANGED
|
@@ -2,14 +2,11 @@ import type { ProjectRootDir } from '@devvit/build-pack/lib/BuildPack.js';
|
|
|
2
2
|
import { type Bundle } from '@devvit/protos/types/devvit/plugin/buildpack/buildpack_common.js';
|
|
3
3
|
import type { ActorSpec } from '@devvit/protos/types/devvit/runtime/bundle.js';
|
|
4
4
|
import type { Observable } from 'rxjs';
|
|
5
|
-
export type BundlerResult = {
|
|
6
|
-
bundles: Bundle[] | undefined;
|
|
7
|
-
};
|
|
8
5
|
export declare class Bundler {
|
|
9
6
|
#private;
|
|
10
7
|
constructor(typecheckEnabled?: boolean);
|
|
11
|
-
bundle(root: ProjectRootDir, actorSpec: ActorSpec): Promise<Bundle
|
|
8
|
+
bundle(root: ProjectRootDir, actorSpec: ActorSpec): Promise<Bundle>;
|
|
12
9
|
dispose(): Promise<void>;
|
|
13
|
-
watch(root: ProjectRootDir, actorSpec: ActorSpec): Observable<
|
|
10
|
+
watch(root: ProjectRootDir, actorSpec: ActorSpec): Observable<Bundle | undefined>;
|
|
14
11
|
}
|
|
15
12
|
//# sourceMappingURL=Bundler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bundler.d.ts","sourceRoot":"","sources":["../../src/util/Bundler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EACL,KAAK,MAAM,EAEZ,MAAM,kEAAkE,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAKvC,
|
|
1
|
+
{"version":3,"file":"Bundler.d.ts","sourceRoot":"","sources":["../../src/util/Bundler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E,OAAO,EACL,KAAK,MAAM,EAEZ,MAAM,kEAAkE,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAKvC,qBAAa,OAAO;;gBAGN,gBAAgB,GAAE,OAAc;IAUtC,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAqBnE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,KAAK,CAAC,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC;CAWlF"}
|
package/dist/util/Bundler.js
CHANGED
|
@@ -33,10 +33,10 @@ export class Bundler {
|
|
|
33
33
|
if (compiledRes.errors.length > 0) {
|
|
34
34
|
throw new Error(formatLogs(compiledRes.errors));
|
|
35
35
|
}
|
|
36
|
-
if (compiledRes.
|
|
36
|
+
if (compiledRes.bundle == null) {
|
|
37
37
|
throw new Error('Missing bundle');
|
|
38
38
|
}
|
|
39
|
-
return compiledRes.
|
|
39
|
+
return compiledRes.bundle;
|
|
40
40
|
}
|
|
41
41
|
async dispose() {
|
|
42
42
|
await __classPrivateFieldGet(this, _Bundler_buildPack, "f").dispose();
|
|
@@ -49,7 +49,7 @@ export class Bundler {
|
|
|
49
49
|
console.warn(formatLogs(rsp.warnings));
|
|
50
50
|
if (rsp.errors.length > 0)
|
|
51
51
|
console.error(formatLogs(rsp.errors));
|
|
52
|
-
return
|
|
52
|
+
return rsp.bundle;
|
|
53
53
|
}));
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -19,10 +19,9 @@ test('watch touched source', async () => {
|
|
|
19
19
|
});
|
|
20
20
|
const [init, first] = await lastValueFrom(observable.pipe(take(2), toArray()));
|
|
21
21
|
// An empty message is sent initially.
|
|
22
|
-
expect(init).
|
|
23
|
-
expect(init.bundles).toHaveLength(0);
|
|
22
|
+
expect(init).toBeUndefined();
|
|
24
23
|
expect(first).toBeDefined();
|
|
25
|
-
expect(first.
|
|
24
|
+
expect(first.code.length).toBeGreaterThan(0);
|
|
26
25
|
// Observe a second bundle.
|
|
27
26
|
const second = lastValueFrom(observable.pipe(take(1)));
|
|
28
27
|
// Touch.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Bundle } from '@devvit/protos/types/devvit/plugin/buildpack/buildpack_common.js';
|
|
2
|
-
import {
|
|
2
|
+
import { modifyBundleVersion } from '../commands/playtest.js';
|
|
3
3
|
test('bundle has a version and is modified', () => {
|
|
4
4
|
const bundle = Bundle.fromPartial({});
|
|
5
|
-
|
|
5
|
+
modifyBundleVersion(bundle, '1.2.3.4');
|
|
6
6
|
expect(bundle?.dependencies?.actor?.version).toBe('1.2.3.4');
|
|
7
7
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/cli",
|
|
3
|
-
"version": "0.11.1
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Reddit's Dev Platform CLI Tool",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"author": "@reddit/dev-platform",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
},
|
|
43
43
|
"types": "dist/index.d.ts",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@devvit/build-pack": "0.11.1
|
|
45
|
+
"@devvit/build-pack": "0.11.1",
|
|
46
46
|
"@devvit/play": "0.0.43",
|
|
47
|
-
"@devvit/protos": "0.11.1
|
|
48
|
-
"@devvit/public-api": "0.11.1
|
|
49
|
-
"@devvit/shared-types": "0.11.1
|
|
47
|
+
"@devvit/protos": "0.11.1",
|
|
48
|
+
"@devvit/public-api": "0.11.1",
|
|
49
|
+
"@devvit/shared-types": "0.11.1",
|
|
50
50
|
"@improbable-eng/grpc-web": "0.15.0",
|
|
51
51
|
"@improbable-eng/grpc-web-node-http-transport": "0.15.0",
|
|
52
52
|
"@oclif/core": "2.9.4",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"ws": "8.18.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@devvit/repo-tools": "0.11.1
|
|
82
|
-
"@devvit/tsconfig": "0.11.1
|
|
81
|
+
"@devvit/repo-tools": "0.11.1",
|
|
82
|
+
"@devvit/tsconfig": "0.11.1",
|
|
83
83
|
"@types/file-type": "10.9.1",
|
|
84
84
|
"@types/inquirer": "9.0.3",
|
|
85
85
|
"@types/js-yaml": "4.0.5",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
]
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "b7e0214655df6dcdd70c7944b9a14b0d752577ae"
|
|
124
124
|
}
|