Move non-relevant code from Marine repo into FluenceJS (#227)

1. Move marine-related part into FJS repo (DXJ184)
2. Move towards component-oriented architecture (DXJ183)
3. Different JS Client distros for node.js and web (DXJ185)
This commit is contained in:
Pavel
2023-01-09 15:51:15 +03:00
committed by GitHub
parent dcb15b7d3c
commit 267ebb687f
220 changed files with 7421 additions and 6362 deletions

21
packages/client/tools/.gitignore vendored Normal file
View File

@@ -0,0 +1,21 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
bundle/
dist
esm
types
# Dependency directories
node_modules/
jspm_packages/
.idea

View File

@@ -0,0 +1,12 @@
.idea
.gitignore
node_modules
types
src/
tsconfig.json
webpack.config.js
bundle
pkg

View File

@@ -0,0 +1 @@
/dist/

View File

@@ -0,0 +1,8 @@
module.exports = {
semi: true,
trailingComma: "all",
singleQuote: true,
printWidth: 120,
tabWidth: 4,
useTabs: false
};

View File

@@ -0,0 +1,13 @@
## Contribute Code
You are welcome to contribute to Fluence.
Things you need to know:
1. You need to **agree to the Contributors License Agreement**. This is a common practice in all major Open Source projects. At the current moment we are unable to accept contributions made on behalf of a company. Only individual contributions will be accepted.
2. **Not all proposed contributions can be accepted**. Some features may e.g. just fit a third-party add-on better. The contribution must fit the overall direction of Fluence and really improve it. The more effort you invest, the better you should clarify in advance whether the contribution fits: the best way would be to just open an issue to discuss the contribution you plan to make.
### Contributor License Agreement
When you contribute, you have to be aware that your contribution is covered by **Apache License 2.0**, but might relicensed under few other software licenses mentioned in the **Contributor License Agreement**.
In particular you need to agree to the [Contributor License Agreement](https://gist.github.com/fluencelabs-org/3f4cbb3cc14c1c0fb9ad99d8f7316ed7). If you agree to its content, you simply have to click on the link posted by the CLA assistant as a comment to the pull request. Click it to check the CLA, then accept it on the following screen if you agree to it. CLA assistant will save this decision for upcoming contributions and will notify you if there is any change to the CLA in the meantime.

View File

@@ -0,0 +1,11 @@
# Fluence JS Client tools
This package is a part of FluenceJS, the official implementation of the Fluence Peer in typescript. See the [FluenceJS repo](https://github.com/fluencelabs/fluence-js) for more info
## Contributing
While the project is still in the early stages of development, you are welcome to track progress and contribute. As the project is undergoing rapid changes, interested contributors should contact the team before embarking on larger pieces of work. All contributors should consult with and agree to our [basic contributing rules](CONTRIBUTING.md).
## License
[Apache 2.0](LICENSE)

View File

@@ -0,0 +1,25 @@
{
"name": "@fluencelabs/tools",
"version": "0.1.0",
"description": "Fluence JS Client tools",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"engines": {
"node": ">=10",
"pnpm": ">=3"
},
"scripts": {
"build": "tsc"
},
"repository": "https://github.com/fluencelabs/fluence-js",
"author": "Fluence Labs",
"license": "Apache-2.0",
"bin": {
"copy-marine": "dist/copyMarine.js"
},
"dependencies": {},
"devDependencies": {
"@types/node": "16.11.59",
"typescript": "4.6.4"
}
}

View File

@@ -0,0 +1,46 @@
#! /usr/bin/env node
import fs from 'fs';
import path from 'path';
const firstArgument = process.argv[2];
if (!firstArgument) {
console.log(`Expected exactly 1 argument, got 0. Usage: ${path.basename(process.argv[1])} <destination directory>`);
process.exit(1);
}
let destPath = firstArgument;
if (!path.isAbsolute(destPath)) {
destPath = path.join(process.cwd(), destPath);
}
async function copyFile(packageName: string, fileName: string) {
const modulePath = require.resolve(packageName);
const source = path.join(path.dirname(modulePath), fileName);
const dest = path.join(destPath, fileName);
console.log(`copying ${fileName}`);
console.log('from: ', source);
console.log('to: ', dest);
await fs.promises.copyFile(source, dest);
}
async function main() {
console.log('ensure directory exists: ', destPath);
await fs.promises.mkdir(destPath, { recursive: true });
await Promise.all([
copyFile('@fluencelabs/marine.worker-script', 'marine-js.web.js'),
copyFile('@fluencelabs/marine-js', 'marine-js.wasm'),
copyFile('@fluencelabs/avm', 'avm.wasm'),
]);
}
main()
.then(() => {
console.log('done!');
})
.catch((err) => {
console.error('Something went wrong!', err);
});

View File

@@ -0,0 +1,21 @@
{
"compilerOptions": {
"outDir": "./dist/",
"baseUrl": ".",
"downlevelIteration": true,
"sourceMap": true,
"inlineSources": true,
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"target": "ES5",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"esModuleInterop": true,
"declarationMap": true,
"strict": true,
"skipLibCheck": true
},
"exclude": ["node_modules", "dist", "bundle"],
"include": ["src/**/*"]
}