@penskemediacorp/larva 1.75.0 → 1.76.0

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/bin/pre-push CHANGED
@@ -127,9 +127,36 @@ function compareVersions(current, latest) {
127
127
  }
128
128
 
129
129
  function checkForceFlag() {
130
- // Only reliable method: check process.argv
131
- const args = process.argv.slice( 2 );
132
- return args.includes( '--force' ) || args.includes( '-f' );
130
+ const args = process.argv.slice(2);
131
+ if (args.includes('--force') || args.includes('-f')) {
132
+ return true;
133
+ }
134
+
135
+ try {
136
+ let psCommand;
137
+
138
+ if (process.platform === 'win32') {
139
+ // Try PowerShell first (works on Windows 10/11)
140
+ psCommand = `powershell -Command "Get-WmiObject Win32_Process -Filter \\"ProcessId=${process.ppid}\\" | Select-Object -ExpandProperty CommandLine"`;
141
+ } else {
142
+ // Unix-like systems
143
+ psCommand = `ps -o command= -p ${process.ppid}`;
144
+ }
145
+
146
+ const parentCommand = execSync(psCommand, {
147
+ encoding: 'utf8',
148
+ stdio: ['pipe', 'pipe', 'pipe'],
149
+ timeout: 2000 // Add timeout
150
+ }).trim();
151
+
152
+ if (parentCommand.includes('--force') || parentCommand.match(/\s-[a-z]*f[a-z]*\s/)) {
153
+ return true;
154
+ }
155
+ } catch (error) {
156
+ // Silently fail - parent process inspection failed
157
+ }
158
+
159
+ return false;
133
160
  }
134
161
 
135
162
  function main() {
@@ -173,13 +200,16 @@ function main() {
173
200
  log('Please update @penskemediacorp/larva as soon as possible!\n', 'yellow');
174
201
  process.exit(0);
175
202
  } else {
176
- log('❌ Push blocked. Update @penskemediacorp/larva or use --force to override.\n', 'red');
177
- process.exit(1);
203
+ log('❌ Push blocked. Please update @penskemediacorp/larva before pushing.\n', 'red');
204
+ log('To override this check:', 'yellow');
205
+ log(' git push --force # Try force push', 'cyan');
206
+ log(' git push --no-verify # Skip hook entirely\n', 'cyan');
207
+ process.exit(1);
178
208
  }
179
209
  } else {
180
210
  log('✓ @penskemediacorp/larva is up to date!\n', 'green');
181
211
  process.exit(0);
182
- }
212
+ }
183
213
  }
184
214
 
185
215
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@penskemediacorp/larva",
3
- "version": "1.75.0",
3
+ "version": "1.76.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "laras126 <laras126@gmail.com>",
6
6
  "homepage": "https://github.com/Penske-Media-Corp/pmc-larva/tree/master/packages/larva#readme",
@@ -45,16 +45,16 @@
45
45
  "dependencies": {
46
46
  "@babel/core": "^7",
47
47
  "@babel/preset-env": "^7",
48
- "@penskemediacorp/backstopjs-config": "^1.75.0",
49
- "@penskemediacorp/eslint-config": "^1.75.0",
50
- "@penskemediacorp/larva-css": "^1.75.0",
51
- "@penskemediacorp/larva-js": "^1.75.0",
52
- "@penskemediacorp/larva-patterns": "^1.75.0",
53
- "@penskemediacorp/larva-scss": "^1.75.0",
54
- "@penskemediacorp/larva-svg": "^1.75.0",
55
- "@penskemediacorp/larva-tokens": "^1.75.0",
56
- "@penskemediacorp/stylelint-config": "^1.75.0",
57
- "@penskemediacorp/twig-to-php-parser": "^1.75.0",
48
+ "@penskemediacorp/backstopjs-config": "^1.76.0",
49
+ "@penskemediacorp/eslint-config": "^1.76.0",
50
+ "@penskemediacorp/larva-css": "^1.76.0",
51
+ "@penskemediacorp/larva-js": "^1.76.0",
52
+ "@penskemediacorp/larva-patterns": "^1.76.0",
53
+ "@penskemediacorp/larva-scss": "^1.76.0",
54
+ "@penskemediacorp/larva-svg": "^1.76.0",
55
+ "@penskemediacorp/larva-tokens": "^1.76.0",
56
+ "@penskemediacorp/stylelint-config": "^1.76.0",
57
+ "@penskemediacorp/twig-to-php-parser": "^1.76.0",
58
58
  "axios": "^1",
59
59
  "babel-loader": "^9",
60
60
  "chalk": "^4",
@@ -96,5 +96,5 @@
96
96
  "overrides": {
97
97
  "@wordpress/eslint-plugin": "^17"
98
98
  },
99
- "gitHead": "44ea285874d1c79466d31f3f013000b733e21c2f"
99
+ "gitHead": "c617273edbccc0474f01f8afca270842f18b234e"
100
100
  }
@@ -5,6 +5,7 @@ const gulpIgnore = require( 'gulp-ignore' );
5
5
  const gulpPostCss = require( 'gulp-postcss' );
6
6
  const gulpRename = require( 'gulp-rename' );
7
7
  const gulpStylelint = require( 'gulp-stylelint' );
8
+ const through2 = require( 'through2' );
8
9
 
9
10
  const globImporter = require( 'node-sass-glob-importer' );
10
11
  const { mkdirpSync } = require( 'fs-extra' );
@@ -45,6 +46,25 @@ const stylelintOpts = {
45
46
  Functions
46
47
  **************/
47
48
 
49
+ /**
50
+ * Strip UTF-8 BOM from CSS files.
51
+ * Prevents junk characters in production when CSS is concatenated.
52
+ *
53
+ * @return {Stream} Gulp stream transformer.
54
+ */
55
+ const stripBom = () => {
56
+ return through2.obj( function ( file, enc, cb ) {
57
+ if ( file.isBuffer() ) {
58
+ // Remove UTF-8 BOM (0xEF 0xBB 0xBF) if present
59
+ const bom = Buffer.from( [ 0xef, 0xbb, 0xbf ] );
60
+ if ( file.contents.slice( 0, 3 ).equals( bom ) ) {
61
+ file.contents = file.contents.slice( 3 );
62
+ }
63
+ }
64
+ cb( null, file );
65
+ } );
66
+ };
67
+
48
68
  /**
49
69
  * Build CSS.
50
70
  *
@@ -70,6 +90,7 @@ const buildScss = (
70
90
  gulp.src( './entries/*.scss' )
71
91
  .pipe( gulpStylelint( stylelintOpts ) )
72
92
  .pipe( sass( sassOpts ).on( 'error', sass.logError ) )
93
+ .pipe( stripBom() ) // Remove UTF-8 BOM added by Sass compiler
73
94
  .pipe( gulp.dest( cssDest ) )
74
95
  .pipe( gulpIgnore.exclude( 'larva-ui.css' ) )
75
96
  .pipe(