Giter VIP home page Giter VIP logo

lightning-cli's Introduction

Lightning CLI

The Lightning-CLI is the Command Line Interface tool for a seamless Lightning App Development flow.

Install the Lightning-CLI globally on your system

npm install -g @lightningjs/cli

Usage:

lng <command> [options]

Check out the complete documentation for more information.

Feedback, bugs, questions and support

In case you find any bugs or have feature requests, feel free to open an issue on the GitHub repository.

If you have questions or need support using the Lightning-CLI, then we're happy to help you out on our Discourse Forum on LightningJS.io.

Contributing

If you want to contribute to the Lightning-CLI, please consider the following:

  • the master branch is the latest stable release
  • the dev branch is used for upcoming releases
  • all development should be done in dedicated topic branches (from latest dev-branch)
  • please send in your PR against the dev-branch

Before you submit your PR, make sure you install the projects dependencies, as this will activate automatic linting and code formatting in a Git commit hook.

Changelog

Checkout the changelog here.

lightning-cli's People

Contributors

chiefcll avatar cidevant avatar collinc2343 avatar csanthoshi-metrological avatar dependabot[bot] avatar drulokia avatar erikhaandrikman avatar fernando-j-afonso-alb avatar frank-weindel avatar jansunavec avatar lbakkertds avatar lewispeel avatar michielvandergeest avatar mlangendijk avatar npoltorapavlo avatar pradeeptakdas avatar sandeep-vedam avatar sandhyakolli avatar sarangk-hotstar avatar serialforbreakfast avatar sukanya673 avatar sverkoye avatar uguraslan avatar wouterlucas avatar woutermeek avatar yevhen-buhaiov-gl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lightning-cli's Issues

Lightning-CLI as a devDependencies

Is possible to add Lightning-CLI ad a dev dependency?
What's the correct syntax?
I need to map the lng commands to npm scripts so I need to be safe that the package is installed.

How to change background color of the App

Is possible to change the background color of the app that is black by default?
Where is the correct point for setting this?
Is it an App setting?

App.js

import { Lightning } from 'wpe-lightning-sdk'

export default class App extends Lightning.Component {
  static _template() {
    return {
      w: 1920,
      h: 1080,
      color: 0xFFFFFFFF,
      UsingShorthand:{ x: 250, y: 100, src: 'https://webplatformforembedded.github.io/Lightning/img/LngDocs_LilLightningIdle.png' },
      Toolbox:{
        x: 50,
        y: 50,
        RoundRectangle: {
            zIndex: 2,
            texture: lng.Tools.getRoundRect(200, 40, 4, 3, 0xffff00ff, true, 0xff00ffff),
        },
        Shadow: {
            x: 10,
            y: 10,
            zIndex: 1,
            color: 0xFFFFFFFF,
            texture: lng.Tools.getShadowRect(150, 40, 4, 10, 15),
        }
      }
    }
  }
}

index.js

import { Launch } from 'wpe-lightning-sdk'
import App from './App.js'

export default function() {
  return Launch(App, ...arguments)
}

Locally installed application does not work - (startApp.js:113 Uncaught (in promise) TypeError: Failed to fetch)

