Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

live-dev-server

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

live-dev-server - npm Package Compare versions

Comparing version 0.9.1 to 0.9.2

live.config.js

32

lib/config.js
const path = require('path')
const fs = require('fs')
const defaultWorkspace = `./src`
const projectRoot = process.cwd()
const { Log } = require('./log')
const CUSTOME_INJECT_CODE_MARK = `//////`

@@ -28,6 +28,6 @@

let options = Object.assign({}, defaultOptions)
let customConfig = {}
// 读取配置文件
try {
customConfig = require(path.join(projectRoot, `./lds.config.js`))
let customConfig = readConfigFile()
if (customConfig) {
Object.assign(options, customConfig, {

@@ -37,8 +37,5 @@ // 优先级lds配置里的root->配置里的workspace->默认的root

})
} catch (error) {
config = options
Log.info('没有lds.config.js配置文件')
}
let { workspace, root, ...restConfig } = options
let extra = {

@@ -48,5 +45,24 @@ workspace: path.join(projectRoot, workspace),

}
// TODO deep merge?
Object.assign(options, restConfig, extra)
function readConfigFile() {
let oldConfigPath = path.join(projectRoot, `./lds.config.js`)
let configPath = path.join(projectRoot, `./live.config.js`)
let isExists = isExsistsSync(configPath)
if (!isExists) {
configPath = oldConfigPath
isExists = isExsistsSync(oldConfigPath)
}
if (isExists) return require(configPath)
return null
}
function isExsistsSync(filePath) {
return fs.existsSync(filePath)
}
module.exports = {

@@ -53,0 +69,0 @@ options,

{
"name": "live-dev-server",
"version": "0.9.1",
"version": "0.9.2",
"description": "develop env, watch files change",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc