mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 23:58:06 +01:00
3a5538bd50
The main `version` field in `package.json` will now include the beta version (if present) rather than it being passed in via the CLI when building. The `version` field is now a fully SemVer-compatible version, with the added restriction that any prerelease portion of the version must match the format `<build type>.<build version>`. This brings the build in-line with the future release process we will be using for the beta version. The plan is for each future release to enter a "beta phase" where the version would get updated to reflect that it's a beta, and we would increment this beta version over time as we update the beta. The manifest gives us a place to store this beta version. It was also important to replace the automatic minor bump logic that was being used previously, because the version in beta might not be a minor bump. Additionally, the filename logic used for beta builds was updated to be generic across all build types rather than beta-specific. This will be useful for Flask builds in the future.
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
const { promises: fs } = require('fs');
|
|
const gulp = require('gulp');
|
|
const gulpZip = require('gulp-zip');
|
|
const del = require('del');
|
|
const pify = require('pify');
|
|
const pump = pify(require('pump'));
|
|
const { version } = require('../../package.json');
|
|
const { createTask, composeParallel } = require('./task');
|
|
const { BuildTypes } = require('./utils');
|
|
|
|
module.exports = createEtcTasks;
|
|
|
|
function createEtcTasks({ browserPlatforms, buildType, livereload }) {
|
|
const clean = createTask('clean', async function clean() {
|
|
await del(['./dist/*']);
|
|
await Promise.all(
|
|
browserPlatforms.map(async (platform) => {
|
|
await fs.mkdir(`./dist/${platform}`, { recursive: true });
|
|
}),
|
|
);
|
|
});
|
|
|
|
const reload = createTask('reload', function devReload() {
|
|
livereload.listen({ port: 35729 });
|
|
});
|
|
|
|
// zip tasks for distribution
|
|
const zip = createTask(
|
|
'zip',
|
|
composeParallel(
|
|
...browserPlatforms.map((platform) => createZipTask(platform, buildType)),
|
|
),
|
|
);
|
|
|
|
return { clean, reload, zip };
|
|
}
|
|
|
|
function createZipTask(platform, buildType) {
|
|
return async () => {
|
|
const path =
|
|
buildType === BuildTypes.main
|
|
? `metamask-${platform}-${version}`
|
|
: `metamask-${buildType}-${platform}-${version}`;
|
|
await pump(
|
|
gulp.src(`dist/${platform}/**`),
|
|
gulpZip(`${path}.zip`),
|
|
gulp.dest('builds'),
|
|
);
|
|
};
|
|
}
|