Drop m.version (#2466)

* Drop `m.version`

It's caused way too much grief over the years, and I've finally decided
it's worth pitching. For those who need it, it's easy to get, especially
if you use it through Node or a build system. And for those who are just
loading it globally, you have to explicitly specify the version anyways,
so you'd be just as golden if you followed it up with a simple inline
script that does `m.version = "the version you loaded"`.

Oh, and also, you shouldn't be coding specifically for version numbers,
either - it's a known anti-pattern. Instead, you should prefer feature
detection and just do the right thing.

* Update changelog [skip ci]
This commit is contained in:
Isiah Meadows 2019-07-10 14:04:44 -04:00 committed by GitHub
parent 02a91356c0
commit 904b63b2aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 2 additions and 47 deletions

View file

@ -1,10 +0,0 @@
"use strict"
const fs = require("fs")
const version = require("../package.json").version
const index = require.resolve("../index")
fs.writeFile(index,
fs.readFile(index, "utf-8")
.replace(/(version\s*=\s*)(['"]).*?\2/, `$1$2${version}$2`)
)