material-icons-browser-exte.../scripts/update-manifest-version.ts
Michael Goodman 0d067d0394
[Bug fix] Fix custom domains not working after conversion to typescript. (#6)
* added dotenv dev dependency, to prevent being dependent on IDE to set env variables

* added biomejs to dev dependencies, was missing

* fixed custom domains not working after ts conversion

* fixed a bug where you could not add multiple custom domains, because the script was trying to register multiple content scripts with same id
2024-07-04 09:51:54 +02:00

36 lines
975 B
TypeScript

import 'dotenv/config';
import * as path from 'path';
import * as fs from 'fs/promises';
const packageJsonPath: string = path.resolve(__dirname, '..', 'package.json');
const manifestPath: string = path.resolve(
__dirname,
'..',
'src',
'manifests',
'base.json'
);
const updateManifestVersion = async (): Promise<void> => {
const packageJsonData: string = await fs.readFile(packageJsonPath, {
encoding: 'utf8',
});
const packageJson = JSON.parse(packageJsonData);
const manifestData: string = await fs.readFile(manifestPath, {
encoding: 'utf8',
});
const manifest = JSON.parse(manifestData);
const updatedManifest = {
...manifest,
version: packageJson.version,
};
const updatedManifestStr: string = `${JSON.stringify(updatedManifest, null, 2)}\n`;
await fs.writeFile(manifestPath, updatedManifestStr);
console.log(`Updated manifest.json version to ${packageJson.version}`);
};
updateManifestVersion().catch(console.error);