GithubHelp home page GithubHelp logo

ngx-rocket / scripts Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 7.0 905 KB

:wrench: Support scripts for ngX-Rocket projects

License: MIT License

JavaScript 100.00%
ngx-rocket support scripts tools ngx project cordova angular ionic enterprise

scripts's Introduction

๐Ÿš€ ngx-rocket/scripts

NPM version Build Status Node version XO code style License

Support scripts for ngX-Rocket projects.

In order to simplify the workflow of applications generated with ngX-Rocket generator, we made this repo to gather all additional scripts and build tools.

Since this module is an independant package, you can even use for projects not built from ngX-Rocket if you find it useful.

Installation

npm install --save @ngx-rocket/scripts

Usage

This modules provides CLI commands to be used in NPM scripts, along with some Cordova hooks (see hooks folder).

Export environment variables to a JSON or JavaScript file

ngx-scripts env <env_var> [<env_var2> ...] [--out <file>] [--format json|js] [--parse-json]

Default output file is src/environments/.env.ts with JavaScript format.

Execute Cordova commands

ngx-scripts cordova <command> [options] [-- <cordova_options>]

Unless the --fast option is provided, the Angular app is rebuilt before executing the command, using npm run build. Any accepted Cordova option can be passed through after --.

Options

  • --app: The name of the Angular app to build. Only useful if you have a workspace with multiples apps.
  • --fast: Skip Angular app rebuild
  • --base-href <ref>: Change application base URL (default is ./)
  • --copy <path>: Copy built apps to the specified path (only works with cordova build)
  • --dev: Build Angular app in dev mode (default is prod)
  • -c, --configuration <name>: Target Angular CLI configuration for npm run build
  • --device: Deploy Cordova build to a device
  • --emulate: Deploy Cordova build to an emulator
  • --debug: Create a Cordova debug build
  • --release: Create a Cordova release build
  • --verbose: Show Cordova debug output
  • --yarn: Use Yarn instead of NPM to run the build script
  • --parse-json: During env, if an environment variable's value is parsable JSON, it will be a proper object in .env.ts

Note: Yarn is automatically used instead of NPM if the environment variable NGX_PACKAGE_MANAGER is set to yarn or if the current project was generated with ngX-Rocket using Yarn option (option is saved in .yo-rc.json).

Examples

ngx-scripts cordova prepare
ngx-scripts cordova run ios --dev --debug --emulate
ngx-scripts cordova build ios --configuration production --device --release -- --developmentTeam="ABCD" --provisioningProfile="UUID"

Clean Cordova (platforms, plugins) and dist folders

clean [--cordova] [--dist] [--path <path>]

Options

  • --cordova: Remove only Cordova folders
  • --dist: Remove only dist folder
  • --path <path>: Remove only specified path

License

MIT

scripts's People

Contributors

bursauxa avatar captaincaius avatar cnuss avatar dependabot[bot] avatar faisalafroz avatar semantic-release-bot avatar sinedied avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

scripts's Issues

env should allow undefined environment variables and pass them along as falsy

motivation: without this, anything you want to do with env can't have sensible defaults in the environment-specific files...

take for example you want to do something like this in one of your environment files:

export const environment = {
...
CORDOVA_ENABLE: env.CORDOVA_ENABLE || false,
...
}

the build will fail if you don't set CORDOVA_ENABLE in your environment b/c JSON.stringify gets rid of keys with undefined values.

Failed to exec env script

Environment
ngX-Rocket: 8.1.1
Node.js: v10.22.0
Npm: 6.14.6
OS: win32 x64 10.0.18363

Error stack trace
verbose npm v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] env: ngx-scripts env npm_package_version
22 error Exit status 1
23 error Failed at the [email protected] env script.
23 error This is probably not a problem with npm. There is likely additional logging output above.

Note : I use nvm - 1.1.7 to manage node installations

I can't get it to build with --env=dev

I apologize for being a squeaky wheel but I have run the following commands and I can't get the angular side of my app to build in development environment. It's always prod config.

npm run cordova:build -- --env=dev --device --debug
npm run cordova build --device --debug -- --env=dev
npm run cordova build --device --debug --env=dev

In several of the version of the above, I saw something complaining that
Unknown option: '--env'

What am I doing wrong?

env script shouldn't use default export apparently

So this took me two days of scratching my head to find the root cause of this, but for some reason it seems the aot compiler silently chokes when using default exports - but only sometimes :'(.

https://github.com/captaincaius/rocketdefaultexporttestcase/pull/1/files#diff-5c26d2c8f8838f32ace87fdecd6344eaL26

It's really annoying cause if you look at the test case, the problem only shows up in certain unpredictable scenarios.

Anyway, it's a one-liner, but it would break existing projects :-/ ...

"npm run env -s" doesn't create .env file

Today i create new project through ngx-rocket cli, and when i print npm start in console, i'v got error

Module not found: Error: Can't resolve './.env' in '/home/mef45/devel/gitlab/taxsee-monitoring-frontend/src/environments'

    ERROR in src/environments/environment.ts:11:21 - error TS2307: Cannot find
