@bobfrankston/extractids 1.0.18 → 1.0.20
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/index.js +6 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -59,7 +59,10 @@ function generateTypes(ids, classes) {
|
|
|
59
59
|
const classType = classes.length > 0
|
|
60
60
|
? `export type cssClasses = ${classes.map(cls => `"${cls}"`).join(' |\n')};\n`
|
|
61
61
|
: `export type cssClasses = never;\n`;
|
|
62
|
-
|
|
62
|
+
const now = new Date();
|
|
63
|
+
const localTime = now.toLocaleString();
|
|
64
|
+
const header = `// AUTO-GENERATED FILE — DO NOT EDIT\n// Generated by extractids on ${localTime}\n// Any manual changes will be overwritten on the next run.\n\n`;
|
|
65
|
+
return `${header}${idType}\n\n${queryType}\n\n${classType}`;
|
|
63
66
|
}
|
|
64
67
|
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
65
68
|
async function updateTypesFile(specifiedHtmlFile) {
|
|
@@ -155,7 +158,8 @@ if (watchMode) {
|
|
|
155
158
|
: ['index.html', 'default.html', 'default.htm'];
|
|
156
159
|
let debounceTimer;
|
|
157
160
|
const watcher = chokidar.watch([...htmlFilesToWatch, '**/*.css'], { ignored: /node_modules/ });
|
|
158
|
-
watcher.on('change', () => {
|
|
161
|
+
watcher.on('change', (path) => {
|
|
162
|
+
console.log(`[extractids ${timestamp()}] Change detected: ${path}`);
|
|
159
163
|
clearTimeout(debounceTimer);
|
|
160
164
|
debounceTimer = setTimeout(() => updateTypesFile(specifiedHtmlFile), 100);
|
|
161
165
|
});
|