@massimo-cassandro/minimo 1.45.0 → 1.45.1

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.
@@ -5,6 +5,7 @@ import fs from 'fs';
5
5
  import path from 'path';
6
6
  import process from 'process';
7
7
  import { pathToFileURL } from 'url';
8
+ import { styleText } from 'util';
8
9
 
9
10
  /**
10
11
  * Genera il file css delle @custom-media.
@@ -30,6 +31,7 @@ export async function buildCustomMedia({
30
31
  const srcPath = path.resolve(src),
31
32
  destPath = path.resolve(dest ?? srcPath.replace(/\.m?js$/, '.css'));
32
33
 
34
+
33
35
  const { default: customMedia } = await import(pathToFileURL(srcPath).href);
34
36
 
35
37
  if (!customMedia || typeof customMedia !== 'object') {
@@ -44,7 +46,7 @@ export async function buildCustomMedia({
44
46
  });
45
47
 
46
48
  const content = '/* File generato da custom-media-builder.mjs a partire da ' +
47
- `${path.basename(srcPath)}. Eventuali modifich andranno perdute */\n\n` +
49
+ `${path.basename(srcPath)}.\nEVENTUALI MODIFICHE ANDRANNO PERDUTE */\n\n` +
48
50
  rows.join('\n') + '\n';
49
51
 
50
52
  if (fs.existsSync(destPath) && fs.readFileSync(destPath, 'utf8') === content) {
@@ -56,7 +58,7 @@ export async function buildCustomMedia({
56
58
  }
57
59
 
58
60
  // esecuzione da riga di comando
59
- if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.argv[1])).href) {
61
+ if (process.argv[1] && import.meta.url === pathToFileURL(fs.realpathSync(process.argv[1])).href) {
60
62
  const args = Object.fromEntries(
61
63
  process.argv.slice(2)
62
64
  .map(arg => arg.match(/^--(src|dest)=(.+)$/))
@@ -66,7 +68,9 @@ if (process.argv[1] && import.meta.url === pathToFileURL(path.resolve(process.ar
66
68
 
67
69
  try {
68
70
  const written = await buildCustomMedia(args);
69
- console.log(written ? 'custom media: file aggiornato' : 'custom media: nessuna modifica');
71
+
72
+ console.log(styleText('yellow', written ? 'custom media: file aggiornato' : 'custom media: nessuna modifica'));
73
+
70
74
  } catch (err) {
71
75
  console.error(err.message);
72
76
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.45.0",
3
+ "version": "1.45.1",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",