Skip to content

Commit

Permalink
ncu -u
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed Sep 22, 2021
1 parent 97cd204 commit f224c95
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 695 deletions.
26 changes: 15 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,66 @@ This module follows semver.
- 🐞 Backwards-compatible bug fixes
- 📦 Minor packaging changes

## v1.6.0

- 📦 Upgrade all dev dependencies

## v1.5.0

- 📦 Add default exports (so `import v from "./Versions"` works, if you want namespaced access).
- 📦 Upgrade all deps
- 📦 Upgrade all dev dependencies

## v1.4.0

- ✨ Support ECMAScript module formats (`.mjs`)
- 📦 Upgrade all deps
- 📦 Upgrade all dev dependencies

## v1.3.6

- 📦 Upgrade all deps (including TypeScript 4.1)
- 📦 Upgrade all dev dependencies (including TypeScript 4.1)

## v1.3.5

- 📦 Upgrade all deps
- 📦 Upgrade all dev dependencies

## v1.3.4

- 📦 Upgrade all deps
- 📦 Upgrade all dev dependencies

## v1.3.3

- 📦 `Version.js` and `Version.ts` both use semicolons now
- 📦 version.ts has test coverage
- 📦 Upgrade all deps
- 📦 Upgrade all dev dependencies
- 📦 Prettier 2.0.0 diffs

## v1.3.2

- 📦 Upgrade all deps, migrate mocha opts
- 📦 Upgrade all dev dependencies, migrate mocha opts

## v1.3.1

- 📦 Upgrade all deps
- 📦 Upgrade all dev dependencies

## v1.3.0

- ✨ Support arbitrarily deep subpackages (if running on node 10.13+)
- 📦 Add better integration tests (by spawning the binfile)
- 📦 prettier .js
- 📦 Upgrade all deps
- 📦 Upgrade all dev dependencies

## v1.2.0

- ✨ Remove runtime dependency on `fs-extra`
- 📦 Upgrade all deps
- 📦 Upgrade all dev dependencies

## v1.1.2

- 📦 Support for `mkver --help`

## v1.1.1

- 📦 Upgrade all deps
- 📦 Upgrade all dev dependencies
- 📦 Add node 11 to the build matrix

## v1.1.0
Expand Down
4 changes: 2 additions & 2 deletions bin/mkver
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Provides Node.js access to your app's version and release metadata.
With no FILE, default output is "./Version.ts".
See <https://github.com/mceachen/mkver> for more information.
See <https://github.com/photostructure/mkver> for more information.
`;

if (String(argv[2]).startsWith("-")) {
if (["--help", "-h"].includes(String(argv[2]))) {
// Assume people don't want filenames that start with a dash.
// Show them usage instructions:
console.log(usage);
Expand Down
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "dist/mkver.js",
"scripts": {
"prettier": "prettier --write src/*.ts bin/mkver",
"pretest": "del-cli dist && tsc",
"pretest": "rimraf dist && tsc",
"test": "mocha dist/**/*.spec.js",
"ci": "yarn install --frozen-lockfile"
},
Expand All @@ -26,17 +26,18 @@
},
"homepage": "https://github.com/photostructure/mkver#readme",
"devDependencies": {
"@types/chai": "^4.2.19",
"@types/mocha": "^8.2.2",
"@types/node": "^15.12.5",
"@types/semver": "^7.3.6",
"@types/chai": "^4.2.22",
"@types/chai-as-promised": "^7.1.4",
"@types/mocha": "^9.0.0",
"@types/node": "^16.9.6",
"@types/semver": "^7.3.8",
"chai": "^4.3.4",
"del-cli": "^4.0.0",
"mocha": "^9.0.1",
"prettier": "^2.3.2",
"chai-as-promised": "^7.1.1",
"mocha": "^9.1.1",
"prettier": "^2.4.1",
"rimraf": "^3.0.2",
"semver": "^7.3.5",
"source-map-support": "^0.5.19",
"tempy": "^1.0.1",
"typescript": "^4.3.5"
"source-map-support": "^0.5.20",
"typescript": "^4.4.3"
}
}
16 changes: 12 additions & 4 deletions src/mkver.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { expect } from "chai"
import { ChildProcess, execFile, execSync, fork, spawn } from "child_process"
import { writeFileSync } from "fs"
import { platform } from "os"
import { mkdirSync, writeFileSync } from "fs"
import { platform, tmpdir } from "os"
import { join, parse } from "path"
import * as semver from "semver"
import { directory } from "tempy"
import { fmtYMDHMS } from "./mkver"

describe("mkver", function () {
Expand Down Expand Up @@ -65,7 +64,8 @@ describe("mkver", function () {
const expVer = `${getRandomInt(15)}.${getRandomInt(15)}.${getRandomInt(15)}`

function mkTestRepo() {
const dir = directory().replace(/\\/g, "/")
const dir = join(tmpdir(), randomChars())
mkdirSync(dir)
writeFileSync(dir + "/package.json", JSON.stringify({ version: expVer }))
execSync("git init", { cwd: dir })
execSync("git add package.json", { cwd: dir })
Expand Down Expand Up @@ -181,3 +181,11 @@ function getRandomInt(max: number) {
function trimEnd(s: string, chars: number): string {
return s.substring(0, s.length - chars)
}

function randomChars(length = 10) {
let s = ""
while (s.length < length) {
s += Math.random().toString(36).slice(2)
}
return s.slice(0, length)
}
4 changes: 2 additions & 2 deletions src/mkver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,12 @@ export function mkver(output: string = join(cwd(), "Version.ts")): void {

try {
mkdirSync(parsed.dir, { recursive: true })
} catch (err) {
} catch (err: any) {
if (err.code !== "EEXIST") throw err
}

writeFileSync(file, msg)
} catch (err) {
} catch (err: any) {
console.error(
argv[1] + ": Failed to produce " + output + ": " + err.message
)
Expand Down
Loading

0 comments on commit f224c95

Please sign in to comment.