codeplay-common 1.2.8 → 1.2.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.
|
@@ -61,6 +61,69 @@ try {
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
+
//In routes.js file check static import START
|
|
65
|
+
const routesPath = path.join(process.cwd(), 'src', 'js', 'routes.js');
|
|
66
|
+
const routesContent = fs.readFileSync(routesPath, 'utf-8');
|
|
67
|
+
|
|
68
|
+
// Track whether we're inside a block comment
|
|
69
|
+
let inBlockComment = false;
|
|
70
|
+
const lines = routesContent.split('\n');
|
|
71
|
+
|
|
72
|
+
const badImportRegex = /^[ \t]*import\s+[\w{}*,\s]*\s+from\s+['"].+\.f7['"]\s*;/;
|
|
73
|
+
const badImports = [];
|
|
74
|
+
|
|
75
|
+
lines.forEach((line, index) => {
|
|
76
|
+
const trimmed = line.trim();
|
|
77
|
+
|
|
78
|
+
// Check block comment start/end
|
|
79
|
+
if (trimmed.startsWith('/*')) inBlockComment = true;
|
|
80
|
+
if (inBlockComment && trimmed.endsWith('*/')) {
|
|
81
|
+
inBlockComment = false;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Skip if inside block comment or line comment
|
|
86
|
+
if (inBlockComment || trimmed.startsWith('//')) return;
|
|
87
|
+
|
|
88
|
+
// Match static import
|
|
89
|
+
if (badImportRegex.test(trimmed)) {
|
|
90
|
+
badImports.push({ line: trimmed, number: index + 1 });
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (badImports.length > 0) {
|
|
95
|
+
console.error('\n❌ ERROR: Detected static imports of .f7 files in routes.js\n');
|
|
96
|
+
console.error(`⚠️ Please convert the following lines to
|
|
97
|
+
var routes = [
|
|
98
|
+
{
|
|
99
|
+
path: '/',
|
|
100
|
+
asyncComponent: () => import('../pages/home.f7'),
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
\n`);
|
|
104
|
+
badImports.forEach(({ line, number }) => {
|
|
105
|
+
console.error(`${number}: ${line}`);
|
|
106
|
+
});
|
|
107
|
+
process.exit(1);
|
|
108
|
+
} else {
|
|
109
|
+
console.log('✅ routes.js passed the .f7 import check.');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
//In routes.js file check static import END
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
64
127
|
|
|
65
128
|
|
|
66
129
|
|