mac命令行默认打通用包

This commit is contained in:
Tw93
2023-01-06 18:57:54 +08:00
parent d681ea8964
commit 0d941bd73f
12 changed files with 78 additions and 215 deletions

View File

@@ -66,24 +66,6 @@ jobs:
run: | run: |
npm run build:all-windows npm run build:all-windows
# - name: Create Release and Upload Release Asset
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# tag_name: ${{ github.ref }}
# name: Release ${{ github.ref }}
# body: TODO New Release.
# draft: false
# prerelease: false
# files: |
# output/*/*.*
# - uses: ncipollo/release-action@v1
# if: startsWith(github.ref, 'refs/tags/v')
# with:
# allowUpdates: true
# artifacts: "output/*/*.*"
# token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload files - name: Upload files
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -46,31 +46,31 @@ export default class LinuxBuilder implements IBuilder {
const { name } = options; const { name } = options;
await mergeTauriConfig(url, options, tauriConf); await mergeTauriConfig(url, options, tauriConf);
const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); await shellExec(`cd ${npmDirectory} && npm install && npm run build`);
let arch = "";
let arch: string;
if (process.arch === "x64") { if (process.arch === "x64") {
arch = "amd64"; arch = "amd64";
} else { } else {
arch = process.arch; arch = process.arch;
} }
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`; const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName); const appPath = this.getBuildAppPath(npmDirectory, "deb", debName);
const distPath = path.resolve(`${name}.deb`); const distPath = path.resolve(`${name}.deb`);
await fs.copyFile(appPath, distPath); await fs.copyFile(appPath, distPath);
await fs.unlink(appPath); await fs.unlink(appPath);
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`; const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName); const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName);
const distAppPath = path.resolve(`${name}.AppImage`); const distAppPath = path.resolve(`${name}.AppImage`);
await fs.copyFile(appImagePath, distAppPath); await fs.copyFile(appImagePath, distAppPath);
await fs.unlink(appImagePath); await fs.unlink(appImagePath);
logger.success('Build success!'); logger.success('Build success!');
logger.success('You can find the deb app installer in', distPath); logger.success('You can find the deb app installer in', distPath);
logger.success('You can find the Appimage app installer in', distAppPath); logger.success('You can find the AppImage app installer in', distAppPath);
} }
getBuildedAppPath(npmDirectory: string,packageType: string, packageName: string) { getBuildAppPath(npmDirectory: string, packageType: string, packageName: string) {
return path.join( return path.join(
npmDirectory, npmDirectory,
'src-tauri/target/release/bundle/', 'src-tauri/target/release/bundle/',
@@ -78,4 +78,4 @@ export default class LinuxBuilder implements IBuilder {
packageName packageName
); );
} }
} }

View File

@@ -29,7 +29,7 @@ export default class MacBuilder implements IBuilder {
// TODO 国内有可能会超时 // TODO 国内有可能会超时
await installRust(); await installRust();
} else { } else {
log.error('Error: Pake need Rust to package your webapp!!!'); log.error('Error: Pake need Rust to package your webapp!');
process.exit(2); process.exit(2);
} }
} }
@@ -40,15 +40,11 @@ export default class MacBuilder implements IBuilder {
await mergeTauriConfig(url, options, tauriConf); await mergeTauriConfig(url, options, tauriConf);
const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); //这里直接使用 universal-apple-darwin 的打包,而非当前系统的包
let arch = "x64"; await shellExec(`cd ${npmDirectory} && npm install && npm run build:mac`);
if (process.arch === "arm64") {
arch = "aarch64"; const dmgName = `${name}_${tauriConf.package.version}_universal.dmg`;
} else { const appPath = this.getBuildAppPath(npmDirectory, dmgName);
arch = process.arch;
}
const dmgName = `${name}_${tauriConf.package.version}_${arch}.dmg`;
const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
const distPath = path.resolve(`${name}.dmg`); const distPath = path.resolve(`${name}.dmg`);
await fs.copyFile(appPath, distPath); await fs.copyFile(appPath, distPath);
await fs.unlink(appPath); await fs.unlink(appPath);
@@ -57,10 +53,10 @@ export default class MacBuilder implements IBuilder {
logger.success('You can find the app installer in', distPath); logger.success('You can find the app installer in', distPath);
} }
getBuildedAppPath(npmDirectory: string, dmgName: string) { getBuildAppPath(npmDirectory: string, dmgName: string) {
return path.join( return path.join(
npmDirectory, npmDirectory,
'src-tauri/target/release/bundle/dmg', 'src-tauri/target/universal-apple-darwin/release/bundle/dmg',
dmgName dmgName
); );
} }

