Skip to content

Commit

Permalink
⚡ Renovate build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
CosmoMyzrailGorynych committed Mar 27, 2020
1 parent ff6ed15 commit 0f09f50
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 11 deletions.
2 changes: 2 additions & 0 deletions app/data/ct.release/pixi-particles.min.js

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"main": "index.js",
"name": "ct.js",
"name": "ctjs",
"description": "ct.js — a free 2D game engine",
"version": "1.3.0",
"homepage": "https://ctjs.rocks/",
Expand Down Expand Up @@ -99,7 +99,8 @@
"zip"
],
"category": "Development",
"maintainer": "Cosmo Myzrail Gorynych"
"maintainer": "Cosmo Myzrail Gorynych",
"synopsis": "A free 2D game editor"
},
"win": {
"target": [
Expand All @@ -120,6 +121,9 @@
"dmg": {
"backgroundColor": "#446adb",
"background": "dmgBg.png"
},
"appImage": {
"license": "./LICENSE"
}
}
}
File renamed without changes.
File renamed without changes.
93 changes: 85 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ const path = require('path'),
const argv = minimist(process.argv.slice(2));
const npm = (/^win/).test(process.platform) ? 'npm.cmd' : 'npm';

const targets = [
'darwin-x64',
'linux-arm64',
'linux-armv7l',
'linux-ia32',
'linux-x64',
'win32-arm64',
'win32-ia32',
'win32-x64'
];

const pack = require('./app/package.json');

var channelPostfix = argv.channel || false;
Expand Down Expand Up @@ -339,16 +350,79 @@ const build = gulp.parallel([
]);

const bakePackages = async () => {
const builder = require('electron-builder');
const packager = require('electron-packager');
await fs.remove(path.join('./build', `ctjs - v${pack.version}`));
await builder.build({// @see https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/src/packagerApi.ts
projectDir: './app',
//mac: pack.build.mac.target || ['default'],
//win: pack.build.win.target,
//linux: pack.build.linux.target
});
const baseOptions = {
// Build parameters
dir: './app',
out: './build',
asar: true,
overwrite: true,
icon: './buildAssets/icon',

appCategoryType: 'public.app-category.developer-tools',

name: 'ct.js',
executableName: 'ctjs',
appCopyright: `Copyright © Cosmo Myzrail Gorynych ${(new Date()).getFullYear()} and contributors. Distributed under MIT license.`,
win32metadata: {
CompanyName: 'Cosmo Myzrail Gorynych aka ComigoGames',
FileDescription: 'A free, open-source 2D game editor that is easy to learn and fun to use'
},

ignore: [
/app\/data\/ct\.(libs|release)/,
/app\/data\/docs/,
/app\/data\/i18n/
],

all: true
};

// wtf and why do I need it? @see https://github.com/electron/electron-packager/issues/875
// process.noAsar = true;

const paths = await packager(baseOptions);
console.log('Built to these locations:', paths);
};

const passthroughBundle = async () => {
await Promise.all(targets.map(target => Promise.all([
'data/ct.release',
'data/ct.libs',
'data/docs',
'data/i18n'
].map(subpath => fs.copy(
path.join('./app', subpath),
path.join('./build/', `ct.js-${target}`, subpath)
)))));
};

//const flatpak = done => {
// const installer = require('electron-installer-flatpak');
// const options = {
// src: 'build/ct.js-linux-x64',
// dest: 'dist/',
// arch: 'x64',
// icon: 'app/ct_ide.png',
// categories: ['Development']
// };
//
// console.log('Creating flatpak package… (this may take a while)');
//
// installer(options, function (err) {
// if (err) {
// throw err;
// }
// console.log('Successfully created package at ' + options.dest);
// done();
// });
//};

const zipPackages = async () => {
await Promise.all(targets.map(target => fs.remove(`./build/ct.js-${target}.zip`)));
await Promise.all(targets.map(target => spawnise.fromLines(`zip -r -y ./build/ct.js-${target}.zip ./build/ct.js-${target}`)));
};

const examples = () => gulp.src('./src/examples/**/*')
.pipe(gulp.dest('./app/examples'));
Expand Down Expand Up @@ -381,7 +455,10 @@ const packages = gulp.series([
docs,
patronsCache,
examples,
bakePackages
bakePackages,
passthroughBundle,
zipPackages
//flatpak
]);

const deployOnly = () => {
Expand Down
1 change: 1 addition & 0 deletions node_requires/spawnise/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const spawnise = {
fromLines: (lines, opts) => {
const commands = lines.split('\n')
.map(str => str.trim())
.filter(str => str)
.map(str => str.split(' '))
.map(arrs => [arrs[0], [...arrs.slice(1)]]);
return Promise.all(commands.map(set => spawnise.spawn(set[0], set[1], opts)));
Expand Down
2 changes: 1 addition & 1 deletion src/node_requires/exporter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const exportCtProject = async (project, projdir) => {
await fs.copyFile(basePath + 'ct.release/pixi.min.js', path.join(writeDir, '/pixi.min.js'));
}
if (currentProject.emitterTandems && currentProject.emitterTandems.length) {
await fs.copyFile('node_modules/pixi-particles/dist/pixi-particles.min.js', path.join(writeDir, '/pixi-particles.min.js'));
await fs.copyFile(basePath + 'ct.release/pixi-particles.min.js', path.join(writeDir, '/pixi-particles.min.js'));
}

const startroom = getStartingRoom(currentProject);
Expand Down

0 comments on commit 0f09f50

Please sign in to comment.