@devvit/cli 0.11.19 → 0.11.20-next-2025-07-23-18-02-25-3ea0d7aed.0
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/init.d.ts.map +1 -1
- package/dist/commands/init.js +9 -21
- package/dist/util/AssetUploader.d.ts +1 -0
- package/dist/util/AssetUploader.d.ts.map +1 -1
- package/dist/util/AssetUploader.js +44 -0
- package/dist/util/AssetUploader.test.js +34 -1
- package/dist/util/Cutter.d.ts.map +1 -1
- package/dist/util/Cutter.js +12 -10
- package/dist/util/auth.d.ts.map +1 -1
- package/dist/util/auth.js +3 -3
- package/dist/util/clientGenerators.d.ts +1 -0
- package/dist/util/clientGenerators.d.ts.map +1 -1
- package/dist/util/clientGenerators.js +1 -1
- package/dist/util/payments/paymentsConfig.d.ts.map +1 -1
- package/dist/util/payments/paymentsConfig.js +3 -1
- package/dist/util/project.d.ts.map +1 -1
- package/dist/util/project.js +2 -1
- package/dist/util/template-resolvers/ProjectTemplateResolver.d.ts.map +1 -1
- package/dist/util/template-resolvers/ProjectTemplateResolver.js +4 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAgBlE,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,aAAa;;IAC7C,OAAgB,WAAW,SAA0B;IAErD,OAAgB,QAAQ,WAA6C;IAErE,OAAgB,IAAI;;MAMT;IAgBI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAuSpC"}
|
package/dist/commands/init.js
CHANGED
|
@@ -17,8 +17,8 @@ import { createRequire } from 'node:module';
|
|
|
17
17
|
import path from 'node:path';
|
|
18
18
|
import querystring from 'node:querystring';
|
|
19
19
|
import util from 'node:util';
|
|
20
|
+
import { InitAppResponse } from '@devvit/protos/types/devvit/cli/init.js';
|
|
20
21
|
import { isDevvitDependency } from '@devvit/shared-types/isDevvitDependency.js';
|
|
21
|
-
import { isObject } from '@devvit/shared-types/isObject.js';
|
|
22
22
|
import { Args } from '@oclif/core';
|
|
23
23
|
import chalk from 'chalk';
|
|
24
24
|
import inquirer from 'inquirer';
|
|
@@ -141,30 +141,18 @@ _Init_initAppParams = new WeakMap(), _Init_instances = new WeakSet(), _Init_proj
|
|
|
141
141
|
// Else, we're using the app slug as the dir name
|
|
142
142
|
return path.join(process.cwd(), __classPrivateFieldGet(this, _Init_initAppParams, "f").appName);
|
|
143
143
|
}, _Init_unpackCode = function _Init_unpackCode(base64code) {
|
|
144
|
-
let token;
|
|
145
144
|
try {
|
|
146
|
-
|
|
145
|
+
const bytes = Buffer.from(base64code, 'base64');
|
|
146
|
+
const message = InitAppResponse.decode(bytes);
|
|
147
|
+
// Basic validation
|
|
148
|
+
if (!message.appName) {
|
|
149
|
+
return undefined;
|
|
150
|
+
}
|
|
151
|
+
return message;
|
|
147
152
|
}
|
|
148
153
|
catch {
|
|
149
154
|
return undefined;
|
|
150
155
|
}
|
|
151
|
-
if (!isObject(token)) {
|
|
152
|
-
return undefined;
|
|
153
|
-
}
|
|
154
|
-
if (!token.authCode || typeof token.authCode !== 'string') {
|
|
155
|
-
return undefined;
|
|
156
|
-
}
|
|
157
|
-
if (typeof token.appName !== 'string') {
|
|
158
|
-
return undefined;
|
|
159
|
-
}
|
|
160
|
-
if (typeof token.templateName !== 'string' && token.templateName !== undefined) {
|
|
161
|
-
return undefined;
|
|
162
|
-
}
|
|
163
|
-
return {
|
|
164
|
-
authCode: token.authCode,
|
|
165
|
-
appName: token.appName,
|
|
166
|
-
templateName: token.templateName,
|
|
167
|
-
};
|
|
168
156
|
}, _Init_getCodeThroughCopyPaste = async function _Init_getCodeThroughCopyPaste() {
|
|
169
157
|
const queryParams = {
|
|
170
158
|
source: getPlatformFromEnvironment(),
|
|
@@ -217,7 +205,7 @@ _Init_initAppParams = new WeakMap(), _Init_instances = new WeakSet(), _Init_proj
|
|
|
217
205
|
}
|
|
218
206
|
return localCodeServer({
|
|
219
207
|
serverListeningCallback: ({ port, state }) => {
|
|
220
|
-
const redirectUrl = new URL(`
|
|
208
|
+
const redirectUrl = new URL(`http://localhost:${port}`);
|
|
221
209
|
redirectUrl.searchParams.set(`state`, state);
|
|
222
210
|
queryParams.redirect_url = redirectUrl.toString();
|
|
223
211
|
const creationWizardUrl = `${DEVVIT_PORTAL_URL}/new?${querystring.stringify(queryParams)}`;
|
|
@@ -21,6 +21,7 @@ export declare class AssetUploader {
|
|
|
21
21
|
* the asset map.
|
|
22
22
|
*/
|
|
23
23
|
syncAssets(): Promise<SyncAssetsResult>;
|
|
24
|
+
assertAssetCanBeAnIcon(data: Buffer): Promise<void>;
|
|
24
25
|
}
|
|
25
26
|
export declare function transformHTMLBuffer(buf: Buffer, clientVersionNum: string | undefined): Buffer;
|
|
26
27
|
export declare function transformHTML(str: string, clientVersionNum: string | undefined): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetUploader.d.ts","sourceRoot":"","sources":["../../src/util/AssetUploader.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,QAAQ,EAKd,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"AssetUploader.d.ts","sourceRoot":"","sources":["../../src/util/AssetUploader.ts"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,QAAQ,EAKd,MAAM,gCAAgC,CAAC;AAWxC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGjE,eAAO,MAAM,aAAa,wDAAwD,CAAC;AACnF,eAAO,MAAM,cAAc,eAAe,CAAC;AAM3C,KAAK,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qBAAa,aAAa;;gBAQZ,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE;IAMlF;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAkFvC,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAmP1D;AA8DD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAI7F;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAuBvF"}
|
|
@@ -18,6 +18,8 @@ import { ASSET_HASHING_ALGO, ASSET_UPLOAD_BATCH_SIZE } from '@devvit/shared-type
|
|
|
18
18
|
import { clientVersionQueryParam } from '@devvit/shared-types/web-view-scripts-constants.js';
|
|
19
19
|
import { ux } from '@oclif/core';
|
|
20
20
|
import { createHash } from 'crypto';
|
|
21
|
+
import { fileTypeFromBuffer } from 'file-type';
|
|
22
|
+
import { imageSize } from 'image-size';
|
|
21
23
|
import { JSDOM } from 'jsdom';
|
|
22
24
|
import { default as tinyglob } from 'tiny-glob';
|
|
23
25
|
import { createAppClient } from './clientGenerators.js';
|
|
@@ -66,6 +68,7 @@ export class AssetUploader {
|
|
|
66
68
|
const iconAssetContents = await fsp.readFile(iconAssetFullPath);
|
|
67
69
|
const iconAssetSize = Buffer.byteLength(iconAssetContents);
|
|
68
70
|
const iconAssetHash = createHash(ASSET_HASHING_ALGO).update(iconAssetContents).digest('hex');
|
|
71
|
+
this.assertAssetCanBeAnIcon(iconAssetContents);
|
|
69
72
|
iconAssetDetails = {
|
|
70
73
|
filePath: ICON_FILE_PATH, // Use a placeholder path for the icon asset
|
|
71
74
|
size: iconAssetSize,
|
|
@@ -96,6 +99,47 @@ export class AssetUploader {
|
|
|
96
99
|
}
|
|
97
100
|
return retval;
|
|
98
101
|
}
|
|
102
|
+
async assertAssetCanBeAnIcon(data) {
|
|
103
|
+
// Verify the icon. It *must*:
|
|
104
|
+
// - NOT be a GIF
|
|
105
|
+
// - be square in shape
|
|
106
|
+
// - be at least 256x256 pixels
|
|
107
|
+
// - be at most 1024x1024 pixels
|
|
108
|
+
// If it doesn't meet these requirements, we throw an error.
|
|
109
|
+
// Also, we should warn the user in any of these cases:
|
|
110
|
+
// - if the icon isn't a PNG
|
|
111
|
+
// - if the icon is smaller than 1024x1024 pixels
|
|
112
|
+
const fileTypeResult = await fileTypeFromBuffer(data);
|
|
113
|
+
if (!fileTypeResult) {
|
|
114
|
+
__classPrivateFieldGet(this, _AssetUploader_cmd, "f").error(`Icon asset is not a valid image.`);
|
|
115
|
+
}
|
|
116
|
+
if (fileTypeResult.mime === 'image/gif') {
|
|
117
|
+
__classPrivateFieldGet(this, _AssetUploader_cmd, "f").error(`Icon asset cannot be a GIF.`);
|
|
118
|
+
}
|
|
119
|
+
const sizeResult = imageSize(data);
|
|
120
|
+
if (!sizeResult) {
|
|
121
|
+
__classPrivateFieldGet(this, _AssetUploader_cmd, "f").error(`Icon asset is not a valid image.`);
|
|
122
|
+
}
|
|
123
|
+
if (sizeResult.width !== sizeResult.height) {
|
|
124
|
+
__classPrivateFieldGet(this, _AssetUploader_cmd, "f").error(`Icon asset must be square, but it is ${sizeResult.width}x${sizeResult.height}.`);
|
|
125
|
+
}
|
|
126
|
+
if (sizeResult.width < 256) {
|
|
127
|
+
__classPrivateFieldGet(this, _AssetUploader_cmd, "f").error(`Icon asset must be at least 256x256 pixels, but it is ${sizeResult.width}x${sizeResult.height}.`);
|
|
128
|
+
}
|
|
129
|
+
if (sizeResult.width > 1024) {
|
|
130
|
+
__classPrivateFieldGet(this, _AssetUploader_cmd, "f").error(`Icon asset can be at most 1024x1024 pixels, but it is ${sizeResult.width}x${sizeResult.height}.`);
|
|
131
|
+
}
|
|
132
|
+
// It's acceptable, but check if there's any warnings we should give the user
|
|
133
|
+
if (fileTypeResult.mime !== 'image/png') {
|
|
134
|
+
__classPrivateFieldGet(this, _AssetUploader_cmd, "f").warn(`Icon asset is not a PNG, but it will still be uploaded.`);
|
|
135
|
+
}
|
|
136
|
+
if (sizeResult.width < 1024) {
|
|
137
|
+
__classPrivateFieldGet(this, _AssetUploader_cmd, "f").warn(`Icon asset is smaller than 1024x1024 pixels. Consider using a larger icon for better quality.`);
|
|
138
|
+
}
|
|
139
|
+
if (![1024, 512, 256].includes(sizeResult.width)) {
|
|
140
|
+
__classPrivateFieldGet(this, _AssetUploader_cmd, "f").warn(`Icon asset is ${sizeResult.width}x${sizeResult.height}. Consider using a standard size (preferably 1024x1024) for better compatibility.`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
99
143
|
}
|
|
100
144
|
_AssetUploader_cmd = new WeakMap(), _AssetUploader_verbose = new WeakMap(), _AssetUploader_appClient = new WeakMap(), _AssetUploader_appSlug = new WeakMap(), _AssetUploader_instances = new WeakSet(), _AssetUploader_processRegularAssets = async function _AssetUploader_processRegularAssets(assets) {
|
|
101
145
|
// early out to avoid logging if empty
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
1
3
|
import { clientVersionQueryParam } from '@devvit/shared-types/web-view-scripts-constants.js';
|
|
2
4
|
import { JSDOM } from 'jsdom';
|
|
3
5
|
import { describe, expect, it } from 'vitest';
|
|
4
|
-
import { DEVVIT_JS_URL, transformHTML } from './AssetUploader.js';
|
|
6
|
+
import { AssetUploader, DEVVIT_JS_URL, transformHTML } from './AssetUploader.js';
|
|
5
7
|
describe('HTML Transformation', () => {
|
|
6
8
|
describe('transformHTML', () => {
|
|
7
9
|
it('should add script tag to head when head exists', () => {
|
|
@@ -101,6 +103,37 @@ describe('HTML Transformation', () => {
|
|
|
101
103
|
});
|
|
102
104
|
});
|
|
103
105
|
});
|
|
106
|
+
describe('assertAssetCanBeAnIcon', () => {
|
|
107
|
+
const TEST_IMAGE_FILES = [
|
|
108
|
+
'1024x1024.gif',
|
|
109
|
+
'1024x1024.jpg',
|
|
110
|
+
'1024x1024.png',
|
|
111
|
+
'256x256.png',
|
|
112
|
+
'256x512.png',
|
|
113
|
+
'420x420.png',
|
|
114
|
+
'512x512.png',
|
|
115
|
+
'notAnImage.txt',
|
|
116
|
+
];
|
|
117
|
+
for (const fileName of TEST_IMAGE_FILES) {
|
|
118
|
+
it(`should match the snapshot for image file: ${fileName}`, async () => {
|
|
119
|
+
const cmd = {
|
|
120
|
+
error: vi.fn(() => {
|
|
121
|
+
throw new Error('Mocked error');
|
|
122
|
+
}),
|
|
123
|
+
warn: vi.fn(),
|
|
124
|
+
};
|
|
125
|
+
const assetUploader = new AssetUploader(cmd, 'some-slug', {
|
|
126
|
+
verbose: false,
|
|
127
|
+
});
|
|
128
|
+
const filePath = `../../testing-images/${fileName}`;
|
|
129
|
+
const fileContent = fs.readFileSync(path.join(__dirname, filePath));
|
|
130
|
+
// Don't care if this resolves or rejects, just want to test the error handling
|
|
131
|
+
await Promise.allSettled([assetUploader.assertAssetCanBeAnIcon(fileContent)]);
|
|
132
|
+
expect(cmd.error.mock.calls).toMatchSnapshot(`${fileName}-err`);
|
|
133
|
+
expect(cmd.warn.mock.calls).toMatchSnapshot(`${fileName}-warn`);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
});
|
|
104
137
|
function selectScript(document) {
|
|
105
138
|
return document.querySelector(`head script[src="${DEVVIT_JS_URL}?${clientVersionQueryParam}=1.2.3"]`);
|
|
106
139
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cutter.d.ts","sourceRoot":"","sources":["../../src/util/Cutter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Cutter.d.ts","sourceRoot":"","sources":["../../src/util/Cutter.ts"],"names":[],"mappings":"AAyBA,oDAAoD;AACpD,MAAM,CAAC,OAAO,OAAO,MAAM;;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,SAAS,EAAE,MAAM;IAIvB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAmFnE"}
|
package/dist/util/Cutter.js
CHANGED
|
@@ -19,8 +19,10 @@ const RAW_FILE_MIME_TYPES = [
|
|
|
19
19
|
'font/',
|
|
20
20
|
'model/',
|
|
21
21
|
];
|
|
22
|
+
// Use custom Mustache delimiters that won't conflict with JSX/TSX curly braces.
|
|
23
|
+
const MUSTACHE_TAGS = ['<%', '%>'];
|
|
22
24
|
function m(template, mustacheContext) {
|
|
23
|
-
return Mustache.render(template, mustacheContext);
|
|
25
|
+
return Mustache.render(template, mustacheContext, undefined, { tags: MUSTACHE_TAGS });
|
|
24
26
|
}
|
|
25
27
|
/** Render a template directly to the filesystem. */
|
|
26
28
|
class Cutter {
|
|
@@ -46,15 +48,15 @@ _Cutter_instances = new WeakSet(), _Cutter_fetchAndExtract = async function _Cut
|
|
|
46
48
|
const buffer = await response.arrayBuffer();
|
|
47
49
|
// Extract the buffer to the temporary directory using jszip
|
|
48
50
|
const zip = await JSZip.loadAsync(buffer);
|
|
49
|
-
await Promise.all(Object.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
await Promise.all(Object.values(zip.files).map(async (file) => {
|
|
52
|
+
const filePath = path.join(tmpdir, file.name);
|
|
53
|
+
// Make sure the directory exists (whether this entry is a file or dir)
|
|
54
|
+
// Some zip archives (e.g., those generated by GitHub) may omit explicit directory
|
|
55
|
+
// entries for nested paths, so we need to create them ourselves.
|
|
56
|
+
const dirToCreate = file.dir ? filePath : path.dirname(filePath);
|
|
57
|
+
await fsp.mkdir(dirToCreate, { recursive: true });
|
|
58
|
+
// If it’s a file, write its content
|
|
59
|
+
if (!file.dir) {
|
|
58
60
|
const content = await file.async('nodebuffer');
|
|
59
61
|
await fsp.writeFile(filePath, content);
|
|
60
62
|
}
|
package/dist/util/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/util/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/util/auth.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,0BAA0B,EAC1B,KAAK,gCAAgC,EACtC,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAqB9D,eAAO,MAAM,WAAW,GAAI,OAAO,WAAW,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAKrE,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,gCAAgC,CAAC,MAAM,CAWhE,CAAC;AAIF,wBAAgB,WAAW,IAAI,0BAA0B,CAQxD;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAmBvE;AAED,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,WAAW,GAAG,aAAa,GAClC,OAAO,CAAC,WAAW,CAAC,CAKtB"}
|
package/dist/util/auth.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { REDDIT_OAUTH_COPY_PASTE_CLIENT_ID } from '@devvit/shared-types/constants.js';
|
|
1
2
|
import { HEADER_USER_AGENT } from '../constants/Headers.js';
|
|
2
3
|
import { NodeFSAuthenticationPlugin, } from '../lib/auth/NodeFSAuthenticationPlugin.js';
|
|
3
4
|
import { DOT_DEVVIT_DIR_FILENAME, REDDIT_DOT_COM } from '../lib/config.js';
|
|
@@ -6,7 +7,6 @@ const PORT = 65010; // Has to match exactly to our oauth app settings
|
|
|
6
7
|
const CLIENT_ID = 'Bep8X2RRjuoyuxkKsKxFuQ';
|
|
7
8
|
const TOKEN_DURATION = 'permanent';
|
|
8
9
|
const API_V1_URL = `${REDDIT_DOT_COM}/api/v1`;
|
|
9
|
-
const COPY_PASTE_CLIENT_ID = 'TWTsqXa53CexlrYGBWaesQ';
|
|
10
10
|
const COPY_PASTE_REDIRECT_URI = `${DEVVIT_PORTAL_URL}/cli-login`;
|
|
11
11
|
const DEVVIT_OAUTH_CLIENT_HEADERS = {
|
|
12
12
|
'User-Agent': 'devvit-cli',
|
|
@@ -14,7 +14,7 @@ const DEVVIT_OAUTH_CLIENT_HEADERS = {
|
|
|
14
14
|
};
|
|
15
15
|
const COPY_PASTE_OAUTH_CLIENT_HEADERS = {
|
|
16
16
|
'User-Agent': 'devvit-cli',
|
|
17
|
-
Authorization: `Basic ${Buffer.from(`${
|
|
17
|
+
Authorization: `Basic ${Buffer.from(`${REDDIT_OAUTH_COPY_PASTE_CLIENT_ID}:`).toString('base64')}`,
|
|
18
18
|
};
|
|
19
19
|
const getRedirectURI = (port) => `http://localhost:${port}/authorize_callback`;
|
|
20
20
|
export const authHeaders = (token) => {
|
|
@@ -30,7 +30,7 @@ export const AUTH_CONFIG = {
|
|
|
30
30
|
clientId: CLIENT_ID,
|
|
31
31
|
devvitOAuthClientHeaders: DEVVIT_OAUTH_CLIENT_HEADERS,
|
|
32
32
|
copyPasteRedirectUri: COPY_PASTE_REDIRECT_URI,
|
|
33
|
-
copyPasteClientId:
|
|
33
|
+
copyPasteClientId: REDDIT_OAUTH_COPY_PASTE_CLIENT_ID,
|
|
34
34
|
copyPasteClientHeaders: COPY_PASTE_OAUTH_CLIENT_HEADERS,
|
|
35
35
|
scopes: '*',
|
|
36
36
|
tokenDuration: TOKEN_DURATION,
|
|
@@ -12,4 +12,5 @@ export declare function createDeveloperAccountClient(): DeveloperAccountClient;
|
|
|
12
12
|
export declare function createEventsClient(): EventsClient;
|
|
13
13
|
export declare function createAppPublishRequestClient(): DevPortalAppPublishRequestClient;
|
|
14
14
|
export declare function createDeveloperSettingsClient(): DevPortalDeveloperSettingsClient;
|
|
15
|
+
export declare function getHeaders(): Headers;
|
|
15
16
|
//# sourceMappingURL=clientGenerators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientGenerators.d.ts","sourceRoot":"","sources":["../../src/util/clientGenerators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,cAAc,EACf,MAAM,6BAA6B,CAAC;AAYrC,OAAO,KAAK,EACV,gCAAgC,EAChC,gCAAgC,EACjC,MAAM,mEAAmE,CAAC;AAE3E,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,4DAA4D,CAAC;AAsDpE,wBAAgB,eAAe,IAAI,SAAS,CAW3C;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAWzD;AAED,wBAAgB,uBAAuB,IAAI,0BAA0B,CAUpE;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CAU/D;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAUrD;AAED,wBAAgB,wBAAwB,IAAI,iBAAiB,CAQ5D;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAUrD;AACD,wBAAgB,4BAA4B,IAAI,sBAAsB,CAUrE;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAWjD;AAED,wBAAgB,6BAA6B,IAAI,gCAAgC,CAUhF;AAED,wBAAgB,6BAA6B,IAAI,gCAAgC,CAUhF"}
|
|
1
|
+
{"version":3,"file":"clientGenerators.d.ts","sourceRoot":"","sources":["../../src/util/clientGenerators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,cAAc,EACf,MAAM,6BAA6B,CAAC;AAYrC,OAAO,KAAK,EACV,gCAAgC,EAChC,gCAAgC,EACjC,MAAM,mEAAmE,CAAC;AAE3E,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,4DAA4D,CAAC;AAsDpE,wBAAgB,eAAe,IAAI,SAAS,CAW3C;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAWzD;AAED,wBAAgB,uBAAuB,IAAI,0BAA0B,CAUpE;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CAU/D;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAUrD;AAED,wBAAgB,wBAAwB,IAAI,iBAAiB,CAQ5D;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAUrD;AACD,wBAAgB,4BAA4B,IAAI,sBAAsB,CAUrE;AAED,wBAAgB,kBAAkB,IAAI,YAAY,CAWjD;AAED,wBAAgB,6BAA6B,IAAI,gCAAgC,CAUhF;AAED,wBAAgB,6BAA6B,IAAI,gCAAgC,CAUhF;AAED,wBAAgB,UAAU,IAAI,OAAO,CAWpC"}
|
|
@@ -125,7 +125,7 @@ export function createDeveloperSettingsClient() {
|
|
|
125
125
|
headers: getHeaders(),
|
|
126
126
|
})));
|
|
127
127
|
}
|
|
128
|
-
function getHeaders() {
|
|
128
|
+
export function getHeaders() {
|
|
129
129
|
const headers = new Headers();
|
|
130
130
|
headers.set(...HEADER_USER_AGENT());
|
|
131
131
|
headers.set(...HEADER_DEVVIT_CLI());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paymentsConfig.d.ts","sourceRoot":"","sources":["../../../src/util/payments/paymentsConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paymentsConfig.d.ts","sourceRoot":"","sources":["../../../src/util/payments/paymentsConfig.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,MAAM,EACN,cAAc,EACf,MAAM,kEAAkE,CAAC;AAE1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0CAA0C,CAAC;AAUxE,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;AAEzF;;;GAGG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,CAU1F;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EACxB,QAAQ,EAAE,WAAW,EAAE,EACvB,sBAAsB,GAAE,OAAc,GACrC,cAAc,CAGhB;AAmGD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,WAAW,EAAE,CAAC,GAAG,cAAc,CAkBpF;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CA0B3D"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
1
2
|
import { access, readFile } from 'node:fs/promises';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { Currency, Environment, PaymentProcessorDefinition, PaymentsServiceDefinition, } from '@devvit/protos/payments.js';
|
|
@@ -116,9 +117,10 @@ export function makePaymentsConfig(products) {
|
|
|
116
117
|
return { products: formattedProducts };
|
|
117
118
|
}
|
|
118
119
|
export function validateProductIcon(assetPath) {
|
|
120
|
+
const file = fs.readFileSync(assetPath);
|
|
119
121
|
let size;
|
|
120
122
|
try {
|
|
121
|
-
size = imageSize(
|
|
123
|
+
size = imageSize(file);
|
|
122
124
|
}
|
|
123
125
|
catch {
|
|
124
126
|
throw new Error(`Product icon ${assetPath} is not a valid image`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/util/project.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/util/project.ts"],"names":[],"mappings":"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"}
|
package/dist/util/project.js
CHANGED
|
@@ -18,7 +18,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
18
18
|
};
|
|
19
19
|
var _Project_config, _Project_packageConfig;
|
|
20
20
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
21
|
-
import { apiPathPrefix
|
|
21
|
+
import { apiPathPrefix } from '@devvit/shared-types/constants.js';
|
|
22
|
+
import { parseAppConfig, } from '@devvit/shared-types/schemas/config-file.v1.js';
|
|
22
23
|
import path from 'path';
|
|
23
24
|
import { DEVVIT_SUBREDDIT } from '../constants/Environment.js';
|
|
24
25
|
import { findUpDirContaining, isFile } from './file-util.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectTemplateResolver.d.ts","sourceRoot":"","sources":["../../../src/util/template-resolvers/ProjectTemplateResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"ProjectTemplateResolver.d.ts","sourceRoot":"","sources":["../../../src/util/template-resolvers/ProjectTemplateResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAKvF,qBAAa,uBAAuB;;IAGlC,IAAI,OAAO,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAG5C;IAEK,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAwBnD,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAOrE"}
|
|
@@ -10,6 +10,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _ProjectTemplateResolver_instances, _ProjectTemplateResolver_options, _ProjectTemplateResolver_fetchOptions;
|
|
13
|
+
import { getHeaders } from '../clientGenerators.js';
|
|
13
14
|
import { DEVVIT_PORTAL_URL } from '../config.js';
|
|
14
15
|
export class ProjectTemplateResolver {
|
|
15
16
|
constructor() {
|
|
@@ -36,7 +37,9 @@ export class ProjectTemplateResolver {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
_ProjectTemplateResolver_options = new WeakMap(), _ProjectTemplateResolver_instances = new WeakSet(), _ProjectTemplateResolver_fetchOptions = async function _ProjectTemplateResolver_fetchOptions() {
|
|
39
|
-
const response = await fetch(DEVVIT_PORTAL_URL + '/templates.json'
|
|
40
|
+
const response = await fetch(DEVVIT_PORTAL_URL + '/templates.json', {
|
|
41
|
+
headers: getHeaders(),
|
|
42
|
+
});
|
|
40
43
|
if (!response.ok) {
|
|
41
44
|
throw new Error(`Failed to fetch templates: ${response.statusText}`);
|
|
42
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/cli",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.20-next-2025-07-23-18-02-25-3ea0d7aed.0",
|
|
4
4
|
"description": "Reddit's Dev Platform CLI Tool",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"author": "@reddit/dev-platform",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
},
|
|
42
42
|
"types": "dist/index.d.ts",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@devvit/build-pack": "0.11.
|
|
44
|
+
"@devvit/build-pack": "0.11.20-next-2025-07-23-18-02-25-3ea0d7aed.0",
|
|
45
45
|
"@devvit/play": "0.0.45",
|
|
46
|
-
"@devvit/protos": "0.11.
|
|
47
|
-
"@devvit/public-api": "0.11.
|
|
48
|
-
"@devvit/shared-types": "0.11.
|
|
46
|
+
"@devvit/protos": "0.11.20-next-2025-07-23-18-02-25-3ea0d7aed.0",
|
|
47
|
+
"@devvit/public-api": "0.11.20-next-2025-07-23-18-02-25-3ea0d7aed.0",
|
|
48
|
+
"@devvit/shared-types": "0.11.20-next-2025-07-23-18-02-25-3ea0d7aed.0",
|
|
49
49
|
"@improbable-eng/grpc-web": "0.15.0",
|
|
50
50
|
"@improbable-eng/grpc-web-node-http-transport": "0.15.0",
|
|
51
51
|
"@oclif/core": "2.9.4",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"date-fns": "2.29.3",
|
|
60
60
|
"dotenv": "16.5.0",
|
|
61
61
|
"file-type": "18.2.1",
|
|
62
|
-
"image-size": "
|
|
62
|
+
"image-size": "2.0.2",
|
|
63
63
|
"inquirer": "9.1.4",
|
|
64
64
|
"isomorphic-git": "1.21.0",
|
|
65
65
|
"js-yaml": "4.1.0",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"ws": "8.18.0"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@devvit/repo-tools": "0.11.
|
|
79
|
-
"@devvit/tsconfig": "0.11.
|
|
78
|
+
"@devvit/repo-tools": "0.11.20-next-2025-07-23-18-02-25-3ea0d7aed.0",
|
|
79
|
+
"@devvit/tsconfig": "0.11.20-next-2025-07-23-18-02-25-3ea0d7aed.0",
|
|
80
80
|
"@types/file-type": "10.9.1",
|
|
81
81
|
"@types/inquirer": "9.0.3",
|
|
82
82
|
"@types/js-yaml": "4.0.5",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
]
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "82d093770e770fa352a8f0c373aca9e9ce01de94"
|
|
117
117
|
}
|