Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM-ify extensions #1072

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions scripts/prepare-extensions.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
const pathUtil = require('path');

let Builder;
try {
Builder = require('../extensions/development/builder');
} catch (e) {
console.error('Could not load TurboWarp/extensions build scripts, most likely because the submodule is missing.');
console.error('Try running: `git submodule init` and `git submodule update`');
console.error(e);
process.exit(1);
}
(async () => {
let Builder;
try {
Builder = await import('../extensions/development/builder');
} catch (e) {
console.error('Could not load TurboWarp/extensions build scripts, most likely because the submodule is missing.');
console.error('Try running: `git submodule init` and `git submodule update`');
console.error(e);
process.exit(1);
}

const outputDirectory = pathUtil.join(__dirname, '../dist-extensions/');
const mode = 'desktop';
const builder = new Builder(mode);
const build = builder.build();
build.export(outputDirectory);
const outputDirectory = pathUtil.join(__dirname, '../dist-extensions/');
const mode = 'desktop';
const builder = new Builder(mode);
const build = await builder.build();
await build.export(outputDirectory);

console.log(`Built ${mode} copy of extensions.turbowarp.org to ${outputDirectory}`);
console.log(`Built ${mode} copy of extensions.turbowarp.org to ${outputDirectory}`);
})();