adminforth 2.25.0-test.2 → 2.25.0-test.21

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.
@@ -15,46 +15,6 @@ async function getNextAvailablePort(startPort: number | undefined) {
15
15
  return await portfinder.getPortPromise({ port: startPort });
16
16
  };
17
17
 
18
- function ignoreTailwindErrors(): Plugin {
19
- return {
20
- name: 'ignore-tailwind-errors',
21
- configureServer(server) {
22
- server.middlewares.use((req, res, next) => {
23
- const originalWrite = res.write;
24
- res.write = function(chunk) {
25
- if (typeof chunk === 'string' && chunk.includes('tailwind')) {
26
- return true;
27
- }
28
- return originalWrite.call(this, chunk);
29
- };
30
- next();
31
- });
32
- },
33
- config(config, { command }) {
34
- if (command === 'build') {
35
- // Override PostCSS config for build
36
- config.css = config.css || {};
37
- config.css.postcss = {
38
- plugins: [
39
- {
40
- postcssPlugin: 'ignore-tailwind-errors',
41
- Once(root, helpers) {
42
- try {
43
- return tailwindcss()(root, helpers);
44
- } catch (error: any) {
45
- console.warn('TailwindCSS warning ignored:', error.message);
46
- return;
47
- }
48
- }
49
- }
50
- ]
51
- };
52
- }
53
- }
54
- };
55
- }
56
-
57
-
58
18
  const appPort = await getNextAvailablePort(5173);
59
19
  const hmrPort = await getNextAvailablePort(5273);
60
20
  console.log(`SPA port: ${appPort}. HMR port: ${hmrPort}`);
@@ -89,6 +49,26 @@ export default defineConfig({
89
49
  return id.toString().split('node_modules/')[1].split('/')[0].toString();
90
50
  }
91
51
  },
52
+
53
+ // by default servers doesnt returns dotfiles
54
+ // so if we'll generate file with name like ".pnpm-BLnlxqcJ.js"
55
+ // it won't be loaded
56
+ assetFileNames: (assetInfo) => {
57
+ return assetInfo.name?.startsWith('.pnpm')
58
+ ? `assets/${assetInfo.name.replace(/^\.pnpm/, 'pnpm')}`
59
+ : `assets/${assetInfo.name}`;
60
+ },
61
+
62
+ entryFileNames: (chunkInfo) => {
63
+ return chunkInfo.name?.startsWith('.pnpm')
64
+ ? `assets/${chunkInfo.name.replace(/^\.pnpm/, 'pnpm')}.js`
65
+ : `assets/${chunkInfo.name}.js`;
66
+ },
67
+ chunkFileNames: (chunkInfo) => {
68
+ return chunkInfo.name?.startsWith('.pnpm')
69
+ ? `assets/${chunkInfo.name.replace(/^\.pnpm/, 'pnpm')}.js`
70
+ : `assets/${chunkInfo.name}.js`;
71
+ },
92
72
  },
93
73
  },
94
74
  },
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "2.25.0-test.2",
3
+ "version": "2.25.0-test.21",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "files": [
9
9
  "dist/**/*",
10
- "commands/**/*"
10
+ "commands/**/*",
11
+ "scripts/**/*"
11
12
  ],
12
13
  "bin": {
13
14
  "adminforth": "./commands/cli.js"
@@ -20,7 +21,7 @@
20
21
  "rollout-doc": "cd documentation && pnpm build && pnpm deploy",
21
22
  "docs": "typedoc",
22
23
  "--comment_postinstall": "postinstall executed after package installed in other project package and when we do pnpm i in the package",
23
- "postinstall": "node -e \"const fs=require('fs');const path=require('path');const spaPath=path.join(__dirname,'dist','spa');if(fs.existsSync(spaPath) && !process.env.PNPM_INSTALL_SPA){process.env.PNPM_INSTALL_SPA=1;require('child_process').execSync('pnpm install --frozen-lockfile',{cwd:spaPath,stdio:'inherit'});console.log('installed spa dependencies');}\""
24
+ "postinstall": "node scripts/postinstall.js"
24
25
  },
25
26
  "release": {
26
27
  "plugins": [
@@ -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');