@devvit/cli 0.11.18-next-2025-06-30-16-07-46-77bec1ee2.0 → 0.11.18
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.
|
@@ -8,9 +8,6 @@ export type PackageJSON = {
|
|
|
8
8
|
version?: string;
|
|
9
9
|
dependencies?: DependencyMap;
|
|
10
10
|
devDependencies?: DependencyMap;
|
|
11
|
-
scripts?: {
|
|
12
|
-
[name: string]: string;
|
|
13
|
-
};
|
|
14
11
|
devvit?: DevvitPackageConfig;
|
|
15
12
|
};
|
|
16
13
|
/** Configuration provided in the `devvit` property of a project's package.json */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-util.d.ts","sourceRoot":"","sources":["../../../src/util/package-managers/package-util.ts"],"names":[],"mappings":"AAGA,KAAK,aAAa,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEhD,6BAA6B;AAC7B,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,
|
|
1
|
+
{"version":3,"file":"package-util.d.ts","sourceRoot":"","sources":["../../../src/util/package-managers/package-util.ts"],"names":[],"mappings":"AAGA,KAAK,aAAa,GAAG;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAEhD,6BAA6B;AAC7B,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,eAAe,CAAC,EAAE,aAAa,CAAC;IA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E,SAAS,GACd,MAAM,EAAE,CA+BV"}
|
package/dist/util/project.js
CHANGED
|
@@ -35,6 +35,11 @@ export class Project {
|
|
|
35
35
|
*/
|
|
36
36
|
static async new(root, filename, mode) {
|
|
37
37
|
const config = await readConfig(root, filename);
|
|
38
|
+
if (isAppConfig(config)) {
|
|
39
|
+
const errs = validateConfig(config, existsSync, mode);
|
|
40
|
+
if (errs.length)
|
|
41
|
+
throw Error(errs.join('; '));
|
|
42
|
+
}
|
|
38
43
|
let packageJSON;
|
|
39
44
|
try {
|
|
40
45
|
packageJSON = await readPackageJSON(root);
|
|
@@ -42,19 +47,6 @@ export class Project {
|
|
|
42
47
|
catch {
|
|
43
48
|
// Failure is fine, it just means we don't have a config file (yet)
|
|
44
49
|
}
|
|
45
|
-
if (isAppConfig(config)) {
|
|
46
|
-
const missingFiles = validateConfig(config, existsSync, mode);
|
|
47
|
-
// check if package.json has a build command
|
|
48
|
-
if (missingFiles.length) {
|
|
49
|
-
const containsBuildScript = Object.keys(packageJSON?.scripts ?? {}).some((script) => script.includes('build'));
|
|
50
|
-
let error = "Your devvit.json references files that don't exist: ";
|
|
51
|
-
error += missingFiles.join(', ');
|
|
52
|
-
if (containsBuildScript) {
|
|
53
|
-
error += `. You may need to run your build script to fix this.`;
|
|
54
|
-
}
|
|
55
|
-
throw Error(error);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
50
|
return new Project(root, filename, config, packageJSON?.devvit);
|
|
59
51
|
}
|
|
60
52
|
constructor(root, filename, config, packageConfig) {
|
|
@@ -178,29 +170,29 @@ async function readConfig(root, filename) {
|
|
|
178
170
|
}
|
|
179
171
|
/** @internal; */
|
|
180
172
|
export function validateConfig(config, fileExists, mode) {
|
|
181
|
-
const
|
|
173
|
+
const errs = [];
|
|
182
174
|
if (config.blocks && !fileExists(config.blocks.entry))
|
|
183
|
-
|
|
175
|
+
errs.push(`\`config.blocks.entry\` (${config.blocks.entry}) does not exist`);
|
|
184
176
|
if (config.media && !fileExists(config.media.dir))
|
|
185
|
-
|
|
177
|
+
errs.push(`\`config.media.dir\` (${config.media.dir}) does not exist`);
|
|
186
178
|
if (config.post) {
|
|
187
179
|
if (!fileExists(config.post.client.dir) && mode === 'Static')
|
|
188
|
-
|
|
180
|
+
errs.push(`\`config.post.client.dir\` (${config.post.client.dir}) does not exist`);
|
|
189
181
|
if (config.post.client.entry.startsWith(apiPathPrefix) || mode === 'Dynamic') {
|
|
190
182
|
// URL path or user is rebuilding regularly during playtest.
|
|
191
183
|
}
|
|
192
184
|
else if (!fileExists(config.post.client.entry))
|
|
193
|
-
|
|
185
|
+
errs.push(`\`config.post.client.entry\` (${config.post.client.entry}) does not exist`);
|
|
194
186
|
else {
|
|
195
187
|
const dir = path.resolve(config.post.client.dir);
|
|
196
188
|
const entry = path.resolve(config.post.client.entry);
|
|
197
189
|
if (!entry.startsWith(dir))
|
|
198
|
-
|
|
190
|
+
errs.push(`\`config.post.client.entry\` (${config.post.client.entry}) must exist within \`config.post.client.dir\` (${config.post.client.dir})`);
|
|
199
191
|
}
|
|
200
192
|
}
|
|
201
193
|
if (config.server && !fileExists(config.server.entry) && mode === 'Static')
|
|
202
|
-
|
|
203
|
-
return
|
|
194
|
+
errs.push(`\`config.server.entry\` (${config.server.entry}) does not exist`);
|
|
195
|
+
return errs;
|
|
204
196
|
}
|
|
205
197
|
function writeConfig(projectPath, configFile, config) {
|
|
206
198
|
writeFileSync(path.join(projectPath, configFile), isAppConfig(config) ? JSON.stringify(config.json, undefined, 2) : dumpJsonToYaml(config));
|
|
@@ -4,13 +4,10 @@ import { isAppConfig, parseClassicConfig, Project, validateConfig, } from './pro
|
|
|
4
4
|
const noPermissions = {
|
|
5
5
|
http: { enable: false, allowedDomains: [] },
|
|
6
6
|
media: false,
|
|
7
|
-
menu: false,
|
|
8
7
|
payments: false,
|
|
9
8
|
realtime: false,
|
|
10
9
|
redis: false,
|
|
11
10
|
reddit: { enable: false, scope: 'user', asUser: [] },
|
|
12
|
-
settings: false,
|
|
13
|
-
triggers: false,
|
|
14
11
|
};
|
|
15
12
|
describe('Project', () => {
|
|
16
13
|
beforeEach(() => {
|
|
@@ -70,13 +67,13 @@ describe('validateConfig()', () => {
|
|
|
70
67
|
for (const exists of [false, true])
|
|
71
68
|
for (const mode of ['Static', 'Dynamic']) {
|
|
72
69
|
const config = {
|
|
73
|
-
blocks: { entry: 'entry' },
|
|
70
|
+
blocks: { entry: 'entry', menu: { enable: true } },
|
|
74
71
|
schema: 'v1',
|
|
75
72
|
name: 'name',
|
|
76
73
|
permissions: noPermissions,
|
|
77
74
|
json: { name: 'name' },
|
|
78
75
|
};
|
|
79
|
-
expect(validateConfig(config, () => exists, mode)).toStrictEqual(exists ? [] : ['`config.blocks.entry` (entry)']);
|
|
76
|
+
expect(validateConfig(config, () => exists, mode)).toStrictEqual(exists ? [] : ['`config.blocks.entry` (entry) does not exist']);
|
|
80
77
|
}
|
|
81
78
|
});
|
|
82
79
|
test('post.client.dir', () => {
|
|
@@ -97,7 +94,7 @@ describe('validateConfig()', () => {
|
|
|
97
94
|
},
|
|
98
95
|
json: { name: 'name' },
|
|
99
96
|
};
|
|
100
|
-
expect(validateConfig(config, (filename) => (filename === 'dir' ? exists : true), mode)).toStrictEqual(exists || mode === 'Dynamic' ? [] : ['`config.post.client.dir` (dir)']);
|
|
97
|
+
expect(validateConfig(config, (filename) => (filename === 'dir' ? exists : true), mode)).toStrictEqual(exists || mode === 'Dynamic' ? [] : ['`config.post.client.dir` (dir) does not exist']);
|
|
101
98
|
}
|
|
102
99
|
});
|
|
103
100
|
test('post.client.entry file', () => {
|
|
@@ -118,7 +115,9 @@ describe('validateConfig()', () => {
|
|
|
118
115
|
},
|
|
119
116
|
json: { name: 'name' },
|
|
120
117
|
};
|
|
121
|
-
expect(validateConfig(config, (filename) => (filename === 'dir/entry' ? exists : true), mode)).toStrictEqual(exists || mode === 'Dynamic'
|
|
118
|
+
expect(validateConfig(config, (filename) => (filename === 'dir/entry' ? exists : true), mode)).toStrictEqual(exists || mode === 'Dynamic'
|
|
119
|
+
? []
|
|
120
|
+
: ['`config.post.client.entry` (dir/entry) does not exist']);
|
|
122
121
|
}
|
|
123
122
|
});
|
|
124
123
|
test('post.client.entry API', () => {
|
|
@@ -149,7 +148,7 @@ describe('validateConfig()', () => {
|
|
|
149
148
|
server: { entry: 'entry' },
|
|
150
149
|
json: { name: 'name' },
|
|
151
150
|
};
|
|
152
|
-
expect(validateConfig(config, () => exists, mode)).toStrictEqual(exists || mode === 'Dynamic' ? [] : ['`config.server.entry` (entry)']);
|
|
151
|
+
expect(validateConfig(config, () => exists, mode)).toStrictEqual(exists || mode === 'Dynamic' ? [] : ['`config.server.entry` (entry) does not exist']);
|
|
153
152
|
}
|
|
154
153
|
});
|
|
155
154
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devvit/cli",
|
|
3
|
-
"version": "0.11.18
|
|
3
|
+
"version": "0.11.18",
|
|
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.18
|
|
45
|
+
"@devvit/build-pack": "0.11.18",
|
|
46
46
|
"@devvit/play": "0.0.45",
|
|
47
|
-
"@devvit/protos": "0.11.18
|
|
48
|
-
"@devvit/public-api": "0.11.18
|
|
49
|
-
"@devvit/shared-types": "0.11.18
|
|
47
|
+
"@devvit/protos": "0.11.18",
|
|
48
|
+
"@devvit/public-api": "0.11.18",
|
|
49
|
+
"@devvit/shared-types": "0.11.18",
|
|
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",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"ws": "8.18.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@devvit/repo-tools": "0.11.18
|
|
80
|
-
"@devvit/tsconfig": "0.11.18
|
|
79
|
+
"@devvit/repo-tools": "0.11.18",
|
|
80
|
+
"@devvit/tsconfig": "0.11.18",
|
|
81
81
|
"@types/file-type": "10.9.1",
|
|
82
82
|
"@types/inquirer": "9.0.3",
|
|
83
83
|
"@types/js-yaml": "4.0.5",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
]
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "528a395e1d56da073194f98bd6eec9f073b4ae3a"
|
|
118
118
|
}
|