clear-wallet/release-scripts/post-build.ts

21 lines
946 B
TypeScript
Raw Permalink Normal View History

2022-11-02 15:11:16 +00:00
(async () => {
const CONTENT_BUILD_PATH = 'src/extension/content.js'
2024-01-24 00:41:31 +00:00
const METAMASK_INJECT_PATH = 'src/extension/inject.js'
2022-11-02 15:11:16 +00:00
const fs = (await import('fs')).default
2023-03-11 15:30:46 +00:00
const path = (await import('path')).default
2022-11-02 15:11:16 +00:00
const pkg = JSON.parse(fs.readFileSync('dist/manifest.json').toString());
pkg.content_scripts[0].js[0] = CONTENT_BUILD_PATH
2024-01-24 00:41:31 +00:00
pkg.content_scripts[1].js[0] = METAMASK_INJECT_PATH
2022-11-02 15:11:16 +00:00
fs.writeFileSync('dist/manifest.json', JSON.stringify(pkg, null, 2))
fs.writeFileSync('dist/'+ CONTENT_BUILD_PATH, fs.readFileSync('src/extension/content.js').toString())
2024-01-24 00:41:31 +00:00
fs.writeFileSync('dist/'+ METAMASK_INJECT_PATH, fs.readFileSync('src/extension/inject.js').toString())
2023-03-11 15:30:46 +00:00
const directory = 'dist/assets/';
fs.readdir(directory, (err, files) => {
files.forEach(file => {
if(file.startsWith('content'))
fs.unlinkSync( path.resolve(directory + file))
});
});
})();