mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-01 13:47:06 +01:00
95c37e1ba3
* feat: add yaml feature management Add yaml feature file per build type. Also add method to parse yaml and set enabled features env to true. The build process will then replace any process.env[feature] that exists on the config by its value * chore: add example for desktop * Added initial draft of build features * [TMP] Sync between computers * Is able to succesfully build stable extension with snaps feature * Removing var context from builds.yml * Add asssets to builds.yml * Minor bug fixes and removing debug logs * [WIP] Test changes * Removed TODOs * Fix regession bug Also * remove debug logs * merge Variables.set and Variables.setMany with an overload * Fix build, lint and a bunch of issues * Update LavaMoat policies * Re-add desktop build type * Fix some tests * Fix desktop build * Define some env variables used by MV3 * Fix lint * Fix remove-fenced-code tests * Fix README typo * Move new code * Fix missing asset copy * Move Jest env setup * Fix path for test after rebase * Fix code fences * Fix fencing and LavaMoat policies * Fix MMI code-fencing after rebase * Fix MMI code fencing after merge * Fix more MMI code fencing --------- Co-authored-by: cryptotavares <joao.tavares@consensys.net> Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com> Co-authored-by: Brad Decker <bhdecker84@gmail.com>
60 lines
1.9 KiB
JavaScript
60 lines
1.9 KiB
JavaScript
const { promises: fs } = require('fs');
|
|
const gulp = require('gulp');
|
|
const sort = require('gulp-sort');
|
|
const gulpZip = require('gulp-zip');
|
|
const del = require('del');
|
|
const pify = require('pify');
|
|
const pump = pify(require('pump'));
|
|
|
|
const { loadBuildTypesConfig } = require('../lib/build-type');
|
|
const { TASKS } = require('./constants');
|
|
const { createTask, composeParallel } = require('./task');
|
|
|
|
module.exports = createEtcTasks;
|
|
|
|
function createEtcTasks({ browserPlatforms, buildType, livereload, version }) {
|
|
const clean = createTask(TASKS.CLEAN, async function clean() {
|
|
await del(['./dist/*']);
|
|
await Promise.all(
|
|
browserPlatforms.map(async (platform) => {
|
|
await fs.mkdir(`./dist/${platform}`, { recursive: true });
|
|
}),
|
|
);
|
|
});
|
|
|
|
const reload = createTask(TASKS.RELOAD, function devReload() {
|
|
livereload.listen({ port: 35729 });
|
|
});
|
|
|
|
// zip tasks for distribution
|
|
const zip = createTask(
|
|
TASKS.ZIP,
|
|
composeParallel(
|
|
...browserPlatforms.map((platform) =>
|
|
createZipTask(platform, buildType, version),
|
|
),
|
|
),
|
|
);
|
|
|
|
return { clean, reload, zip };
|
|
}
|
|
|
|
function createZipTask(platform, buildType, version) {
|
|
return async () => {
|
|
const path =
|
|
buildType === loadBuildTypesConfig().default
|
|
? `metamask-${platform}-${version}`
|
|
: `metamask-${buildType}-${platform}-${version}`;
|
|
await pump(
|
|
gulp.src(`dist/${platform}/**`),
|
|
// sort files and set `mtime` to epoch to ensure zip build is deterministic
|
|
sort(),
|
|
// Modified time set to an arbitrary static date to ensure build the is reproducible.
|
|
// The date chosen is MetaMask's birthday. Originally we chose the Unix epoch, but this
|
|
// resulted in invalid dates on certain timezones/operating systems.
|
|
gulpZip(`${path}.zip`, { modifiedTime: new Date('2016-07-14T00:00:00') }),
|
|
gulp.dest('builds'),
|
|
);
|
|
};
|
|
}
|