Skip to content

Commit

Permalink
chore(*): update ci
Browse files Browse the repository at this point in the history
  • Loading branch information
neki-dev committed Jul 14, 2024
1 parent 1d2a6bb commit 539e9ed
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 34 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/build.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: deploy
on: push
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Installing
run: yarn install
- name: Building
run: yarn build:demo
- name: Deploying
uses: burnett01/[email protected]
with:
switches: -a --delete --progress
path: demo/
remote_path: ${{ secrets.SSH_REMOTE_DIR }}
remote_host: ${{ secrets.SSH_HOST }}
remote_user: ${{ secrets.SSH_USER }}
remote_key: ${{ secrets.SSH_PRIVATE_KEY }}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
},
"main": "./dist/index.js",
"scripts": {
"watch": "webpack --mode development --watch",
"watch": "webpack --mode development--name demo --watch",
"build": "webpack --mode production",
"build:demo": "webpack --mode production --name demo",
"lint": "eslint ./src --fix"
},
"devDependencies": {
Expand Down
47 changes: 26 additions & 21 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
const path = require('path');
const path = require("path");

module.exports = (_, { mode }) => {
const isDev = mode === 'development';
const pathRoot =isDev ? path.resolve(__dirname, 'demo') : __dirname;
module.exports = (_, { mode, name }) => {
const isDev = mode === "development";
const isDemo = name === "demo";

const pathRoot = isDemo ? path.resolve(__dirname, "demo") : __dirname;

return {
resolve: {
extensions: ['.ts'],
extensions: [".ts"],
},
entry: [
path.resolve(pathRoot, 'src/index.ts'),
],
entry: [path.resolve(pathRoot, "src/index.ts")],
output: {
path: path.resolve(pathRoot, 'dist'),
filename: 'index.js',
libraryTarget: isDev ? undefined : 'commonjs2',
path: path.resolve(pathRoot, "dist"),
filename: "index.js",
libraryTarget: isDemo ? undefined : "commonjs2",
clean: true,
},
module: {
rules: [{
test: /\.ts$/,
use: [{
loader: 'ts-loader',
options: {
configFile: isDev ? 'tsconfig.dev.json' : undefined,
},
}],
}],
rules: [
{
test: /\.ts$/,
use: [
{
loader: "ts-loader",
options: {
configFile: isDemo ? "tsconfig.dev.json" : undefined,
},
},
],
},
],
},
devtool: isDev ? 'inline-source-map' : undefined,
devtool: isDev ? "inline-source-map" : undefined,
};
};

0 comments on commit 539e9ed

Please sign in to comment.