Skip to content

Commit

Permalink
Merge pull request #258 from rdkcentral/fix/custom-config-check
Browse files Browse the repository at this point in the history
Fixed customConfig errors
  • Loading branch information
michielvandergeest authored Apr 12, 2024
2 parents 365efe3 + a371285 commit d34507c
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v2.14.1

*11 apr 2024*

- Fixed issues related to custom config implementations for both esbuild & rollup ([#257](https://github.com/rdkcentral/Lightning-CLI/issues/257))

## v2.14.0

*03 apr 2024*
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Michiel van der Geest <[email protected]>",
"license": "Apache-2",
"name": "@lightningjs/cli",
"version": "2.14.0",
"version": "2.14.1",
"description": "Lightning-CLI: Command Line Interface tool for a seamless Lightning App Development flow",
"bin": {
"lightning": "./bin/index.js",
Expand Down
13 changes: 11 additions & 2 deletions src/configs/esbuild.es5.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,20 @@ const babelPluginTransFormParameters = require('@babel/plugin-transform-paramete
const babelPluginClassProperties = require('@babel/plugin-proposal-class-properties')
const babelPluginInlineJsonImport = require('babel-plugin-inline-json-import')
const deepMerge = require('deepmerge')
const fs = require('fs')
const chalk = require('chalk')

let customConfig

if (process.env.LNG_CUSTOM_ESBUILD === 'true') {
customConfig = require(path.join(process.cwd(), 'esbuild.es5.config'))
const customConfigPath = path.join(process.cwd(), 'esbuild.es5.config')
if (fs.existsSync(customConfigPath)) {
customConfig = require(customConfigPath)
} else {
console.warn(
chalk.yellow('\nCustom esbuild config not found while LNG_CUSTOM_ESBUILD is set to true')
)
}
}

module.exports = (folder, globalName) => {
Expand Down Expand Up @@ -124,7 +133,7 @@ module.exports = (folder, globalName) => {
].join(os.EOL),
},
}
if ('entryPoints' in customConfig) {
if (customConfig && 'entryPoints' in customConfig) {
delete defaultConfig.entryPoints
}
const finalConfig = customConfig ? deepMerge(defaultConfig, customConfig) : defaultConfig
Expand Down
14 changes: 11 additions & 3 deletions src/configs/esbuild.es6.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@ const path = require('path')
const babelPluginClassProperties = require('@babel/plugin-proposal-class-properties')
const babelPluginInlineJsonImport = require('babel-plugin-inline-json-import')
const deepMerge = require('deepmerge')
const fs = require('fs')
const chalk = require('chalk')

let customConfig

if (process.env.LNG_CUSTOM_ESBUILD === 'true') {
customConfig = require(path.join(process.cwd(), 'esbuild.es6.config'))
const customConfigPath = path.join(process.cwd(), 'esbuild.es6.config')
if (fs.existsSync(customConfigPath)) {
customConfig = require(customConfigPath)
} else {
console.warn(
chalk.yellow('\nCustom esbuild config not found while LNG_CUSTOM_ESBUILD is set to true')
)
}
}

module.exports = (folder, globalName) => {
Expand Down Expand Up @@ -113,8 +122,7 @@ module.exports = (folder, globalName) => {
].join(os.EOL),
},
}

if ('entryPoints' in customConfig) {
if (customConfig && 'entryPoints' in customConfig) {
delete defaultConfig.entryPoints
}
const finalConfig = customConfig ? deepMerge(defaultConfig, customConfig) : defaultConfig
Expand Down
10 changes: 9 additions & 1 deletion src/configs/rollup.es5.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,19 @@ const license = require('rollup-plugin-license')
const os = require('os')
const extensions = ['.js', '.ts', '.mjs']
const deepMerge = require('deepmerge')
const chalk = require('chalk')

let customConfig

if (process.env.LNG_CUSTOM_ROLLUP === 'true') {
customConfig = require(path.join(process.cwd(), 'rollup.es5.config'))
const customConfigPath = path.join(process.cwd(), 'rollup.es5.config')
if (fs.existsSync(customConfigPath)) {
customConfig = require(customConfigPath)
} else {
console.warn(
chalk.yellow('\nCustom rollup config not found while LNG_CUSTOM_ROLLUP is set to true')
)
}
}

const defaultConfig = {
Expand Down
10 changes: 9 additions & 1 deletion src/configs/rollup.es6.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,19 @@ const license = require('rollup-plugin-license')
const os = require('os')
const extensions = ['.js', '.ts']
const deepMerge = require('deepmerge')
const chalk = require('chalk')

let customConfig

if (process.env.LNG_CUSTOM_ROLLUP === 'true') {
customConfig = require(path.join(process.cwd(), 'rollup.es6.config'))
const customConfigPath = path.join(process.cwd(), 'rollup.es6.config')
if (fs.existsSync(customConfigPath)) {
customConfig = require(customConfigPath)
} else {
console.warn(
chalk.yellow('\nCustom rollup config not found while LNG_CUSTOM_ROLLUP is set to true')
)
}
}

const defaultConfig = {
Expand Down

0 comments on commit d34507c

Please sign in to comment.