Skip to content

Commit

Permalink
Merge pull request #229 from rdkcentral/release/2.11.0
Browse files Browse the repository at this point in the history
Release - v2.11.0
  • Loading branch information
michielvandergeest authored Apr 28, 2023
2 parents 4823546 + eefc1cc commit 9ea454c
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 48 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## v2.11.0

*28 apr 2023*

- Removed license texts from fixtures, so new Apps created with the CLI don't come with unnecessary licenses anymore ([#226](https://github.com/rdkcentral/Lightning-CLI/issues/226))
- Fixed build issue related to rollup path when using NPX. Solves issue for Metrological CLI. ([#222](https://github.com/rdkcentral/Lightning-CLI/issues/222))
- Fixed issue where sourcemap files were not generated when using esbuild ([#228](https://github.com/rdkcentral/Lightning-CLI/issues/228))
- Added support for CORS in `lng serve` via a new environment variable (`LNG_SERVE_CORS`)

## v2.10.0

*15 feb 2023*
Expand Down
1 change: 1 addition & 0 deletions docs/environmentvariables.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ You can use the following environment variables to customize the behavior of the
| `LNG_LIVE_RELOAD` | false | Instructs your browser to reload the location when a new app bundle is created (using `lng dev`). When the watcher resolves, `document.location.reload()` is called in the browser (tab) that serves your app. Live reload communication is driven by WebSockets. Possible value: `true`, `false`. |
| `LNG_LIVE_RELOAD_HOST` | localhost | Specifies the Websocket host your application will attempt to connect to listen for livereload events. Possible values: ip or host. |
| `LNG_LIVE_RELOAD_PORT` | 8991 | Specifies the port Websocket is listening on. Possible values: Any numeric value. |
| `LNG_SERVE_CORS` | false | When set to `true`, CORS is enabled by allowing all origins (Access-Control-Allow-Origin: *) and default headers (Origin, X-Requested-With, Content-Type, Accept, Range). To allow additional headers, provide comma-separated header names as the value (e.g. Authorization, X-Debug). This both enables CORS and appends the provided headers to Access-Control-Allow-Headers

#### `LNG_SETTINGS_ENV`
Specifies which environment to be used. User need to have `settings.{env}.json` file in the Project home folder with different settings. This will build/dist the application with `settings.{env}.json`.
Expand Down
19 changes: 0 additions & 19 deletions fixtures/js/lightning-app/src/App.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2020 Metrological
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { Lightning, Utils } from '@lightningjs/sdk'

export default class App extends Lightning.Component {
Expand Down
18 changes: 0 additions & 18 deletions fixtures/ts/lightning-app/src/App.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
/*
* If not stated otherwise in this file or this component's LICENSE file the
* following copyright and licenses apply:
*
* Copyright 2022 Metrological
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Lightning, Utils } from '@lightningjs/sdk'

interface AppTemplateSpec extends Lightning.Component.TemplateSpec {
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.10.0",
"version": "2.11.0",
"description": "Lightning-CLI: Command Line Interface tool for a seamless Lightning App Development flow",
"bin": {
"lightning": "./bin/index.js",
Expand Down
2 changes: 2 additions & 0 deletions src/actions/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module.exports = () => {
process.env.LNG_SERVE_CACHE_TIME ? '-c' + process.env.LNG_SERVE_CACHE_TIME : '-c-1',
process.env.LNG_SERVE_PORT ? '-p' + process.env.LNG_SERVE_PORT : false,
process.env.LNG_SERVE_PROXY ? '-P' + process.env.LNG_SERVE_PROXY : false,
process.env.LNG_SERVE_CORS && process.env.LNG_SERVE_CORS !== 'false' ? process.env.LNG_SERVE_CORS === 'true'
? '--cors' : '--cors='+ process.env.LNG_SERVE_CORS : '',
].filter(val => val)

const levelsDown = isLocallyInstalled()
Expand Down
8 changes: 5 additions & 3 deletions src/configs/esbuild.es5.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ const babelPluginInlineJsonImport = require('babel-plugin-inline-json-import')

module.exports = (folder, globalName) => {
const sourcemap =
process.env.LNG_BUILD_SOURCEMAP === 'true'
? true
process.env.NODE_ENV === 'production'
? 'external'
: process.env.LNG_BUILD_SOURCEMAP === 'inline'
? 'inline'
: false
: process.env.LNG_BUILD_SOURCEMAP === 'false'
? ''
: 'external'

// Load .env config every time build is triggered
const appVars = {
Expand Down
8 changes: 5 additions & 3 deletions src/configs/esbuild.es6.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ const babelPluginInlineJsonImport = require('babel-plugin-inline-json-import')

module.exports = (folder, globalName) => {
const sourcemap =
process.env.LNG_BUILD_SOURCEMAP === 'true'
? true
process.env.NODE_ENV === 'production'
? 'external'
: process.env.LNG_BUILD_SOURCEMAP === 'inline'
? 'inline'
: false
: process.env.LNG_BUILD_SOURCEMAP === 'false'
? ''
: 'external'

//Load .env config every time build is triggered
const appVars = {
Expand Down
9 changes: 8 additions & 1 deletion src/configs/rollup.es5.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ module.exports = {
output: {
format: 'iife',
inlineDynamicImports: true,
sourcemap: true,
sourcemap:
process.env.NODE_ENV === 'production'
? true
: process.env.LNG_BUILD_SOURCEMAP === undefined
? true
: process.env.LNG_BUILD_SOURCEMAP === 'false'
? false
: process.env.LNG_BUILD_SOURCEMAP,
},
}
14 changes: 13 additions & 1 deletion src/helpers/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,18 @@ const findFile = (parent, filePath, depthCount = 0) => {
return findFile(path.join(parent, '..'), filePath, ++depthCount)
}

const findBinary = binary => {
const binaryPath = path.join(__dirname, '../..', `node_modules/.bin/${binary}`)
const npxPath = path.join(__dirname, '../../../..', `.bin/${binary}`)
return fs.existsSync(binaryPath)
? binaryPath
: fs.existsSync(npxPath)
? npxPath
: (() => {
throw new Error(`Required binary (${binary}) not found`)
})()
}

const removeFolder = folder => {
spinner.start('Removing "' + folder.split('/').pop() + '" folder')
shell.rm('-rf', folder)
Expand Down Expand Up @@ -212,7 +224,7 @@ const bundleAppRollup = (folder, metadata, type, options) => {

const levelsDown = isLocallyInstalled()
? findFile(process.cwd(), 'node_modules/.bin/rollup')
: path.join(__dirname, '../..', 'node_modules/.bin/rollup')
: findBinary('rollup')
process.env.LNG_BUILD_FAIL_ON_WARNINGS === 'true' ? args.push('--failAfterWarnings') : ''
return execa(levelsDown, args)
.then(() => {
Expand Down

0 comments on commit 9ea454c

Please sign in to comment.