Browse Source

added installation of flow-typed to drone build

pull/1/head
Arwed Mett 3 years ago
parent
commit
fdae79e6a5
Signed by: Pfeifenjoy GPG Key ID: 86943827297DA9FC
  1. 1
      .core.yml
  2. 8
      package.json
  3. 13
      src/local-instance.js
  4. 30
      webpack.config.js

1
.core.yml

@ -7,6 +7,7 @@ steps:
image: node
commands:
- npm install
- npx flow-typed install
- name: test
image: node

8
package.json

@ -13,12 +13,11 @@
"test": "test"
},
"scripts": {
"start": "webpack-dev-server --env development",
"test:flow": "flow --quiet",
"test:lint": "eslint src",
"test:mocha": "mocha --use_strict --require @babel/register --require babel-polyfill",
"test": "npm run test:lint && npm run test:flow && npm run test:mocha",
"dev-server": "webpack-dev-server --env development",
"start": "nodemon --exec npm run babel-node",
"babel-node": "npx babel-node src/local-instance.js --source-maps",
"build:webpack": "webpack --env production",
"build:flow": "flow-copy-source src build",
@ -42,18 +41,15 @@
"eslint-plugin-flowtype": "^2.46.1",
"eslint-plugin-react": "^7.7.0",
"file-loader": "^2.0.0",
"flow": "^0.2.3",
"flow-bin": "^0.69.0",
"flow-copy-source": "^2.0.2",
"flow-typed": "^2.4.0",
"mocha": "^5.1.0",
"nodemon": "^1.18.9",
"raw-loader": "^0.5.1",
"url-loader": "^1.1.2",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.14",
"webpack-notifier": "^1.7.0"
"webpack-dev-server": "^3.1.14"
},
"dependencies": {
"@babel/node": "^7.2.2",

13
src/local-instance.js

@ -1,13 +0,0 @@
//@flow
import express from "express"
import router from "./router"
async function launch() {
const app = express()
app.use(router)
app.listen(5000)
}
launch()

30
webpack.config.js

@ -1,6 +1,11 @@
const path = require("path")
const webpack = require("webpack")
const WebpackNotifierPlugin = require("webpack-notifier")
const port = parseInt(process.env.PORT) || 5000
/************************************************************/
/* Base configuration */
/************************************************************/
const baseConfig = {
output: {
@ -56,7 +61,11 @@ const baseConfig = {
}
// targets
/************************************************************/
/* Targets */
/************************************************************/
//This will be the script which is included in the index.html
const runtime = () => Object.assign({ }, baseConfig, {
target: "web",
entry: {
@ -69,6 +78,8 @@ const runtime = () => Object.assign({ }, baseConfig, {
}
})
//This target will be exposed by this package, that either node
//or browser applications can require it.
const index = () => Object.assign({ }, baseConfig, {
target: "node",
entry: {
@ -87,7 +98,11 @@ const index = () => Object.assign({ }, baseConfig, {
}
})
// decorators
/************************************************************/
/* Decorators */
/************************************************************/
//extend the configuration by all production settings
const production = config => Object.assign({ }, config(), {
mode: "production",
plugins: [
@ -97,18 +112,18 @@ const production = config => Object.assign({ }, config(), {
]
})
//extend the configuration by all development settings
const development = config => Object.assign({ }, config(), {
mode: "development",
devServer: {
historyApiFallback: true,
stats: "errors-only",
host: process.env.HOST,
port: 5000,
port,
compress: true,
overlay: true,
hot: true,
contentBase: path.resolve(__dirname, "build/static"),
https: true,
proxy: {
"/api": {
"target": "https://localhost:6000",
@ -118,12 +133,11 @@ const development = config => Object.assign({ }, config(), {
},
devtool: "source-map",
plugins: [
new webpack.HotModuleReplacementPlugin(),
new WebpackNotifierPlugin()
new webpack.HotModuleReplacementPlugin()
]
})
//choose according to environment
module.exports = env => {
if (env === "production") {
return [ production(index), production(runtime) ]

Loading…
Cancel
Save