adminforth 1.0.7 → 1.0.9
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/modules/codeInjector.js +13 -6
- package/package.json +1 -1
package/modules/codeInjector.js
CHANGED
|
@@ -11,6 +11,14 @@ import crypto from 'crypto';
|
|
|
11
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
12
|
const __dirname = path.join(path.dirname(__filename), '..');
|
|
13
13
|
|
|
14
|
+
// const SPA_TMP_PATH = path.join(__dirname, 'spa_tmp');
|
|
15
|
+
|
|
16
|
+
// folder in /tmp directory to store SPA sources
|
|
17
|
+
const SPA_TMP_PATH = path.join('/tmp', 'adminforth', 'spa_tmp');
|
|
18
|
+
// make sure the folder exists
|
|
19
|
+
fsExtra.ensureDirSync(SPA_TMP_PATH);
|
|
20
|
+
|
|
21
|
+
|
|
14
22
|
const execAsync = promisify(exec);
|
|
15
23
|
|
|
16
24
|
function hashify(obj) {
|
|
@@ -57,7 +65,7 @@ class CodeInjector {
|
|
|
57
65
|
|
|
58
66
|
async rmTmpDir() {
|
|
59
67
|
// remove spa_tmp folder if it is exists
|
|
60
|
-
const spaTmpPath =
|
|
68
|
+
const spaTmpPath = SPA_TMP_PATH;
|
|
61
69
|
try {
|
|
62
70
|
await fs.promises.rm(spaTmpPath, { recursive: true });
|
|
63
71
|
} catch (e) {
|
|
@@ -66,7 +74,7 @@ class CodeInjector {
|
|
|
66
74
|
}
|
|
67
75
|
|
|
68
76
|
async prepareSources({ filesUpdated, verbose = false }) {
|
|
69
|
-
const spaTmpPath =
|
|
77
|
+
const spaTmpPath = SPA_TMP_PATH;
|
|
70
78
|
|
|
71
79
|
const customFiles = [];
|
|
72
80
|
const icons = [];
|
|
@@ -274,12 +282,11 @@ class CodeInjector {
|
|
|
274
282
|
await this.watchForReprepare();
|
|
275
283
|
console.log('AdminForth bundling');
|
|
276
284
|
|
|
277
|
-
const cwd =
|
|
278
|
-
|
|
279
|
-
|
|
285
|
+
const cwd = SPA_TMP_PATH;
|
|
280
286
|
|
|
281
287
|
if (!hotReload) {
|
|
282
|
-
|
|
288
|
+
// probably add option to build with tsh check (plain 'build')
|
|
289
|
+
await this.runNpmShell({command: 'run build-only', verbose, cwd});
|
|
283
290
|
} else {
|
|
284
291
|
const command = 'run dev';
|
|
285
292
|
console.time(`Running npm ${command}...`);
|