
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
magic-script-cli
Advanced tools
This repository is the command line toolkit for generating, compiling, and running MagicScript applications.
Installation is easy assuming you have Node.js already installed.
npm install -g magic-script-cli
You can now access the toolkit as magic-script
in your system path.
See https://magicscript.org/ for more documentation.
If you plan to develop for Android and/or iOS, follow instructions below:
The detailed information on necessary tooling and setup for ReactNative you can find here: https://facebook.github.io/react-native/docs/getting-started Verify your versions of tools with the minimum below:
Common:
Tool | Version |
---|---|
NodeJS | >=12.10 |
NPM | should be installed with NodeJS |
Android:
To develop on Android platform, your device must support ARCore. To ensure your device supports ARCore visit: https://developers.google.com/ar/discover/supported-devices
Tool | Version |
---|---|
Android SDK | >=28.0.3 |
Gradle | >=3.4.1 |
Android Device OS | >=24 |
JDK | >=8 |
iOS: To develop on iOS platform, your device must support ARKit. To ensure your device supports ARKit visit and scroll to the bottom: https://www.apple.com/ios/augmented-reality/ Please be aware, that it is recommended to use the latest stable versions of below tools:
Tool | Version |
---|---|
iOS device OS | >=12 |
xCode | >=10 |
CocoaPods | >=24 |
Creating a project
magic-script init
. You will be asked few questions regarding the configuration of the project you want to choose:Possible configurations: Components:
Lumin - The OS which is running on MagicLeap device, more info at Magic Script Explained
Landscape - Only available on Lumin, uses vanilla MagicScript to develop apps, more info at Magic Script Explained
Immersive - Only available on Lumin, uses vanilla MagicScript to develop apps, more info at Magic Script Explained
Components - Built on top of MagicScript, React & ReactNative; UI framework that simplifies developing 3D apps. When choosing Components
app type during initialization, you can choose which platform the project is going to be built on. You can choose any combination of those three platforms: Lumin, Android & iOS.
Building & running the project
magic-script build android
or magic-script build ios
. If you have device connected, the project will be built & installed on your device. That's it!magic-script build lumin
to build project for MagicLeap device. Type magic-script build lumin -i
if you want to build & install the app on MagicLeap. That's it!Creating the project
<project>/reactnative/android
.
a. If you have Android Studio installed, open <project>/reactnative/android
as an Android project. The local.properties file should be created automatically
b. If not, create local.properties
file in <project>/reactnative/android
with one line: sdk.dir=<Location of your Android SDK>
<project>/reactnative/
pointing to <project>/assets
.
a. If you're Windows user, you can find more information here: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/mklink
b. If you're MacOS or Linux user, you can use ln
tool for thatTemplate
and package id will be set to com.magicscript.template
. If you want to change the name of the project and package id:
a. For Android use Android Studio to change the project name and package id
b. For iOS use XCode to change the project name and package idBuilding and installing the project
Problems during runtime
rm
and del
tools, which can lead to irreparable situations!! If you are not familiar with those tools, we recommend execute commands between &
and &&
one after another!reactnative
directory from root directory of your project
del %appdata%\Temp\react-native-* & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
cd android && gradlew clean && cd ..
cd android & gradlew clean & cd ..
cd ios & del Pods & del Podfile.lock & del *.xcworkspace & cd ..
cd ios && rm -rf Pods && rm -rf Podfile.lock && rm -rf *.xcworkspace && cd ..
The architecture of the multiplatform MagicScript Components project template is based on the architecture of the MagicScript Components ecosystem itself. Look below on the diagram:
As you can see, there is a hard separation between Magic Script Components library, which is just an interface/definition of the Components, and platform specific libraries, which are engines that are in charge of compiling, building and rendering the app on desired platform. This short explanation leads us to the main idea behind the 'monorepo' type project structure. If you choose to develop on all three platforms (MagicLeap, iOS and Android), your newly created project will have structure like this:
reactnative/common - This directory has the config files for reactnative library. They're needed to write one source code that will run on all three platforms
lumin - This directory has all of the configuration files needed to compile, build and deploy the app to the MagicLeap device
reactnative - This directory has all of the configuration files needed to compile, build and deploy the app to the iOS and Android device
assets - This directory should be used if you want to add assets to your project, like 3D model, image, video or audio.
src - This is where you should put your source code of the application
package.json - It contains only magic-script-components
library, which is (like described above), a definition of the Components. If you want to add some other dependencies to your app, you should place it in this package.json
Building iOS & Android project:
src
directory, resolve dependencies and bundle all of the source code files into single file that will be understood by the machine.reactnative
directory has its own package.json with the dependencies needed by the engine to render the app on the device. That's where the magic-script-components-react-native
library isBuilding MagicLeap project:
lumin
directory you can see that the Rollup Bundler is used to bundle the source code. It is configured the same way as the Metro Bundler. It grabs the code from src
directory, resolves dependencies and bundles the files.lumin
directory (like mentioned above) has all of the configuration files and dependencies that are used to properly render the code on the device. This is where the magic-script-components-lumin
library is set.If you want to add assets like Lomino Font or Lumin System Icons you need to follow the steps below:
Check if the assets
directory already exists in the root of the project. If so, please check if you have symlink created for reactnative/assets
directory. If everything is set properly, put your assets in assets
directory in the root of the project. Otherwise, follow the steps below:
assets
directory in root directory of the project"lomino-font": "git+https://github.com/magic-script/lomino-font"
"lumin-system-icons": "git+https://github.com/magic-script/system-icons"
npm install
in the root directory of the project to install dependencies. Each library has functionality that copies files to the assets
directoryassets
in reactnative
directory:ln -s ../assets reactnative/assets
cmd
, type in the root directory mklink /D "../assets" "reactnative/assets"
path.resolve(__dirname, '../assets')
in watchFolders
configuration in metro.config.js
file:watchFolders: [ path.resolve(__dirname, '../common'), path.resolve(__dirname, '../src'), path.resolve(__dirname, 'node_modules'), path.resolve(__dirname, '../node_modules'), path.resolve(__dirname, '../assets') ],
"../assets/" : "assets/"
in app.package
file:DATAS = "digest.sha512.signed" : "." \ "bin/" : "bin/"\ "../assets/" : "assets/" OPTIONS = package/minApiLevel/2
When you are working on local dependencies in multiplatform project, you can use symlinks in your node_modules
to get instance updates in your dependency:
<dependency-path>
to your dependency in package.json
in lumin
, reactnative
or root directory<dependency>
in node_modules
directory (example shows symlink for lumin platform, you can do exactly the same for react native). Dependency path should be the same as the one from package.json
:
a) On MacOS/Linux type in the root directory ln -s <dependency_path> lumin/node_modules/<dependency-name>
cmd
, type in the root directory mklink /D "<dependency_path>" "lumin/node_modules/<dependency-name>"
lumin
, add this line to rollup.config.js
file in lumin
directory:export default [ // Build for MagicScript on LuminOS { ...common, external: ['uv', 'lumin', 'ssl', 'jpeg', 'png', 'gl'], input: 'src/main.js', preserveModules: true, preserveSymlinks: true, output: { dir: 'bin', ...
This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details
FAQs
Magic Script Toolkit
The npm package magic-script-cli receives a total of 9 weekly downloads. As such, magic-script-cli popularity was classified as not popular.
We found that magic-script-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.