Giter VIP home page Giter VIP logo

app-extension-dotenv's People

Contributors

bartduisters avatar cinderisles avatar dalezak avatar dependabot-preview[bot] avatar hawkeye64 avatar lucasfernog avatar mstaack avatar rstoenescu avatar stefanneuser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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

app-extension-dotenv's Issues

Add support for variable replacement ${FOO_BAR}

Is your feature request related to a problem? Please describe.
I'm combining Laravel and Quasar in the same project, and since APP_URL already exists in process.env.APP_URL, it would be nice to be able to do API_URL="${APP_URL}" when including Laravel's env file, to reuse the same variable.

Describe the solution you'd like
When looping through the parsed variables, check and replace pattern in the values.

Describe alternatives you've considered
Duplicating the value.

Additional context
Regex to match the variable pattern: \${[A-Z]+(_?[A-Z]+)*}

Variables from .env file are not available in quasar.conf.js

I have successfully installed @quasar/dotenv app Extension to my Quasar, create .env file with simple string:

APP_PORT=12345

And type in my quasar.conf.js:

    devServer: {
      port: process.env.APP_PORT,
    },

But it stay empty. My quasar.extensions.json is:

{
  "@quasar/dotenv": {
    "env_development": ".env",
    "env_production": ".env",
    "common_root_object": "none",
    "create_env_files": true,
    "add_env_to_gitignore": true
  }
}

and when starting Quasar I see

 app:extension Running "@quasar/dotenv" Quasar App Extension... +0ms
 app:quasar-conf Reading quasar.conf.js +11ms

Please descripbe where can be the problem and why the APP_PORT env variable is not filled?

Allow adding custom environments

I'm using a different configuration for local/dev/prod environments but I can manage only 2 configurations with the extension.

Can you allow using different environments other than prod/dev?

Support for CI enviroments

Hi guys, great work with the extension I have been using it for a project recently and works great, there is one thing I'm not getting, and it's CI and CD support. On environments like netlify you don't have a .env file but are able to set environment variables to be used on the build process.

When building on a CI environment since there is no .env file and it's not practical (or secure) to pick all process.env variables available the env variables set using Netlify console (or other providers) are lost and not available after build.

I had built an extension for quasar pre v1.0 which addressed this issue using a .env.example file as a key dictionary to look for system env values at build time and include them on the process. https://github.com/CarbonoDev/quasar-dotenv

Could we do something similar here? Or is there a way to support this that I'm missing?

Wrong installation instruction

For a legitimate bug, in order to process faster, please go here https://codesandbox.io/s/qcalendar-bx1y7, fork the codesandbox, add code to reproduce the bug and submit link here:

Describe the bug
On the npm page it says:
Install
quasar ext add dotenv
But if you run this, npm won't find this package:
error An unexpected error occurred: "https://registry.npmjs.org/quasar-app-extension-dotenv: Not found".

After reading quasar app extension introduction https://quasar.dev/app-extensions/introduction, I realized it has to be:
quasar ext add @quasar/dotenv

You may want to change this confusing instruction on the npm page, or fix quasar cli so npm can recognize the correct name of this extension.

Existing environment variables are not taken into account

For a legitimate bug, in order to process faster, please go here https://codesandbox.io/s/qcalendar-bx1y7, fork the codesandbox, add code to reproduce the bug and submit link here:

Describe the bug
If one set an environment variable instead of putting it in the .env file, the extension doesn't read it unlike the original dotenv package.

To Reproduce
Create a quasar app with console.log(process.env.MyData) somewhere in the code.
In bash do:

export MyData="something"
quasar dev

In the navigator console nothing is output or the value defined in .env file.

Expected behavior
The environment variable should have the priority so we should have "something" in the console.

Desktop (please complete the following information):

  • OS: Windows
  • Browser chrome
  • Version any

Compatibilty issue with @quasar/apollo

Describe the bug
Hello, I didn't know where to report so I guess I will do it on both repository.
@quasar/apollo extension has trouble using @quasar/dotenv variables when in quasar.extensions.json,
dotenv is configured before apollo. It adds some quotation marks around the variable causing issues on the GRAPHQL_URI.

changing the order fixes the problem but still very ennoying issue and difficult to debug.

Steps to reproduce the behavior:

  1. Start new quasar project
  2. Install @quasar/dotenv extension
  3. Install @quasar/apollo extension
  4. Set GRAPHQL_URI environment variable to a graphql URI
  5. Make a graphql request on a page in the application
  6. build the app and see the error in the network and console tab of the developper tools

Expected behavior:
No error no matter the order of installation

Desktop:

  • OS:Ubuntu 18.04
  • Browser chromium Version 85.0.4183.121 (Official Build) snap (64-bit)
  • Quasar v1.14.2, @quasar/quasar-app-extension-apollo v1.0.0-beta.6, @quasar/quasar-app-extension-dotenv v1.0.5

.git directory in node_modules

After installing the extension, if I do a later npm install I get the following error:

2019-03-25 at 3 41 PM

When I navigate to node_modules/@quasar/quasar-app-extension-dotenv/ and do a ls -a I see that there's a .git directory there.

When I delete this .git directory, I can now do npm install.

Wondering if the .git directory should be added to the .npmignore file?

QENV bug or missunderstood

Hi @hawkeye64 , thank you for merging my last PR. I have a question and maybe it's a bug. I have the following npm scripts:

    "dev": "QENV=development quasar dev",
    "dev-build": "QENV=development quasar build",
    "prod": "QENV=production quasar build",

