mirror of
https://github.com/fluencelabs/fluence-js.git
synced 2025-03-15 15:30:49 +00:00
Add playground project
This commit is contained in:
parent
e9454473ed
commit
1d9e11a86e
3
.gitignore
vendored
3
.gitignore
vendored
@ -16,3 +16,6 @@ jspm_packages/
|
||||
/dist/
|
||||
|
||||
.idea
|
||||
|
||||
playground_dist
|
||||
playground_public
|
5703
package-lock.json
generated
5703
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -13,7 +13,8 @@
|
||||
"test:unit": "jest --testPathPattern=src/__test__/unit",
|
||||
"test:integration": "jest --testPathPattern=src/__test__/integration",
|
||||
"build": "tsc",
|
||||
"build:docs": "typedoc"
|
||||
"build:docs": "typedoc",
|
||||
"playground:start": "webpack serve"
|
||||
},
|
||||
"repository": "https://github.com/fluencelabs/fluence-js",
|
||||
"author": "Fluence Labs",
|
||||
@ -48,12 +49,21 @@
|
||||
"devDependencies": {
|
||||
"@fluencelabs/aqua": "^0.7.0-285",
|
||||
"@fluencelabs/aqua-lib": "^0.4.3",
|
||||
"@fluencelabs/fluence-network-environment": "^1.0.13",
|
||||
"@types/jest": "^26.0.22",
|
||||
"@types/platform": "^1.3.4",
|
||||
"css-loader": "^6.5.1",
|
||||
"html-webpack-plugin": "^5.5.0",
|
||||
"jest": "^26.6.3",
|
||||
"js-base64": "^3.7.2",
|
||||
"process": "^0.11.10",
|
||||
"style-loader": "^3.3.1",
|
||||
"ts-jest": "^26.5.4",
|
||||
"ts-loader": "^8.3.0",
|
||||
"typedoc": "^0.21.9",
|
||||
"typescript": "^4.0.0"
|
||||
"typescript": "^4.0.0",
|
||||
"webpack": "^5.65.0",
|
||||
"webpack-cli": "^4.9.1",
|
||||
"webpack-dev-server": "^4.6.0"
|
||||
}
|
||||
}
|
||||
|
8
playground/index.html
Normal file
8
playground/index.html
Normal file
@ -0,0 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Fluence JS</title>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
14
playground/index.ts
Normal file
14
playground/index.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { Fluence } from '../src/index';
|
||||
import { krasnodar } from '@fluencelabs/fluence-network-environment';
|
||||
|
||||
async function main() {
|
||||
await Fluence.start({
|
||||
connectTo: krasnodar[4],
|
||||
});
|
||||
|
||||
alert('started');
|
||||
|
||||
await Fluence.stop();
|
||||
}
|
||||
|
||||
main();
|
67
webpack.config.js
Normal file
67
webpack.config.js
Normal file
@ -0,0 +1,67 @@
|
||||
// Generated using webpack-cli https://github.com/webpack/webpack-cli
|
||||
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
|
||||
// const isProduction = process.env.NODE_ENV == 'production';
|
||||
const isProduction = false;
|
||||
|
||||
const stylesHandler = 'style-loader';
|
||||
|
||||
const config = {
|
||||
entry: './playground/index.ts',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'playground_dist'),
|
||||
},
|
||||
devServer: {
|
||||
open: true,
|
||||
host: 'localhost',
|
||||
static: {
|
||||
directory: path.join(__dirname, 'playground_public'),
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'playground/index.html',
|
||||
}),
|
||||
new webpack.ProvidePlugin({
|
||||
process: 'process/browser',
|
||||
}),
|
||||
|
||||
// Add your plugins here
|
||||
// Learn more about plugins from https://webpack.js.org/configuration/plugins/
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(ts|tsx)$/i,
|
||||
loader: 'ts-loader',
|
||||
exclude: ['/node_modules/'],
|
||||
},
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: [stylesHandler, 'css-loader'],
|
||||
},
|
||||
{
|
||||
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
|
||||
type: 'asset',
|
||||
},
|
||||
|
||||
// Add your rules for custom modules here
|
||||
// Learn more about loaders from https://webpack.js.org/loaders/
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js', 'css'],
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = () => {
|
||||
if (isProduction) {
|
||||
config.mode = 'production';
|
||||
} else {
|
||||
config.mode = 'development';
|
||||
}
|
||||
return config;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user