adminforth 2.25.0-test.10 → 2.25.0-test.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.25.0-test.10",
3
+ "version": "2.25.0-test.11",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -8,7 +8,7 @@
8
8
  "files": [
9
9
  "dist/**/*",
10
10
  "commands/**/*",
11
- "sctripts/**/*"
11
+ "scripts/**/*"
12
12
  ],
13
13
  "bin": {
14
14
  "adminforth": "./commands/cli.js"
@@ -0,0 +1,25 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ const nodeBinary = process.execPath;
6
+ const __filename = fileURLToPath(import.meta.url);
7
+ const __dirname = path.dirname(__filename);
8
+ const spaPath=path.join(__dirname,'dist','spa');
9
+
10
+ const pnpmPotentionalPath=path.join(nodeBinary,'..','pnpm');
11
+ const doesUserProjectHasPnpm = fs.existsSync(pnpmPotentionalPath)
12
+ console.log('doesUserProjectHasPnpm', doesUserProjectHasPnpm);
13
+ if (doesUserProjectHasPnpm) {
14
+ if(fs.existsSync(spaPath) && !process.env.PNPM_INSTALL_SPA){
15
+ process.env.PNPM_INSTALL_SPA=1;
16
+ require('child_process').execSync('pnpm install --frozen-lockfile',{cwd:spaPath,stdio:'inherit'});
17
+ }
18
+ } else {
19
+ if(fs.existsSync(spaPath)){
20
+ process.chdir(spaPath);
21
+ require('child_process').execSync('npm ci',{stdio:'inherit'});
22
+ }
23
+ }
24
+
25
+ console.log('installed spa dependencies');