@penskemediacorp/larva 1.74.0 ā 1.75.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/install-hooks.js +122 -0
- package/bin/pre-push +185 -0
- package/build/css/larva-important.css +1 -1
- package/build/css/larva.css +1 -1
- package/build/css/larva.inline-important.css +1 -1
- package/build/css/larva.inline.css +1 -1
- package/build/js/standalone/video-showcase.js +1 -1
- package/build/svg/defs/sprite.defs.html +1 -1
- package/build/tokens/artinamerica.custom-properties.css +1 -1
- package/build/tokens/artnews.custom-properties.css +1 -1
- package/build/tokens/bbesp-2025.custom-properties.css +1 -1
- package/build/tokens/bbesp.custom-properties.css +1 -1
- package/build/tokens/bbpro-2025.custom-properties.css +1 -1
- package/build/tokens/bbpro.custom-properties.css +1 -1
- package/build/tokens/billboard-2025.custom-properties.css +1 -1
- package/build/tokens/billboard.custom-properties.css +1 -1
- package/build/tokens/deadline.custom-properties.css +1 -1
- package/build/tokens/dirt.custom-properties.css +1 -1
- package/build/tokens/indiewire.custom-properties.css +1 -1
- package/build/tokens/rivet.custom-properties.css +1 -1
- package/build/tokens/rollingstone-2022.custom-properties.css +1 -1
- package/build/tokens/rollingstone.custom-properties.css +1 -1
- package/build/tokens/sheknows.custom-properties.css +1 -1
- package/build/tokens/sheknows.json +6 -0
- package/build/tokens/sheknows.map.scss +6 -0
- package/build/tokens/sheknows.raw.json +42 -0
- package/build/tokens/sourcingjournal.custom-properties.css +1 -1
- package/build/tokens/spy-2022.custom-properties.css +1 -1
- package/build/tokens/thr.custom-properties.css +1 -1
- package/build/tokens/variety-vip.custom-properties.css +1 -1
- package/build/tokens/variety.custom-properties.css +1 -1
- package/build/tokens/vibe-2024.custom-properties.css +1 -1
- package/build/tokens/vibe.custom-properties.css +1 -1
- package/build/tokens/wwd-2021.custom-properties.css +1 -1
- package/build/tokens/wwd-beauty.custom-properties.css +1 -1
- package/build/tokens/wwd-dd.custom-properties.css +1 -1
- package/build/tokens/wwd-fn.custom-properties.css +1 -1
- package/build/tokens/wwd.custom-properties.css +1 -1
- package/package.json +15 -14
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Git Hooks Installation Script
|
|
5
|
+
*
|
|
6
|
+
* Copies pre-push hook from larva package to .git/hooks/ for all team members.
|
|
7
|
+
* Runs automatically via npm postinstall script.
|
|
8
|
+
*
|
|
9
|
+
* Source: node_modules/@penskemediacorp/larva/bin/pre-push
|
|
10
|
+
* Target: root/.git/hooks/pre-push (local, not tracked)
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const fs = require( 'fs' );
|
|
14
|
+
const path = require( 'path' );
|
|
15
|
+
const { execSync } = require( 'child_process' );
|
|
16
|
+
|
|
17
|
+
const colors = {
|
|
18
|
+
reset: '\x1b[0m',
|
|
19
|
+
green: '\x1b[32m',
|
|
20
|
+
yellow: '\x1b[33m',
|
|
21
|
+
cyan: '\x1b[36m',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
function log( message, color = 'reset' ) {
|
|
25
|
+
console.log( `${ colors[ color ] }${ message }${ colors.reset }` );
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function findGitRoot() {
|
|
29
|
+
// Try multiple strategies to find the correct git root
|
|
30
|
+
|
|
31
|
+
// Strategy 1: Check if INIT_CWD is set (npm sets this to original directory)
|
|
32
|
+
if ( process.env.INIT_CWD ) {
|
|
33
|
+
try {
|
|
34
|
+
const gitRoot = execSync( 'git rev-parse --show-toplevel', {
|
|
35
|
+
encoding: 'utf8',
|
|
36
|
+
cwd: process.env.INIT_CWD,
|
|
37
|
+
} ).trim();
|
|
38
|
+
return gitRoot;
|
|
39
|
+
} catch ( e ) {
|
|
40
|
+
// Fall through to next strategy
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Strategy 2: Walk up from node_modules to find .git
|
|
45
|
+
let currentDir = __dirname;
|
|
46
|
+
while ( currentDir !== path.parse( currentDir ).root ) {
|
|
47
|
+
// Go up until we find node_modules
|
|
48
|
+
if ( currentDir.includes( 'node_modules' ) ) {
|
|
49
|
+
// Go up from node_modules/@penskemediacorp/larva to the project root
|
|
50
|
+
const parts = currentDir.split( path.sep );
|
|
51
|
+
const nodeModulesIndex = parts.lastIndexOf( 'node_modules' );
|
|
52
|
+
if ( nodeModulesIndex > 0 ) {
|
|
53
|
+
const projectRoot = parts.slice( 0, nodeModulesIndex ).join( path.sep );
|
|
54
|
+
const gitDir = path.join( projectRoot, '.git' );
|
|
55
|
+
if ( fs.existsSync( gitDir ) ) {
|
|
56
|
+
return projectRoot;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
currentDir = path.dirname( currentDir );
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Strategy 3: Use current working directory as fallback
|
|
65
|
+
try {
|
|
66
|
+
return execSync( 'git rev-parse --show-toplevel', {
|
|
67
|
+
encoding: 'utf8',
|
|
68
|
+
cwd: process.cwd(),
|
|
69
|
+
} ).trim();
|
|
70
|
+
} catch ( e ) {
|
|
71
|
+
throw new Error( 'Could not find git repository' );
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function installHooks() {
|
|
76
|
+
try {
|
|
77
|
+
// Find the correct git root
|
|
78
|
+
const gitRoot = findGitRoot();
|
|
79
|
+
|
|
80
|
+
// Source hook is in bin folder (same directory as this script)
|
|
81
|
+
const sourceHookPath = path.join( __dirname, 'pre-push' );
|
|
82
|
+
const targetHookPath = path.join( gitRoot, '.git', 'hooks', 'pre-push' );
|
|
83
|
+
|
|
84
|
+
if (!fs.existsSync(sourceHookPath)) {
|
|
85
|
+
log( 'ā ļø Larva pre-push hook not found', 'yellow' );
|
|
86
|
+
log( `Looking in: ${ sourceHookPath }`, 'yellow' );
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Create .git/hooks directory if needed
|
|
91
|
+
const hooksDir = path.dirname( targetHookPath );
|
|
92
|
+
if ( ! fs.existsSync( hooksDir ) ) {
|
|
93
|
+
fs.mkdirSync( hooksDir, { recursive: true } );
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Copy the hook
|
|
97
|
+
fs.copyFileSync( sourceHookPath, targetHookPath );
|
|
98
|
+
|
|
99
|
+
// Make executable
|
|
100
|
+
if ( process.platform !== 'win32' ) {
|
|
101
|
+
fs.chmodSync( targetHookPath, '755' );
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
log( 'ā Larva pre-push hook installed successfully!', 'green' );
|
|
105
|
+
log( ` Git root: ${ gitRoot }`, 'cyan' );
|
|
106
|
+
log( ` Source: ${ sourceHookPath }`, 'cyan' );
|
|
107
|
+
log( ` Target: ${ targetHookPath }`, 'cyan' );
|
|
108
|
+
return true;
|
|
109
|
+
} catch ( error ) {
|
|
110
|
+
log( `ā ļø Could not install Larva hook: ${ error.message }`, 'yellow' );
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Run if called directly
|
|
116
|
+
if ( require.main === module ) {
|
|
117
|
+
log( '\nš¦ Installing Larva Git hooks...', 'cyan' );
|
|
118
|
+
installHooks();
|
|
119
|
+
log( '' );
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
module.exports = { installHooks };
|
package/bin/pre-push
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pre-Push Git Hook - Larva Version Checker
|
|
5
|
+
*
|
|
6
|
+
* Automatically checks if @penskemediacorp/larva is up-to-date before allowing git push.
|
|
7
|
+
* Blocks push if update is available, unless --force flag is used.
|
|
8
|
+
*
|
|
9
|
+
* Installation: Auto-installed via npm postinstall script
|
|
10
|
+
* Override: Use --force, -f, or --no-verify flags
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const { execSync } = require( 'child_process' );
|
|
14
|
+
const fs = require( 'fs' );
|
|
15
|
+
const path = require( 'path' );
|
|
16
|
+
const os = require( 'os' );
|
|
17
|
+
|
|
18
|
+
// Cache configuration
|
|
19
|
+
const CACHE_FILE = path.join(os.tmpdir(), 'larva-version-cache.json');
|
|
20
|
+
const CACHE_DURATION = 1000 * 60 * 60 * 24; // 1 Day.
|
|
21
|
+
|
|
22
|
+
// ANSI color codes
|
|
23
|
+
const colors = {
|
|
24
|
+
reset: '\x1b[0m',
|
|
25
|
+
red: '\x1b[31m',
|
|
26
|
+
yellow: '\x1b[33m',
|
|
27
|
+
green: '\x1b[32m',
|
|
28
|
+
cyan: '\x1b[36m',
|
|
29
|
+
bold: '\x1b[1m'
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function log(message, color = 'reset') {
|
|
33
|
+
console.log(`${colors[color]}${message}${colors.reset}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function getCurrentLarvaVersion() {
|
|
37
|
+
try {
|
|
38
|
+
// Get git root directory
|
|
39
|
+
const gitRoot = execSync('git rev-parse --show-toplevel', {
|
|
40
|
+
encoding: 'utf8'
|
|
41
|
+
}).trim();
|
|
42
|
+
|
|
43
|
+
// Look for package.json in assets folder
|
|
44
|
+
const packageJsonPath = path.join(gitRoot, 'assets', 'package.json');
|
|
45
|
+
|
|
46
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
51
|
+
const larvaVersion = packageJson.dependencies?.['@penskemediacorp/larva'] ||
|
|
52
|
+
packageJson.devDependencies?.['@penskemediacorp/larva'];
|
|
53
|
+
|
|
54
|
+
if (!larvaVersion) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Remove all semver operators and pre-release tags
|
|
59
|
+
return larvaVersion.replace(/^[\^~>=<]+/, '').split('-')[0].split('+')[0];
|
|
60
|
+
} catch (error) {
|
|
61
|
+
log(`Error reading package.json: ${error.message}`, 'red');
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function getLatestLarvaVersion() {
|
|
67
|
+
|
|
68
|
+
// Check cache first
|
|
69
|
+
if ( fs.existsSync( CACHE_FILE ) ) {
|
|
70
|
+
try {
|
|
71
|
+
const cache = JSON.parse( fs.readFileSync( CACHE_FILE, 'utf8' ) );
|
|
72
|
+
const now = Date.now();
|
|
73
|
+
|
|
74
|
+
// Return cached version if still valid
|
|
75
|
+
if ( cache.timestamp && cache.version && ( now - cache.timestamp ) < CACHE_DURATION ) {
|
|
76
|
+
return cache.version;
|
|
77
|
+
}
|
|
78
|
+
} catch ( error ) {
|
|
79
|
+
// Invalid cache file, continue to fetch
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
const result = execSync('npm view @penskemediacorp/larva version', {
|
|
85
|
+
encoding: 'utf8',
|
|
86
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
87
|
+
timeout: 5000 // 5 second timeout
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const version = result.trim();
|
|
91
|
+
|
|
92
|
+
// Save to cache
|
|
93
|
+
try {
|
|
94
|
+
fs.writeFileSync( CACHE_FILE, JSON.stringify( {
|
|
95
|
+
version: version,
|
|
96
|
+
timestamp: Date.now()
|
|
97
|
+
} ), 'utf8' );
|
|
98
|
+
} catch ( error ) {
|
|
99
|
+
// Cache write failure is non-critical, ignore
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return version;
|
|
103
|
+
} catch (error) {
|
|
104
|
+
// Check if it's a timeout error.
|
|
105
|
+
if ( error.killed ) {
|
|
106
|
+
log( 'Warning: npm registry request timed out', 'yellow' );
|
|
107
|
+
} else {
|
|
108
|
+
log( 'Warning: Could not fetch latest @penskemediacorp/larva version from npm', 'yellow' );
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function compareVersions(current, latest) {
|
|
115
|
+
const currentParts = current.split('.').map(Number);
|
|
116
|
+
const latestParts = latest.split('.').map(Number);
|
|
117
|
+
|
|
118
|
+
for (let i = 0; i < Math.max(currentParts.length, latestParts.length); i++) {
|
|
119
|
+
const curr = currentParts[i] || 0;
|
|
120
|
+
const lat = latestParts[i] || 0;
|
|
121
|
+
|
|
122
|
+
if (lat > curr) return 1; // Update available
|
|
123
|
+
if (lat < curr) return -1; // Current is newer
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return 0; // Same version
|
|
127
|
+
}
|
|
128
|
+
|
|
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' );
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function main() {
|
|
136
|
+
log('\nš Checking @penskemediacorp/larva version...', 'cyan');
|
|
137
|
+
|
|
138
|
+
const currentVersion = getCurrentLarvaVersion();
|
|
139
|
+
|
|
140
|
+
if (!currentVersion) {
|
|
141
|
+
log('ā No @penskemediacorp/larva dependency found in this project', 'green');
|
|
142
|
+
process.exit(0);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
log(`Current version: ${currentVersion}`, 'cyan');
|
|
146
|
+
|
|
147
|
+
const latestVersion = getLatestLarvaVersion();
|
|
148
|
+
|
|
149
|
+
if (!latestVersion) {
|
|
150
|
+
log('ā Could not verify latest version, proceeding with push...', 'yellow');
|
|
151
|
+
process.exit(0);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
log(`Latest version: ${latestVersion}`, 'cyan');
|
|
155
|
+
|
|
156
|
+
const comparison = compareVersions(currentVersion, latestVersion);
|
|
157
|
+
|
|
158
|
+
if (comparison > 0) {
|
|
159
|
+
// Update available (latest is greater than current)
|
|
160
|
+
const forceFlag = checkForceFlag();
|
|
161
|
+
|
|
162
|
+
log('\n' + '='.repeat(60), 'yellow');
|
|
163
|
+
log('ā ļø UPDATE AVAILABLE FOR @penskemediacorp/larva', 'yellow');
|
|
164
|
+
log('='.repeat(60), 'yellow');
|
|
165
|
+
log(`Current: ${currentVersion}`, 'red');
|
|
166
|
+
log(`Latest: ${latestVersion}`, 'green');
|
|
167
|
+
log('\nPlease update @penskemediacorp/larva before pushing:', 'yellow');
|
|
168
|
+
log(' npm install @penskemediacorp/larva@latest', 'cyan');
|
|
169
|
+
log('='.repeat(60) + '\n', 'yellow');
|
|
170
|
+
|
|
171
|
+
if (forceFlag) {
|
|
172
|
+
log('ā ļø Force flag detected - allowing push with outdated version', 'yellow');
|
|
173
|
+
log('Please update @penskemediacorp/larva as soon as possible!\n', 'yellow');
|
|
174
|
+
process.exit(0);
|
|
175
|
+
} else {
|
|
176
|
+
log('ā Push blocked. Update @penskemediacorp/larva or use --force to override.\n', 'red');
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
} else {
|
|
180
|
+
log('ā @penskemediacorp/larva is up to date!\n', 'green');
|
|
181
|
+
process.exit(0);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
main();
|