module './.env' or its corresponding type declarations.

    11 import { env } from './.env';

If i rename env script to something else, eg: "dotenv": "ngx-scripts env ...", all works as expected

npm run env output is really weird

"npm run env" output
> [email protected] env
> env

USER=mef45
npm_config_user_agent=npm/7.0.15 node/v15.0.1 linux x64
XDG_SEAT=seat0
SSH_AGENT_PID=1773
XDG_SESSION_TYPE=x11
LF_ICONS=tw=๏“:st=๏“:ow=๏“:dt=๏“:di=๏“:fi=๏Ž:ln=๏’:or=๏’:ex=๏ง:*.c=๎˜ž:*.cc=๎˜:*.clj=๎จ:*.coffee=๎‘:*.cpp=๎˜:*.css=๎˜”:*.d=๎žฏ:*.dart=๎ž˜:*.erl=๎žฑ:*.exs=๎˜ญ:*.fs=๎žง:*.go=๎˜ง:*.h=๎˜ž:*.hh=๎˜:*.hpp=๎˜:*.hs=๎ท:*.html=๎˜Ž:*.java=๎œธ:*.jl=๎˜ค:*.js=๎Ž:*.json=๎˜‹:*.lua=๎˜ :*.md=๎˜‰:*.php=๎˜ˆ:*.pl=๎ฉ:*.pro=๎žก:*.py=๎œผ:*.rb=๎œน:*.rs=๎žจ:*.scala=๎œท:*.ts=๎˜จ:*.vim=๎˜ซ:*.cmd=๏:*.ps1=๏:*.sh=๏:*.bash=๏:*.zsh=๏:*.fish=๏:*.tar=๏:*.tgz=๏:*.arc=๏:*.arj=๏:*.taz=๏:*.lha=๏:*.lz4=๏:*.lzh=๏:*.lzma=๏:*.tlz=๏:*.txz=๏:*.tzo=๏:*.t7z=๏:*.zip=๏:*.z=๏:*.dz=๏:*.gz=๏:*.lrz=๏:*.lz=๏:*.lzo=๏:*.xz=๏:*.zst=๏:*.tzst=๏:*.bz2=๏:*.bz=๏:*.tbz=๏:*.tbz2=๏:*.tz=๏:*.deb=๏:*.rpm=๏:*.jar=๏:*.war=๏:*.ear=๏:*.sar=๏:*.rar=๏:*.alz=๏:*.ace=๏:*.zoo=๏:*.cpio=๏:*.7z=๏:*.rz=๏:*.cab=๏:*.wim=๏:*.swm=๏:*.dwm=๏:*.esd=๏:*.jpg=๏:*.jpeg=๏:*.mjpg=๏:*.mjpeg=๏:*.gif=๏:*.bmp=๏:*.pbm=๏:*.pgm=๏:*.ppm=๏:*.tga=๏:*.xbm=๏:*.xpm=๏:*.tif=๏:*.tiff=๏:*.png=๏:*.svg=๏:*.svgz=๏:*.mng=๏:*.pcx=๏:*.mov=๏:*.mpg=๏:*.mpeg=๏:*.m2v=๏:*.mkv=๏:*.webm=๏:*.ogm=๏:*.mp4=๏:*.m4v=๏:*.mp4v=๏:*.vob=๏:*.qt=๏:*.nuv=๏:*.wmv=๏:*.asf=๏:*.rm=๏:*.rmvb=๏:*.flc=๏:*.avi=๏:*.fli=๏:*.flv=๏:*.gl=๏:*.dl=๏:*.xcf=๏:*.xwd=๏:*.yuv=๏:*.cgm=๏:*.emf=๏:*.ogv=๏:*.ogx=๏:*.aac=๏:*.au=๏:*.flac=๏:*.m4a=๏:*.mid=๏:*.midi=๏:*.mka=๏:*.mp3=๏:*.mpc=๏:*.ogg=๏:*.ra=๏:*.wav=๏:*.oga=๏:*.opus=๏:*.spx=๏:*.xspf=๏:*.pdf=๏‘:*.nix=๏Œ“:
FILE=lf
npm_node_execpath=/home/mef45/.nvm/versions/node/v15.0.1/bin/node
SHLVL=0
BROWSER=google-chrome-stable
HOME=/home/mef45
OLDPWD=/home/mef45/devel/gitlab
DESKTOP_SESSION=i3
NVM_BIN=/home/mef45/.nvm/versions/node/v15.0.1/bin
npm_package_json=/home/mef45/devel/gitlab/taxsee-monitoring-frontend/package.json
NVM_INC=/home/mef45/.nvm/versions/node/v15.0.1/include/node
GTK_MODULES=gail:atk-bridge
npm_config_userconfig=/home/mef45/.npmrc
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
COLOR=0
NVM_DIR=/home/mef45/.nvm
npm_config_metrics_registry=https://registry.npmjs.org/
ASPNETCORE_ENVIRONMENT=Development
LOGNAME=mef45
WINDOWID=46137348
_=/home/mef45/.nvm/versions/node/v15.0.1/bin/npm
npm_config_prefix=/home/mef45/.nvm/versions/node/v15.0.1
XDG_SESSION_CLASS=user
USERNAME=mef45
TERM=st-256color
XDG_SESSION_ID=2
npm_config_cache=/home/mef45/.npm
WINDOWPATH=2
npm_config_node_gyp=/home/mef45/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
PATH=/home/mef45/devel/gitlab/taxsee-monitoring-frontend/node_modules/.bin:/home/mef45/devel/gitlab/node_modules/.bin:/home/mef45/devel/node_modules/.bin:/home/mef45/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/home/mef45/.nvm/versions/node/v15.0.1/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/mef45/.nvm/versions/node/v15.0.1/bin:/home/mef45/spicetify-cli:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin:/home/mef45/.dotnet/tools:/home/mef45/bin/:/home/mef45/.local/bin/i3cmds:/home/mef45/.local/bin/:/usr/local/go/bin:/home/mef45/.local/share/go/bin
GDM_LANG=en_US.UTF-8
npm_package_name=taxsee-monitoring-frontend
XDG_RUNTIME_DIR=/run/user/1000
DISPLAY=:1
LANG=en_US.UTF-8
XDG_CURRENT_DESKTOP=i3
XDG_SESSION_DESKTOP=i3
XAUTHORITY=/run/user/1000/gdm/Xauthority
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
npm_lifecycle_script=env
SSH_AUTH_SOCK=/tmp/ssh-RSG7EO0V9hjP/agent.1618
PREFIX=/home/mef45/.nvm/versions/node/v15.0.1
SHELL=/bin/bash
GOPATH=/home/mef45/.local/share/go
npm_package_version=1.0.0
npm_lifecycle_event=env
QT_ACCESSIBILITY=1
GDMSESSION=i3
npm_config_host_prod=https://mef45.myjetbrains.com/youtrack
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
DEFAULT_NETWORK=enp3s0
XDG_VTNR=2
npm_config_init_module=/home/mef45/.npm-init.js
npm_config_globalconfig=/home/mef45/.nvm/versions/node/v15.0.1/etc/npmrc
GPG_TTY=not
PWD=/home/mef45/devel/gitlab/taxsee-monitoring-frontend
SPICETIFY_INSTALL=/home/mef45/spicetify-cli
npm_execpath=/home/mef45/.nvm/versions/node/v15.0.1/lib/node_modules/npm/bin/npm-cli.js
NVM_CD_FLAGS=
XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
npm_command=run-script
I3SOCK=/run/user/1000/i3/ipc-socket.1618
TERMINAL=st
EDITOR=vi
ngx debug info
ngX-Rocket: 9.1.0
Node.js: v15.0.1
Npm: 7.0.15
OS: linux x64 4.19.0-12-amd64

