6043d23a42
All CI tests currently run in TravisCI are ported to GitHub Actions except for the BrowserStack tests. TravisCI is kept in place for some transition period until we know GitHub Actions are working as expected. Also tests run on BrowserStack must be migrated to GitHub Actions before.
62 lines
1.3 KiB
JavaScript
62 lines
1.3 KiB
JavaScript
/* eslint-env node */
|
|
/* eslint-disable no-console */
|
|
'use strict';
|
|
|
|
const { copy, ensureDir, unlink } = require('fs-extra');
|
|
const { exec } = require('child_process');
|
|
|
|
const apiPath = 'api/';
|
|
const targets = [
|
|
'composer.json',
|
|
'composer.lock',
|
|
'config.default.php',
|
|
'cron.php',
|
|
'index.php',
|
|
'classes/',
|
|
'utils/',
|
|
];
|
|
|
|
module.exports = {
|
|
name: 'include-api-in-build',
|
|
|
|
postBuild(result) {
|
|
let environment = this.app.env;
|
|
|
|
// do not include app if build is for testing purposes only
|
|
if (environment === 'test') {
|
|
return;
|
|
}
|
|
let outputPath = result.directory + '/api';
|
|
|
|
return Promise.resolve()
|
|
.then(() => {
|
|
return ensureDir(outputPath);
|
|
})
|
|
.then(() => {
|
|
return Promise.all(
|
|
targets.map((target) => {
|
|
return copy(`${apiPath}/${target}`, `${outputPath}/${target}`);
|
|
})
|
|
);
|
|
})
|
|
.then(() => {
|
|
return new Promise((resolve, reject) => {
|
|
exec('composer install --no-dev', {
|
|
cwd: outputPath
|
|
}, (err) => {
|
|
if (err) {
|
|
reject(err);
|
|
}
|
|
|
|
resolve();
|
|
});
|
|
});
|
|
})
|
|
.then(() => {
|
|
return Promise.all([
|
|
unlink(`${outputPath}/composer.json`),
|
|
unlink(`${outputPath}/composer.lock`),
|
|
]);
|
|
});
|
|
}
|
|
};
|