generated from PolymeshAssociation/typescript-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from PolymathNetwork/feat/MSDK-13-sandbox
Feat/msdk 13 sandbox
- Loading branch information
Showing
7 changed files
with
2,278 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ npm-package/ | |
.idea/ | ||
coverage/ | ||
test.ts | ||
sandbox.ts | ||
docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "dist", | ||
"rootDir": ".", | ||
"baseUrl": ".", | ||
"paths": { | ||
"~/*": ["src/*"] | ||
}, | ||
"plugins": [ | ||
{ | ||
"transform": "@zerollup/ts-transform-paths", | ||
"exclude": ["*"] | ||
} | ||
], | ||
"target": "es6", | ||
"module": "commonjs", | ||
"declaration": true, | ||
"declarationMap": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"resolveJsonModule": true, | ||
"lib": ["es2017", "dom"], | ||
"typeRoots": ["./node_modules/@types", "./src/typings"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); | ||
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); | ||
|
||
module.exports = { | ||
devtool: 'cheap-module-source-map', | ||
mode: 'development', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
loader: 'awesome-typescript-loader', | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.js'], | ||
plugins: [new TsconfigPathsPlugin()], | ||
}, | ||
plugins: [new CaseSensitivePathsPlugin()], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
const merge = require('webpack-merge'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
|
||
const baseConfig = require('./webpack.base'); | ||
|
||
const SANDBOX_FILE_NAME = 'sandbox.ts'; | ||
|
||
const sandboxFilePath = path.resolve(`./${SANDBOX_FILE_NAME}`); | ||
|
||
if (!fs.existsSync(sandboxFilePath)) { | ||
fs.writeFileSync( | ||
sandboxFilePath, | ||
"import { Polymesh } from './src/Polymesh';\r\n\r\n/**\r\n * Polymesh SDK connection\r\n */\r\nasync function run(): Promise<void> {\r\n await Polymesh.connect({\r\n nodeUrl: 'ws://78.47.38.110:9944',\r\n });\r\n}\r\n\r\nrun();" | ||
); | ||
} | ||
|
||
const devConfig = merge.smart(baseConfig, { | ||
entry: path.resolve(__dirname, SANDBOX_FILE_NAME), | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
loader: 'awesome-typescript-loader', | ||
options: { | ||
configFileName: 'tsconfig-dev.json', | ||
}, | ||
}, | ||
], | ||
}, | ||
|
||
devServer: { | ||
// This is not written to the disk, but has to be named anyways | ||
contentBase: path.join(__dirname, 'dist'), | ||
watchContentBase: true, | ||
// Opens the browser when the watcher starts | ||
open: true, | ||
// No need for compression on development | ||
compress: false, | ||
port: process.env.PORT || 9000, | ||
}, | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
title: 'Polymesh SDK - Sandbox', | ||
}), | ||
], | ||
output: { | ||
pathinfo: true, | ||
filename: 'devServer.js', | ||
path: path.resolve(__dirname, 'dist'), | ||
publicPath: '/', | ||
}, | ||
node: { | ||
fs: 'empty', | ||
}, | ||
}); | ||
|
||
module.exports = devConfig; |
Oops, something went wrong.