@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.
Files changed (2) hide show
  1. package/index.js +6 -2
  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
- return `${idType}\n\n${queryType}\n\n${classType}`;
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/extractids",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Extracd html and css as types",
5
5
  "main": "index.js",
6
6
  "bin": {