View File

@@ -5,11 +5,9 @@ import { checkRustInstalled, installRust } from '@/helpers/rust.js';
import { PakeAppOptions } from '@/types.js'; import { PakeAppOptions } from '@/types.js';
import { IBuilder } from './base.js'; import { IBuilder } from './base.js';
import { shellExec } from '@/utils/shell.js'; import { shellExec } from '@/utils/shell.js';
// @ts-expect-error 加上resolveJsonModule rollup会打包报错 // @ts-expect-error
// import tauriConf from '../../src-tauri/tauri.windows.conf.json';
import tauriConf from './tauriConf.js'; import tauriConf from './tauriConf.js';
import { fileURLToPath } from 'url';
import logger from '@/options/logger.js'; import logger from '@/options/logger.js';
import { mergeTauriConfig } from './common.js'; import { mergeTauriConfig } from './common.js';
import { npmDirectory } from '@/utils/dir.js'; import { npmDirectory } from '@/utils/dir.js';
@@ -47,11 +45,11 @@ export default class WinBuilder implements IBuilder {
await mergeTauriConfig(url, options, tauriConf); await mergeTauriConfig(url, options, tauriConf);
const _ = await shellExec(`cd ${npmDirectory} && npm install && npm run build`); await shellExec(`cd ${npmDirectory} && npm install && npm run build`);
const language = tauriConf.tauri.bundle.windows.wix.language[0]; const language = tauriConf.tauri.bundle.windows.wix.language[0];
const arch = process.arch; const arch = process.arch;
const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`; const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`;
const appPath = this.getBuildedAppPath(npmDirectory, msiName); const appPath = this.getBuildAppPath(npmDirectory, msiName);
const distPath = path.resolve(`${name}.msi`); const distPath = path.resolve(`${name}.msi`);
await fs.copyFile(appPath, distPath); await fs.copyFile(appPath, distPath);
await fs.unlink(appPath); await fs.unlink(appPath);
@@ -59,7 +57,7 @@ export default class WinBuilder implements IBuilder {
logger.success('You can find the app installer in', distPath); logger.success('You can find the app installer in', distPath);
} }
getBuildedAppPath(npmDirectory: string, dmgName: string) { getBuildAppPath(npmDirectory: string, dmgName: string) {
return path.join( return path.join(
npmDirectory, npmDirectory,
'src-tauri/target/release/bundle/msi', 'src-tauri/target/release/bundle/msi',

View File

@@ -51,7 +51,7 @@ export async function mergeTauriConfig(
const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/); const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/);
if (!reg.test(name) || reg.exec(name)[0].length != name.length) { if (!reg.test(name) || reg.exec(name)[0].length != name.length) {
logger.error("package name is illegal it must be letters, numbers, and it must contain the letters") logger.error("package name is illegal it must be letters, numbers, and it must contain the letters")
logger.error("E.g 123pan,123Pan Pan123,weread, WeRead, WERead"); logger.error("E.g 123pan,123Pan,Pan123,weread,WeRead,WERead");
process.exit(); process.exit();
} }
} }
@@ -113,7 +113,7 @@ export async function mergeTauriConfig(
break; break;
} }
} }
let bundleConf = {tauri: {bundle: tauriConf.tauri.bundle}}; let bundleConf = {tauri: {bundle: tauriConf.tauri.bundle}};
await fs.writeFile( await fs.writeFile(
configPath, configPath,

7
bin/cli.ts vendored
View File

@@ -1,6 +1,5 @@
import { program } from 'commander'; import { program } from 'commander';
import log from 'loglevel'; import log from 'loglevel';
import chalk from 'chalk';
import { DEFAULT_PAKE_OPTIONS } from './defaults.js'; import { DEFAULT_PAKE_OPTIONS } from './defaults.js';
import { PakeCliOptions } from './types.js'; import { PakeCliOptions } from './types.js';
import { validateNumberInput, validateUrlInput } from './utils/validate.js'; import { validateNumberInput, validateUrlInput } from './utils/validate.js';
@@ -9,7 +8,6 @@ import BuilderFactory from './builders/BuilderFactory.js';
import { checkUpdateTips } from './helpers/updater.js'; import { checkUpdateTips } from './helpers/updater.js';
// @ts-expect-error // @ts-expect-error
import packageJson from '../package.json'; import packageJson from '../package.json';
import logger from './options/logger.js';
program.version(packageJson.version).description('A cli application can package a web page to desktop application.'); program.version(packageJson.version).description('A cli application can package a web page to desktop application.');
@@ -25,7 +23,8 @@ program
.option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent) .option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
.option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent) .option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent)
.action(async (url: string, options: PakeCliOptions) => { .action(async (url: string, options: PakeCliOptions) => {
checkUpdateTips();
await checkUpdateTips();
if (!url) { if (!url) {
// 直接 pake 不需要出现url提示 // 直接 pake 不需要出现url提示
@@ -42,7 +41,7 @@ program
const appOptions = await handleInputOptions(options, url); const appOptions = await handleInputOptions(options, url);
builder.build(url, appOptions); await builder.build(url, appOptions);
}); });
program.parse(); program.parse();

37
bin/options/icon.ts vendored
View File

@@ -33,43 +33,6 @@ export async function getDefaultIcon() {
return path.join(npmDirectory, iconPath); return path.join(npmDirectory, iconPath);
} }
// export async function getIconFromPageUrl(url: string) {
// const icon = await pageIcon(url);
// console.log(icon);
// if (icon.ext === '.ico') {
// const a = await ICO.parse(icon.data);
// icon.data = Buffer.from(a[0].buffer);
// }
// const iconDir = (await dir()).path;
// const iconPath = path.join(iconDir, `/icon.icns`);
// const out = png2icons.createICNS(icon.data, png2icons.BILINEAR, 0);
// await fs.writeFile(iconPath, out);
// return iconPath;
// }
// export async function getIconFromMacosIcons(name: string) {
// const data = {
// query: name,
// filters: 'approved:true',
// hitsPerPage: 10,
// page: 1,
// };
// const res = await axios.post('https://p1txh7zfb3-2.algolianet.com/1/indexes/macOSicons/query?x-algolia-agent=Algolia%20for%20JavaScript%20(4.13.1)%3B%20Browser', data, {
// headers: {
// 'x-algolia-api-key': '0ba04276e457028f3e11e38696eab32c',
// 'x-algolia-application-id': 'P1TXH7ZFB3',
// },
// });
// if (!res.data.hits.length) {
// return '';
// } else {
// return downloadIcon(res.data.hits[0].icnsUrl);
// }
// }
export async function downloadIcon(iconUrl: string) { export async function downloadIcon(iconUrl: string) {
let iconResponse; let iconResponse;
try { try {

119
dist/cli.js vendored
View File

@@ -1646,7 +1646,7 @@ function mergeTauriConfig(url, options, tauriConf) {
const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/); const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/);
if (!reg.test(name) || reg.exec(name)[0].length != name.length) { if (!reg.test(name) || reg.exec(name)[0].length != name.length) {
logger.error("package name is illegal it must be letters, numbers, and it must contain the letters"); logger.error("package name is illegal it must be letters, numbers, and it must contain the letters");
logger.error("E.g 123pan,123Pan Pan123,weread, WeRead, WERead"); logger.error("E.g 123pan,123Pan,Pan123,weread,WeRead,WERead");
process.exit(); process.exit();
} }
} }
@@ -1752,38 +1752,6 @@ function getDefaultIcon() {
return path.join(npmDirectory, iconPath); return path.join(npmDirectory, iconPath);
}); });
} }
// export async function getIconFromPageUrl(url: string) {
// const icon = await pageIcon(url);
// console.log(icon);
// if (icon.ext === '.ico') {
// const a = await ICO.parse(icon.data);
// icon.data = Buffer.from(a[0].buffer);
// }
// const iconDir = (await dir()).path;
// const iconPath = path.join(iconDir, `/icon.icns`);
// const out = png2icons.createICNS(icon.data, png2icons.BILINEAR, 0);
// await fs.writeFile(iconPath, out);
// return iconPath;
// }
// export async function getIconFromMacosIcons(name: string) {
// const data = {
// query: name,
// filters: 'approved:true',
// hitsPerPage: 10,
// page: 1,
// };
// const res = await axios.post('https://p1txh7zfb3-2.algolianet.com/1/indexes/macOSicons/query?x-algolia-agent=Algolia%20for%20JavaScript%20(4.13.1)%3B%20Browser', data, {
// headers: {
// 'x-algolia-api-key': '0ba04276e457028f3e11e38696eab32c',
// 'x-algolia-application-id': 'P1TXH7ZFB3',
// },
// });
// if (!res.data.hits.length) {
// return '';
// } else {
// return downloadIcon(res.data.hits[0].icnsUrl);
// }
// }
function downloadIcon(iconUrl) { function downloadIcon(iconUrl) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let iconResponse; let iconResponse;
@@ -1861,8 +1829,8 @@ function checkRustInstalled() {
var tauri$3 = { var tauri$3 = {
windows: [ windows: [
{ {
url: "https://weread.qq.com/", url: "https://baidu.com",
transparent: true, transparent: false,
fullscreen: false, fullscreen: false,
width: 1200, width: 1200,
height: 780, height: 780,
@@ -1874,21 +1842,40 @@ var tauri$3 = {
}, },
updater: { updater: {
active: false active: false
},
bundle: {
icon: [
"/Users/tw93/www/pake/src-tauri/icons/icon.icns"
],
identifier: "pake-bb6e08",
active: true,
category: "DeveloperTool",
copyright: "",
externalBin: [
],
longDescription: "",
macOS: {
entitlements: null,
exceptionDomain: "",
frameworks: [
],
providerShortName: null,
signingIdentity: null
},
resources: [
],
shortDescription: "",
targets: [
"dmg"
]
} }
}; };
var build = {
devPath: "../dist",
distDir: "../dist",
beforeBuildCommand: "",
beforeDevCommand: ""
};
var CommonConf = { var CommonConf = {
"package": { "package": {
productName: "WeRead", productName: "baidu",
version: "1.0.0" version: "1.0.0"
}, },
tauri: tauri$3, tauri: tauri$3
build: build
}; };
var tauri$2 = { var tauri$2 = {
@@ -1931,9 +1918,9 @@ var WinConf = {
var tauri$1 = { var tauri$1 = {
bundle: { bundle: {
icon: [ icon: [
"icons/weread.icns" "/Users/tw93/www/pake/src-tauri/icons/icon.icns"
], ],
identifier: "com.tw93.weread", identifier: "pake-bb6e08",
active: true, active: true,
category: "DeveloperTool", category: "DeveloperTool",
copyright: "", copyright: "",
@@ -2038,7 +2025,7 @@ class MacBuilder {
yield installRust(); yield installRust();
} }
else { else {
log.error('Error: Pake need Rust to package your webapp!!!'); log.error('Error: Pake need Rust to package your webapp!');
process.exit(2); process.exit(2);
} }
}); });
@@ -2048,16 +2035,10 @@ class MacBuilder {
log.debug('PakeAppOptions', options); log.debug('PakeAppOptions', options);
const { name } = options; const { name } = options;
yield mergeTauriConfig(url, options, tauriConf); yield mergeTauriConfig(url, options, tauriConf);
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); //这里直接使用 universal-apple-darwin 的打包,而非当前系统的包
let arch = "x64"; yield shellExec(`cd ${npmDirectory} && npm install && npm run build:mac`);
if (process.arch === "arm64") { const dmgName = `${name}_${tauriConf.package.version}_universal.dmg`;
arch = "aarch64"; const appPath = this.getBuildAppPath(npmDirectory, dmgName);
}
else {
arch = process.arch;
}
const dmgName = `${name}_${tauriConf.package.version}_${arch}.dmg`;
const appPath = this.getBuildedAppPath(npmDirectory, dmgName);
const distPath = path.resolve(`${name}.dmg`); const distPath = path.resolve(`${name}.dmg`);
yield fs.copyFile(appPath, distPath); yield fs.copyFile(appPath, distPath);
yield fs.unlink(appPath); yield fs.unlink(appPath);
@@ -2065,8 +2046,8 @@ class MacBuilder {
logger.success('You can find the app installer in', distPath); logger.success('You can find the app installer in', distPath);
}); });
} }
getBuildedAppPath(npmDirectory, dmgName) { getBuildAppPath(npmDirectory, dmgName) {
return path.join(npmDirectory, 'src-tauri/target/release/bundle/dmg', dmgName); return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
} }
} }
@@ -2102,7 +2083,7 @@ class WinBuilder {
const language = tauriConf.tauri.bundle.windows.wix.language[0]; const language = tauriConf.tauri.bundle.windows.wix.language[0];
const arch = process.arch; const arch = process.arch;
const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`; const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`;
const appPath = this.getBuildedAppPath(npmDirectory, msiName); const appPath = this.getBuildAppPath(npmDirectory, msiName);
const distPath = path.resolve(`${name}.msi`); const distPath = path.resolve(`${name}.msi`);
yield fs.copyFile(appPath, distPath); yield fs.copyFile(appPath, distPath);
yield fs.unlink(appPath); yield fs.unlink(appPath);
@@ -2110,7 +2091,7 @@ class WinBuilder {
logger.success('You can find the app installer in', distPath); logger.success('You can find the app installer in', distPath);
}); });
} }
getBuildedAppPath(npmDirectory, dmgName) { getBuildAppPath(npmDirectory, dmgName) {
return path.join(npmDirectory, 'src-tauri/target/release/bundle/msi', dmgName); return path.join(npmDirectory, 'src-tauri/target/release/bundle/msi', dmgName);
} }
} }
@@ -2144,7 +2125,7 @@ class LinuxBuilder {
const { name } = options; const { name } = options;
yield mergeTauriConfig(url, options, tauriConf); yield mergeTauriConfig(url, options, tauriConf);
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`); yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
let arch = ""; let arch;
if (process.arch === "x64") { if (process.arch === "x64") {
arch = "amd64"; arch = "amd64";
} }
@@ -2152,21 +2133,21 @@ class LinuxBuilder {
arch = process.arch; arch = process.arch;
} }
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`; const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName); const appPath = this.getBuildAppPath(npmDirectory, "deb", debName);
const distPath = path.resolve(`${name}.deb`); const distPath = path.resolve(`${name}.deb`);
yield fs.copyFile(appPath, distPath); yield fs.copyFile(appPath, distPath);
yield fs.unlink(appPath); yield fs.unlink(appPath);
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`; const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName); const appImagePath = this.getBuildAppPath(npmDirectory, "appimage", appImageName);
const distAppPath = path.resolve(`${name}.AppImage`); const distAppPath = path.resolve(`${name}.AppImage`);
yield fs.copyFile(appImagePath, distAppPath); yield fs.copyFile(appImagePath, distAppPath);
yield fs.unlink(appImagePath); yield fs.unlink(appImagePath);
logger.success('Build success!'); logger.success('Build success!');
logger.success('You can find the deb app installer in', distPath); logger.success('You can find the deb app installer in', distPath);
logger.success('You can find the Appimage app installer in', distAppPath); logger.success('You can find the AppImage app installer in', distAppPath);
}); });
} }
getBuildedAppPath(npmDirectory, packageType, packageName) { getBuildAppPath(npmDirectory, packageType, packageName) {
return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName); return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName);
} }
} }
@@ -2187,7 +2168,7 @@ class BuilderFactory {
} }
var name = "pake-cli"; var name = "pake-cli";
var version = "1.0.1"; var version = "1.2.0";
var description = "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust."; var description = "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.";
var engines = { var engines = {
node: "^14.13 || >=16.0.0" node: "^14.13 || >=16.0.0"
@@ -2303,7 +2284,7 @@ program
.option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent) .option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
.option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent) .option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent)
.action((url, options) => __awaiter(void 0, void 0, void 0, function* () { .action((url, options) => __awaiter(void 0, void 0, void 0, function* () {
checkUpdateTips(); yield checkUpdateTips();
if (!url) { if (!url) {
// 直接 pake 不需要出现url提示 // 直接 pake 不需要出现url提示
program.help(); program.help();
@@ -2315,6 +2296,6 @@ program
const builder = BuilderFactory.create(); const builder = BuilderFactory.create();
yield builder.prepare(); yield builder.prepare();
const appOptions = yield handleOptions(options, url); const appOptions = yield handleOptions(options, url);
builder.build(url, appOptions); yield builder.build(url, appOptions);
})); }));
program.parse(); program.parse();

View File

@@ -1,6 +1,6 @@
{ {
"name": "pake-cli", "name": "pake-cli",
"version": "1.1.0", "version": "1.2.0",
"description": "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.", "description": "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.",
"engines": { "engines": {
"node": "^14.13 || >=16.0.0" "node": "^14.13 || >=16.0.0"

3
script/build.sh vendored
View File

@@ -45,7 +45,6 @@ if [[ "$OSTYPE" =~ ^linux ]]; then
# for linux, package name may be com.xxx.xxx # for linux, package name may be com.xxx.xxx
echo "rename package name" echo "rename package name"
export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop" export desktop_file="src-tauri/assets/${package_prefix}.weread.desktop"
# sed -i "s/\"productName\": \"weread\"/\"productName\": \"${package_prefix}-weread\"/g" src-tauri/tauri.conf.json
$sd "\"productName\": \"WeRead\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json $sd "\"productName\": \"WeRead\"" "\"productName\": \"${package_prefix}-weread\"" src-tauri/tauri.conf.json
fi fi
@@ -109,7 +108,6 @@ do
if [[ "$OSTYPE" =~ ^darwin ]]; then if [[ "$OSTYPE" =~ ^darwin ]]; then
npm run tauri build -- --target universal-apple-darwin npm run tauri build -- --target universal-apple-darwin
# mv src-tauri/target/release/bundle/dmg/*.dmg output/macos/${package_title}_x64.dmg
mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg output/macos/${package_title}.dmg mv src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg output/macos/${package_title}.dmg
fi fi
@@ -119,4 +117,3 @@ done
echo "build all package success!" echo "build all package success!"
echo "you run 'rm src-tauri/assets/*.desktop && git checkout src-tauri' to recovery code" echo "you run 'rm src-tauri/assets/*.desktop && git checkout src-tauri' to recovery code"
# rm src-tauri/assets/*.desktop && git checkout src-tauri

View File

@@ -1,30 +1 @@
{ {"package":{"productName":"baidu","version":"1.0.0"},"tauri":{"windows":[{"url":"https://baidu.com","transparent":false,"fullscreen":false,"width":1200,"height":780,"resizable":true}],"security":{"csp":null},"updater":{"active":false},"bundle":{"icon":["/Users/tw93/www/pake/src-tauri/icons/icon.icns"],"identifier":"pake-bb6e08","active":true,"category":"DeveloperTool","copyright":"","externalBin":[],"longDescription":"","macOS":{"entitlements":null,"exceptionDomain":"","frameworks":[],"providerShortName":null,"signingIdentity":null},"resources":[],"shortDescription":"","targets":["dmg"]}}}
"package": {
"productName": "WeRead",
"version": "1.0.0"
},
"tauri": {
"windows": [
{
"url": "https://weread.qq.com/",
"transparent": true,
"fullscreen": false,
"width": 1200,
"height": 780,
"resizable": true
}
],
"security": {
"csp": null
},
"updater": {
"active": false
}
},
"build": {
"devPath": "../dist",
"distDir": "../dist",
"beforeBuildCommand": "",
"beforeDevCommand": ""
}
}

View File

@@ -1,25 +1 @@
{ {"tauri":{"bundle":{"icon":["/Users/tw93/www/pake/src-tauri/icons/icon.icns"],"identifier":"pake-bb6e08","active":true,"category":"DeveloperTool","copyright":"","externalBin":[],"longDescription":"","macOS":{"entitlements":null,"exceptionDomain":"","frameworks":[],"providerShortName":null,"signingIdentity":null},"resources":[],"shortDescription":"","targets":["dmg"]}}}
"tauri": {
"bundle": {
"icon": [
"icons/weread.icns"
],
"identifier": "com.tw93.weread",
"active": true,
"category": "DeveloperTool",
"copyright": "",
"externalBin": [],
"longDescription": "",
"macOS": {
"entitlements": null,
"exceptionDomain": "",
"frameworks": [],
"providerShortName": null,
"signingIdentity": null
},
"resources": [],
"shortDescription": "",
"targets": ["dmg"]
}
}
}