@geekron/strapi 0.2.6 → 0.2.7
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/admin/index.js +100 -97
- package/dist/admin/index.mjs +100 -97
- package/dist/server/index.js +44 -1
- package/dist/server/index.mjs +44 -1
- package/package.json +1 -1
package/dist/admin/index.js
CHANGED
|
@@ -20648,110 +20648,14 @@ var init_App = __esm(() => {
|
|
|
20648
20648
|
// admin/src/index.ts
|
|
20649
20649
|
var exports_src = {};
|
|
20650
20650
|
__export(exports_src, {
|
|
20651
|
+
handlerBootstrap: () => handlerBootstrap,
|
|
20651
20652
|
default: () => src_default
|
|
20652
20653
|
});
|
|
20653
20654
|
module.exports = __toCommonJS(exports_src);
|
|
20654
20655
|
|
|
20655
|
-
// admin/src/boot/handle-missing-translations.ts
|
|
20656
|
-
function extractTranslationInfo(logMessage) {
|
|
20657
|
-
const regex = /Missing message: "([^"]+)"[^,]+, using default message \(([^)]+)\)/;
|
|
20658
|
-
const match = logMessage.match(regex);
|
|
20659
|
-
if (match) {
|
|
20660
|
-
return {
|
|
20661
|
-
messageId: match[1],
|
|
20662
|
-
defaultMessage: match[2]
|
|
20663
|
-
};
|
|
20664
|
-
}
|
|
20665
|
-
return null;
|
|
20666
|
-
}
|
|
20667
|
-
var missTranslations = {};
|
|
20668
|
-
var handleMissingTranslations = (message) => {
|
|
20669
|
-
const info = extractTranslationInfo(message);
|
|
20670
|
-
if (info?.messageId)
|
|
20671
|
-
missTranslations[info.messageId] = info.defaultMessage;
|
|
20672
|
-
console.log(JSON.stringify(missTranslations));
|
|
20673
|
-
};
|
|
20674
|
-
var originalError = console.error;
|
|
20675
|
-
var originalWarn = () => {};
|
|
20676
|
-
console.warn = (..._args) => {
|
|
20677
|
-
originalWarn();
|
|
20678
|
-
};
|
|
20679
|
-
console.error = (error) => {
|
|
20680
|
-
try {
|
|
20681
|
-
if (error?.message?.includes("MISSING_TRANSLATION")) {
|
|
20682
|
-
handleMissingTranslations(error.message);
|
|
20683
|
-
} else {
|
|
20684
|
-
originalError(error);
|
|
20685
|
-
}
|
|
20686
|
-
} catch (error2) {
|
|
20687
|
-
originalError(error2);
|
|
20688
|
-
}
|
|
20689
|
-
};
|
|
20690
|
-
|
|
20691
|
-
// admin/src/boot/remove-links.ts
|
|
20692
|
-
function waitForLi(href, callback) {
|
|
20693
|
-
const findLi = () => {
|
|
20694
|
-
const anchor = document.querySelector(`li a[href="${href}"]`);
|
|
20695
|
-
if (anchor) {
|
|
20696
|
-
const li = anchor.closest("li");
|
|
20697
|
-
if (li)
|
|
20698
|
-
return li;
|
|
20699
|
-
}
|
|
20700
|
-
return null;
|
|
20701
|
-
};
|
|
20702
|
-
setInterval(() => {
|
|
20703
|
-
const initial = findLi();
|
|
20704
|
-
if (initial) {
|
|
20705
|
-
callback(initial);
|
|
20706
|
-
return;
|
|
20707
|
-
}
|
|
20708
|
-
});
|
|
20709
|
-
}
|
|
20710
|
-
function waitForDD(href, callback) {
|
|
20711
|
-
const findDD = () => {
|
|
20712
|
-
const anchor = document.querySelector(`div a[href="${href}"]`);
|
|
20713
|
-
if (anchor) {
|
|
20714
|
-
const dd = anchor.closest("div");
|
|
20715
|
-
if (dd)
|
|
20716
|
-
return dd;
|
|
20717
|
-
}
|
|
20718
|
-
return null;
|
|
20719
|
-
};
|
|
20720
|
-
setInterval(() => {
|
|
20721
|
-
const initial = findDD();
|
|
20722
|
-
if (initial) {
|
|
20723
|
-
callback(initial);
|
|
20724
|
-
return;
|
|
20725
|
-
}
|
|
20726
|
-
});
|
|
20727
|
-
}
|
|
20728
|
-
var removeLinks = () => {
|
|
20729
|
-
const hrefs = [
|
|
20730
|
-
"/admin/settings/purchase-content-history",
|
|
20731
|
-
"/admin/settings/plugins/purchase-content-releases",
|
|
20732
|
-
"/admin/settings/purchase-review-workflows",
|
|
20733
|
-
"/admin/settings/purchase-single-sign-on",
|
|
20734
|
-
"/admin/settings/purchase-audit-logs"
|
|
20735
|
-
];
|
|
20736
|
-
hrefs.forEach((href) => {
|
|
20737
|
-
waitForLi(href, (li) => {
|
|
20738
|
-
const parent = li.parentNode;
|
|
20739
|
-
parent.removeChild(li);
|
|
20740
|
-
});
|
|
20741
|
-
});
|
|
20742
|
-
const ddHrefs = ["https://strapi.io/pricing-self-hosted"];
|
|
20743
|
-
ddHrefs.forEach((href) => {
|
|
20744
|
-
waitForDD(href, (dd) => {
|
|
20745
|
-
const parent = dd.parentNode;
|
|
20746
|
-
parent.removeChild(dd);
|
|
20747
|
-
});
|
|
20748
|
-
});
|
|
20749
|
-
};
|
|
20750
|
-
|
|
20751
20656
|
// admin/src/bootstrap.ts
|
|
20752
20657
|
var bootstrap = (_app) => {
|
|
20753
20658
|
console.log("website admin plugin: bootstrap");
|
|
20754
|
-
removeLinks();
|
|
20755
20659
|
};
|
|
20756
20660
|
var bootstrap_default = bootstrap;
|
|
20757
20661
|
|
|
@@ -50214,6 +50118,105 @@ var register = (app) => {
|
|
|
50214
50118
|
};
|
|
50215
50119
|
var register_default = register;
|
|
50216
50120
|
|
|
50121
|
+
// admin/src/boot/handle-missing-translations.ts
|
|
50122
|
+
function extractTranslationInfo(logMessage) {
|
|
50123
|
+
const regex2 = /Missing message: "([^"]+)"[^,]+, using default message \(([^)]+)\)/;
|
|
50124
|
+
const match = logMessage.match(regex2);
|
|
50125
|
+
if (match) {
|
|
50126
|
+
return {
|
|
50127
|
+
messageId: match[1],
|
|
50128
|
+
defaultMessage: match[2]
|
|
50129
|
+
};
|
|
50130
|
+
}
|
|
50131
|
+
return null;
|
|
50132
|
+
}
|
|
50133
|
+
var missTranslations = {};
|
|
50134
|
+
var handleMissingTranslations = () => {
|
|
50135
|
+
const originalError = console.error;
|
|
50136
|
+
const originalWarn = () => {};
|
|
50137
|
+
console.warn = (..._args) => {
|
|
50138
|
+
originalWarn();
|
|
50139
|
+
};
|
|
50140
|
+
console.error = (error) => {
|
|
50141
|
+
try {
|
|
50142
|
+
if (error?.message?.includes("MISSING_TRANSLATION")) {
|
|
50143
|
+
const info = extractTranslationInfo(error.message);
|
|
50144
|
+
if (info?.messageId)
|
|
50145
|
+
missTranslations[info.messageId] = info.defaultMessage;
|
|
50146
|
+
console.log(JSON.stringify(missTranslations));
|
|
50147
|
+
} else {
|
|
50148
|
+
originalError(error);
|
|
50149
|
+
}
|
|
50150
|
+
} catch (error2) {
|
|
50151
|
+
originalError(error2);
|
|
50152
|
+
}
|
|
50153
|
+
};
|
|
50154
|
+
};
|
|
50155
|
+
// admin/src/boot/remove-links.ts
|
|
50156
|
+
function waitForLi(href, callback) {
|
|
50157
|
+
const findLi = () => {
|
|
50158
|
+
const anchor = document.querySelector(`li a[href="${href}"]`);
|
|
50159
|
+
if (anchor) {
|
|
50160
|
+
const li = anchor.closest("li");
|
|
50161
|
+
if (li)
|
|
50162
|
+
return li;
|
|
50163
|
+
}
|
|
50164
|
+
return null;
|
|
50165
|
+
};
|
|
50166
|
+
setInterval(() => {
|
|
50167
|
+
const initial = findLi();
|
|
50168
|
+
if (initial) {
|
|
50169
|
+
callback(initial);
|
|
50170
|
+
return;
|
|
50171
|
+
}
|
|
50172
|
+
});
|
|
50173
|
+
}
|
|
50174
|
+
function waitForDD(href, callback) {
|
|
50175
|
+
const findDD = () => {
|
|
50176
|
+
const anchor = document.querySelector(`div a[href="${href}"]`);
|
|
50177
|
+
if (anchor) {
|
|
50178
|
+
const dd = anchor.closest("div");
|
|
50179
|
+
if (dd)
|
|
50180
|
+
return dd;
|
|
50181
|
+
}
|
|
50182
|
+
return null;
|
|
50183
|
+
};
|
|
50184
|
+
setInterval(() => {
|
|
50185
|
+
const initial = findDD();
|
|
50186
|
+
if (initial) {
|
|
50187
|
+
callback(initial);
|
|
50188
|
+
return;
|
|
50189
|
+
}
|
|
50190
|
+
});
|
|
50191
|
+
}
|
|
50192
|
+
var removeLinks = () => {
|
|
50193
|
+
const hrefs = [
|
|
50194
|
+
"/admin/settings/purchase-content-history",
|
|
50195
|
+
"/admin/settings/plugins/purchase-content-releases",
|
|
50196
|
+
"/admin/settings/purchase-review-workflows",
|
|
50197
|
+
"/admin/settings/purchase-single-sign-on",
|
|
50198
|
+
"/admin/settings/purchase-audit-logs"
|
|
50199
|
+
];
|
|
50200
|
+
hrefs.forEach((href) => {
|
|
50201
|
+
waitForLi(href, (li) => {
|
|
50202
|
+
const parent = li.parentNode;
|
|
50203
|
+
parent.removeChild(li);
|
|
50204
|
+
});
|
|
50205
|
+
});
|
|
50206
|
+
const ddHrefs = ["https://strapi.io/pricing-self-hosted"];
|
|
50207
|
+
ddHrefs.forEach((href) => {
|
|
50208
|
+
waitForDD(href, (dd) => {
|
|
50209
|
+
const parent = dd.parentNode;
|
|
50210
|
+
parent.removeChild(dd);
|
|
50211
|
+
});
|
|
50212
|
+
});
|
|
50213
|
+
};
|
|
50214
|
+
// admin/src/handlers.ts
|
|
50215
|
+
var handlerBootstrap = async (_app) => {
|
|
50216
|
+
handleMissingTranslations();
|
|
50217
|
+
removeLinks();
|
|
50218
|
+
};
|
|
50219
|
+
|
|
50217
50220
|
// admin/src/index.ts
|
|
50218
50221
|
var plugin = {
|
|
50219
50222
|
register: register_default,
|
package/dist/admin/index.mjs
CHANGED
|
@@ -20685,106 +20685,9 @@ var init_App = __esm(() => {
|
|
|
20685
20685
|
App_default = App;
|
|
20686
20686
|
});
|
|
20687
20687
|
|
|
20688
|
-
// admin/src/boot/handle-missing-translations.ts
|
|
20689
|
-
function extractTranslationInfo(logMessage) {
|
|
20690
|
-
const regex = /Missing message: "([^"]+)"[^,]+, using default message \(([^)]+)\)/;
|
|
20691
|
-
const match = logMessage.match(regex);
|
|
20692
|
-
if (match) {
|
|
20693
|
-
return {
|
|
20694
|
-
messageId: match[1],
|
|
20695
|
-
defaultMessage: match[2]
|
|
20696
|
-
};
|
|
20697
|
-
}
|
|
20698
|
-
return null;
|
|
20699
|
-
}
|
|
20700
|
-
var missTranslations = {};
|
|
20701
|
-
var handleMissingTranslations = (message) => {
|
|
20702
|
-
const info = extractTranslationInfo(message);
|
|
20703
|
-
if (info?.messageId)
|
|
20704
|
-
missTranslations[info.messageId] = info.defaultMessage;
|
|
20705
|
-
console.log(JSON.stringify(missTranslations));
|
|
20706
|
-
};
|
|
20707
|
-
var originalError = console.error;
|
|
20708
|
-
var originalWarn = () => {};
|
|
20709
|
-
console.warn = (..._args) => {
|
|
20710
|
-
originalWarn();
|
|
20711
|
-
};
|
|
20712
|
-
console.error = (error) => {
|
|
20713
|
-
try {
|
|
20714
|
-
if (error?.message?.includes("MISSING_TRANSLATION")) {
|
|
20715
|
-
handleMissingTranslations(error.message);
|
|
20716
|
-
} else {
|
|
20717
|
-
originalError(error);
|
|
20718
|
-
}
|
|
20719
|
-
} catch (error2) {
|
|
20720
|
-
originalError(error2);
|
|
20721
|
-
}
|
|
20722
|
-
};
|
|
20723
|
-
|
|
20724
|
-
// admin/src/boot/remove-links.ts
|
|
20725
|
-
function waitForLi(href, callback) {
|
|
20726
|
-
const findLi = () => {
|
|
20727
|
-
const anchor = document.querySelector(`li a[href="${href}"]`);
|
|
20728
|
-
if (anchor) {
|
|
20729
|
-
const li = anchor.closest("li");
|
|
20730
|
-
if (li)
|
|
20731
|
-
return li;
|
|
20732
|
-
}
|
|
20733
|
-
return null;
|
|
20734
|
-
};
|
|
20735
|
-
setInterval(() => {
|
|
20736
|
-
const initial = findLi();
|
|
20737
|
-
if (initial) {
|
|
20738
|
-
callback(initial);
|
|
20739
|
-
return;
|
|
20740
|
-
}
|
|
20741
|
-
});
|
|
20742
|
-
}
|
|
20743
|
-
function waitForDD(href, callback) {
|
|
20744
|
-
const findDD = () => {
|
|
20745
|
-
const anchor = document.querySelector(`div a[href="${href}"]`);
|
|
20746
|
-
if (anchor) {
|
|
20747
|
-
const dd = anchor.closest("div");
|
|
20748
|
-
if (dd)
|
|
20749
|
-
return dd;
|
|
20750
|
-
}
|
|
20751
|
-
return null;
|
|
20752
|
-
};
|
|
20753
|
-
setInterval(() => {
|
|
20754
|
-
const initial = findDD();
|
|
20755
|
-
if (initial) {
|
|
20756
|
-
callback(initial);
|
|
20757
|
-
return;
|
|
20758
|
-
}
|
|
20759
|
-
});
|
|
20760
|
-
}
|
|
20761
|
-
var removeLinks = () => {
|
|
20762
|
-
const hrefs = [
|
|
20763
|
-
"/admin/settings/purchase-content-history",
|
|
20764
|
-
"/admin/settings/plugins/purchase-content-releases",
|
|
20765
|
-
"/admin/settings/purchase-review-workflows",
|
|
20766
|
-
"/admin/settings/purchase-single-sign-on",
|
|
20767
|
-
"/admin/settings/purchase-audit-logs"
|
|
20768
|
-
];
|
|
20769
|
-
hrefs.forEach((href) => {
|
|
20770
|
-
waitForLi(href, (li) => {
|
|
20771
|
-
const parent = li.parentNode;
|
|
20772
|
-
parent.removeChild(li);
|
|
20773
|
-
});
|
|
20774
|
-
});
|
|
20775
|
-
const ddHrefs = ["https://strapi.io/pricing-self-hosted"];
|
|
20776
|
-
ddHrefs.forEach((href) => {
|
|
20777
|
-
waitForDD(href, (dd) => {
|
|
20778
|
-
const parent = dd.parentNode;
|
|
20779
|
-
parent.removeChild(dd);
|
|
20780
|
-
});
|
|
20781
|
-
});
|
|
20782
|
-
};
|
|
20783
|
-
|
|
20784
20688
|
// admin/src/bootstrap.ts
|
|
20785
20689
|
var bootstrap = (_app) => {
|
|
20786
20690
|
console.log("website admin plugin: bootstrap");
|
|
20787
|
-
removeLinks();
|
|
20788
20691
|
};
|
|
20789
20692
|
var bootstrap_default = bootstrap;
|
|
20790
20693
|
|
|
@@ -50277,6 +50180,105 @@ var register = (app) => {
|
|
|
50277
50180
|
};
|
|
50278
50181
|
var register_default = register;
|
|
50279
50182
|
|
|
50183
|
+
// admin/src/boot/handle-missing-translations.ts
|
|
50184
|
+
function extractTranslationInfo(logMessage) {
|
|
50185
|
+
const regex2 = /Missing message: "([^"]+)"[^,]+, using default message \(([^)]+)\)/;
|
|
50186
|
+
const match = logMessage.match(regex2);
|
|
50187
|
+
if (match) {
|
|
50188
|
+
return {
|
|
50189
|
+
messageId: match[1],
|
|
50190
|
+
defaultMessage: match[2]
|
|
50191
|
+
};
|
|
50192
|
+
}
|
|
50193
|
+
return null;
|
|
50194
|
+
}
|
|
50195
|
+
var missTranslations = {};
|
|
50196
|
+
var handleMissingTranslations = () => {
|
|
50197
|
+
const originalError = console.error;
|
|
50198
|
+
const originalWarn = () => {};
|
|
50199
|
+
console.warn = (..._args) => {
|
|
50200
|
+
originalWarn();
|
|
50201
|
+
};
|
|
50202
|
+
console.error = (error) => {
|
|
50203
|
+
try {
|
|
50204
|
+
if (error?.message?.includes("MISSING_TRANSLATION")) {
|
|
50205
|
+
const info = extractTranslationInfo(error.message);
|
|
50206
|
+
if (info?.messageId)
|
|
50207
|
+
missTranslations[info.messageId] = info.defaultMessage;
|
|
50208
|
+
console.log(JSON.stringify(missTranslations));
|
|
50209
|
+
} else {
|
|
50210
|
+
originalError(error);
|
|
50211
|
+
}
|
|
50212
|
+
} catch (error2) {
|
|
50213
|
+
originalError(error2);
|
|
50214
|
+
}
|
|
50215
|
+
};
|
|
50216
|
+
};
|
|
50217
|
+
// admin/src/boot/remove-links.ts
|
|
50218
|
+
function waitForLi(href, callback) {
|
|
50219
|
+
const findLi = () => {
|
|
50220
|
+
const anchor = document.querySelector(`li a[href="${href}"]`);
|
|
50221
|
+
if (anchor) {
|
|
50222
|
+
const li = anchor.closest("li");
|
|
50223
|
+
if (li)
|
|
50224
|
+
return li;
|
|
50225
|
+
}
|
|
50226
|
+
return null;
|
|
50227
|
+
};
|
|
50228
|
+
setInterval(() => {
|
|
50229
|
+
const initial = findLi();
|
|
50230
|
+
if (initial) {
|
|
50231
|
+
callback(initial);
|
|
50232
|
+
return;
|
|
50233
|
+
}
|
|
50234
|
+
});
|
|
50235
|
+
}
|
|
50236
|
+
function waitForDD(href, callback) {
|
|
50237
|
+
const findDD = () => {
|
|
50238
|
+
const anchor = document.querySelector(`div a[href="${href}"]`);
|
|
50239
|
+
if (anchor) {
|
|
50240
|
+
const dd = anchor.closest("div");
|
|
50241
|
+
if (dd)
|
|
50242
|
+
return dd;
|
|
50243
|
+
}
|
|
50244
|
+
return null;
|
|
50245
|
+
};
|
|
50246
|
+
setInterval(() => {
|
|
50247
|
+
const initial = findDD();
|
|
50248
|
+
if (initial) {
|
|
50249
|
+
callback(initial);
|
|
50250
|
+
return;
|
|
50251
|
+
}
|
|
50252
|
+
});
|
|
50253
|
+
}
|
|
50254
|
+
var removeLinks = () => {
|
|
50255
|
+
const hrefs = [
|
|
50256
|
+
"/admin/settings/purchase-content-history",
|
|
50257
|
+
"/admin/settings/plugins/purchase-content-releases",
|
|
50258
|
+
"/admin/settings/purchase-review-workflows",
|
|
50259
|
+
"/admin/settings/purchase-single-sign-on",
|
|
50260
|
+
"/admin/settings/purchase-audit-logs"
|
|
50261
|
+
];
|
|
50262
|
+
hrefs.forEach((href) => {
|
|
50263
|
+
waitForLi(href, (li) => {
|
|
50264
|
+
const parent = li.parentNode;
|
|
50265
|
+
parent.removeChild(li);
|
|
50266
|
+
});
|
|
50267
|
+
});
|
|
50268
|
+
const ddHrefs = ["https://strapi.io/pricing-self-hosted"];
|
|
50269
|
+
ddHrefs.forEach((href) => {
|
|
50270
|
+
waitForDD(href, (dd) => {
|
|
50271
|
+
const parent = dd.parentNode;
|
|
50272
|
+
parent.removeChild(dd);
|
|
50273
|
+
});
|
|
50274
|
+
});
|
|
50275
|
+
};
|
|
50276
|
+
// admin/src/handlers.ts
|
|
50277
|
+
var handlerBootstrap = async (_app) => {
|
|
50278
|
+
handleMissingTranslations();
|
|
50279
|
+
removeLinks();
|
|
50280
|
+
};
|
|
50281
|
+
|
|
50280
50282
|
// admin/src/index.ts
|
|
50281
50283
|
var plugin = {
|
|
50282
50284
|
register: register_default,
|
|
@@ -50284,5 +50286,6 @@ var plugin = {
|
|
|
50284
50286
|
};
|
|
50285
50287
|
var src_default = plugin;
|
|
50286
50288
|
export {
|
|
50289
|
+
handlerBootstrap,
|
|
50287
50290
|
src_default as default
|
|
50288
50291
|
};
|
package/dist/server/index.js
CHANGED
|
@@ -325,6 +325,12 @@ var schema_default4 = {
|
|
|
325
325
|
}
|
|
326
326
|
},
|
|
327
327
|
attributes: {
|
|
328
|
+
style: {
|
|
329
|
+
type: "enumeration",
|
|
330
|
+
enum: [
|
|
331
|
+
"default"
|
|
332
|
+
]
|
|
333
|
+
},
|
|
328
334
|
logo: {
|
|
329
335
|
type: "component",
|
|
330
336
|
pluginOptions: {
|
|
@@ -466,8 +472,45 @@ var api_default = {
|
|
|
466
472
|
};
|
|
467
473
|
|
|
468
474
|
// server/src/bootstrap.ts
|
|
469
|
-
var
|
|
475
|
+
var import_node_fs = require("node:fs");
|
|
476
|
+
var import_node_path = require("node:path");
|
|
477
|
+
var __dirname = "/Users/imoyh/GithubProjects/geekron/strapi/server/src";
|
|
478
|
+
var initializeSingleTypeData = async (strapi2, pluginName, modelName, initialData) => {
|
|
479
|
+
try {
|
|
480
|
+
const uid = `plugin::${pluginName}.${modelName}`;
|
|
481
|
+
const service = strapi2.plugin(pluginName).service(modelName);
|
|
482
|
+
if (!service) {
|
|
483
|
+
strapi2.log.warn(`Service not found for ${uid}, skipping initialization`);
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
const existingData = await service.find();
|
|
487
|
+
if (existingData && Object.keys(existingData).length > 0) {
|
|
488
|
+
strapi2.log.debug(`Data already exists for ${uid}, skipping initialization`);
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
await service.createOrUpdate({ data: initialData });
|
|
492
|
+
strapi2.log.info(`Successfully initialized data for ${uid}`);
|
|
493
|
+
} catch (error) {
|
|
494
|
+
strapi2.log.error(`Failed to initialize data for plugin::${pluginName}.${modelName}:`, error.message);
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
var bootstrap = async ({ strapi: strapi2 }) => {
|
|
470
498
|
strapi2.log.info("website server plugin: bootstrap");
|
|
499
|
+
try {
|
|
500
|
+
const dataPath = import_node_path.join(__dirname, "../data/data.json");
|
|
501
|
+
const dataContent = import_node_fs.readFileSync(dataPath, "utf-8");
|
|
502
|
+
const initialData = JSON.parse(dataContent);
|
|
503
|
+
strapi2.log.info("Loading initial data from data.json");
|
|
504
|
+
const modelNames = ["common", "menu", "site", "theme"];
|
|
505
|
+
for (const modelName of modelNames) {
|
|
506
|
+
if (initialData[modelName]) {
|
|
507
|
+
await initializeSingleTypeData(strapi2, "website", modelName, initialData[modelName]);
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
strapi2.log.info("Initial data loading completed");
|
|
511
|
+
} catch (error) {
|
|
512
|
+
strapi2.log.error("Failed to load initial data:", error.message);
|
|
513
|
+
}
|
|
471
514
|
};
|
|
472
515
|
var bootstrap_default = bootstrap;
|
|
473
516
|
|
package/dist/server/index.mjs
CHANGED
|
@@ -290,6 +290,12 @@ var schema_default4 = {
|
|
|
290
290
|
}
|
|
291
291
|
},
|
|
292
292
|
attributes: {
|
|
293
|
+
style: {
|
|
294
|
+
type: "enumeration",
|
|
295
|
+
enum: [
|
|
296
|
+
"default"
|
|
297
|
+
]
|
|
298
|
+
},
|
|
293
299
|
logo: {
|
|
294
300
|
type: "component",
|
|
295
301
|
pluginOptions: {
|
|
@@ -431,8 +437,45 @@ var api_default = {
|
|
|
431
437
|
};
|
|
432
438
|
|
|
433
439
|
// server/src/bootstrap.ts
|
|
434
|
-
|
|
440
|
+
import { readFileSync } from "node:fs";
|
|
441
|
+
import { join } from "node:path";
|
|
442
|
+
var __dirname = "/Users/imoyh/GithubProjects/geekron/strapi/server/src";
|
|
443
|
+
var initializeSingleTypeData = async (strapi2, pluginName, modelName, initialData) => {
|
|
444
|
+
try {
|
|
445
|
+
const uid = `plugin::${pluginName}.${modelName}`;
|
|
446
|
+
const service = strapi2.plugin(pluginName).service(modelName);
|
|
447
|
+
if (!service) {
|
|
448
|
+
strapi2.log.warn(`Service not found for ${uid}, skipping initialization`);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
const existingData = await service.find();
|
|
452
|
+
if (existingData && Object.keys(existingData).length > 0) {
|
|
453
|
+
strapi2.log.debug(`Data already exists for ${uid}, skipping initialization`);
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
await service.createOrUpdate({ data: initialData });
|
|
457
|
+
strapi2.log.info(`Successfully initialized data for ${uid}`);
|
|
458
|
+
} catch (error) {
|
|
459
|
+
strapi2.log.error(`Failed to initialize data for plugin::${pluginName}.${modelName}:`, error.message);
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
var bootstrap = async ({ strapi: strapi2 }) => {
|
|
435
463
|
strapi2.log.info("website server plugin: bootstrap");
|
|
464
|
+
try {
|
|
465
|
+
const dataPath = join(__dirname, "../data/data.json");
|
|
466
|
+
const dataContent = readFileSync(dataPath, "utf-8");
|
|
467
|
+
const initialData = JSON.parse(dataContent);
|
|
468
|
+
strapi2.log.info("Loading initial data from data.json");
|
|
469
|
+
const modelNames = ["common", "menu", "site", "theme"];
|
|
470
|
+
for (const modelName of modelNames) {
|
|
471
|
+
if (initialData[modelName]) {
|
|
472
|
+
await initializeSingleTypeData(strapi2, "website", modelName, initialData[modelName]);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
strapi2.log.info("Initial data loading completed");
|
|
476
|
+
} catch (error) {
|
|
477
|
+
strapi2.log.error("Failed to load initial data:", error.message);
|
|
478
|
+
}
|
|
436
479
|
};
|
|
437
480
|
var bootstrap_default = bootstrap;
|
|
438
481
|
|