@appsemble/node-utils 0.27.0 → 0.27.2
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/README.md +3 -3
- package/app.js +39 -6
- package/package.json +3 -3
- package/server/controllers/resources.js +1 -0
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#  Appsemble Node Utilities
|
|
2
2
|
|
|
3
3
|
> NodeJS utilities used by Appsemble internally.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@appsemble/node-utils)
|
|
6
|
-
[](https://gitlab.com/appsemble/appsemble/-/releases/0.27.2)
|
|
7
7
|
[](https://prettier.io)
|
|
8
8
|
|
|
9
9
|
## Table of Contents
|
|
@@ -26,5 +26,5 @@ compatibility is not guaranteed.
|
|
|
26
26
|
|
|
27
27
|
## License
|
|
28
28
|
|
|
29
|
-
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.
|
|
29
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.2/LICENSE.md) ©
|
|
30
30
|
[Appsemble](https://appsemble.com)
|
package/app.js
CHANGED
|
@@ -215,12 +215,45 @@ export async function applyAppVariant(appPath, appVariant) {
|
|
|
215
215
|
await transferAppVariantFiles(appPath, appVariantDefDir, appVariantDestDir, 'screenshots');
|
|
216
216
|
await transferAppVariantFiles(appPath, appVariantDefDir, appVariantDestDir, 'icon.png');
|
|
217
217
|
const patchesPath = join(appVariantDefDir, 'patches');
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
218
|
+
try {
|
|
219
|
+
const definitionPath = join(patchesPath, 'app-definition.json');
|
|
220
|
+
if (existsSync(definitionPath)) {
|
|
221
|
+
const [definitionPatches] = await readData(definitionPath);
|
|
222
|
+
await patchDefinition(appVariantDestDir, definitionPatches);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
logger.warn(`Missing file ${definitionPath}. Skipping patching app-definition.yaml`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
logger.error(error);
|
|
230
|
+
}
|
|
231
|
+
try {
|
|
232
|
+
const messagesPath = join(patchesPath, 'messages.json');
|
|
233
|
+
if (existsSync(messagesPath)) {
|
|
234
|
+
const [messagesPatches] = await readData(messagesPath);
|
|
235
|
+
await patchMessages(appVariantDestDir, messagesPatches);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
logger.warn(`Missing file ${messagesPath}. Skipping patching app messages.`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
logger.error(error);
|
|
243
|
+
}
|
|
244
|
+
try {
|
|
245
|
+
const stylesPath = join(patchesPath, 'styles.json');
|
|
246
|
+
if (existsSync(stylesPath)) {
|
|
247
|
+
const [stylesPatches] = await readData(stylesPath);
|
|
248
|
+
await patchStyles(appVariantDestDir, stylesPatches);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
logger.warn(`Missing file ${stylesPath}. Skipping patching app styles.`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
logger.error(error);
|
|
256
|
+
}
|
|
224
257
|
logger.info(`Successfully applied ${appVariant} variant to ${appPath}`);
|
|
225
258
|
logger.verbose(`The ${appVariant} variant app can be found in ${appVariantDestDir}`);
|
|
226
259
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/node-utils",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.2",
|
|
4
4
|
"description": "NodeJS utilities used by Appsemble internally.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"test": "vitest"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@appsemble/types": "0.27.
|
|
42
|
-
"@appsemble/utils": "0.27.
|
|
41
|
+
"@appsemble/types": "0.27.2",
|
|
42
|
+
"@appsemble/utils": "0.27.2",
|
|
43
43
|
"@formatjs/fast-memoize": "^2.0.0",
|
|
44
44
|
"@fortawesome/fontawesome-free": "^6.0.0",
|
|
45
45
|
"@koa/cors": "^4.0.0",
|
|
@@ -359,6 +359,7 @@ export function createDeleteSeedResources(options) {
|
|
|
359
359
|
const { pathParams: { appId }, } = ctx;
|
|
360
360
|
const { deleteAppResource, getApp, getAppResources } = options;
|
|
361
361
|
const app = await getApp({ context: ctx, query: { where: { id: appId } } });
|
|
362
|
+
assertKoaError(!app, ctx, 404, 'App not found');
|
|
362
363
|
for (const resourceType of Object.keys((_a = app.definition.resources) !== null && _a !== void 0 ? _a : {})) {
|
|
363
364
|
const resourcesToDeleteFindOptions = {
|
|
364
365
|
where: {
|