feat: support windows (#122)
This commit is contained in:
parent
bd6a003a27
commit
5d3e058edf
20 changed files with 3835 additions and 3537 deletions
|
@ -1,55 +0,0 @@
|
||||||
{
|
|
||||||
"plugins": ["jest", "@typescript-eslint"],
|
|
||||||
"extends": ["plugin:github/recommended"],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 9,
|
|
||||||
"sourceType": "module",
|
|
||||||
"project": "./tsconfig.json"
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"i18n-text/no-en": "off",
|
|
||||||
"eslint-comments/no-use": "off",
|
|
||||||
"import/no-namespace": "off",
|
|
||||||
"no-unused-vars": "off",
|
|
||||||
"@typescript-eslint/no-unused-vars": "error",
|
|
||||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
|
||||||
"@typescript-eslint/no-require-imports": "error",
|
|
||||||
"@typescript-eslint/array-type": "error",
|
|
||||||
"@typescript-eslint/await-thenable": "error",
|
|
||||||
"@typescript-eslint/ban-ts-comment": "error",
|
|
||||||
"camelcase": "off",
|
|
||||||
"@typescript-eslint/consistent-type-assertions": "error",
|
|
||||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
|
||||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
|
||||||
"@typescript-eslint/no-array-constructor": "error",
|
|
||||||
"@typescript-eslint/no-empty-interface": "error",
|
|
||||||
"@typescript-eslint/no-explicit-any": "off",
|
|
||||||
"@typescript-eslint/no-extraneous-class": "error",
|
|
||||||
"@typescript-eslint/no-for-in-array": "error",
|
|
||||||
"@typescript-eslint/no-inferrable-types": "error",
|
|
||||||
"@typescript-eslint/no-misused-new": "error",
|
|
||||||
"@typescript-eslint/no-namespace": "error",
|
|
||||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
||||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
||||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
||||||
"@typescript-eslint/no-useless-constructor": "error",
|
|
||||||
"@typescript-eslint/no-var-requires": "error",
|
|
||||||
"@typescript-eslint/prefer-for-of": "warn",
|
|
||||||
"@typescript-eslint/prefer-function-type": "warn",
|
|
||||||
"@typescript-eslint/prefer-includes": "error",
|
|
||||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
||||||
"@typescript-eslint/promise-function-async": "error",
|
|
||||||
"@typescript-eslint/require-array-sort-compare": "error",
|
|
||||||
"@typescript-eslint/restrict-plus-operands": "error",
|
|
||||||
"semi": "off",
|
|
||||||
"@typescript-eslint/semi": ["error", "never"],
|
|
||||||
"@typescript-eslint/type-annotation-spacing": "error",
|
|
||||||
"@typescript-eslint/unbound-method": "error"
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest/globals": true
|
|
||||||
}
|
|
||||||
}
|
|
39
.eslintrc.yml
Normal file
39
.eslintrc.yml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
env:
|
||||||
|
node: true
|
||||||
|
es6: true
|
||||||
|
jest: true
|
||||||
|
|
||||||
|
globals:
|
||||||
|
Atomics: readonly
|
||||||
|
SharedArrayBuffer: readonly
|
||||||
|
|
||||||
|
ignorePatterns:
|
||||||
|
- '!.*'
|
||||||
|
- '**/node_modules/.*'
|
||||||
|
- '**/dist/.*'
|
||||||
|
- '**/coverage/.*'
|
||||||
|
- '*.json'
|
||||||
|
|
||||||
|
parser: '@typescript-eslint/parser'
|
||||||
|
|
||||||
|
parserOptions:
|
||||||
|
ecmaVersion: 2023
|
||||||
|
sourceType: module
|
||||||
|
project:
|
||||||
|
- './.github/linters/tsconfig.json'
|
||||||
|
- './tsconfig.json'
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
- jest
|
||||||
|
- '@typescript-eslint'
|
||||||
|
|
||||||
|
extends:
|
||||||
|
- eslint:recommended
|
||||||
|
- plugin:@typescript-eslint/eslint-recommended
|
||||||
|
- plugin:@typescript-eslint/recommended
|
||||||
|
- plugin:github/recommended
|
||||||
|
- plugin:jest/recommended
|
||||||
|
|
||||||
|
rules:
|
||||||
|
'i18n-text/no-en': off
|
||||||
|
'import/no-namespace': off
|
83
.github/linters/.eslintrc.yml
vendored
83
.github/linters/.eslintrc.yml
vendored
|
@ -1,83 +0,0 @@
|
||||||
env:
|
|
||||||
node: true
|
|
||||||
es6: true
|
|
||||||
jest: true
|
|
||||||
|
|
||||||
globals:
|
|
||||||
Atomics: readonly
|
|
||||||
SharedArrayBuffer: readonly
|
|
||||||
|
|
||||||
ignorePatterns:
|
|
||||||
- '!.*'
|
|
||||||
- '**/node_modules/.*'
|
|
||||||
- '**/dist/.*'
|
|
||||||
- '**/coverage/.*'
|
|
||||||
- '*.json'
|
|
||||||
|
|
||||||
parser: '@typescript-eslint/parser'
|
|
||||||
|
|
||||||
parserOptions:
|
|
||||||
ecmaVersion: 2023
|
|
||||||
sourceType: module
|
|
||||||
project:
|
|
||||||
- './.github/linters/tsconfig.json'
|
|
||||||
- './tsconfig.json'
|
|
||||||
|
|
||||||
plugins:
|
|
||||||
- jest
|
|
||||||
- '@typescript-eslint'
|
|
||||||
|
|
||||||
extends:
|
|
||||||
- eslint:recommended
|
|
||||||
- plugin:@typescript-eslint/eslint-recommended
|
|
||||||
- plugin:@typescript-eslint/recommended
|
|
||||||
- plugin:github/recommended
|
|
||||||
- plugin:jest/recommended
|
|
||||||
|
|
||||||
rules:
|
|
||||||
{
|
|
||||||
'camelcase': 'off',
|
|
||||||
'eslint-comments/no-use': 'off',
|
|
||||||
'eslint-comments/no-unused-disable': 'off',
|
|
||||||
'i18n-text/no-en': 'off',
|
|
||||||
'import/no-namespace': 'off',
|
|
||||||
'no-console': 'off',
|
|
||||||
'no-unused-vars': 'off',
|
|
||||||
'prettier/prettier': 'error',
|
|
||||||
'semi': 'off',
|
|
||||||
'@typescript-eslint/array-type': 'error',
|
|
||||||
'@typescript-eslint/await-thenable': 'error',
|
|
||||||
'@typescript-eslint/ban-ts-comment': 'error',
|
|
||||||
'@typescript-eslint/consistent-type-assertions': 'error',
|
|
||||||
'@typescript-eslint/explicit-member-accessibility':
|
|
||||||
['error', { 'accessibility': 'no-public' }],
|
|
||||||
'@typescript-eslint/explicit-function-return-type':
|
|
||||||
['error', { 'allowExpressions': true }],
|
|
||||||
'@typescript-eslint/func-call-spacing': ['error', 'never'],
|
|
||||||
'@typescript-eslint/no-array-constructor': 'error',
|
|
||||||
'@typescript-eslint/no-empty-interface': 'error',
|
|
||||||
'@typescript-eslint/no-explicit-any': 'error',
|
|
||||||
'@typescript-eslint/no-extraneous-class': 'error',
|
|
||||||
'@typescript-eslint/no-for-in-array': 'error',
|
|
||||||
'@typescript-eslint/no-inferrable-types': 'error',
|
|
||||||
'@typescript-eslint/no-misused-new': 'error',
|
|
||||||
'@typescript-eslint/no-namespace': 'error',
|
|
||||||
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
||||||
'@typescript-eslint/no-require-imports': 'error',
|
|
||||||
'@typescript-eslint/no-unnecessary-qualifier': 'error',
|
|
||||||
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
|
|
||||||
'@typescript-eslint/no-unused-vars': 'error',
|
|
||||||
'@typescript-eslint/no-useless-constructor': 'error',
|
|
||||||
'@typescript-eslint/no-var-requires': 'error',
|
|
||||||
'@typescript-eslint/prefer-for-of': 'warn',
|
|
||||||
'@typescript-eslint/prefer-function-type': 'warn',
|
|
||||||
'@typescript-eslint/prefer-includes': 'error',
|
|
||||||
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
|
|
||||||
'@typescript-eslint/promise-function-async': 'error',
|
|
||||||
'@typescript-eslint/require-array-sort-compare': 'error',
|
|
||||||
'@typescript-eslint/restrict-plus-operands': 'error',
|
|
||||||
'@typescript-eslint/semi': ['error', 'never'],
|
|
||||||
'@typescript-eslint/space-before-function-paren': 'off',
|
|
||||||
'@typescript-eslint/type-annotation-spacing': 'error',
|
|
||||||
'@typescript-eslint/unbound-method': 'error'
|
|
||||||
}
|
|
7
.github/linters/.markdown-lint.yml
vendored
7
.github/linters/.markdown-lint.yml
vendored
|
@ -1,7 +0,0 @@
|
||||||
# Unordered list style
|
|
||||||
MD004:
|
|
||||||
style: dash
|
|
||||||
|
|
||||||
# Ordered list item prefix
|
|
||||||
MD029:
|
|
||||||
style: one
|
|
10
.github/linters/.yaml-lint.yml
vendored
10
.github/linters/.yaml-lint.yml
vendored
|
@ -1,10 +0,0 @@
|
||||||
rules:
|
|
||||||
document-end: disable
|
|
||||||
document-start:
|
|
||||||
level: warning
|
|
||||||
present: false
|
|
||||||
line-length:
|
|
||||||
level: warning
|
|
||||||
max: 80
|
|
||||||
allow-non-breakable-words: true
|
|
||||||
allow-non-breakable-inline-mappings: true
|
|
53
.github/workflows/linter.yml
vendored
53
.github/workflows/linter.yml
vendored
|
@ -1,53 +0,0 @@
|
||||||
name: Lint Code Base
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
push:
|
|
||||||
branches-ignore:
|
|
||||||
- main
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref_name }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
name: Lint Code Base
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: read
|
|
||||||
statuses: write
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
id: checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
id: setup-node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
cache: npm
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
id: install
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Lint Code Base
|
|
||||||
id: super-linter
|
|
||||||
uses: super-linter/super-linter/slim@v6
|
|
||||||
env:
|
|
||||||
DEFAULT_BRANCH: main
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
TYPESCRIPT_DEFAULT_STYLE: prettier
|
|
||||||
VALIDATE_CHECKOV: false
|
|
||||||
VALIDATE_MARKDOWN: false
|
|
||||||
VALIDATE_JSCPD: false
|
|
||||||
VALIDATE_NATURAL_LANGUAGE: false
|
|
26
.github/workflows/test.yml
vendored
26
.github/workflows/test.yml
vendored
|
@ -25,34 +25,36 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
|
||||||
- macos-latest
|
- macos-latest
|
||||||
tool_versions:
|
- ubuntu-latest
|
||||||
- |
|
- windows-latest
|
||||||
nodejs 20
|
|
||||||
- |
|
|
||||||
nodejs 18
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: ./
|
- name: Setup mise
|
||||||
|
uses: ./
|
||||||
with:
|
with:
|
||||||
tool_versions: ${{ matrix.tool_versions }}
|
mise_toml: |
|
||||||
|
[tools]
|
||||||
|
node = "22.0.0"
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- run: mise --version
|
- run: mise --version
|
||||||
- run: mise exec -- node --version
|
- run: mise x node -- node -v
|
||||||
- run: which node
|
- run: which node
|
||||||
- run: node -v
|
- run: node --version
|
||||||
|
- run: . scripts/test.sh
|
||||||
|
shell: bash
|
||||||
specific_version:
|
specific_version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: ./
|
- name: Setup mise
|
||||||
|
uses: ./
|
||||||
with:
|
with:
|
||||||
cache_save: ${{ github.ref_name == 'main' }}
|
cache_save: ${{ github.ref_name == 'main' }}
|
||||||
cache_key_prefix: mise-v1
|
cache_key_prefix: mise-v1
|
||||||
version: 2024.1.6
|
version: 2024.9.6
|
||||||
install_args: bun
|
install_args: bun
|
||||||
mise_toml: |
|
mise_toml: |
|
||||||
[tools]
|
[tools]
|
||||||
|
|
2980
dist/cache-save/index.js
generated
vendored
2980
dist/cache-save/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/cache-save/index.js.map
generated
vendored
2
dist/cache-save/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/cache-save/sourcemap-register.js
generated
vendored
2
dist/cache-save/sourcemap-register.js
generated
vendored
File diff suppressed because one or more lines are too long
3230
dist/index.js
generated
vendored
3230
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/licenses.txt
generated
vendored
2
dist/licenses.txt
generated
vendored
|
@ -613,7 +613,7 @@ ms
|
||||||
MIT
|
MIT
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2016 Zeit, Inc.
|
Copyright (c) 2020 Vercel, Inc.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
2
dist/sourcemap-register.js
generated
vendored
2
dist/sourcemap-register.js
generated
vendored
File diff suppressed because one or more lines are too long
820
package-lock.json
generated
820
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -21,7 +21,7 @@
|
||||||
"bundle": "npm run format:write && npm run package",
|
"bundle": "npm run format:write && npm run package",
|
||||||
"format:check": "prettier --check **/*.ts",
|
"format:check": "prettier --check **/*.ts",
|
||||||
"format:write": "prettier --write **/*.ts",
|
"format:write": "prettier --write **/*.ts",
|
||||||
"lint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
|
"lint": "npx eslint . && npm run format:check",
|
||||||
"package": "ncc build -s src/index.ts --license licenses.txt && ncc -s build src/cache-save.ts -o dist/cache-save/",
|
"package": "ncc build -s src/index.ts --license licenses.txt && ncc -s build src/cache-save.ts -o dist/cache-save/",
|
||||||
"package:watch": "npm run package -- --watch",
|
"package:watch": "npm run package -- --watch",
|
||||||
"version": "./scripts/version.sh",
|
"version": "./scripts/version.sh",
|
||||||
|
@ -33,12 +33,13 @@
|
||||||
"@actions/cache": "^3.2.2",
|
"@actions/cache": "^3.2.2",
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/glob": "^0.4.0"
|
"@actions/glob": "^0.5.0",
|
||||||
|
"typescript-eslint": "^8.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.8.0",
|
"@eslint/js": "^9.8.0",
|
||||||
"@types/eslint__js": "^8.42.3",
|
"@types/eslint__js": "^8.42.3",
|
||||||
"@types/node": "^20.10.6",
|
"@types/node": "^22.7.0",
|
||||||
"@vercel/ncc": "^0.38.1",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"eslint-plugin-github": "^5.0.0",
|
"eslint-plugin-github": "^5.0.0",
|
||||||
"eslint-plugin-jest": "^28.0.0",
|
"eslint-plugin-jest": "^28.0.0",
|
||||||
|
|
17
scripts/test.sh
Executable file
17
scripts/test.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
function assert_equal() {
|
||||||
|
if [ "$1" != "$2" ]; then
|
||||||
|
echo "Assertion failed: Expected '$1', got '$2'" >&2
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_equal "v22.0.0" "$(mise exec -- node --version)"
|
||||||
|
which node
|
||||||
|
|
||||||
|
# windows bash does not seem to work with shims
|
||||||
|
if [[ "$(uname)" != "MINGW"* ]]; then
|
||||||
|
assert_equal "v22.0.0" "$(node --version)"
|
||||||
|
fi
|
29
src/index.ts
29
src/index.ts
|
@ -1,4 +1,5 @@
|
||||||
import * as cache from '@actions/cache'
|
import * as cache from '@actions/cache'
|
||||||
|
import * as io from '@actions/io'
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as exec from '@actions/exec'
|
import * as exec from '@actions/exec'
|
||||||
import * as glob from '@actions/glob'
|
import * as glob from '@actions/glob'
|
||||||
|
@ -91,23 +92,29 @@ async function restoreMiseCache(): Promise<void> {
|
||||||
async function setupMise(version: string | undefined): Promise<void> {
|
async function setupMise(version: string | undefined): Promise<void> {
|
||||||
core.startGroup(version ? `Setup mise@${version}` : 'Setup mise')
|
core.startGroup(version ? `Setup mise@${version}` : 'Setup mise')
|
||||||
const miseBinDir = path.join(miseDir(), 'bin')
|
const miseBinDir = path.join(miseDir(), 'bin')
|
||||||
|
await fs.promises.mkdir(miseBinDir, { recursive: true })
|
||||||
const url = version
|
const url = version
|
||||||
? `https://mise.jdx.dev/v${version}/mise-v${version}-${getOS()}-${os.arch()}`
|
? `https://mise.jdx.dev/v${version}/mise-v${version}-${getOS()}-${os.arch()}`
|
||||||
: `https://mise.jdx.dev/mise-latest-${getOS()}-${os.arch()}`
|
: `https://mise.jdx.dev/mise-latest-${getOS()}-${os.arch()}`
|
||||||
await fs.promises.mkdir(miseBinDir, { recursive: true })
|
if (getOS() === 'windows') {
|
||||||
await exec.exec('curl', [
|
const zipPath = path.join(os.tmpdir(), 'mise.zip')
|
||||||
'-fsSL',
|
await exec.exec('curl', ['-fsSL', `${url}.zip`, '--output', zipPath])
|
||||||
url,
|
await exec.exec('unzip', [zipPath, '-d', os.tmpdir()])
|
||||||
'--output',
|
await io.mv(
|
||||||
path.join(miseBinDir, 'mise')
|
path.join(os.tmpdir(), 'mise/bin/mise.exe'),
|
||||||
])
|
path.join(miseBinDir, 'mise.exe')
|
||||||
await exec.exec('chmod', ['+x', path.join(miseBinDir, 'mise')])
|
)
|
||||||
|
} else {
|
||||||
|
const output = path.join(miseBinDir, 'mise')
|
||||||
|
await exec.exec('curl', ['-fsSL', url, '--output', output])
|
||||||
|
await exec.exec('chmod', ['+x', path.join(miseBinDir, 'mise')])
|
||||||
|
}
|
||||||
core.addPath(miseBinDir)
|
core.addPath(miseBinDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getExperimental(): boolean {
|
function getExperimental(): boolean {
|
||||||
const experimentalString = core.getInput('experimental')
|
const experimentalString = core.getInput('experimental')
|
||||||
return experimentalString === 'true' ? true : false
|
return experimentalString === 'true'
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setToolVersions(): Promise<void> {
|
async function setToolVersions(): Promise<void> {
|
||||||
|
@ -120,7 +127,7 @@ async function setToolVersions(): Promise<void> {
|
||||||
async function setMiseToml(): Promise<void> {
|
async function setMiseToml(): Promise<void> {
|
||||||
const toml = core.getInput('mise_toml')
|
const toml = core.getInput('mise_toml')
|
||||||
if (toml) {
|
if (toml) {
|
||||||
await writeFile('.mise.toml', toml)
|
await writeFile('mise.toml', toml)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +135,8 @@ function getOS(): string {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case 'darwin':
|
case 'darwin':
|
||||||
return 'macos'
|
return 'macos'
|
||||||
|
case 'win32':
|
||||||
|
return 'windows'
|
||||||
default:
|
default:
|
||||||
return process.platform
|
return process.platform
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,11 @@ export function miseDir(): string {
|
||||||
const dir = core.getState('MISE_DIR')
|
const dir = core.getState('MISE_DIR')
|
||||||
if (dir) return dir
|
if (dir) return dir
|
||||||
|
|
||||||
const { MISE_DATA_DIR, XDG_DATA_HOME } = process.env
|
const { MISE_DATA_DIR, XDG_DATA_HOME, LOCALAPPDATA } = process.env
|
||||||
if (MISE_DATA_DIR) return MISE_DATA_DIR
|
if (MISE_DATA_DIR) return MISE_DATA_DIR
|
||||||
if (XDG_DATA_HOME) return path.join(XDG_DATA_HOME, 'mise')
|
if (XDG_DATA_HOME) return path.join(XDG_DATA_HOME, 'mise')
|
||||||
|
if (process.platform === 'win32' && LOCALAPPDATA)
|
||||||
|
return path.join(LOCALAPPDATA, 'mise')
|
||||||
|
|
||||||
return path.join(os.homedir(), '.local/share/mise')
|
return path.join(os.homedir(), '.local', 'share', 'mise')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue