🐛 fix: remove lockfile
Signed-off-by: Pauline <git@ethanlibs.co>
This commit is contained in:
parent
3c6865a875
commit
5b66bc15d2
2 changed files with 1 additions and 17 deletions
|
|
@ -1,15 +1,12 @@
|
||||||
import fs from 'node:fs';
|
|
||||||
import { readFile, writeFile } from 'node:fs/promises';
|
import { readFile, writeFile } from 'node:fs/promises';
|
||||||
import { consola } from 'consola';
|
import { consola } from 'consola';
|
||||||
import mustache from 'mustache';
|
import mustache from 'mustache';
|
||||||
import { join, resolve } from 'pathe';
|
import { join } from 'pathe';
|
||||||
import { checkEnvironment, which } from './utils';
|
import { checkEnvironment, which } from './utils';
|
||||||
import { getTriple } from './utils/triple';
|
import { getTriple } from './utils/triple';
|
||||||
|
|
||||||
const env = checkEnvironment(import.meta);
|
const env = checkEnvironment(import.meta);
|
||||||
const triple = getTriple();
|
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))
|
if ((await Promise.all([which`cargo`, which`rustc`, which`pnpm`])).some(f => !f))
|
||||||
consola.error(
|
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.');
|
consola.info('generating cargo configuration file.');
|
||||||
|
|
||||||
if (fs.existsSync(prepareLockPath))
|
|
||||||
if (fs.readFileSync(prepareLockPath, 'utf-8') === PREPARE_LOCK_VERSION)
|
|
||||||
env.__exit(0);
|
|
||||||
|
|
||||||
interface ConfigStore {
|
interface ConfigStore {
|
||||||
isWin: boolean;
|
isWin: boolean;
|
||||||
isMacOS: boolean;
|
isMacOS: boolean;
|
||||||
|
|
@ -66,7 +59,6 @@ try {
|
||||||
const template = await readFile(join(env.__root, '.cargo', 'config.toml.mustache'), { encoding: 'utf8' });
|
const template = await readFile(join(env.__root, '.cargo', 'config.toml.mustache'), { encoding: 'utf8' });
|
||||||
const rendered = mustache.render(template, configStore).replace(/\n{2,}/g, '\n');
|
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.__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) {
|
catch (error) {
|
||||||
consola.error(`
|
consola.error(`
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import { existsSync, readFileSync } from 'node:fs';
|
|
||||||
import fs from 'node:fs/promises';
|
import fs from 'node:fs/promises';
|
||||||
import { type } from 'node:os';
|
import { type } from 'node:os';
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
|
|
@ -8,8 +7,6 @@ import { join, resolve } from 'pathe';
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
import type { CheckedEnvironment } from '.';
|
import type { CheckedEnvironment } from '.';
|
||||||
|
|
||||||
const UPDATEKEY_LOCK_VERSION = '1';
|
|
||||||
|
|
||||||
export async function tauriUpdateKey(env: CheckedEnvironment): Promise<string | undefined> {
|
export async function tauriUpdateKey(env: CheckedEnvironment): Promise<string | undefined> {
|
||||||
if (process.env.TAURI_SIGNING_PRIVATE_KEY)
|
if (process.env.TAURI_SIGNING_PRIVATE_KEY)
|
||||||
return;
|
return;
|
||||||
|
|
@ -18,10 +15,6 @@ export async function tauriUpdateKey(env: CheckedEnvironment): Promise<string |
|
||||||
const publicKeyPath = resolve(join(env.__deps, 'tauri.key.pub'));
|
const publicKeyPath = resolve(join(env.__deps, 'tauri.key.pub'));
|
||||||
const updatekeyPath = resolve(join(env.__deps, 'updatekey_lock'));
|
const updatekeyPath = resolve(join(env.__deps, 'updatekey_lock'));
|
||||||
|
|
||||||
if (existsSync(updatekeyPath))
|
|
||||||
if (readFileSync(updatekeyPath, 'utf-8') === UPDATEKEY_LOCK_VERSION)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const readKeys = () => Promise.all([
|
const readKeys = () => Promise.all([
|
||||||
fs.readFile(publicKeyPath, 'utf-8'),
|
fs.readFile(publicKeyPath, 'utf-8'),
|
||||||
fs.readFile(privateKeyPath, '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 = keys.privateKey;
|
||||||
process.env.TAURI_SIGNING_PRIVATE_KEY_PASSWORD = '';
|
process.env.TAURI_SIGNING_PRIVATE_KEY_PASSWORD = '';
|
||||||
await fs.writeFile(updatekeyPath, UPDATEKEY_LOCK_VERSION, 'utf-8');
|
|
||||||
return keys.publicKey;
|
return keys.publicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue