mirror of
https://github.com/fluencelabs/dashboard
synced 2024-12-04 15:20:21 +00:00
204f7f3be9
* Bump js-client * Temp deploy dev on prod * Fix * Fix * Bump fcli * Fix * F * update js-client.web.standalone * bump node.js for dev as well * compile differently * update multiaddr * install old multiaddr explicitly * remove openssl-legacy * return parameter name * downgrade * use kras compatible versions * remove prefix * Cleanup --------- Co-authored-by: Artsiom Shamsutdzinau <shamsartem@gmail.com>
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
// @ts-check
|
|
|
|
import { join } from 'path';
|
|
import { AquaConfig, Aqua, Path } from './node_modules/@fluencelabs/aqua-api/aqua-api.js';
|
|
import { mkdir, writeFile } from 'fs/promises';
|
|
|
|
function getConfig({
|
|
constants = [],
|
|
logLevel = 'info',
|
|
noRelay = false,
|
|
noXor = false,
|
|
targetType = 'air',
|
|
tracing = false,
|
|
}) {
|
|
return new AquaConfig(
|
|
logLevel,
|
|
constants,
|
|
noXor,
|
|
noRelay,
|
|
{
|
|
ts: 'typescript',
|
|
js: 'javascript',
|
|
air: 'air',
|
|
}[targetType],
|
|
tracing,
|
|
);
|
|
}
|
|
|
|
function compileFromPath({ filePath, ...commonArgs }) {
|
|
const config = getConfig(commonArgs);
|
|
const { imports = [] } = commonArgs;
|
|
return Aqua.compile(new Path(filePath), imports, config);
|
|
}
|
|
|
|
const { generatedSources } = await compileFromPath({
|
|
targetType: 'js',
|
|
filePath: join('aqua', 'app.aqua'),
|
|
imports: ['node_modules'],
|
|
});
|
|
|
|
const targetDir = join('src', '_aqua');
|
|
|
|
await mkdir(targetDir, { recursive: true });
|
|
|
|
// @ts-ignore
|
|
await writeFile(join(targetDir, 'app.js'), generatedSources[0].jsSource, { encoding: 'utf8' });
|