Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ on:
description: "Publish on Visual Studio Marketplace?"
required: true
type: choice
default: "yes"
default: "no"
options:
- "yes"
- "no"
publishOpenVSX:
description: "Publish on Open VSX Registry?"
required: true
type: choice
default: "yes"
default: "no"
options:
- "yes"
- "no"
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Setup Git
run: |
git config --global user.name "Release Bot"
git config --global user.email "no-replay@github.com"
git config --global user.email "no-noreply@github.com"
- name: Get Current Version Number
run: |
CURRENT_VERSION=$(cat package.json | jq .version | cut -d'"' -f 2)
Expand All @@ -90,21 +90,21 @@ jobs:
if: ${{ github.event.inputs.releaseChannel == 'stable' }}
- name: Version Package
run: |
git checkout .
npm version $RELEASE_VERSION
git tag -a $RELEASE_VERSION -m "$RELEASE_VERSION"
- name: Package Extension (Edge)
if: ${{ github.event.inputs.releaseChannel == 'edge' }}
run: |
node .github/scripts/updateEdgeVersion.js
yarn vsce package --pre-release --yarn --no-git-tag-version --no-update-package-json -o "./live-server-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
npx vsce package --pre-release --no-git-tag-version --no-update-package-json -o "./live-server-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
- name: Package Extension (Stable)
run: yarn vsce package $RELEASE_VERSION --yarn --no-git-tag-version --no-update-package-json -o "./live-server-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
run: npx vsce package $RELEASE_VERSION --no-git-tag-version --no-update-package-json -o "./live-server-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.releaseChannel == 'stable' }}
- name: Publish to Visual Studio Marketplace (Edge)
run: yarn vsce publish --packagePath "./live-server-$RELEASE_VERSION.vsix" --pre-release --yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
run: npx vsce publish --packagePath "./live-server-$RELEASE_VERSION.vsix" --pre-release --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'edge' }}
- name: Publish to Visual Studio Marketplace (Stable)
run: yarn vsce publish --packagePath "./live-server-$RELEASE_VERSION.vsix" --yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
run: npx vsce publish --packagePath "./live-server-$RELEASE_VERSION.vsix" --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
- name: Publish to Open VSX Registry (Edge)
uses: HaaLeo/publish-vscode-extension@v1
Expand All @@ -123,7 +123,7 @@ jobs:
- name: Push Tags
run: |
git log -1 --stat
git push origin main --tags
git push origin master --tags

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CRITICAL_BUG] Changed branch name in 'git push' (line 126) from 'main' to 'master'. Verify that this matches the repository's default branch to avoid deployment issues.

- run: |
export GIT_TAG=$(git describe --tags --abbrev=0)
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CI
on:
push:
branches:
- main
- master

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[CRITICAL_BUG] Branch name updated from 'main' to 'master' on line 6. Ensure consistency across all workflows and repository settings.

pull_request:

jobs:
Expand All @@ -28,6 +28,7 @@ jobs:
if: matrix.os != 'ubuntu-latest'
with:
run: npm test
options: "-screen 0 1600x1200x24"
- name: Run Tests
uses: GabrielBB/xvfb-action@v1
if: matrix.os == 'ubuntu-latest'
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ _site
Gemfile.lock
**/*.vsix
.vscode-test
.wdio-vscode-service
.wdio-vscode-service
*-CHANGELOG.txt
1 change: 1 addition & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vscode/**
.vscode-test/**
.wdio-vscode-service/**
out/test/**
test/**
src/**
Expand Down
4 changes: 2 additions & 2 deletions lib/live-server/injected.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- Code injected by live-server -->
<script type="text/javascript">
<script>
// <![CDATA[ <-- For SVG support
if ('WebSocket' in window) {
(function () {
Expand Down Expand Up @@ -35,4 +35,4 @@
console.error('Upgrade your browser. This Browser is NOT supported WebSocket for Live-Reloading.');
}
// ]]>
</script>
</script>
47 changes: 22 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "LiveServer",
"displayName": "Live Server",
"description": "Launch a development local Server with live reload feature for static & dynamic pages",
"version": "5.7.5",
"version": "5.7.9",
"publisher": "ritwickdey",
"author": {
"name": "Ritwick Dey",
Expand Down Expand Up @@ -115,11 +115,6 @@
"pattern": "/|/[^\\/]",
"description": "Set Custom root of Live Server. \nTo change root the the server to sub folder of workspace, use '/' and relative path from workspace. \nExample: /subfolder1/subfolder2"
},
"liveServer.settings.useBrowserPreview": {
"type": "boolean",
"default": false,
"description": "Open in Browser Preview inside VS Code, instead of default browser"
},
"liveServer.settings.CustomBrowser": {
"type": [
"string",
Expand Down Expand Up @@ -350,7 +345,8 @@
"tslint": "^6.1.3",
"typescript": "^4.5.4",
"vsce": "^2.7.0",
"wdio-vscode-service": "^2.0.1"
"wdio-vscode-service": "^2.0.1",
"es5-ext": "0.10.53"
},
"dependencies": {
"http-shutdown": "^1.2.0",
Expand All @@ -359,8 +355,11 @@
"opn": "^6.0.0",
"vsls": "^0.3.967"
},
"overrides": {
"es5-ext": "0.10.53"
},
"announcement": {
"onVersion": "5.7.5",
"message": "[NEW] LiveServer@5.7.5: Changed extension activationEvents to onStartupFinished."
"onVersion": "5.7.9",
"message": "[NEW] LiveServer@5.7.9: Activation load time improved"
}
}
8 changes: 2 additions & 6 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ export class Config {
return Config.getSettings<boolean>('NoBrowser');
}

public static get getUseBrowserPreview(): boolean {
return Config.getSettings<boolean>('useBrowserPreview');
}

public static get getAdvancedBrowserCmdline(): string {
return Config.getSettings<string>('AdvanceCustomBrowserCmdLine');
}
Expand Down Expand Up @@ -121,11 +117,11 @@ export class Config {
return Config.getSettings<string>('file');
}

public static get getMutiRootWorkspaceName(): string {
public static get getMultiRootWorkspaceName(): string {
return Config.getSettings<string>('multiRootWorkspaceName');
}

public static setMutiRootWorkspaceName(val: string) {
public static setMultiRootWorkspaceName(val: string) {
Comment on lines +120 to +124

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NITPICK] Renamed getters and setters from 'MutiRoot' to 'MultiRoot' (lines 120 and 124). This fix improves naming clarity; ensure all references are updated.

return Config.configuration.update('multiRootWorkspaceName', val, false);
}
}
6 changes: 3 additions & 3 deletions src/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as fs from 'fs';
import * as path from 'path';
import { Config } from './Config';

export const SUPPRORTED_EXT: string[] = [
export const SUPPORTED_EXT: string[] = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NITPICK] Corrected the misspelled variable name from 'SUPPRORTED_EXT' to 'SUPPORTED_EXT'. This change improves readability and consistency.

'.html', '.htm', '.svg'
];

Expand Down Expand Up @@ -65,7 +65,7 @@ export class Helper {
*/
public static IsSupportedFile(file: string): boolean {
let ext = path.extname(file) || (file.startsWith('.') ? file : `.${file}`);
return SUPPRORTED_EXT.indexOf(ext.toLowerCase()) > -1;
return SUPPORTED_EXT.indexOf(ext.toLowerCase()) > -1;
}


