mirror of
https://github.com/hanzoai/studio-desktop.git
synced 2026-10-30 18:21:16 +00:00
* Sort imports with prettier * sort imports * Add as dev dependency * Apply separation * nit
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
import mainPackage from './getPackage.js';
|
|
|
|
// Create the types-only package.json
|
|
const typesPackage = {
|
|
name: `${mainPackage.name}-types`,
|
|
version: mainPackage.version,
|
|
type: 'module',
|
|
main: './index.js',
|
|
types: './index.d.ts',
|
|
files: ['index.d.ts', 'index.js'],
|
|
publishConfig: {
|
|
access: 'public',
|
|
},
|
|
repository: mainPackage.repository,
|
|
homepage: mainPackage.homepage,
|
|
description: `TypeScript definitions for ${mainPackage.name}`,
|
|
author: mainPackage.author,
|
|
license: mainPackage.license,
|
|
};
|
|
|
|
// Ensure dist directory exists
|
|
const distDir = path.join(import.meta.dirname, '../dist');
|
|
if (!fs.existsSync(distDir)) {
|
|
fs.mkdirSync(distDir, { recursive: true });
|
|
}
|
|
|
|
// Write the new package.json to the dist directory
|
|
fs.writeFileSync(path.join(distDir, 'package.json'), JSON.stringify(typesPackage, null, 2));
|
|
|
|
// Create an empty yarn.lock file
|
|
fs.writeFileSync(path.join(distDir, 'yarn.lock'), '');
|
|
|
|
console.log('Types package.json and yarn.lock have been prepared in the dist directory');
|