@@ -97,6 +97,10 @@ export function makePatch({
97
97
} )
98
98
99
99
function cleanup ( ) {
100
+ if ( isDebug ) {
101
+ console . log ( `patch-package/makePatch: cleanup: keeping temporary files: ${ tmpRepo . name } ` )
102
+ return
103
+ }
100
104
tmpRepo . removeCallback ( )
101
105
}
102
106
@@ -195,13 +199,14 @@ commitHash is the full hash with 40 chars.`)
195
199
}
196
200
}
197
201
// https://docs.npmjs.com/about-semantic-versioning
198
- if ( ! v . match ( / ^ [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + $ / ) ) {
199
- var exactPart = v . match ( / ^ [ ^ ~ ] ( [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + ) $ / )
200
- var exampleVersion = '1.2.3'
201
- if ( exactPart ) {
202
- exampleVersion = exactPart [ 1 ]
202
+ // TODO handle protocols? pnpm workspace: protocol does not make sense here, no need to patch local packages
203
+ var m = v . match ( / ^ ( [ ~ ^ ] ) ( .* ) $ / )
204
+ if ( m ) {
205
+ var exampleVersion = m [ 1 ]
206
+ if ( ! exampleVersion ) {
207
+ exampleVersion = '1.0.0'
203
208
}
204
- console . warn ( `patch-package/makePatch: warning: found wildcard version. \
209
+ console . warn ( `patch-package/makePatch: warning: found wildcard version ${ v } . \
205
210
to ensure successful patching, package.json should pin the exact version of ${ packageDetails . name } \
206
211
in the format <major>.<minor>.<patch>, for example: "${ packageDetails . name } ": "${ exampleVersion } "` )
207
212
}
@@ -473,11 +478,7 @@ in the format <major>.<minor>.<patch>, for example: "${packageDetails.name}": "$
473
478
// patchfiles are parsed in patch/parse.ts function parsePatchLines
474
479
// -> header comments are ignored
475
480
let diffHeader = ""
476
- const dateStr = (
477
- isTest ? '1980-01-01 00:00:00' : // mock date
478
- new Date ( ) . toLocaleString ( "lt" )
479
- )
480
- diffHeader += `# generated by patch-package ${ patchPackageVersion } on ${ dateStr } \n`
481
+ diffHeader += `# generated by patch-package ${ patchPackageVersion } \n`
481
482
diffHeader += `#\n`
482
483
const prettyArgv = process . argv . slice ( )
483
484
if ( prettyArgv [ 0 ] . match ( / n o d e / ) ) {
0 commit comments