quasarframework / app-extension-dotenv Goto Github PK
View Code? Open in Web Editor NEWOfficial Quasar App Extension for dotenv
Home Page: https://quasarframework.github.io/app-extension-dotenv
License: MIT License
Official Quasar App Extension for dotenv
Home Page: https://quasarframework.github.io/app-extension-dotenv
License: MIT License
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]+)*}
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?
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?
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?
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.
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):
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:
Expected behavior:
No error no matter the order of installation
Desktop:
After installing the extension, if I do a later npm install
I get the following error:
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?
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
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:
quasar ext add dotenv
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:
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
Hi, I don't have much experience with .env
files outside of my Laravel time 3 years ago (so it's all kinda fuzzy)
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.
Is there any way to extract just the password of this build.json
file into an environment file with this app extension?
Hi, is there a way to make the app reload when one of the .env file has been modified ?
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.
I think it would be helpful to create base files for the user. Since quasar is smart enough not to overwrite files that exist (and prompts the user) creating these files would make the extension "better" and offer a template for those who are new to dotenv
https://forum.quasar-framework.org/topic/3309/v1-a-guide-for-quasar-dotenv
Describe the bug
Boolean variables from .env
are parsed to strings.
To Reproduce
Steps to reproduce the behavior:
.env
file with sole content DEV=true
process.env
anywhereDEV
is a string instead of a boolean.Expected behavior
Booleans should be parsed correctly.
How do i build a copy with .env.staging
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.
I have common_root_object set.
But that object is not available in quasar.conf.js
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.