1
0
mirror of https://gitcode.com/github-mirrors/react-native-update-cli.git synced 2025-09-16 01:41:37 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

add gitignore check

This commit is contained in:
sunnylqm
2025-04-01 23:13:20 +08:00
parent b725d2b08e
commit fbdacfffd2
4 changed files with 48 additions and 11 deletions

View File

@@ -136,11 +136,11 @@
"hasValue": true
},
"intermediaDir": {
"default": ".pushy/intermedia/${platform}",
"default": "${tempDir}/intermedia/${platform}",
"hasValue": true
},
"output": {
"default": ".pushy/output/${platform}.${time}.ppk",
"default": "${tempDir}/output/${platform}.${time}.ppk",
"hasValue": true
},
"sourcemap": {
@@ -167,7 +167,7 @@
"description": "Create diff patch",
"options": {
"output": {
"default": ".pushy/output/diff",
"default": "${tempDir}/output/diff",
"hasValue": true
}
}
@@ -176,7 +176,7 @@
"description": "Create diff patch from a Android package(.apk)",
"options": {
"output": {
"default": ".pushy/output/diff-${time}.apk-patch",
"default": "${tempDir}/output/diff-${time}.apk-patch",
"hasValue": true
}
}
@@ -185,7 +185,7 @@
"description": "Create diff patch from a iOS package(.ipa)",
"options": {
"output": {
"default": ".pushy/output/diff-${time}.ipa-patch",
"default": "${tempDir}/output/diff-${time}.ipa-patch",
"hasValue": true
}
}
@@ -194,7 +194,7 @@
"description": "Create hdiff patch",
"options": {
"output": {
"default": ".pushy/output/hdiff",
"default": "${tempDir}/output/hdiff",
"hasValue": true
}
}
@@ -203,7 +203,7 @@
"description": "Create hdiff patch from a Android package(.apk)",
"options": {
"output": {
"default": ".pushy/output/hdiff-${time}.apk-patch",
"default": "${tempDir}/output/hdiff-${time}.apk-patch",
"hasValue": true
}
}
@@ -212,7 +212,7 @@
"description": "Create hdiff patch from a Prepare package(.ppk)",
"options": {
"output": {
"default": ".pushy/output/hdiff-${time}.ppk-patch",
"default": "${tempDir}/output/hdiff-${time}.ppk-patch",
"hasValue": true
}
}
@@ -221,7 +221,7 @@
"description": "Create hdiff patch from a Harmony package(.app)",
"options": {
"output": {
"default": ".pushy/output/hdiff-${time}.app-patch",
"default": "${tempDir}/output/hdiff-${time}.app-patch",
"hasValue": true
}
}
@@ -230,7 +230,7 @@
"description": "Create hdiff patch from a iOS package(.ipa)",
"options": {
"output": {
"default": ".pushy/output/hdiff-${time}.ipa-patch",
"default": "${tempDir}/output/hdiff-${time}.ipa-patch",
"hasValue": true
}
}
@@ -241,4 +241,4 @@
"default": false
}
}
}
}

View File

@@ -12,6 +12,7 @@ import os from 'node:os';
const properties = require('properties');
import { depVersions } from './utils/dep-versions';
import { t } from './utils/i18n';
import { tempDir } from './utils/constants';
let bsdiff;
let hdiff;
@@ -908,6 +909,7 @@ export const commands = {
disableHermes,
} = translateOptions({
...options,
tempDir,
platform,
});

View File

@@ -5,6 +5,7 @@ import updateNotifier from 'update-notifier';
import { printVersionCommand } from './utils';
import pkg from '../package.json';
import { t } from './utils/i18n';
import { addGitIgnore } from './utils/add-gitignore';
updateNotifier({ pkg }).notify({
isGlobal: true,
@@ -32,6 +33,7 @@ const commands = {
};
async function run() {
addGitIgnore();
await printVersionCommand();
if (process.argv.indexOf('-v') >= 0 || process.argv[2] === 'version') {
process.exit();

View File

@@ -0,0 +1,33 @@
import fs from 'node:fs';
import path from 'node:path';
import { credentialFile, tempDir } from './constants';
export function addGitIgnore() {
const shouldIgnore = [credentialFile, tempDir];
const gitignorePath = path.join(process.cwd(), '.gitignore');
if (!fs.existsSync(gitignorePath)) {
return;
}
const gitignoreContent = fs.readFileSync(gitignorePath, 'utf-8');
const gitignoreLines = gitignoreContent.split('\n');
for (const line of gitignoreLines) {
const index = shouldIgnore.indexOf(line);
if (index !== -1) {
shouldIgnore.splice(index, 1);
}
}
if (shouldIgnore.length > 0) {
for (const line of shouldIgnore) {
gitignoreLines.push(line);
console.log(`Added ${line} to .gitignore`);
}
fs.writeFileSync(gitignorePath, gitignoreLines.join('\n'));
}
}