🐛 fix: remove lockfile

Signed-off-by: Pauline <git@ethanlibs.co>
This commit is contained in:
Pauline 2024-09-08 19:02:18 +02:00
parent 3c6865a875
commit 5b66bc15d2
No known key found for this signature in database
GPG key ID: 722BB181973296AE
2 changed files with 1 additions and 17 deletions

View file

@ -1,15 +1,12 @@
import fs from 'node:fs';
import { readFile, writeFile } from 'node:fs/promises';
import { consola } from 'consola';
import mustache from 'mustache';
import { join, resolve } from 'pathe';
import { join } from 'pathe';
import { checkEnvironment, which } from './utils';
import { getTriple } from './utils/triple';
const env = checkEnvironment(import.meta);
const triple = getTriple();
const PREPARE_LOCK_VERSION = '1';
const prepareLockPath = resolve(join(env.__deps, 'prepare_lock'));
if ((await Promise.all([which`cargo`, which`rustc`, which`pnpm`])).some(f => !f))
consola.error(
@ -26,10 +23,6 @@ if ((await Promise.all([which`cargo`, which`rustc`, which`pnpm`])).some(f => !f)
consola.info('generating cargo configuration file.');
if (fs.existsSync(prepareLockPath))
if (fs.readFileSync(prepareLockPath, 'utf-8') === PREPARE_LOCK_VERSION)
env.__exit(0);
interface ConfigStore {
isWin: boolean;
isMacOS: boolean;
@ -66,7 +59,6 @@ try {
const template = await readFile(join(env.__root, '.cargo', 'config.toml.mustache'), { encoding: 'utf8' });
const rendered = mustache.render(template, configStore).replace(/\n{2,}/g, '\n');
await writeFile(join(env.__root, '.cargo', 'config.toml'), rendered, { mode: 0o751, flag: 'w+', encoding: 'utf-8' });
await writeFile(join(env.__deps, 'prepare_lock'), PREPARE_LOCK_VERSION, 'utf-8');
}
catch (error) {
consola.error(`

View file

@ -1,4 +1,3 @@
import { existsSync, readFileSync } from 'node:fs';
import fs from 'node:fs/promises';
import { type } from 'node:os';
import process from 'node:process';
@ -8,8 +7,6 @@ import { join, resolve } from 'pathe';
import semver from 'semver';
import type { CheckedEnvironment } from '.';
const UPDATEKEY_LOCK_VERSION = '1';
export async function tauriUpdateKey(env: CheckedEnvironment): Promise<string | undefined> {
if (process.env.TAURI_SIGNING_PRIVATE_KEY)
return;
@ -18,10 +15,6 @@ export async function tauriUpdateKey(env: CheckedEnvironment): Promise<string |
const publicKeyPath = resolve(join(env.__deps, 'tauri.key.pub'));
const updatekeyPath = resolve(join(env.__deps, 'updatekey_lock'));
if (existsSync(updatekeyPath))
if (readFileSync(updatekeyPath, 'utf-8') === UPDATEKEY_LOCK_VERSION)
return;
const readKeys = () => Promise.all([
fs.readFile(publicKeyPath, 'utf-8'),
fs.readFile(privateKeyPath, 'utf-8'),
@ -48,7 +41,6 @@ export async function tauriUpdateKey(env: CheckedEnvironment): Promise<string |
process.env.TAURI_SIGNING_PRIVATE_KEY = keys.privateKey;
process.env.TAURI_SIGNING_PRIVATE_KEY_PASSWORD = '';
await fs.writeFile(updatekeyPath, UPDATEKEY_LOCK_VERSION, 'utf-8');
return keys.publicKey;
}