@@ -12,6 +12,20 @@ import { parseArgs } from '@socketsecurity/lib/argv/parse'
1212const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
1313const rootDir = path . join ( __dirname , '..' )
1414
15+ /**
16+ * Generates a datetime-based version string.
17+ */
18+ function generateDatetimeVersion ( ) {
19+ const now = new Date ( )
20+ const year = now . getFullYear ( )
21+ const month = String ( now . getMonth ( ) + 1 ) . padStart ( 2 , '0' )
22+ const day = String ( now . getDate ( ) ) . padStart ( 2 , '0' )
23+ const hours = String ( now . getHours ( ) ) . padStart ( 2 , '0' )
24+ const minutes = String ( now . getMinutes ( ) ) . padStart ( 2 , '0' )
25+ const seconds = String ( now . getSeconds ( ) ) . padStart ( 2 , '0' )
26+ return `${ year } .${ month } .${ day } .${ hours } ${ minutes } ${ seconds } `
27+ }
28+
1529const { values } = parseArgs ( {
1630 options : {
1731 platform : { type : 'string' } ,
@@ -39,18 +53,6 @@ if (!platform || !arch) {
3953 process . exit ( 1 )
4054}
4155
42- // Generate datetime version if not provided
43- const generateDatetimeVersion = ( ) => {
44- const now = new Date ( )
45- const year = now . getFullYear ( )
46- const month = String ( now . getMonth ( ) + 1 ) . padStart ( 2 , '0' )
47- const day = String ( now . getDate ( ) ) . padStart ( 2 , '0' )
48- const hours = String ( now . getHours ( ) ) . padStart ( 2 , '0' )
49- const minutes = String ( now . getMinutes ( ) ) . padStart ( 2 , '0' )
50- const seconds = String ( now . getSeconds ( ) ) . padStart ( 2 , '0' )
51- return `${ year } .${ month } .${ day } .${ hours } ${ minutes } ${ seconds } `
52- }
53-
5456// Clean version (remove 'v' prefix if present) or generate if not provided
5557const cleanVersion = providedVersion
5658 ? providedVersion . replace ( / ^ v / , '' )
0 commit comments