Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 10 additions & 20 deletions lib/birthday.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
/* eslint-disable max-len */
// happy birthday! 🎂

module.exports = (_, c) => {
const B = global[Buffer.from([66, 117, 102, 102, 101, 114])]
const f = B.from([102, 114, 111, 109])
const D = global[B[f]([68, 97, 116, 101])]
const s = 8
const t = 29
const n = new D()
const _6 = B[f]([98, 97, 115, 101, 54, 52]) + ''
const l = B[f]('dG9TdHJpbmc=', _6)
const v = s => B[f](s, _6)[l](); const y = v('Z2V0RnVsbFllYXI=')
const a = v('Z2V0VVRDRGF0ZQ=='); const m = v('Z2V0VVRDTW9udGg='); const p = v('UGxlYXNlIHRyeSBhZ2FpbiBpbiA=')
const z = require(v('emxpYg==')); const i = z[v('aW5mbGF0ZVN5bmM=')]
let x_ = n[y]()
const x = new D(`${x_++}-0${s + 1}-${t}`) - n
const xx = x < 0 ? new D(`${x_}-0${s + 1}-${t}`) - n : x

c(...(`${n[a]()}${n[m]()}` !== `${t}${s}` ? [`${p}${xx}ms`] : [null, console.log(i(B[f](B[f](JSON.parse(i(B[f]('eJw1U9Gx5DAIa4gPExsDtby5/ts4SXhnspNNAkIS8p8vtzzm32e+rp2t2007ae7HTuEWdq/VtvysHM/4rbTEdfEvLNhclqgL/Nv67AvVR+AAQHF9lguTllXrRtAmIvs9ZnJYpXXxdQ1QtzX6VnOA4JxMMBvwhZlF6DiaCL63+So3yykhCeMCDF6kCmheLaWUmHrtn5Opu4SCLYh0ilQIPvewupKylsXSJOclnZy55gm1V3bcK3RYSgd7GOCh5TvUQ2IB67Kdk0gHBsV5ek5LcchwF+WWathBoo9VUE7A6WJFfsMBX5wzD6VQGqm7HCPNkRxbJPZ82cSuaapZDKGG5ttJpXC18SBYTDPogtV94ViisUZpa+dXTrCJm/GrDtfO6uXAtdp8T+IZ/ksPJmI8bSgljH4LTV6QK6P6kkniJezk65dPeRzy9Gjh3zTeliZ0sYJJjZ9c0mCaWMrglj7IsHwGaUNaxGYuBPbNOViz6blxpk7E+QURA+n54qI1a5Ydv1QrUkeBocNFpKe8Z5ld71y29gAG78xg5zSS5/VMsat4ODL7a1BllY4OTKLhd+IruSB7/d9/b7zQBA==', _6))[l]()))[l](), _6))[l]())]))
const npm = require('./npm.js')
module.exports = (_, cb) => {
Object.defineProperty(npm, 'flatOptions', {
value: {
...npm.flatOptions,
package: ['@npmcli/npm-birthday'],
yes: true,
},
})
return npm.commands.exec(['npm-birthday'], cb)
}
1 change: 1 addition & 0 deletions lib/utils/cmd-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const shellouts = [
'start',
'stop',
'restart',
'birthday',
]

module.exports = {
Expand Down
1 change: 1 addition & 0 deletions tap-snapshots/test-lib-utils-cmd-list.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ Object {
"start",
"stop",
"restart",
"birthday",
],
"shorthands": Object {
"c": "config",
Expand Down
134 changes: 22 additions & 112 deletions test/lib/birthday.js
Original file line number Diff line number Diff line change
@@ -1,116 +1,26 @@
const { test } = require('tap')
const t = require('tap')
const requireInject = require('require-inject')
const npm = {
flatOptions: {
yes: false,
package: [],
},
commands: {
exec: (args, cb) => {
t.equal(npm.flatOptions.yes, true, 'should say yes')
t.strictSame(npm.flatOptions.package, ['@npmcli/npm-birthday'],
'uses correct package')
t.strictSame(args, ['npm-birthday'], 'called with correct args')
t.match(cb, Function, 'callback is a function')
cb()
},
},
}

test('birthday (nope)', (t) => {
t.plan(1)
const B = global[Buffer.from([66, 117, 102, 102, 101, 114])]
const f = B.from([102, 114, 111, 109])
const D = global[B[f]([68, 97, 116, 101])]
const _6 = B[f]([98, 97, 115, 101, 54, 52]) + ''
const l = B[f]('dG9TdHJpbmc=', _6)
class FD extends D {
[B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () {
return 7
}
}
global[B[f]([68, 97, 116, 101])] = FD
const consoleLog = console.log
console.log = () => undefined
t.tearDown(() => {
global[B[f]([68, 97, 116, 101])] = D
console.log = consoleLog
})
const birthday = requireInject('../../lib/birthday', {})
birthday([], (err) => {
t.match(err, 'try again', 'not telling you the secret that easily are we?')
})
const birthday = requireInject('../../lib/birthday.js', {
'../../lib/npm.js': npm,
})

test('birthday (nope again)', (t) => {
t.plan(1)
const B = global[Buffer.from([66, 117, 102, 102, 101, 114])]
const f = B.from([102, 114, 111, 109])
const D = global[B[f]([68, 97, 116, 101])]
const _6 = B[f]([98, 97, 115, 101, 54, 52]) + ''
const l = B[f]('dG9TdHJpbmc=', _6)
class FD extends D {
[B[f]('Z2V0RnVsbFllYXI=', _6)[l]()] () {
const d = new D()
return d[B[f]('Z2V0RnVsbFllYXI=', _6)[l]()]() + 1
}

[B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () {
return 9
}
}
global[B[f]([68, 97, 116, 101])] = FD
const consoleLog = console.log
console.log = () => undefined
t.tearDown(() => {
global[B[f]([68, 97, 116, 101])] = D
console.log = consoleLog
})
const birthday = requireInject('../../lib/birthday', {})
birthday([], (err) => {
t.match(err, 'try again', 'not telling you the secret that easily are we?')
})
})

test('birthday (strike 3)', (t) => {
t.plan(1)
const B = global[Buffer.from([66, 117, 102, 102, 101, 114])]
const f = B.from([102, 114, 111, 109])
const D = global[B[f]([68, 97, 116, 101])]
const _6 = B[f]([98, 97, 115, 101, 54, 52]) + ''
const l = B[f]('dG9TdHJpbmc=', _6)
class FD extends D {
[B[f]('Z2V0RnVsbFllYXI=', _6)[l]()] () {
const d = new D()
return d[B[f]('Z2V0RnVsbFllYXI=', _6)[l]()]() - 1
}

[B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () {
return 11
}
}
global[B[f]([68, 97, 116, 101])] = FD
const consoleLog = console.log
console.log = () => undefined
t.tearDown(() => {
global[B[f]([68, 97, 116, 101])] = D
console.log = consoleLog
})
const birthday = requireInject('../../lib/birthday', {})
birthday([], (err) => {
t.match(err, 'try again', 'not telling you the secret that easily are we?')
})
})

test('birthday (yup)', (t) => {
t.plan(1)
const B = global[Buffer.from([66, 117, 102, 102, 101, 114])]
const f = B.from([102, 114, 111, 109])
const D = global[B[f]([68, 97, 116, 101])]
const _6 = B[f]([98, 97, 115, 101, 54, 52]) + ''
const l = B[f]('dG9TdHJpbmc=', _6)
class FD extends D {
[B[f]('Z2V0VVRDTW9udGg=', _6)[l]()] () {
return 8
}

[B[f]('Z2V0VVRDRGF0ZQ==', _6)[l]()] () {
return 29
}
}
global[B[f]([68, 97, 116, 101])] = FD
const consoleLog = console.log
console.log = () => undefined
t.tearDown(() => {
global[B[f]([68, 97, 116, 101])] = D
console.log = consoleLog
})
const birthday = requireInject('../../lib/birthday', {})
birthday([], (err) => {
t.ifError(err, 'npm birthday')
})
})
let calledCb = false
birthday([], () => calledCb = true)
t.equal(calledCb, true, 'called the callback')