Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr authored Dec 28, 2024
1 parent 7b97bf5 commit 3895cee
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
1 change: 0 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:

strategy:
matrix:
# node-version: [18.x, 20.x, 22.x]
node-version: [latest]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "platformdirs",
"version": "4.3.8-rc2",
"version": "4.3.8-rc3",
"description": "📂 Unified interface to get platform-specific directories",
"keywords": [
"nodejs",
Expand Down Expand Up @@ -29,17 +29,18 @@
"./unix": "./dist/unix.js",
"./version": "./dist/version.js"
},
"types": "dist/index.d.ts",
"bin": {
"platformdirs": "dist/main.js"
},
"files": ["dist"],
"scripts": {
"build": "tsc --noCheck",
"format": "biome format --write .",
"lint": "biome check --write . && tsc --noEmit",
"run": "node --experimental-transform-types src/main.ts",
"test": "node --experimental-transform-types --test",
"build": "tsc --noCheck",
"prepack": "npm run build"
"prepack": "npm run build",
"platformdirs": "node --experimental-transform-types src/main.ts",
"test": "node --experimental-transform-types --test"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
Expand Down
10 changes: 8 additions & 2 deletions src/version.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { readFile } from "node:fs/promises";

// https://github.com/nodejs/node/issues/51347
const packageJSON = JSON.parse(await readFile(new URL(import.meta.resolve("../package.json")), "utf8")) as { version: string; };
const packageJSON = JSON.parse(
await readFile(new URL(import.meta.resolve("../package.json")), "utf8"),
) as { version: string };

function throwExpression(error: unknown): never {
throw error;
Expand All @@ -11,4 +13,8 @@ export const version: string = packageJSON.version;
const match =
packageJSON.version.match(/^(\d+)\.(\d+)\.(\d+)/) ??
throwExpression(new Error("unreachable"));
export const versionTuple: [number, number, number] = [+match[1], +match[2], +match[3]];
export const versionTuple: [number, number, number] = [
+match[1],
+match[2],
+match[3],
];
9 changes: 7 additions & 2 deletions src/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export class Windows extends PlatformDirsABC {
return this._appendParts(path2);
}

protected _appendParts(path2: string, { opinionValue }: { opinionValue?: string | undefined; } = {}): string {
protected _appendParts(
path2: string,
{ opinionValue }: { opinionValue?: string | undefined } = {},
): string {
const params = [];
if (this.appname) {
if (this.appauthor !== false) {
Expand Down Expand Up @@ -196,7 +199,9 @@ function getWinFolderFromEnvVars(csidlName: string): string {
/**
* Get a folder for a CSIDL name that does not exist as an environment variable.
*/
function getWinFolderIfCSIDLNameNotEnvVar(csidlName: string): string | undefined {
function getWinFolderIfCSIDLNameNotEnvVar(
csidlName: string,
): string | undefined {
if (csidlName === "CSIDL_PERSONAL") {
const p = process.env.USERPROFILE;
if (p === undefined) {
Expand Down
4 changes: 3 additions & 1 deletion test/main.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ test("matches python platformdirs", async (t) => {
const expected = (
await $`uv run --with platformdirs python -m platformdirs`
).stdout.replace(/^.*\n/, "");
const actual = (await $`node --experimental-transform-types src/main.ts`).stdout.replace(/^.*\n/, "");
const actual = (
await $`node --experimental-transform-types src/main.ts`
).stdout.replace(/^.*\n/, "");
assert.equal(actual, expected);
});
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"outDir": "dist",
"declaration": true
},
"include": ["src"],
"include": ["src"]
}

0 comments on commit 3895cee

Please sign in to comment.