mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 04:51:28 +08:00
Fix prebuilt architecture on macOS (#2965)
This commit is contained in:
parent
f6a1fcd88b
commit
0e13ab37c9
@ -19,3 +19,14 @@ if (fs.existsSync(windowsReleasePath)) {
|
|||||||
const destPath = path.join(windowsReleasePath, 'index.js')
|
const destPath = path.join(windowsReleasePath, 'index.js')
|
||||||
fs.copyFileSync(srcPath, destPath)
|
fs.copyFileSync(srcPath, destPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WORKAROUND: electron-builder downloads the wrong prebuilt architecture on macOS and the reason is unknown.
|
||||||
|
// For now, we rebuild all native libraries from source.
|
||||||
|
const keytarPath = path.resolve(__dirname, '../node_modules/keytar')
|
||||||
|
if (process.platform === 'darwin' && fs.existsSync(keytarPath)) {
|
||||||
|
const keytarPackageJsonPath = path.join(keytarPath, 'package.json')
|
||||||
|
let packageText = fs.readFileSync(keytarPackageJsonPath, { encoding : 'utf-8' })
|
||||||
|
|
||||||
|
packageText = packageText.replace(/"install": "prebuild-install \|\| npm run build",/i, '"install": "npm run build",')
|
||||||
|
fs.writeFileSync(keytarPackageJsonPath, packageText, { encoding : 'utf-8' })
|
||||||
|
}
|
||||||
|
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
@ -44,21 +44,21 @@ jobs:
|
|||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ github.workspace }}/node_modules
|
path: ${{ github.workspace }}/node_modules
|
||||||
key: ${{ runner.os }}-node_modules-cache-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
key: ${{ runner.os }}-node_modules-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-node_modules-cache-
|
${{ runner.os }}-node_modules-cache-v1-
|
||||||
|
|
||||||
- name: Cache Electron
|
- name: Cache Electron
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ env.HOME }}/.cache/electron
|
path: ${{ env.HOME }}/.cache/electron
|
||||||
key: ${{ runner.os }}-electron-cache-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
key: ${{ runner.os }}-electron-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||||
|
|
||||||
- name: Cache Electron-Builder
|
- name: Cache Electron-Builder
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ env.HOME }}/.cache//electron-builder
|
path: ${{ env.HOME }}/.cache//electron-builder
|
||||||
key: ${{ runner.os }}-electron-builder-cache-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
key: ${{ runner.os }}-electron-builder-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --check-files --frozen-lockfile
|
run: yarn install --check-files --frozen-lockfile
|
||||||
@ -148,13 +148,13 @@ jobs:
|
|||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ env.LOCALAPPDATA }}\electron\Cache
|
path: ${{ env.LOCALAPPDATA }}\electron\Cache
|
||||||
key: ${{ runner.os }}-electron-cache-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
key: ${{ runner.os }}-electron-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||||
|
|
||||||
- name: Cache Electron-Builder
|
- name: Cache Electron-Builder
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ${{ env.LOCALAPPDATA }}\electron-builder\cache
|
path: ${{ env.LOCALAPPDATA }}\electron-builder\cache
|
||||||
key: ${{ runner.os }}-electron-builder-cache-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
key: ${{ runner.os }}-electron-builder-cache-v1-${{ hashFiles(format('{0}{1}', github.workspace, '\yarn.lock')) }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --check-files --frozen-lockfile
|
run: yarn install --check-files --frozen-lockfile
|
||||||
|
@ -6,6 +6,8 @@ asarUnpack:
|
|||||||
- "**/*.node"
|
- "**/*.node"
|
||||||
directories:
|
directories:
|
||||||
output: "build"
|
output: "build"
|
||||||
|
# Workaround: Don't download prebuilt libraries (GH#2953).
|
||||||
|
buildDependenciesFromSource: true
|
||||||
files:
|
files:
|
||||||
- "dist/electron/**/*"
|
- "dist/electron/**/*"
|
||||||
# Don't bundle these files
|
# Don't bundle these files
|
||||||
|
@ -175,7 +175,8 @@
|
|||||||
"webpack-merge": "^5.8.0"
|
"webpack-merge": "^5.8.0"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"cld": "^2.7.1"
|
"cld": "^2.7.1",
|
||||||
|
"node-abi": "^3.5.0"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
Loading…
Reference in New Issue
Block a user