magic-script / magic-script-cli Goto Github PK
View Code? Open in Web Editor NEWCommand Line Tool for MagicScript applications
Home Page: https://www.magicscript.org/
License: Apache License 2.0
Command Line Tool for MagicScript applications
Home Page: https://www.magicscript.org/
License: Apache License 2.0
Right now there is support only for Lumin. This enhancement will allow developer to create multiplatform project that has typescript support
Currently the input for the app name com.foo.bar...
is a free-form field and lets developers put in names that will be rejected later on as a strange "manifest failure". We should check using a regular expression to catch this early on.
We should an an option, something like --port=9229
when doing magic-script run
so that there can be a stable websocket port to make using inspector easier.
Right now, we include builtins.js in the app template, this should be published to npm as magic-script-polyfills
$ magic-script init
? What is the name of your application? MagicScriptSample
? What is the app ID of your application? com.magicscript.sample
? In which folder do you want to save this project? MagicScriptSample
? What app type do you want? Components
? What platform do you want develop on? Lumin, iOS, Android
Start creating project for Components type, target: LUMIN,IOS,ANDROID
new project name: MagicScriptSample
Lumin manifest file has been updated successfully
Prepare project name and package in the project...
Successfully created local.properties file!
Project successfully created for platforms: LUMIN,IOS,ANDROID
null
Why is there a null
at the last line ?
The Python path is wrong for windows hosts
Add argument to handle case when multiple devices are plugged in to the same computer.
Steps to Reproduce / Actual Behavior:
magic-script build
app.mpk
magic-script install
error: File not found: '.out/app/app.mpk'
Example:
mlla1848:MxsTestRc10 jgrills$ magic-script build
Adding tail data
Tail data added successfully to 'digest.sha512.signed'built package: .out/custom/custom.mpk
mlla1848:MxsTestRc10 jgrills$ magic-script installmldb install .out/app/app.mpk
error: File not found: '.out/app/app.mpk'
Expected Behavior:
Magic-Script install should support OUTNAME command/parameter
We need to add an option to create immersive apps from the command line init
parameter.
Create app with broken manifest. App fails to install, but magic-script build -i returns 0.
MLDB server needs to be up and running. If it's not running the CLI will show odd errors that are not easily reproducible.
We should call "mldb start-server" and wait for this to return before proceeding with any additional mldb commands for each command we support that needs mldb.
If lumin has symlink as a dependency, the rollup plugin creates wrong files structure
If installed with magic-script build \ [-i] it should be installed with debug version, but debug is set to false.
The following error occurs when executing magic-script run pacakge name.
exec error: Error: Command failed: mldb launch --auto-net-privs
Can not set --auto-net-priv for non-debuggable application:
Windows 10 Version 1803(OS build 17134.648)
Lumin OS v0.95.0
Lumin SDK v0.20.0
node v10.15.3
npm 6.4.1
magic-script 1.0.3
Sadao Tokuyama
https://twitter.com/tokufxug
The last version of react-native-cli
was published 3 years ago. https://facebook.github.io/react-native/docs/getting-started recommends uninstalling react-native-cli
from npm and using npx
instead. We should update to use npx
for our init
and run
commands.
Check if it's possible, if so, place common directory from multiplatform structure in reactnative directory and resolve imports properly
Add require to global-scope.js in multiplatform template structure to properly resolve resources and assets on lumin
"magic-script-components": "2.0.0",
"magic-script-components-lumin": "1.0.0",
"magic-script-polyfills": "^2.4.2",
"rollup": "^1.1.2",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "https://github.com/creationix/rollup-plugin-commonjs.git",
"rollup-plugin-node-resolve": "^4.0.0",
rollup.config.js
:import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
const common = {
plugins: [
babel({ exclude: 'node_modules/**' }),
resolve(),
commonjs()
]
};
...
...
$ magic-script init
app.js
to the following:import React, { Component } from "react";
import { View, Text } from "magic-script-components";
export default class MyApp extends Component {
...
}
$ magic-script build -i
Error: 'Component' is not exported by node_modules/react/index.js
It is a very common pattern to use React's named exports.
(ie. import React, { Component, CreateRef, Fragment, etc... } from 'react'
)
The current rollup.config
does not allow for such use of React's named exports. This is not only detrimental to the DevX, but many react specific packages make use of this syntax. Adding any of those packages the project with the current rollup.config
will cause the build error above.
As an example, you can add react-router to the project ($ npm install --save react-router
). Then in app.js
, add import { Router } from 'react-router'
. Running magic-script install -i
will produce the same error as above.
I think the simplest approach is to export all of React's named exports by default in the rollup.config. This is easily accomplished as follows:
import React from 'react'
import babel from 'rollup-plugin-babel'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'
const common = {
plugins: [
babel({ exclude: 'node_modules/**' }),
resolve(),
commonjs({
include: 'node_modules/**',
namedExports: {
react: Object.keys(React),
},
}),
],
}
...
...
The getting started instructions don't mention that rollup needs to be installed globally. magic-script build -i
after magic-script init
fails otherwise.
Alternately, you could change the init'd build
script to run npx rollup -c
instead of just rollup -c
.
Running magic-script build android
from the terminal for newly created project fails with the following error:
BUILD FAILED in 0s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* Where:
Settings file '/Users/lab/Downloads/magic-script-cli/testapp/reactnative/android/settings.gradle'
* What went wrong:
Could not compile settings file '/Users/lab/Downloads/magic-script-cli/testapp/reactnative/android/settings.gradle'.
> startup failed:
General error during semantic analysis: Unsupported class file major version 57
The following workaround steps resolve the issue:
magic-script build android
from the terminal againWhile generating MagicScript Components project for iOS platform, the CLI printed the following message:
/android/app/src/main/java/com/mxs/cube BUNDLE **INDENTIFIER** CHANGED
instead of:
/android/app/src/main/java/com/mxs/cube BUNDLE **IDENTIFIER** CHANGED
Tested on ver. 2.3.6
Template dependencies are very old for magic-script-components-lumin
and even for magic-script-components
. This needs to be fixed https://github.com/magic-script/magic-script-cli/search?l=JSON&q=components
Fix the name of the file to properly change to project's name while creating new project
Currenlty, magic-script --help
does not include information on debug
option:
% magic-script --help
magic-script <command>
Commands:
magic-script init [folderName] [packageName] [appType] [target] [visibleName] Create a new project
magic-script install [target] [path] Install the project
magic-script build [target] Compile project
magic-script remove Remove project from device
magic-script run [target] Compile and run project
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--help Show help [boolean]
The new help
should update the build
step with:
magic-script build [lumin] [debug: true]
Update CLI to allow creation of an Immersive App instead of just Landscape to access the ImmersieveApp APIs
The init
command has the following typo:
? What platform do you want develop on? iOS
instead of:
? What platform do you want to develop on? iOS
Tested on ver. 2.3.6
Looks like you need to drop the -v INSPECTOR_PORT=7275
for this to run properly
mlla1848:MxsCalculator jgrills$ magic-script run --debug=false Launching: mxscalculator at port: 7275 exec error: Error: Command failed: mldb launch -v INSPECTOR_PORT=7275 mxscalculator Failed to start mxscalculator .universe: Cannot specify environment variables for non-debuggable application
Right now we have a single inline template we use for the init command, but it would be nice if we could publish template apps to npm or github and people could fork them and the CLI tool would let you choose from these.
The documentation needs to clearly outline the differences between a Landscape, Immersive and Components application. Further we need to make clear what choosing Lumin, iOS and Android means for Components applications.
Right now we include a rollup config in the template, this needs to be improved with more custom behavior and published as a rollup plugin to npm so we can push updates easier.
It seems that long packageIDs and project names are not renamed at all when creating we are multiplatform components project
How to reproduce:
~/MagicScript/sandbox/TestNewCLI $ magic-script build lumin -h
Adding tail data
Tail data added successfully to 'digest.sha512.signed'
built package: undefined
Reason: Building for the simulator (host) does not generate .mpk
file.
If there is an error in the rollup build step, the output is suppressed and the build continues as if nothing bad happened. The symptom is after a while, changing source files won't affect anything in the bin folder (or the resulting mpk) anymore.
We should detect failed rollup runs and show the diagnostic info and fail the build command.
It should indicate the default build is a debug build. It should also document the command line to do a release build instead.
I created a new project using magic-script init
. After that, I built it by magic-script build -h
and when I run magic-script run
I see issue:
error getting installed packages: Error: Command failed: mldb packages -j
error: no devices found
at ChildProcess.exithandler (child_process.js:303:12)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1026:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
killed: false,
code: 1,
signal: null,
cmd: 'mldb packages -j'
}
Package: com.clitest is not installed. Please install it.
I also tried building it by magic-script build -h -i
with similar result. I'm able to run it by mxs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.