Skip to content
This repository has been archived by the owner on Oct 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #255 from kabisa/feature/cordova-prepare-before-run
Browse files Browse the repository at this point in the history
Run `cordova prepare` in `maji run`
  • Loading branch information
pascalw authored Mar 11, 2019
2 parents 3a8627d + 58bb33f commit d6969e0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ module.exports.build = (environment, platform, mode, restArgs) => {
USE_CORDOVA: !!platform
};

const buildAssets = () => runYarn(["run", "build"], env);
const buildNative = () =>
platform
? buildCordovaApp(platform, mode, env, restArgs)
: Promise.resolve();

return buildAssets().then(buildNative);
return buildAssets(env).then(buildNative);
};

/**
Expand All @@ -40,20 +39,25 @@ module.exports.run = (environment, platform, deviceType, restArgs) => {
};
const deviceOpts = process.env.DEVICE_OPTS ? [process.env.DEVICE_OPTS] : [];

const buildAssets = () => runYarn(["run", "build"], env);
const cordovaRun = () =>
runCordova(
["run", platform, `--${deviceType}`, ...restArgs, ...deviceOpts],
env
);

return buildAssets().then(cordovaRun);
return buildAssets(env)
.then(() => cordovaPrepare(platform, env))
.then(cordovaRun);
};

const buildAssets = env => runYarn(["run", "build"], env);

const cordovaPrepare = (platform, env) =>
runCordova(["prepare", platform], env);

const buildCordovaApp = (platform, mode, env, restArgs) => {
const prepareCordova = () => runCordova(["prepare", platform], env);
const buildCordova = () =>
runCordova(["build", platform, `--${mode}`, ...restArgs], env);

return prepareCordova().then(buildCordova);
return cordovaPrepare(platform, env).then(buildCordova);
};

0 comments on commit d6969e0

Please sign in to comment.