Giter VIP home page Giter VIP logo

magic-script-cli's People

Contributors

bchapman avatar creationix avatar grozdanov avatar kpiascik avatar leoyanggit avatar leoz avatar ml-bnr avatar panwrona avatar sofomomobile avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

magic-script-cli's Issues

Update typescript template

  • The rollup config for typescript multiplatform must match the one from js multiplatform
  • In multiplatform structure, the tsconfig.json and types have to be in the top-level directory

Check for valid app name and app IDs in init command.

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.

Initializing magic-script-components for Android prints 'null' in the terminal

$ 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 ?

Install command does not support OUTNAME

Steps to Reproduce / Actual Behavior:

  1. Build MPK using OUTNAME command/parameter: magic-script build
    Make sure the OUTNAME parameter (from app.package) has different name than app.mpk
  2. Install the MPK: magic-script install
    error: 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

CLI doesn't handle MLDB server not running

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.

I can not execute debugging

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:

Capture_000058

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

RollUp Config Improvements for magic-script-components

When building a magic-script-components app, the rollup.config is not well optimized for a react project.

Env:

    "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",

Current 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()
  ]
};
 ...
 ...

Steps To Reproduce:

  • init new components project using $ magic-script init
  • Change lines 2 and 5 of app.js to the following:
import React, { Component } from "react";
import { View, Text } from "magic-script-components";

export default class MyApp extends Component {
  ...
}
  • run $ magic-script build -i
  • You receive the following error:
    Error: 'Component' is not exported by node_modules/react/index.js

Why is this important?

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.

How to resolve

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),
      },
    }),
  ],
}
...
...

Rollup needs to be installed globally

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.

Command: `magic-script build android` fails

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:

  1. Open the project from the Android Studio - that will trigger gradle sync
  2. Build the project from the Android Studio
  3. Run magic-script build android from the terminal again

Typo into CLI project create messages

While 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

Update printed help with debug option

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]

Typo in the config questions

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

magic-script run --debug=false doesn't work

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

Use published samples for init command.

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.

Update Documentation for INIT

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.

Need proper rollup plugin.

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.

Remove confusing message: `built package: undefined`

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.

Build command swallows errors

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.

[MXSCOMP-23] magic-script run for ZI is not working

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

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.