Applications launched from local storage (using file:// locator) does not work.
Chrome, Version 83.0.4103.61 (Official Build) (64-bit) generates the following message/errors:

startApp.js:130 Fetch API cannot load file:///home/sw/public_html/refapp2-2/settings.json. URL scheme must be "http" or "https" for CORS request.
getSettings @ startApp.js:130
(anonymous) @ startApp.js:46
(anonymous) @ startApp.js:221
Promise.then (async)
(anonymous) @ startApp.js:218
sequence @ startApp.js:213
startApp @ startApp.js:41
(anonymous) @ startApp.js:251
startApp.js:137 No settings.json found. Using defaults.
(anonymous) @ startApp.js:137
Promise.catch (async)
getSettings @ startApp.js:134
(anonymous) @ startApp.js:46
(anonymous) @ startApp.js:221
Promise.then (async)
(anonymous) @ startApp.js:218
sequence @ startApp.js:213
startApp @ startApp.js:41
(anonymous) @ startApp.js:251
startApp.js:113 Fetch API cannot load file:///home/sw/public_html/refapp2-2/metadata.json. URL scheme must be "http" or "https" for CORS request.
getAppMetadata @ startApp.js:113
(anonymous) @ startApp.js:56
(anonymous) @ startApp.js:221
Promise.then (async)
(anonymous) @ startApp.js:218
sequence @ startApp.js:213
startApp @ startApp.js:41
(anonymous) @ startApp.js:251
startApp.js:113 Uncaught (in promise) TypeError: Failed to fetch
    at getAppMetadata (startApp.js:113)
    at startApp.js:56
    at startApp.js:221
getAppMetadata @ startApp.js:113
(anonymous) @ startApp.js:56
(anonymous) @ startApp.js:221
Promise.then (async)
(anonymous) @ startApp.js:218
sequence @ startApp.js:213
startApp @ startApp.js:41
(anonymous) @ startApp.js:251

Where to put static assets

Proposal for documenting how it works and where to put the static assets like svg files and images in the source code.

Wrong messages in wrong folder

I've run lng dev in a wrong folder, without node_modules or other files of Lightning and the messages seem refer to an installation (es: ⚠️ You are using an older version of the Lightning SDK. Please consider upgrading to the latest version. ⚠️). It should be wrong. I'm expecting an error of wrong folder.

The output

matti@LAPTOP-FKK5J5IS MINGW64 ~/OneDrive/Documenti/projects/GitLab/com.company.app.TicTacToe (13-terzo-o-quarto-client)        
$ lng dev
 
√ Removing "dist" folder
 
√ Ensuring "dist" folder exists
 
- Copying support files to "dist"

⚠️  You are using an older version of the Lightning SDK. Please consider upgrading to the latest version.  ⚠️

cp: no such file or directory: ./node_modules/wpe-lightning/dist/lightning.js
cp: no such file or directory: ./node_modules/wpe-lightning/devtools/lightning-inspect.js
cp: no such file or directory: ./node_modules/wpe-lightning-sdk/support/*
√ Copying support files to "dist"
 
- Copying static assets to "dist"cp: no such file or directory: ./static
√ Copying static assets to "dist"
× Copying static assets to "dist"

'lng typo' displays NO error message..

lng crete (typo of create)

Issuing the above command - just quietly ignores the command.

A error message like ...

'lng crete' is not a recognized command. typo ?

... would be useful.

[FEATURE/DOC] Documenting source path

Documenting that the code is under:
npm root -g => wpe-lightning-cli
Example:
file:///C:/Users/matti/AppData/Roaming/npm/node_modules/wpe-lightning-cli/
For debugging reason.

Uncaught ReferenceError: process is not defined

Hi,
I'm trying to use https://xstate.js.org/docs/ and I'm experiencing an issue:

environment.js:3 Uncaught ReferenceError: process is not defined
    at environment.js:3
    at createCommonjsModule (index.js:9)
    at constants.js:6
    at index.js:6
(anonymous) @ environment.js:3
createCommonjsModule @ index.js:9
(anonymous) @ constants.js:6
(anonymous) @ index.js:6

Seems this is connected with Rollup.
Here some similar issues:

The file

Can You fix this in the CLI or Can I extends the configuration of Rollup?

Error while creating ES6 bundle - UnhandledPromiseRejectionWarning: TypeError: PromiseReject called on non-object

We're observing the following problems:

(node:1198) UnhandledPromiseRejectionWarning: TypeError: PromiseReject called on non-object
    at reject (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1198) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To termi
nate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1198) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The first problem is that lng doesn't seem to use --unhandled-rejections=strict option which means that bundling creation fails but remains unnoticed from the rest of the build process. We would need to have non-zero exit code in all that cases.

The second problem is why this actually happens?

What we're trying to do is to compile: refapp + PR13.

The full recipe can be found here: https://code.rdkcentral.com/r/#/c/components/generic/rdk-oe/meta-cmf-video-restricted/+/38330/2/

do_configure log:

DEBUG: Executing python function sysroot_cleansstate
DEBUG: Removing manifest: /data/dwrobel1/rdkv/rpi-refapp2/build-raspberrypirdkhybrefapp/tmp/sysroots/raspberrypirdkhybrefapp/sysroot-providers/refapp2
DEBUG: Removing manifest: /data/dwrobel1/rdkv/rpi-refapp2/build-raspberrypirdkhybrefapp/tmp/sysroots/raspberrypirdkhybrefapp/sysroot-providers/
DEBUG: Python function sysroot_cleansstate finished
DEBUG: Executing shell function do_configure
Using npm version : 6.14.4
npm WARN com.metrological.app.myawesomeapp@ No repository field.
npm WARN com.metrological.app.myawesomeapp@ No license field.

audited 3954 packages in 3.163s

33 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-commonjs.
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-node-resolve.
npm WARN com.metrological.app.myawesomeapp@ No repository field.
npm WARN com.metrological.app.myawesomeapp@ No license field.

+ [email protected]
updated 1 package and audited 3954 packages in 9.014s

27 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

DEBUG: Shell function do_configure finished
DEBUG: Executing python function do_qa_configure
DEBUG: Python function do_qa_configure finished

do_compile log:

DEBUG: Executing shell function do_compile
Using node version : v12.16.3
 
- Removing "dist" folder
✔ Removing "dist" folder
 
- Ensuring "dist" folder exists
✔ Ensuring "dist" folder exists
 
- Copying support files to "dist"
✔ Copying support files to "dist"
 
- Copying static assets to "dist"
✔ Copying static assets to "dist"
 
- Copying settings.json "dist"
✔ Copying settings.json "dist"
 
- Copying metadata.json "dist"
✔ Copying metadata.json "dist"
 
- Building ES6 appBundle and saving to "dist"
✖ Error while creating ES6 bundle (see log)
 

(node:1198) UnhandledPromiseRejectionWarning: TypeError: PromiseReject called on non-object
    at reject (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1198) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1198) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
+ mkdir dist/img
+ mkdir dist/cache
+ mkdir dist/fonts
+ cp -avr ./src/img/. dist/img/.
‘./src/img/./default-poster.jpg’ -> ‘dist/img/././default-poster.jpg’
‘./src/img/./movies’ -> ‘dist/img/././movies’
‘./src/img/./movies/movie_01.png’ -> ‘dist/img/././movies/movie_01.png’
‘./src/img/./movies/movie_02.png’ -> ‘dist/img/././movies/movie_02.png’
‘./src/img/./movies/movie_03.png’ -> ‘dist/img/././movies/movie_03.png’
‘./src/img/./movies/movie_04.png’ -> ‘dist/img/././movies/movie_04.png’
‘./src/img/./movies/movie_05.png’ -> ‘dist/img/././movies/movie_05.png’
‘./src/img/./movies/movie_06.png’ -> ‘dist/img/././movies/movie_06.png’
‘./src/img/./movies/movie_07.png’ -> ‘dist/img/././movies/movie_07.png’
‘./src/img/./node’ -> ‘dist/img/././node’
‘./src/img/./node/border.png’ -> ‘dist/img/././node/border.png’
‘./src/img/./posters’ -> ‘dist/img/././posters’
‘./src/img/./posters/poster_01.png’ -> ‘dist/img/././posters/poster_01.png’
‘./src/img/./posters/poster_02.png’ -> ‘dist/img/././posters/poster_02.png’
‘./src/img/./posters/poster_03.png’ -> ‘dist/img/././posters/poster_03.png’
‘./src/img/./posters/poster_04.png’ -> ‘dist/img/././posters/poster_04.png’
‘./src/img/./posters/poster_05.png’ -> ‘dist/img/././posters/poster_05.png’
‘./src/img/./posters/poster_06.png’ -> ‘dist/img/././posters/poster_06.png’
‘./src/img/./posters/poster_07.png’ -> ‘dist/img/././posters/poster_07.png’
‘./src/img/./rdk-logo.png’ -> ‘dist/img/././rdk-logo.png’
‘./src/img/./tvchannels’ -> ‘dist/img/././tvchannels’
‘./src/img/./tvchannels/1.png’ -> ‘dist/img/././tvchannels/1.png’
‘./src/img/./tvchannels/10.png’ -> ‘dist/img/././tvchannels/10.png’
‘./src/img/./tvchannels/11.png’ -> ‘dist/img/././tvchannels/11.png’
‘./src/img/./tvchannels/12.png’ -> ‘dist/img/././tvchannels/12.png’
‘./src/img/./tvchannels/13.png’ -> ‘dist/img/././tvchannels/13.png’
‘./src/img/./tvchannels/14.png’ -> ‘dist/img/././tvchannels/14.png’
‘./src/img/./tvchannels/15.png’ -> ‘dist/img/././tvchannels/15.png’
‘./src/img/./tvchannels/16.png’ -> ‘dist/img/././tvchannels/16.png’
‘./src/img/./tvchannels/17.png’ -> ‘dist/img/././tvchannels/17.png’
‘./src/img/./tvchannels/18.png’ -> ‘dist/img/././tvchannels/18.png’
‘./src/img/./tvchannels/19.png’ -> ‘dist/img/././tvchannels/19.png’
‘./src/img/./tvchannels/2.png’ -> ‘dist/img/././tvchannels/2.png’
‘./src/img/./tvchannels/20.png’ -> ‘dist/img/././tvchannels/20.png’
‘./src/img/./tvchannels/3.png’ -> ‘dist/img/././tvchannels/3.png’
‘./src/img/./tvchannels/4.png’ -> ‘dist/img/././tvchannels/4.png’
‘./src/img/./tvchannels/5.png’ -> ‘dist/img/././tvchannels/5.png’
‘./src/img/./tvchannels/6.png’ -> ‘dist/img/././tvchannels/6.png’
‘./src/img/./tvchannels/7.png’ -> ‘dist/img/././tvchannels/7.png’
‘./src/img/./tvchannels/8.png’ -> ‘dist/img/././tvchannels/8.png’
‘./src/img/./tvchannels/9.png’ -> ‘dist/img/././tvchannels/9.png’
+ cp -avr ./src/cache/. dist/cache/.
‘./src/cache/./apps.json’ -> ‘dist/cache/././apps.json’
‘./src/cache/./appsLogos’ -> ‘dist/cache/././appsLogos’
‘./src/cache/./appsLogos/default_app_collection.png’ -> ‘dist/cache/././appsLogos/default_app_collection.png’
‘./src/cache/./appsLogos/metrological.png’ -> ‘dist/cache/././appsLogos/metrological.png’
‘./src/cache/./appsLogos/spark.png’ -> ‘dist/cache/././appsLogos/spark.png’
‘./src/cache/./config.json’ -> ‘dist/cache/././config.json’
‘./src/cache/./demo-ssm’ -> ‘dist/cache/././demo-ssm’
‘./src/cache/./demo-ssm/channelsV2.json’ -> ‘dist/cache/././demo-ssm/channelsV2.json’
‘./src/cache/./demo-ssm/movies.json’ -> ‘dist/cache/././demo-ssm/movies.json’
‘./src/cache/./demo’ -> ‘dist/cache/././demo’
‘./src/cache/./demo/channelsV2.json’ -> ‘dist/cache/././demo/channelsV2.json’
‘./src/cache/./demo/movies.json’ -> ‘dist/cache/././demo/movies.json’
‘./src/cache/./eventsV2.json’ -> ‘dist/cache/././eventsV2.json’
‘./src/cache/./menu.json’ -> ‘dist/cache/././menu.json’
+ cp -avr ./src/fonts/. dist/fonts/.
‘./src/fonts/./DejaVuSerif.ttf’ -> ‘dist/fonts/././DejaVuSerif.ttf’
DEBUG: Shell function do_compile finished

Error while installing the CLI

PS C:\Users\matti\OneDrive\Documenti\projects\GitLab\lightning-demo-app> npm install -g WebPlatformForEmbedded/Lightning-CLI       
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-node-resolve.
npm ERR! Unexpected end of JSON input while parsing near '...curity":"^1.4.0","esl'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\matti\AppData\Roaming\npm-cache\_logs\2020-01-23T11_17_43_713Z-debug.log

lng dev not working

Actually, running lng dev:

  • The first time it works, the app builds and the view is rendered correctly:
√ Removing "dist" folder
 
√ Ensuring "dist" folder exists
 
√ Copying support files to "dist"

√ Copying static assets to "dist"

√ Copying settings.json "dist"

√ Copying metadata.json "dist"

√ Building ES6 appBundle and saving to "dist"

√ Building ES5 appBundle and saving to "dist"
Starting up http-server, serving ./dist
Available on:
  http://192.168.0.103:8080
  http://127.0.0.1:8080
Hit CTRL-C to stop the server
open: http://127.0.0.1:8080
  • When you save, console shows:
√ Ensuring "dist" folder exists

Reload your webbrowser to see the changes

but the changes is not correctly showed after refreshing browser.
You have to run lng build; lng serve; to correctly rebuild and re render the app.

Proposal

combine lng build; lng serve; in a single npm script command out of the box.

Side issue

lng dev is mentioned in 2 section in the readme, should be the Doc section reference to anorther command or is it right?

Watching external .mjs

Hello,

I've created externals .mjs modules for my App (for defining custom classes).
They are not in the src folder.
Can I ensure/watch these files that the apps realods in lng dev mode?
Maybe If I try to make them node_modules it will works?

⚠️ You are using an older version of the Lightning SDK. Please consider upgrading to the latest version. ⚠️

Running lng dev I got this warning:
⚠️ You are using an older version of the Lightning SDk. Please consider upgrading to the latest version. ⚠️
My questions are:

Best regards,
Mattia

Managing Environment Variables

Hello!

I'm looking for a way to declare different API URLs for local development build and production build.
Is it possible to set the environment variables in package.json or via CLI?

NPM Inconsistencies

When creating a new Lightning app using PNPM as our node cli and the strictPeerDependencies option enabled, I get the following error trying to install the lightning cli:

wpe-lightning-cli: [email protected] requires a peer of rollup@^2.0.0 but version 1.32.1 was installed

Any chance we could update the rollup version used in the CLI (and Lightning) packages to use rollup 2.0.0 and avoid this invalid versioning?

Managing the loading time "before the canvas"

I'm studying a way to manage fetch loading and errors inside Lightning but how about the fetches before the app is instantiated?
For example a spinner not in canvas?

Example Logs

DevTools failed to load SourceMap: Could not load content for chrome-extension://hdokiejnpimakedhajhdlcegeplioahd/sourcemaps/onloadwff.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
startApp.js:199 loadJS ./polyfills/babel-polyfill.js
startApp.js:199 loadJS ./polyfills/url.js
startApp.js:199 loadJS ./lib/lightning.es5.js
startApp.js:199 loadJS ./appBundle.es5.js
helpers.js:52 [Violation] Only request geolocation information in response to a user gesture.
(anonymous) @ helpers.js:51
getLatLon @ helpers.js:36
(anonymous) @ defaults.js:3
(anonymous) @ index.js:20
lightning.es5.js:16144 Using image worker!
index.js:137 [Intervention] Slow network is detected. See https://www.chromestatus.com/feature/5636954674692096 for more details. Fallback font will be used while loading: http://127.0.0.1:8084/static/fonts/pixel.ttf
lightning.es5.js:19984 FOCUS :[R]#1:[0]App:[0]#3
lightning.es5.js:19984 FOCUS :[R]#1:[0]App:[1]#5:[0]#6:[0]Items:[0]#9

Code splitting is missing

While working with large codebase that includes third-party libraries(state management, video players, analytics systems), code splitting allows to reduce time required to load an app. Utilization of the SDK's routing mechanism may be a very good option to split code on which each route depends + generic vendor bundles. A Next.js per-page code splitting is a very good example.

Preserve customs files in ./dist

Actually, when You run lng build all added files in the ./dist folder are cancelled.
Should be good if they are preserved in order to have the possibility to setup html files for distribution.

npm ERR! Command failed: git submodule update -q --init --recursive

Installation fails if executed in a npm script.

package.json

"scripts": {
    "preinstall": "npm install -g WebPlatformForEmbedded/Lightning-CLI"
  }

Complete log

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'WebPlatformForEmbedded/Lightning-CLI'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 69ee69ac1c9553ed
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for github:WebPlatformForEmbedded/Lightning-CLI Command failed: git submodule update -q --init --recursive
7 silly fetchPackageMetaData C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 21: .: git-sh-setup: file not found
8 timing stage:rollbackFailedOptional Completed in 0ms
9 timing stage:runTopLevelLifecycles Completed in 1838ms
10 verbose stack Error: Command failed: git submodule update -q --init --recursive
10 verbose stack C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 21: .: git-sh-setup: file not found
10 verbose stack
10 verbose stack     at ChildProcess.exithandler (child_process.js:295:12)
10 verbose stack     at ChildProcess.emit (events.js:223:5)
10 verbose stack     at maybeClose (internal/child_process.js:1021:16)
10 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
11 verbose cwd C:\Users\matti\OneDrive\Documenti\projects\GitLab\com.company.app.tictactoe
12 verbose Windows_NT 10.0.18362
13 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "WebPlatformForEmbedded/Lightning-CLI"
14 verbose node v12.14.1
15 verbose npm  v6.13.4
16 error code 1
17 error Command failed: git submodule update -q --init --recursive
17 error C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 21: .: git-sh-setup: file not found
18 verbose exit [ 1, true ]

Goal

Ensuring someone can simply clone my project, install that and start.
Related: #20

Update

The same type of error happens even if I use npm explore in the project that it is expected to run the build.
Example, a preinstall script where I expect to build before starting

$ npm i

> [email protected] preinstall C:\Users\matti\OneDrive\Documenti\projects\GitLab\com.company.app.tictactoe
> npm explore tic-tac-toe-client npm install

npm ERR! code 1
npm ERR! Command failed: git submodule update -q --init --recursive
npm ERR! C:/Program Files/Git/mingw64/libexec/git-core\git-submodule: line 21: .: git-sh-setup: file not found        
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\matti\AppData\Roaming\npm-cache\_logs\2020-05-07T15_13_16_881Z-debug.log
npm ERR! weird error 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] preinstall: `npm explore tic-tac-toe-client npm install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\matti\AppData\Roaming\npm-cache\_logs\2020-05-07T15_13_24_676Z-debug.log

Seems that the build needs to be installed (installed means that have to have the node_modules inside the folder, even if the folder is into another node_modules folder 🤪) before being executed.

Support Typescript

Feature Request: Lightning is really good. I would love if it supported development in Typescript

Documenting how to updade SDK

Hi @MattiaPontonioKineton,
Based on the output i can see that you are still using both an old version of the SDK as of the CLI.
To update the SDK delete the Package-lock.json, and the node_modules and run npm i again.
To update the CLI run its installer again:
npm install -g WebPlatformForEmbedded/Lightning-CLI

Originally posted by @Thomvl in #34 (comment)

lng dev not working

lng dev ask for continue without internet connection. Then, It deletes dist folder and then exit the process.

npm WARNINGS

npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-commonjs.
npm WARN deprecated [email protected]: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-node-resolve.

cp: no such file or directory:

Hello,
regarding this block of code I've 2 issues:
https://github.com/WebPlatformForEmbedded/Lightning-CLI/blob/16cdea600acc8019e7b942f7ad56c412904897cb/src/helpers/build.js#L44

  1. The if condition should not be the correct way to check the version of the SDK because it results true if the "finding of the file" fails.

  2. Problems with use as a dependency

Error

Actually I'm receiving this error in the build:

⚠️  You are using an older version of the Lightning SDK. Please consider upgrading to the latest version.  ⚠️

cp: no such file or directory: ./node_modules/wpe-lightning/dist/lightning.js
cp: no such file or directory: ./node_modules/wpe-lightning/devtools/lightning-inspect.js
cp: no such file or directory: ./node_modules/wpe-lightning-sdk/support/*

I'm using this kind of architecture:

  • tic-tac-toe (.git repo & package.json)
    • tic-tac-toe-client (.git repo & package.json)
    • tic-tac-toe-server (.git repo & package.json)

package.json scripts

"scripts": {
    "preinstall": "npm explore tic-tac-toe-client npm install",
    "start": "npm run build:client & npm explore tic-tac-toe-server npm run start",
    "dev": "npm run build:client & npm explore tic-tac-toe-server npm run dev",
    "debug": "npm run build:client & npm explore tic-tac-toe-server npm run start:debug",
    "build:client": "npm explore tic-tac-toe-client npm run build"
  }

After investigation, I found that when You use a project ad a dependency the node_modules are "packed" in one folder on top so exploring the module and running commands try to find node_modules in the root may results in errors.
I'm looking to a workaround but I think that the CLI should consider this case.
I'm also looking to a Native npm way to point to an "agnostic" node_modules folder.
This results in a "bad build" without the index.html.

The "Bad" build

image

REF: #8

Updade

I think that the correct approaches that Lightning-CLI strict depends on specific versions (tags) of wpe-lightning and wpe-lightning-sdk so You do not have to check the modules and if You need to use some functionality address an issue to expose that from the package at this version.

Safe Reverse domain name notation changing

Hello,
is safe to change the name of the folder?
For example, I need to change com.sky.app.lightning.demo.app to com.skyita.lightning.
There are other points where the CLI use this name?
Best regards

lng build hangs when importing a JS file from outside the app root

I'm working on an app that involves an HTML app running on a mobile or desktop device and a Lightning app running on a TV. I'd like the two apps to share the same common app dependencies via an import

Directory structure

/common
- /SocketClient.js
/tv-app
- /src
  - /App.js
/mobile-app

I'm trying to import SocketClient.js from the Lightning app's App.js like so:

import SocketClient from '../../common/SocketClient.js'

However when I run lng build, rollup seems to hang indefinitely with no error or warning.

Screen Shot 2020-10-19 at 3 42 29 PM

Attached is a sample project to reproduce. Simply extract, go to the "tv-app" directory. Run npm install, and then lng build

lightning-common-rollup-hang.zip

If any of you know another pattern you can recommend to achieve the same "commonality" I'd love to hear about it. Thanks!

Commitizen breaks ES5 builds

It seems adding a library like Commitizen or commitLint breaks ES5 applications. ES6 applications seem to be unaffected. This is the error I'm seeing when trying to launch the application;

image

Steps to reproduce

  • Create an empty project using lng create (eslint=yes, install npm dependencies=yes, init empty git=yes)
  • Change platformSettings/esEnv to "es5" inside settings.json
  • Make the repo Commitizen-friendly
    • npm i commitizen -g
    • commitizen init cz-conventional-changelog --save-dev --save-exact
  • Run app in the browser lng dev and open the console in DevTools

Favicon support | Control over index.html

Steps to reproduce

  1. I'm getting an error while using the dist into a browser.
  2. The error is related to the absense of favicon.ico file
  3. If I put the file into the dist folder the issue solves
  4. If I rebuild the build the favicon.ico went deleted and the issue went reopened
Failed to load resource: the server responded with a status of 403 (denied)
http://data.oscdn.any.sky.it/favicon.ico

More generally this issue addresses to the need of have more control over the features of the HTML document.

App Background Transparency

  • clearColor with alpha value to 0 (transparent) in settings.json is rendered obsolete due to the background: black; property being set at:
    • fixtures/dist/index.es5.html
    • fixtures/dist/index.es6.html

proposed fix in the following pull request #72

Configure root / dist

Should be good if I can specify optionally the path in the system of the dist folder.
This is because I have an express server and I need to configure the static root.
https://expressjs.com/it/starter/static-files.html

My goal

1 Express server

  • / --> point to the dist and serves the SPA app.
  • /api/something --> point to my custom APIs
  • same hostname and port
  • I want even to make the server and the client as 2 different npm modules

[!](plugin Rollup Core) Error: Could not load /Users/Naseem/AppData/Roaming/npm/node_modules/wpe-lightning-cli/src/alias/wpe-lightning.js

I am facing issue while running lng build command, How can i fix this issue?

$ lng build

√ Removing "E:\workspace\xxx\xxx\build" folder

√ Ensuring "E:\workspace\xxx\xxx\build" folder exists

√ Copying support files to "E:\workspace\xxx\xxx\build"

  • Copying static assets to "E:\workspace\xxx\xxx\build"cp: no such file or directory: ./static
    √ Copying static assets to "E:\workspace\xxx\xxx\build"

√ Copying settings.json to "E:\workspace\xxx\xxx\build"

√ Copying metadata.json to "E:\workspace\xxx\xxx\build"

× Error while creating ES6 bundle (see log)

E:\workspace\xxx\xxx\src\index.js → build\appBundle.js...
[!] (plugin Rollup Core) Error: Could not load /Users/Naseem/AppData/Roaming/npm/node_modules/wpe-lightning-cli/src/alias/wpe-lightning.js (imported by E:\workspace\xxx\xxx\node_modules\wpe-lightning-sdk\src\Lightning\index.js): ENOENT: no such file or directory, open 'E:\Users\Naseem\AppData\Roaming\npm\node_modules\wpe-lightning-cli\src\alias\wpe-lightning.js'
Error: Could not load /Users/Naseem/AppData/Roaming/npm/node_modules/wpe-lightning-cli/src/alias/wpe-lightning.js (imported by E:\workspace\xxx\xxx\node_modules\wpe-lightning-sdk\src\Lightning\index.js): ENOENT: no such file or directory, open 'E:\Users\Naseem\AppData\Roaming\npm\node_modules\wpe-lightning-cli\src\alias\wpe-lightning.js'

(node:7472) UnhandledPromiseRejectionWarning: Error: Error: Command failed with exit code 1: C:\Users\Naseem\AppData\Roaming\npm\node_modules\wpe-lightning-cli\node_modules.bin\rollup -c C:\Users\Naseem\AppData\Roaming\npm\node_modules\wpe-lightning-cli\src\configs\rollup.es6.config.js --input E:\workspace\xxx\xxx\src\index.js
--file E:\workspace\xxx\xxx\build\appBundle.js --name APP_com_epam_lgi
at execa.then.catch.e (C:\Users\Naseem\AppData\Roaming\npm\node_modules\wpe-lightning-cli\src\helpers\build.js:150:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:7472) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:7472) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

using npm -v > 6.13.4
using node -v > v10.19.0

[FEATURE] Implementing Hot Reloading

Should be good if when You run lng dev the apps rebuilds and the browser even reloads.
Working in a TV should be frustrating because You have to relaunch the app every change with command line or other methods.

lng [dev] do not create index

Hello,
I'm experiencing an issue.
Before this error I've moved some directories and deleted maybe the dist folder, client is the lightning project.

Project structure

  • com.company.app.TicTacToe
    • client
      • Here the lightning project
    • server

Log

matti@LAPTOP-FKK5J5IS MINGW64 ~/OneDrive/Documenti/projects/GitLab/com.company.app.TicTacToe/client (13-terzo-o-quarto-client) 
$ lng dev
 
√ Removing "dist" folder

√ Ensuring "dist" folder exists

- Copying support files to "dist"

⚠️  You are using an older version of the Lightning SDK. Please consider upgrading to the latest version.  ⚠️

cp: no such file or directory: ./node_modules/wpe-lightning/dist/lightning.js
cp: no such file or directory: ./node_modules/wpe-lightning/devtools/lightning-inspect.js
cp: no such file or directory: ./node_modules/wpe-lightning-sdk/support/*
√ Copying support files to "dist"

√ Copying static assets to "dist"

√ Copying settings.json "dist"

√ Copying metadata.json "dist"

√ Building ES5 appBundle and saving to "dist"
Starting up http-server, serving ./dist
Available on:
  http://127.0.0.1:8081
Hit CTRL-C to stop the server
open: http://127.0.0.1:8081
[2020-03-25T09:02:19.807Z]  "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
[2020-03-25T09:02:20.243Z]  "GET /favicon.ico" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
[2020-03-25T09:02:20.246Z]  "GET /favicon.ico" Error (404): "Not found"
[2020-03-25T09:02:48.106Z]  "GET /metadata.json" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
[2020-03-25T09:03:26.739Z]  "GET /" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"

127.0.0.1:8080

Here I'm expecting the app running but there is no index....


  | (drw-rw-rw-) |   | static/
-- | -- | -- | --
  | (-rw-rw-rw-) | 29.4k | appBundle.es5.js
  | (-rw-rw-rw-) | 35.4k | appBundle.es5.js.map
  | (-rw-rw-rw-) | 132B | metadata.json
  | (-rw-rw-rw-) | 471B | settings.json


CLI does not work when NPM installed locally

I'm not a fan of installing CLI tools globally when I can get away with not doing so. So I prefer installing them locally into my project and relying on NPM script commands or NPX to run those cli scripts. Obviously this is just a preference. The problem is, Lightning-CLI does not seem to work when installed locally. See command logs below:

fweind200@HQSML-1720180 tv-app % npx lng dist
 
✔ Removing "static" folder
 
✔ Copying static assets to "es6"
 
✖ Error while creating ES6 bundle (see log)
 

(node:51964) UnhandledPromiseRejectionWarning: TypeError: PromiseReject called on non-object
    at reject (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:51964) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
(node:51964) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
fweind200@HQSML-1720180 tv-app % npx lng dev 
 
✔ Removing "build" folder
 
✔ Ensuring "build" folder exists
 
✔ Copying support files to "build"
 
✔ Copying static assets to "build"
 
✔ Copying settings.json to "build"
 
✔ Copying metadata.json to "build"
 
✖ Error while creating ES6 bundle (see log)
 

✖ Building ES6 appBundle and saving to "build"

(Not sure where the log is)

These commands work fine with a globally installed Lightning-CLI.

Publish wpe-lightning-cli

Running npm install -g wpe-lightning-cli.

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/wpe-lightning-cli - Not found
npm ERR! 404
npm ERR! 404  'wpe-lightning-cli@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\matti\AppData\Roaming\npm-cache\_logs\2020-01-23T11_58_16_967Z-debug.log

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.