Expand Down Expand Up @@ -153,4 +153,4 @@ export class Helper {

return proxy;
}
}
}
8 changes: 3 additions & 5 deletions src/LiveServerHelper.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
'use strict';
const liveServer = require('live-server');
const httpShutdown = require('http-shutdown');

export class LiveServerHelper {

static StartServer(params, callback) {
setTimeout(() => {
try {
let ServerInstance = liveServer.start(params);
let ServerInstance = require('live-server').start(params);
setTimeout(() => {

if (!ServerInstance._connectionKey) {
return callback({});
}

httpShutdown(ServerInstance);
require('http-shutdown')(ServerInstance);
Comment on lines +8 to +15

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[PERFORMANCE_OPTIMIZATION] The usage of dynamic require calls (e.g. for 'live-server' and 'http-shutdown') inside functions (lines 8 and 15) may lead to repeated module resolution. Consider moving these require statements to the module scope to benefit from caching.

const liveServer = require('live-server');
const httpShutdown = require('http-shutdown');

export class LiveServerHelper {

    static StartServer(params, callback) {
        setTimeout(() => {
            try {
                let ServerInstance = liveServer.start(params);
                setTimeout(() => {

                    if (!ServerInstance._connectionKey) {
                        return callback({});
                    }

                    httpShutdown(ServerInstance);
                    return callback(ServerInstance);

                }, 1000);
            } catch (err) {
                console.error(err);
                callback({
                    errorMsg: err
                });
            }

        }, 0);

    }

    static StopServer(LiveServerInstance, callback) {
        LiveServerInstance.shutdown(() => {
            // callback(); /*only Working first time, Unknown Bug*/
        });
        LiveServerInstance.close();
        liveServer.shutdown();
        setTimeout(() => { callback(); }, 1000);
    }
}

return callback(ServerInstance);

}, 1000);
Expand All @@ -34,7 +32,7 @@ export class LiveServerHelper {
// callback(); /*only Working first time, Unknown Bug*/
});
LiveServerInstance.close();
liveServer.shutdown();
require('live-server').shutdown();
setTimeout(() => { callback(); }, 1000);
}
}
15 changes: 7 additions & 8 deletions src/announcement/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
import { Memento, extensions, window } from 'vscode';
import * as opn from 'opn';

export const SETUP_STRING = 'liveServer.setup.version';

export async function checkNewAnnouncement(memento: Memento) {

const packageJSON = extensions.getExtension('ritwickdey.LiveServer').packageJSON;
const announment = packageJSON.announcement;
const announcement = packageJSON.announcement;

if (!announment && Object.keys(announment).length === 0) return;
if (!announcement && Object.keys(announcement).length === 0) return;
Comment on lines +8 to +10

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NITPICK] Corrected variable name from 'announment' to 'announcement' and updated its usage (lines 8-10). Confirm that the 'opn' package is still supported or consider using its modern alternative if available.


const stateVersion = await memento.get(SETUP_STRING) || '0.0.0';
const installedVersion = packageJSON.version;

if (stateVersion !== installedVersion && installedVersion === announment.onVersion) {
if (stateVersion !== installedVersion && installedVersion === announcement.onVersion) {
await memento.update(SETUP_STRING, installedVersion);
const showDetails = 'Show Details';
const choice = await window.showInformationMessage(announment.message, showDetails);
const choice = await window.showInformationMessage(announcement.message, showDetails);
if (choice === showDetails) {
const url = announment.url || 'https://github.com/ritwickdey/vscode-live-server';
opn(url);
const url = announcement.url || 'https://github.com/ritwickdey/vscode-live-server';
require('opn')(url);
}

}

}
}
Loading