when i run yarn dev-build i want to build the app in dist/spa with the .env.dev settings but it just load the .env. The QENV is not present. I also can't find some QENV usages in the source-code.

Here are my extension settings:

  "@quasar/dotenv": {
    "env_development": ".env.dev",
    "env_production": ".env"
  }

Maybe you can give you hint :-)

Best regards from Germany,

Stefan

Does not install

I'm very new to Quasar so it is possible I'm missing something.

Describe the bug
I've followed the instructions but the installation breaks

To Reproduce
Steps to reproduce the behavior:

  1. From terminal, run
    quasar ext add dotenv
  2. I get:
app:spawn [sync] Running "npm install --save-dev quasar-app-extension-dotenv" +0ms
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/quasar-app-extension-dotenv - Not found

In fact https://registry.npmjs.org/quasar-app-extension-dotenv returns 404

Desktop:

  • OS: Debian buster
  • Quasar info output:
Operating System - Linux(4.19.15-1) - linux/x64
NodeJs - 12.14.0

Global packages
  NPM - 6.13.4
  yarn - 1.21.1
  @quasar/cli - 1.0.3
  cordova - Not installed

Important local packages
  quasar - 1.5.9 -- Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time
  @quasar/app - 1.4.3 -- Quasar Framework local CLI
  @quasar/extras - 1.3.3 -- Quasar Framework fonts, icons and animations
  vue - 2.6.11 -- Reactive, component-oriented view layer for modern web interfaces.
  vue-router - 3.1.3 -- Official router for Vue.js 2
  vuex - 3.1.2 -- state management for Vue.js
  electron - Not installed
  electron-packager - Not installed
  electron-builder - Not installed
  @capacitor/core - Not installed
  @capacitor/cli - Not installed
  @capacitor/android - Not installed
  @capacitor/ios - Not installed
  @babel/core - 7.7.7 -- Babel compiler core.
  webpack - 4.41.3 -- Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.
  webpack-dev-server - 3.9.0 -- Serves a webpack app. Updates the browser on changes.
  workbox-webpack-plugin - 4.3.1 -- A plugin for your Webpack build process, helping you generate a manifest of local files that workbox-sw should precache.
  register-service-worker - 1.6.2 -- Script for registering service worker, with hooks

Quasar App Extensions
  *None installed*

Networking
<cut>

Work around
I managed to install the extension in this way:

npm i --save-dev @quasar/quasar-app-extension-dotenv
quasar ext invoke @quasar/dotenv

I see the ext listed as installed:

> quasar ext
 app:extension-manager Listing installed App Extensions +0ms

Extension name: @quasar/dotenv
Extension prompts: {
  "env_development": ".env.development",
  "env_production": ".env",
  "common_root_object": "TEST",
  "create_env_files": true,
  "add_env_to_gitignore": true
}

and process.env.TEST does contain the variables present in .env as expected.
However I can not uninstall it:

> quasar ext remove dotenv
 app:extension Uninstalling "dotenv" Quasar App Extension +0ms

 app:extension ⚠️  Quasar App Extension "quasar-app-extension-dotenv" is not installed... +1ms

Can I use this for src-cordova/build.json?

Hi, I don't have much experience with .env files outside of my Laravel time 3 years ago (so it's all kinda fuzzy)

My setup

With Cordova to publish Android apps, they need to be signed with a private key from a local keystore.
In the Quasar documentation, the method explained here is kind of elaborate and can be solved waaaay easier by just adding your local keystore information inside a src-cordova/build.json file.

This is also explained in the Cordova documentation and a build file would look like this:

{
    "android": {
        "debug": {
            "keystore": "../android.keystore",
            "storePassword": "android",
            "alias": "mykey1",
            "password" : "password",
            "keystoreType": ""
        },
        "release": {
            "keystore": "../android.keystore",
            "storePassword": "",
            "alias": "mykey2",
            "password" : "password",
            "keystoreType": ""
        }
    }
}

I've been successfully signing all my Quasar cordova android apps with such a build.json file and just the regular Quasar CLI build command for cordova.

However, I've had to .gitignore this build.json file because it has a password.

My question

Is there any way to extract just the password of this build.json file into an environment file with this app extension?

Rebuild Quasar when .env changes

Is your feature request related to a problem? Please describe.
Whenever you change the .env file, you have to restart quasar dev before the changes take effect.

Describe the solution you'd like
Is it possible to have this package instruct Quasar to reload the .env file and rebuild if it changes?

Describe alternatives you've considered
I honestly don't know if there're any other approaches, but I do know that Nuxt is able to detect changes to .env and force rebuild.

Trying to override DEV=true results in string instead of boolean

Describe the bug
Boolean variables from .env are parsed to strings.

To Reproduce
Steps to reproduce the behavior:

  1. Install extension
  2. Create an .env file with sole content DEV=true
  3. Log content of process.env anywhere
  4. See that DEV is a string instead of a boolean.

Expected behavior
Booleans should be parsed correctly.

Screenshots
quasar-env-dev

Append to .gitignore

We need to definitely add .env files of all types to gitignore, because otherwise we are exposing people (like me) who accidentally forget to add the .env to their gitignore.

Not working?

Hi,

I do not see the variables in process.env.

Also, I opened the demo and there is no TEST property in the object.

Screenshot from 2019-05-08 00-02-30

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.