forked from olcxjas-softworks/LarpixClient
Add capacitorjs runtime
This commit is contained in:
parent
d0ece489ee
commit
f90c0e6c40
8362 changed files with 1502407 additions and 1 deletions
53
node_modules/@capacitor-community/electron/build.js
generated
vendored
Normal file
53
node_modules/@capacitor-community/electron/build.js
generated
vendored
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/* eslint-disable no-undef */
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const esbuild = require('esbuild');
|
||||
const { readdirSync } = require('fs');
|
||||
const { join } = require('path');
|
||||
const tar = require('tar');
|
||||
|
||||
async function packTemplate() {
|
||||
const templateSrc = join('./', 'src', 'electron-platform-template');
|
||||
const destTemplateFilePath = join('./', 'template.tar.gz');
|
||||
const files = [];
|
||||
readdirSync(templateSrc).forEach((file) => {
|
||||
files.push(file);
|
||||
});
|
||||
await tar.create({ gzip: true, file: destTemplateFilePath, cwd: templateSrc }, files);
|
||||
console.log(`Packed ${destTemplateFilePath}!`);
|
||||
}
|
||||
|
||||
async function buildCliScrpts() {
|
||||
await esbuild.build({
|
||||
entryPoints: ['src/cli-scripts/index.ts'],
|
||||
bundle: true,
|
||||
outfile: 'dist/cli-scripts/cap-scripts.js',
|
||||
platform: 'node',
|
||||
target: 'node16',
|
||||
minify: true,
|
||||
external: ['child_process', 'fs', 'path', 'fs-extra', 'crypto', 'chalk', 'ora'],
|
||||
});
|
||||
}
|
||||
|
||||
async function buildPlatformCore() {
|
||||
await esbuild.build({
|
||||
entryPoints: ['src/electron-platform/index.ts'],
|
||||
bundle: true,
|
||||
outfile: 'dist/core/index.js',
|
||||
platform: 'node',
|
||||
target: 'node16',
|
||||
minify: true,
|
||||
external: ['electron', 'fs', 'path', 'mime-types', 'events'],
|
||||
});
|
||||
}
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
await buildPlatformCore();
|
||||
await buildCliScrpts();
|
||||
await packTemplate();
|
||||
console.log('\nPlatform Build Complete.\n');
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
}
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue