diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef799e4..7aa3426 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,6 @@ jobs: - name: Fix git checkout line endings run: git config --global core.autocrlf input - uses: actions/checkout@v2.4.0 - with: - clean: false - name: Use Node.js 17.x uses: actions/setup-node@v2.5.1 with: @@ -38,7 +36,7 @@ jobs: - name: Install run: yarn install - name: Build - run: yarn build + run: yarn build:ci - name: Zip uses: papeloto/action-zip@v1 with: diff --git a/package.json b/package.json index 6f3cf3f..945f845 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onlybuys-bot/main", - "version": "0.0.30", + "version": "0.0.31", "description": "Multi-chain EVM compatible bot that buys new launches", "engines": { "node": ">= 16.13" @@ -22,7 +22,8 @@ }, "scripts": { "lint": "yarn workspace @onlybuys-bot/electron lint", - "build": "yarn workspace @onlybuys-bot/cli bundle && yarn && yarn workspace @onlybuys-bot/electron package" + "build": "yarn workspace @onlybuys-bot/cli bundle && yarn && yarn workspace @onlybuys-bot/electron package", + "build:ci": "yarn workspace @onlybuys-bot/cli bundle:ci && yarn && yarn workspace @onlybuys-bot/electron package" }, "author": "Kevin ", "license": "MIT", diff --git a/packages/cli/package.json b/packages/cli/package.json index 0d83387..9ac6faf 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@onlybuys-bot/cli", - "version": "0.0.30", + "version": "0.0.31", "description": "EVM bot with new pair watcher and trading", "engines": { "node": ">= 16.13" @@ -49,6 +49,8 @@ "start:moonriver": "yarn start -- --network=moonriver", "start:moonbeam": "yarn start -- --network=moonbeam", "bundle": "yarn webpack", + "bundle:ci": "yarn webpack -c ./webpack.ci.config.js", + "bundle:watch": "yarn webpack --watch", "maybe-sell-all": "node build/src/maybe-sell-all.js", "clean": "rimraf coverage build tmp", "prebuild": "yarn lint", diff --git a/packages/cli/webpack.ci.config.js b/packages/cli/webpack.ci.config.js new file mode 100644 index 0000000..8c724b7 --- /dev/null +++ b/packages/cli/webpack.ci.config.js @@ -0,0 +1,33 @@ +const path = require('path') +const webpack = require('webpack') +const nodeExternals = require('webpack-node-externals') + +module.exports = { + entry: './src/main.ts', + devtool: 'inline-source-map', + mode: process.env.NODE_ENV === 'development' ? 'development' : 'production', + target: 'node', + externals: [nodeExternals()], + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: [/node_modules/, /__tests__/], + }, + ], + }, + resolve: { + extensions: ['.tsx', '.ts', '.js'], + }, + output: { + filename: 'bundle.js', + path: path.resolve(__dirname, 'bundle-ci'), + }, + plugins: [ + new webpack.ProvidePlugin({ + // Promise: 'es6-promise', // Thanks Aaron (https://gist.github.com/Couto/b29676dd1ab8714a818f#gistcomment-1584602) + // fetch: 'imports?this=>global!exports?global.fetch!node-fetch', + }), + ], +} diff --git a/packages/electron/electron/cli-runner.ts b/packages/electron/electron/cli-runner.ts index b0e396e..3ad69af 100644 --- a/packages/electron/electron/cli-runner.ts +++ b/packages/electron/electron/cli-runner.ts @@ -1,6 +1,7 @@ import { join } from 'path' import { EventEmitter } from 'events' import { fork, ChildProcess } from 'child_process' +import { boolean as toBool } from 'boolean' // import AbortController from 'abort-controller' import store from './store' @@ -98,7 +99,9 @@ export class CLIWrapper extends EventEmitter { 'node_modules', '@onlybuys-bot', 'cli', - 'bundle', + // this workaround is here because github actions insists on deleting + // everything that's in gitignore, but we can't add bundled files to git + toBool(process.env.GH_ACTIONS_CI) ? 'bundle-ci' : 'bundle', 'bundle', ), [ diff --git a/packages/electron/package.json b/packages/electron/package.json index ac47f21..512819e 100644 --- a/packages/electron/package.json +++ b/packages/electron/package.json @@ -1,7 +1,7 @@ { "name": "@onlybuys-bot/electron", "author": "Kevin ", - "version": "0.0.30", + "version": "0.0.31", "description": "UI application for onlybuys-bot", "main": "./.webpack/main", "scripts": {