release: prepare August 1 Android RC
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { renderAndroidPrivacy } from './app-legal-config.mjs';
|
||||
|
||||
const projectRoot = resolve(import.meta.dirname, '..');
|
||||
const templatePath = resolve(projectRoot, 'androidPrivacy.json.example');
|
||||
// uni-app CLI uses src/ as UNI_INPUT_DIR. The App-Plus compiler only copies
|
||||
// androidPrivacy.json from that input directory into the native build resource.
|
||||
const outputPath = resolve(projectRoot, 'src', 'androidPrivacy.json');
|
||||
|
||||
const argumentValue = (name) => {
|
||||
const prefix = `--${name}=`;
|
||||
return process.argv.find((argument) => argument.startsWith(prefix))?.slice(prefix.length);
|
||||
};
|
||||
|
||||
const termsUrl = argumentValue('terms-url') || process.env.VITE_APP_TERMS_URL;
|
||||
const privacyUrl = argumentValue('privacy-url') || process.env.VITE_APP_PRIVACY_URL;
|
||||
|
||||
try {
|
||||
const rendered = renderAndroidPrivacy(
|
||||
readFileSync(templatePath, 'utf8'),
|
||||
termsUrl,
|
||||
privacyUrl
|
||||
);
|
||||
writeFileSync(outputPath, rendered, 'utf8');
|
||||
console.log('src/androidPrivacy.json configured from final public legal URLs.');
|
||||
} catch (error) {
|
||||
console.error(`Android privacy configuration failed: ${error instanceof Error ? error.message : String(error)}`);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user