Skip to content

Commit

Permalink
feat: Ctrl+Shift+R to reload Window
Browse files Browse the repository at this point in the history
refactor: Change build tools
  • Loading branch information
colin969 committed Apr 3, 2024
1 parent 9389cde commit 9d9b3d0
Show file tree
Hide file tree
Showing 24 changed files with 1,776 additions and 2,223 deletions.
20 changes: 0 additions & 20 deletions .swcrc

This file was deleted.

2 changes: 1 addition & 1 deletion extensions/core-curation
41 changes: 32 additions & 9 deletions extensions/core-ruffle/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const fs = require('fs');
const gulp = require('gulp');
const zip = require('gulp-zip');
const merge = require('merge-stream');
const esbuild = require('esbuild');

const filesToCopy = [
'extension.js',
Expand All @@ -12,6 +13,29 @@ const filesToCopy = [
'README.md'
];

function build(done) {
esbuild.build({
bundle: true,
entryPoints: ['./src/extension.ts'],
outfile: './dist/extension.js',
platform: 'node',
external: ['flashpoint-launcher'],
})
.catch(console.error)
.finally(done);
}

async function watch() {
const ctx = await esbuild.context({
bundle: true,
entryPoints: ['./src/extension.ts'],
outfile: './dist/extension.js',
platform: 'node',
external: ['flashpoint-launcher'],
});
return ctx.watch();
}

function clean(cb) {
fs.rm('./package', { recursive: true }, (err) => {
if (err) { console.log('Clean', err); }
Expand All @@ -22,22 +46,21 @@ function clean(cb) {
function stage() {
const streams = filesToCopy.map(file => {
if (fs.existsSync(file)) {
return gulp.src(file).pipe(gulp.dest('package/core-curation'));
return gulp.src(file).pipe(gulp.dest('package/core-ruffle'));
}
}).filter(s => s !== undefined);
return merge([
...streams,
gulp.src('out/**/*').pipe(gulp.dest('package/core-curation/out')),
gulp.src('dist/**/*').pipe(gulp.dest('package/core-curation/dist')),
gulp.src('static/**/*').pipe(gulp.dest('package/core-curation/static')),
gulp.src('out/**/*').pipe(gulp.dest('package/core-ruffle/out')),
gulp.src('dist/**/*').pipe(gulp.dest('package/core-ruffle/dist')),
gulp.src('static/**/*').pipe(gulp.dest('package/core-ruffle/static')),
]);
}

function package() {
return gulp.src('package/**/*').pipe(zip('core-curation.fplx')).pipe(gulp.dest('.'));
return gulp.src('package/**/*').pipe(zip('core-ruffle.fplx')).pipe(gulp.dest('.'));
}

exports.clean = clean;
exports.stage = stage;
exports.package = package;
exports.default = series(clean, stage, package);
exports.build = series(build);
exports.watch = series(watch);
exports.package = series(clean, stage, package);
Loading

0 comments on commit 9d9b3d0

Please sign in to comment.