Generated project options:
{
  "generator-ngx-rocket": {
    "version": "9.1.0",
    "props": {
      "location": "path",
      "strict": false,
      "skipInstall": false,
      "skipQuickstart": false,
      "initGit": true,
      "usePrefix": true,
      "appName": "taxsee monitoring frontend",
      "target": [
        "web"
      ],
      "pwa": true,
      "ui": "material",
      "layout": "side-menu",
      "auth": true,
      "lazy": true,
      "angulartics": true,
      "languages": [
        "en-US",
        "fr-FR"
      ],
      "analyticsProvider": "ga",
      "googleAnalyticsAccount": "UA-1234567-1",
      "tools": [
        "prettier",
        "hads",
        "compodoc",
        "jest",
        "puppeteer"
      ],
      "utility": [
        "lodash",
        "datefns"
      ],
      "deploy": "none",
      "projectName": "taxsee-monitoring-frontend",
      "packageManager": "npm",
      "mobile": [],
      "desktop": []
    }
  }
}

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / โ–ณ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 10.1.7
Node: 15.0.1
OS: linux x64

Angular: 10.2.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1002.0
@angular-devkit/build-angular   0.1001.7
@angular-devkit/core            10.2.0
@angular-devkit/schematics      10.1.7
@angular/cdk                    10.2.7
@angular/cli                    10.1.7
@angular/flex-layout            10.0.0-beta.32
@angular/material               10.2.7
@schematics/angular             10.1.7
@schematics/update              0.1001.7
rxjs                            6.6.3
typescript                      4.0.5

Can't Include --target="iPad Air 2" (or similar)

Unless I don't understand how to do it (a possibility), I can't quite figure out how, if I can at all, include the --target="" in the cordova command. This would allow me to emulate, for example, an iPad rather than always the iPhone X which is the default.

Am I just missing how to do this?

output from env script not compiling with Angular 8.2.1

ERROR in environments/environment.prod.ts:6:8 - error TS1192: Module '".../src/environments/.env"' has no default export.

6 import env from './.env';
         ~~~
environments/environment.ts:6:8 - error TS1192: Module '".../src/environments/.env"' has no default export.

6 import env from './.env';

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.