| 1 |
// generated from test/fixtures/workspaces-non-simplistic |
| 2 |
module.exports = t => { |
| 3 |
const path = t.testdir({ |
| 4 |
"a": { |
| 5 |
"package.json": JSON.stringify({ |
| 6 |
"name": "pkg-a", |
| 7 |
"dependencies": { |
| 8 |
"@ruyadorno/dep-bar": "^1.0.0" |
| 9 |
} |
| 10 |
}) |
| 11 |
}, |
| 12 |
"node_modules": { |
| 13 |
".package-lock.json": JSON.stringify({ |
| 14 |
"name": "workspaces-non-simplistic", |
| 15 |
"lockfileVersion": 2, |
| 16 |
"requires": true, |
| 17 |
"packages": { |
| 18 |
"a": { |
| 19 |
"dependencies": { |
| 20 |
"@ruyadorno/dep-bar": "^1.0.0" |
| 21 |
} |
| 22 |
}, |
| 23 |
"node_modules/@ruyadorno/dep-bar": { |
| 24 |
"version": "1.0.0", |
| 25 |
"resolved": "https://registry.npmjs.org/@ruyadorno/dep-bar/-/dep-bar-1.0.0.tgz", |
| 26 |
"integrity": "sha512-odCQAbeN4ZPv0AAVIyVMZuX4sMYEsUgVAbAtRa+oDsLAoyz+weSQCDcefkk23sfqsJuOXTiohHJ3rcr0lN0rGA==", |
| 27 |
"dependencies": { |
| 28 |
"@ruyadorno/dep-foo": "^1.0.0" |
| 29 |
} |
| 30 |
}, |
| 31 |
"node_modules/@ruyadorno/dep-foo": { |
| 32 |
"version": "1.0.0", |
| 33 |
"resolved": "https://registry.npmjs.org/@ruyadorno/dep-foo/-/dep-foo-1.0.0.tgz", |
| 34 |
"integrity": "sha512-ffU1K0OPjx+75PIZRjDQy/Iwj/tAFYczGiqYx5ak9JWDRDubLwN2VLarPq4w0QqPdZtJ7Z9AMGDLKPmLnu6iZw==", |
| 35 |
"funding": { |
| 36 |
"type": "Patreon", |
| 37 |
"url": "https://patreon.com/ruyadorno" |
| 38 |
} |
| 39 |
}, |
| 40 |
"node_modules/abbrev": { |
| 41 |
"version": "1.1.1", |
| 42 |
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", |
| 43 |
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", |
| 44 |
"dev": true |
| 45 |
}, |
| 46 |
"node_modules/pkg-a": { |
| 47 |
"resolved": "a", |
| 48 |
"link": true |
| 49 |
} |
| 50 |
} |
| 51 |
}), |
| 52 |
"@ruyadorno": { |
| 53 |
"dep-bar": { |
| 54 |
"package.json": JSON.stringify({ |
| 55 |
"name": "@ruyadorno/dep-bar", |
| 56 |
"version": "1.0.0", |
| 57 |
"dependencies": { |
| 58 |
"@ruyadorno/dep-foo": "^1.0.0" |
| 59 |
} |
| 60 |
}) |
| 61 |
}, |
| 62 |
"dep-foo": { |
| 63 |
"package.json": JSON.stringify({ |
| 64 |
"name": "@ruyadorno/dep-foo", |
| 65 |
"version": "1.0.0", |
| 66 |
"description": "", |
| 67 |
"main": "index.js", |
| 68 |
"scripts": { |
| 69 |
"test": "echo \"Error: no test specified\" && exit 1" |
| 70 |
}, |
| 71 |
"funding": { |
| 72 |
"type": "Patreon", |
| 73 |
"url": "https://patreon.com/ruyadorno" |
| 74 |
}, |
| 75 |
"author": "Ruy Adorno", |
| 76 |
"license": "ISC" |
| 77 |
}) |
| 78 |
} |
| 79 |
}, |
| 80 |
"abbrev": { |
| 81 |
"LICENSE": `This software is dual-licensed under the ISC and MIT licenses. |
| 82 |
You may use this software under EITHER of the following licenses. |
| 83 |
|
| 84 |
---------- |
| 85 |
|
| 86 |
The ISC License |
| 87 |
|
| 88 |
Copyright (c) Isaac Z. Schlueter and Contributors |
| 89 |
|
| 90 |
Permission to use, copy, modify, and/or distribute this software for any |
| 91 |
purpose with or without fee is hereby granted, provided that the above |
| 92 |
copyright notice and this permission notice appear in all copies. |
| 93 |
|
| 94 |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 95 |
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 96 |
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 97 |
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 98 |
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 99 |
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR |
| 100 |
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 101 |
|
| 102 |
---------- |
| 103 |
|
| 104 |
Copyright Isaac Z. Schlueter and Contributors |
| 105 |
All rights reserved. |
| 106 |
|
| 107 |
Permission is hereby granted, free of charge, to any person |
| 108 |
obtaining a copy of this software and associated documentation |
| 109 |
files (the "Software"), to deal in the Software without |
| 110 |
restriction, including without limitation the rights to use, |
| 111 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 112 |
copies of the Software, and to permit persons to whom the |
| 113 |
Software is furnished to do so, subject to the following |
| 114 |
conditions: |
| 115 |
|
| 116 |
The above copyright notice and this permission notice shall be |
| 117 |
included in all copies or substantial portions of the Software. |
| 118 |
|
| 119 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 120 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 121 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 122 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 123 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 124 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 125 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 126 |
OTHER DEALINGS IN THE SOFTWARE. |
| 127 |
`, |
| 128 |
"README.md": `# abbrev-js |
| 129 |
|
| 130 |
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev). |
| 131 |
|
| 132 |
Usage: |
| 133 |
|
| 134 |
var abbrev = require("abbrev"); |
| 135 |
abbrev("foo", "fool", "folding", "flop"); |
| 136 |
|
| 137 |
// returns: |
| 138 |
{ fl: 'flop' |
| 139 |
, flo: 'flop' |
| 140 |
, flop: 'flop' |
| 141 |
, fol: 'folding' |
| 142 |
, fold: 'folding' |
| 143 |
, foldi: 'folding' |
| 144 |
, foldin: 'folding' |
| 145 |
, folding: 'folding' |
| 146 |
, foo: 'foo' |
| 147 |
, fool: 'fool' |
| 148 |
} |
| 149 |
|
| 150 |
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands. |
| 151 |
`, |
| 152 |
"abbrev.js": `module.exports = exports = abbrev.abbrev = abbrev |
| 153 |
|
| 154 |
abbrev.monkeyPatch = monkeyPatch |
| 155 |
|
| 156 |
function monkeyPatch () { |
| 157 |
Object.defineProperty(Array.prototype, 'abbrev', { |
| 158 |
value: function () { return abbrev(this) }, |
| 159 |
enumerable: false, configurable: true, writable: true |
| 160 |
}) |
| 161 |
|
| 162 |
Object.defineProperty(Object.prototype, 'abbrev', { |
| 163 |
value: function () { return abbrev(Object.keys(this)) }, |
| 164 |
enumerable: false, configurable: true, writable: true |
| 165 |
}) |
| 166 |
} |
| 167 |
|
| 168 |
function abbrev (list) { |
| 169 |
if (arguments.length !== 1 || !Array.isArray(list)) { |
| 170 |
list = Array.prototype.slice.call(arguments, 0) |
| 171 |
} |
| 172 |
for (var i = 0, l = list.length, args = [] ; i < l ; i ++) { |
| 173 |
args[i] = typeof list[i] === "string" ? list[i] : String(list[i]) |
| 174 |
} |
| 175 |
|
| 176 |
// sort them lexicographically, so that they're next to their nearest kin |
| 177 |
args = args.sort(lexSort) |
| 178 |
|
| 179 |
// walk through each, seeing how much it has in common with the next and previous |
| 180 |
var abbrevs = {} |
| 181 |
, prev = "" |
| 182 |
for (var i = 0, l = args.length ; i < l ; i ++) { |
| 183 |
var current = args[i] |
| 184 |
, next = args[i + 1] || "" |
| 185 |
, nextMatches = true |
| 186 |
, prevMatches = true |
| 187 |
if (current === next) continue |
| 188 |
for (var j = 0, cl = current.length ; j < cl ; j ++) { |
| 189 |
var curChar = current.charAt(j) |
| 190 |
nextMatches = nextMatches && curChar === next.charAt(j) |
| 191 |
prevMatches = prevMatches && curChar === prev.charAt(j) |
| 192 |
if (!nextMatches && !prevMatches) { |
| 193 |
j ++ |
| 194 |
break |
| 195 |
} |
| 196 |
} |
| 197 |
prev = current |
| 198 |
if (j === cl) { |
| 199 |
abbrevs[current] = current |
| 200 |
continue |
| 201 |
} |
| 202 |
for (var a = current.substr(0, j) ; j <= cl ; j ++) { |
| 203 |
abbrevs[a] = current |
| 204 |
a += current.charAt(j) |
| 205 |
} |
| 206 |
} |
| 207 |
return abbrevs |
| 208 |
} |
| 209 |
|
| 210 |
function lexSort (a, b) { |
| 211 |
return a === b ? 0 : a > b ? 1 : -1 |
| 212 |
} |
| 213 |
`, |
| 214 |
"package.json": JSON.stringify({ |
| 215 |
"name": "abbrev", |
| 216 |
"version": "1.1.1", |
| 217 |
"description": "Like ruby's abbrev module, but in js", |
| 218 |
"author": "Isaac Z. Schlueter <[email protected]>", |
| 219 |
"main": "abbrev.js", |
| 220 |
"scripts": { |
| 221 |
"test": "tap test.js --100", |
| 222 |
"preversion": "npm test", |
| 223 |
"postversion": "npm publish", |
| 224 |
"postpublish": "git push origin --all; git push origin --tags" |
| 225 |
}, |
| 226 |
"repository": "http://github.com/isaacs/abbrev-js", |
| 227 |
"license": "ISC", |
| 228 |
"devDependencies": { |
| 229 |
"tap": "^10.1" |
| 230 |
}, |
| 231 |
"files": [ |
| 232 |
"abbrev.js" |
| 233 |
] |
| 234 |
}) |
| 235 |
}, |
| 236 |
"pkg-a": t.fixture('symlink', "../a") |
| 237 |
}, |
| 238 |
"package-lock.json": JSON.stringify({ |
| 239 |
"name": "workspaces-non-simplistic", |
| 240 |
"lockfileVersion": 2, |
| 241 |
"requires": true, |
| 242 |
"packages": { |
| 243 |
"": { |
| 244 |
"workspaces": [ |
| 245 |
"a" |
| 246 |
], |
| 247 |
"devDependencies": { |
| 248 |
"abbrev": "^1.0.0" |
| 249 |
} |
| 250 |
}, |
| 251 |
"a": { |
| 252 |
"dependencies": { |
| 253 |
"@ruyadorno/dep-bar": "^1.0.0" |
| 254 |
} |
| 255 |
}, |
| 256 |
"node_modules/@ruyadorno/dep-bar": { |
| 257 |
"version": "1.0.0", |
| 258 |
"resolved": "https://registry.npmjs.org/@ruyadorno/dep-bar/-/dep-bar-1.0.0.tgz", |
| 259 |
"integrity": "sha512-odCQAbeN4ZPv0AAVIyVMZuX4sMYEsUgVAbAtRa+oDsLAoyz+weSQCDcefkk23sfqsJuOXTiohHJ3rcr0lN0rGA==", |
| 260 |
"dependencies": { |
| 261 |
"@ruyadorno/dep-foo": "^1.0.0" |
| 262 |
} |
| 263 |
}, |
| 264 |
"node_modules/@ruyadorno/dep-foo": { |
| 265 |
"version": "1.0.0", |
| 266 |
"resolved": "https://registry.npmjs.org/@ruyadorno/dep-foo/-/dep-foo-1.0.0.tgz", |
| 267 |
"integrity": "sha512-ffU1K0OPjx+75PIZRjDQy/Iwj/tAFYczGiqYx5ak9JWDRDubLwN2VLarPq4w0QqPdZtJ7Z9AMGDLKPmLnu6iZw==", |
| 268 |
"funding": { |
| 269 |
"type": "Patreon", |
| 270 |
"url": "https://patreon.com/ruyadorno" |
| 271 |
} |
| 272 |
}, |
| 273 |
"node_modules/abbrev": { |
| 274 |
"version": "1.1.1", |
| 275 |
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", |
| 276 |
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", |
| 277 |
"dev": true |
| 278 |
}, |
| 279 |
"node_modules/pkg-a": { |
| 280 |
"resolved": "a", |
| 281 |
"link": true |
| 282 |
} |
| 283 |
}, |
| 284 |
"dependencies": { |
| 285 |
"@ruyadorno/dep-bar": { |
| 286 |
"version": "1.0.0", |
| 287 |
"resolved": "https://registry.npmjs.org/@ruyadorno/dep-bar/-/dep-bar-1.0.0.tgz", |
| 288 |
"integrity": "sha512-odCQAbeN4ZPv0AAVIyVMZuX4sMYEsUgVAbAtRa+oDsLAoyz+weSQCDcefkk23sfqsJuOXTiohHJ3rcr0lN0rGA==", |
| 289 |
"requires": { |
| 290 |
"@ruyadorno/dep-foo": "^1.0.0" |
| 291 |
} |
| 292 |
}, |
| 293 |
"@ruyadorno/dep-foo": { |
| 294 |
"version": "1.0.0", |
| 295 |
"resolved": "https://registry.npmjs.org/@ruyadorno/dep-foo/-/dep-foo-1.0.0.tgz", |
| 296 |
"integrity": "sha512-ffU1K0OPjx+75PIZRjDQy/Iwj/tAFYczGiqYx5ak9JWDRDubLwN2VLarPq4w0QqPdZtJ7Z9AMGDLKPmLnu6iZw==" |
| 297 |
}, |
| 298 |
"abbrev": { |
| 299 |
"version": "1.1.1", |
| 300 |
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", |
| 301 |
"integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", |
| 302 |
"dev": true |
| 303 |
}, |
| 304 |
"pkg-a": { |
| 305 |
"version": "file:a", |
| 306 |
"requires": { |
| 307 |
"@ruyadorno/dep-bar": "^1.0.0" |
| 308 |
} |
| 309 |
} |
| 310 |
} |
| 311 |
}), |
| 312 |
"package.json": JSON.stringify({ |
| 313 |
"name": "workspaces-non-simplistic", |
| 314 |
"workspaces": [ |
| 315 |
"a" |
| 316 |
], |
| 317 |
"devDependencies": { |
| 318 |
"abbrev": "^1.0.0" |
| 319 |
} |
| 320 |
}) |
| 321 |
}) |
| 322 |
const {utimesSync} = require('fs') |
| 323 |
const n = Date.now() + 10000 |
| 324 |
const {resolve} = require('path') |
| 325 |
|
| 326 |
utimesSync(resolve(path, "node_modules/.package-lock.json"), new Date(n), new Date(n)) |
| 327 |
return path |
| 328 |
} |