dashboard-shell-shell 0.0.1 → 0.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/vue.config.js +15 -83
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashboard-shell-shell",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Rancher Dashboard Shell",
5
5
  "repository": "https://github.com/rancherlabs/dashboard",
6
6
  "license": "Apache-2.0",
package/vue.config.js CHANGED
@@ -37,79 +37,27 @@ const perfTest = (process.env.PERF_TEST === 'true'); // Enable performance testi
37
37
  * Paths to the shell folder when it is included as a node dependency
38
38
  */
39
39
  const getShellPaths = (dir) => {
40
- // 设置初始路径
41
- let SHELL_ABS = path.join(dir, 'node_modules/dashboard-shell/shell');
42
- let COMPONENTS_DIR = path.join(SHELL_ABS, 'rancher-components'); // 默认组件路径
43
-
44
- console.log('初始SHELL_ABS:', SHELL_ABS);
45
- console.log('初始COMPONENTS_DIR:', COMPONENTS_DIR);
46
-
47
- // 检查初始路径是否存在
40
+ let SHELL_ABS = path.join(dir, 'node_modules/dashboard-shell-shell');
41
+ let COMPONENTS_DIR = path.join(SHELL_ABS, 'rancher-components');
42
+
48
43
  if (fs.existsSync(SHELL_ABS)) {
49
44
  const stat = fs.lstatSync(SHELL_ABS);
50
-
51
- console.log('SHELL_ABS 存在,是否为符号链接:', stat.isSymbolicLink());
52
-
53
- // 处理符号链接情况
45
+
46
+ // If @rancher/shell is a symlink, then use the components folder for it
54
47
  if (stat.isSymbolicLink()) {
55
- const REAL_SHELL_ABS = fs.realpathSync(SHELL_ABS);
56
- console.log('符号链接的真实路径:', REAL_SHELL_ABS);
57
-
58
- // 根据实际项目结构调整符号链接后的组件路径
59
- // 这里假设符号链接指向项目根目录,组件在 pkg/rancher-components/src/components
60
- COMPONENTS_DIR = path.join(REAL_SHELL_ABS, 'pkg', 'rancher-components', 'src', 'components');
61
-
62
- // 如果上述路径不存在,尝试其他可能的路径
63
- if (!fs.existsSync(COMPONENTS_DIR)) {
64
- console.log('备选路径1不存在,尝试备选路径2');
65
- COMPONENTS_DIR = path.join(REAL_SHELL_ABS, '..', 'pkg', 'rancher-components', 'src', 'components');
66
- }
67
- }
68
-
69
- // 验证组件目录是否存在
70
- if (!fs.existsSync(COMPONENTS_DIR)) {
71
- console.log('警告: 计算出的组件目录不存在:', COMPONENTS_DIR);
72
-
73
- // 尝试备选路径
74
- const altComponentsDir = path.join(SHELL_ABS,'..', 'pkg', 'rancher-components', 'src', 'components');
75
- if (fs.existsSync(altComponentsDir)) {
76
- console.log('使用备选组件目录:', altComponentsDir);
77
- COMPONENTS_DIR = altComponentsDir;
78
- }
48
+ const REAL_SHELL_ABS = fs.realpathSync(SHELL_ABS); // In case the shell is being linked via 'yarn link'
49
+
50
+ COMPONENTS_DIR = path.join(REAL_SHELL_ABS, '..', 'pkg', 'rancher-components', 'src', 'components');
79
51
  }
80
- } else {
81
- console.log('警告: SHELL_ABS 路径不存在:', SHELL_ABS);
82
52
  }
83
-
84
- // 检查本地是否有 shell 目录(用于主仓库开发)
85
- const localShellPath = path.join(dir, 'shell');
86
- if (fs.existsSync(localShellPath)) {
87
- console.log('找到本地 shell 目录:', localShellPath);
88
- SHELL_ABS = localShellPath;
89
-
90
- // 根据实际项目结构调整本地开发时的组件路径
53
+
54
+ // If we have a local folder named 'shell' then use that rather than the one in node_modules
55
+ // This will be the case in the main dashboard repository.
56
+ if (fs.existsSync(path.join(dir, 'shell'))) {
57
+ SHELL_ABS = path.join(dir, 'shell');
91
58
  COMPONENTS_DIR = path.join(dir, 'pkg', 'rancher-components', 'src', 'components');
92
-
93
- // 验证路径是否存在
94
- if (!fs.existsSync(COMPONENTS_DIR)) {
95
- console.log('警告: 本地开发组件目录不存在:', COMPONENTS_DIR);
96
-
97
- // 尝试备选路径
98
- const altLocalComponentsDir = path.join(SHELL_ABS, 'rancher-components');
99
- if (fs.existsSync(altLocalComponentsDir)) {
100
- console.log('使用本地备选组件目录:', altLocalComponentsDir);
101
- COMPONENTS_DIR = altLocalComponentsDir;
102
- }
103
- }
104
59
  }
105
-
106
- console.log('最终SHELL_ABS:', SHELL_ABS);
107
- console.log('最终COMPONENTS_DIR:', COMPONENTS_DIR);
108
-
109
- // 验证关键组件是否存在
110
- const testComponentPath = path.join(COMPONENTS_DIR, 'Banner.vue');
111
- console.log('测试组件 (Banner.vue) 是否存在:', fs.existsSync(testComponentPath));
112
-
60
+
113
61
  return { SHELL_ABS, COMPONENTS_DIR };
114
62
  };
115
63
 
@@ -590,11 +538,6 @@ module.exports = function(dir, appConfig = {}) {
590
538
  config.resolve.alias['@shell'] = SHELL_ABS;
591
539
  config.resolve.alias['@pkg'] = path.join(dir, 'pkg');
592
540
  config.resolve.alias['./node_modules'] = path.join(dir, 'node_modules');
593
-
594
- console.log('SHELL_ABS 路径:', SHELL_ABS);
595
- console.log('@components 路径:', COMPONENTS_DIR);
596
- console.log('Radio 组件是否存在:', fs.existsSync(path.join(COMPONENTS_DIR, 'Form/Radio.vue')));
597
-
598
541
  config.resolve.alias['@components'] = COMPONENTS_DIR;
599
542
  config.resolve.alias['vue$'] = dev ? path.resolve(process.cwd(), 'node_modules', 'vue') : 'vue';
600
543
  config.resolve.modules.push(__dirname);
@@ -610,17 +553,6 @@ module.exports = function(dir, appConfig = {}) {
610
553
 
611
554
  config.plugins.push(new webpack.IgnorePlugin({ resourceRegExp: /\/__tests__\// }));
612
555
 
613
- // 添加模块替换插件用于调试
614
- config.plugins.push(
615
- new webpack.NormalModuleReplacementPlugin(/.*/, (resource) => {
616
- if (resource.request.startsWith('@components/Form/Radio')) {
617
- console.log('尝试解析组件:', resource.request);
618
- console.log('解析路径:', path.join(COMPONENTS_DIR, resource.request.substr('@components/'.length)));
619
- }
620
- })
621
- )
622
-
623
-
624
556
  config.resolve.extensions.push(...['.tsx', '.ts', '.js', '.vue', '.scss']);
625
557
  config.watchOptions = {
626
558
  ...(config.watchOptions || {}),
@@ -642,4 +574,4 @@ module.exports = function(dir, appConfig = {}) {
642
574
  };
643
575
 
644
576
  return config;
645
- };
577
+ };