Skip to content

Commit

Permalink
Change PUBLIC_PATH to demo
Browse files Browse the repository at this point in the history
  • Loading branch information
vkruglikov committed Jan 6, 2025
1 parent 827e3e3 commit 9618436
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/connect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
branches: ['master']

jobs:
release:
name: Build and Release
deploy-connect:
name: Deploy @msw-devtools/connect
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ permissions:

jobs:
deploy-demo:
name: Install dependencies
name: Deploy @msw-devtools/demo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node
- uses: ./.github/actions/install-npm-deps

- name: Build all packages
env:
PUBLIC_PATH: /msw-devtools-extension
run: npm run build -- --filter=@msw-devtools/demo

- name: Setup Pages
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/extension.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
name: Deploy @msw-devtools/extension

on:
push:
branches: ['master']
paths:
- 'packages/extension/package.json'
workflow_dispatch:

jobs:
release:
name: Build and Release
deploy-extension:
name: Deploy @msw-devtools/extension
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -35,6 +31,5 @@ jobs:
files: |
dist.zip
dist.tar.gz
make_latest: true
name: "@msw-devtools/extension"
tag_name: "@msw-devtools/extension@latest"
1 change: 1 addition & 0 deletions packages/core/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const STABLE_CONFIG_VERSION = 1
5 changes: 1 addition & 4 deletions packages/demo/src/msw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ const handlers = [
setupWorker(...handlers).start({
onUnhandledRequest: 'bypass',
serviceWorker: {
url:
process.env.NODE_ENV === 'production'
? '/msw-devtools-extension/mockServiceWorker.js'
: '/mockServiceWorker.js'
url: `${process.env.PUBLIC_PATH}mockServiceWorker.js`
}
})
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"globalEnv": ["NODE_ENV", "PUBLIC_PATH"],
"tasks": {
"build": {
"dependsOn": ["^build"],
Expand Down
9 changes: 8 additions & 1 deletion webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ const CopyPlugin = require('copy-webpack-plugin')

const IS_DEV = process.env.NODE_ENV === 'development'

console.log(
process.env.PUBLIC_PATH,
'PUBLIC_PATHPUBLIC_PATHPUBLIC_PATHPUBLIC_PATHPUBLIC_PATHPUBLIC_PATHPUBLIC_PATH'
)
throw {}

module.exports = ({ root, port, wdsClient = true }) => ({
mode: IS_DEV ? 'development' : 'production',
module: {
Expand Down Expand Up @@ -63,7 +69,7 @@ module.exports = ({ root, port, wdsClient = true }) => ({
output: {
filename: '[name].js',
path: path.resolve(root, 'dist'),
publicPath: '/',
publicPath: process.env.PUBLIC_PATH || '/',
clean: true
},
plugins: [
Expand All @@ -74,6 +80,7 @@ module.exports = ({ root, port, wdsClient = true }) => ({
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.PUBLIC_PATH': JSON.stringify(process.env.PUBLIC_PATH || '/'),
'process.env.WDS_EXTENSION_CLIENT_URL': JSON.stringify(
`ws://localhost:${port}/ws`
)
Expand Down

0 comments on commit 9618436

Please sign in to comment.