EAS build through dynamic app.config.js configuration and problem with environment variables - expo

I have dynamic configuration for my EAS environment:
eas.json
{
"cli": {
"version": ">= 0.55.1",
"appVersionSource": "local"
},
"build": {
"development": {
"distribution": "internal",
"ios": {
"simulator": true
},
"env": {
"API_URL": "http://localhost/",
"APP_ENV": "development",
}
},
"staging": {
"distribution": "internal",
"env": {
"API_URL": "https://dev.my-url.com/",
"APP_ENV": "staging",
}
},
"production": {
"env": {
"API_URL": "https://my-url.com/",
"APP_ENV": "production",
}
}
},
"submit": {
"production": {
"android": {
"serviceAccountKeyPath": "./keys/pc-api-ccc.json",
"track": "internal"
}
},
"staging": {
"extends": "production"
}
}
}
and accordingly have app.config.js
import "dotenv/config";
export default () => {
console.log("ENV", process.env.API_URL);
return {
//...
extra: {
API_URL: process.env.API_URL,
APP_ENV: process.env.APP_ENV,
DEEP_LINK: process.env.DEEP_LINK,
eas: {
projectId: "2c680410-428f-431d-911f-fb378e45b885",
},
//...
};
For some reason, after running eas build -p ios --profile staging config default function is called 3 times and in last call environment variables are lost:
console.log output:
ENV https://my-url.com/
ENV https://my-url.com/
ENV undefined
Any idea why 3 times? or why I'm loosing env variables on last call?

Related

I can't eas build --platform android Execution failed for task ':app:mergeReleaseResources'

In my expo sdk version 47, when I eas build in root directory it shows Execution failed for task ':app:mergeReleaseResources'.
how will i solve?
my app.json folder is
{
"expo": {
"name": "ebibaaha",
"slug": "ebibaaha",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "myapp",
"userInterfaceStyle": "automatic",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/images/adaptive-icon.png",
"backgroundColor": "#ffffff"
},
"package": "com.ebibaaha.app",
"permissions": [
"CAMERA",
"CAMERA_ROLL"
]
},
"web": {
"favicon": "./assets/images/favicon.png"
},
"extra": {
"eas": {
"projectId": "97cd307d-920a-4056-a550-0770aa4afaef"
}
}
}
}
enter image description here
I tried eas build --platform android to build my expo react native app but it show error.

Angular v12 - Unit Test - [ERROR] No specs found

After developing my Angular application I would like to run unit tests with Karma and Jasmine.
I haven't written any unit-tests yet, but trying to run the default ones, with the 'ng test' command, I notice that the .spec files are not recognized by Karma-Jasmine.
Inside the browser, Karma gives the following message: "Incomplete, no specs found", in the terminal "Executed 0 of 0 SUCCESS".
I tried to generate a new application with the Angular CLI and to run the unit test. And it works.
Within my application, the Karma configuration files have not been touched, they are the same as those of the test application, and I don't understand why the .spec files are not recognized.
angular.json
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"dibfibo": {
"projectType": "application",
"schematics": {
"#schematics/angular:component": {
"style": "scss"
},
"#schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/dibfibo",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "dibfibo:build:production"
},
"development": {
"browserTarget": "dibfibo:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "dibfibo:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
}
}
}
}
},
"defaultProject": "dibfibo"
}
karma.conf.js
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '#angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('#angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/dibfibo'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

Nuxt Fatal Error Error: [VuetifyLoaderPlugin Error] No matching rule for vue-loader found

After running npm run build, I get an error: Error: [VuetifyLoaderPlugin Error] No matching rule for vue-loader found.Make sure there is at least one root-level rule that uses vue-loader and VuetifyLoaderPlugin is applied after VueLoaderPlugin.
package.json
{
"name": "client",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate"
},
"dependencies": {
"#nuxtjs/axios": "^5.13.6",
"core-js": "^3.15.1",
"dotenv": "^10.0.0",
"nuxt": "^2.15.7",
"nuxt-i18n": "^6.27.3",
"nuxt-mail": "^3.0.10",
"vuetify": "^2.5.5"
},
"devDependencies": {
"#fortawesome/fontawesome-free": "^5.15.3",
"#fortawesome/fontawesome-svg-core": "^1.2.35",
"#fortawesome/free-brands-svg-icons": "^5.15.3",
"#fortawesome/free-solid-svg-icons": "^5.15.3",
"#fortawesome/vue-fontawesome": "^2.0.2",
"#mdi/font": "^5.9.55",
"#nuxtjs/fontawesome": "^1.1.2",
"#nuxtjs/vuetify": "^1.12.1",
"eslint-config-prettier": "^8.3.0",
"font-awesome": "^4.7.0",
"material-design-icons-iconfont": "^6.1.0",
"prettier": "^2.3.2"
}
}
Here is my config nuxt.config.js file:
import colors from 'vuetify/es5/util/colors'
import i18n from './config/i18n'
export default {
// Global page headers: https://go.nuxtjs.dev/config-head
head: {
titleTemplate: '%s - client',
title: 'client',
htmlAttrs: {
lang: 'en'
},
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: '' },
{ name: 'format-detection', content: 'telephone=no' }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
},
// Global CSS: https://go.nuxtjs.dev/config-css
css: [
],
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
plugins: [
],
// Auto import components: https://go.nuxtjs.dev/config-components
components: true,
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
buildModules: [
[
'nuxt-i18n',
{
vueI18nLoader: true,
defaultLocale: 'hr',
locales: [
{
code: 'en',
name: 'Eng'
},
{
code: 'hr',
name: 'Hrv'
}
],
vueI18n: i18n
}
],
'#nuxtjs/vuetify',
'#nuxtjs/fontawesome'
],
fontawesome: {
icons: {
solid: true,
brands: true
}
},
// Modules: https://go.nuxtjs.dev/config-modules
modules: [
// https://go.nuxtjs.dev/axios
'#nuxtjs/axios',
'#nuxtjs/vuetify',
'nuxt-i18n',
['nuxt-mail', {
message: {
to: 'mislav0508#hotmail.com',
},
smtp: {
host: "smtp-mail.outlook.com",
port: 587,
secure: false, // true for 465, false for other ports
auth: {
user: "mislav0508#hotmail.com",
pass: process.env.EMAIL_PASS,
},
tls: {
rejectUnauthorized:false
}
},
}],
],
// Axios module configuration: https://go.nuxtjs.dev/config-axios
axios: {},
i18n: {
i18n: {
locales: ['hr', 'en'],
defaultLocale: 'hr',
vueI18n: {
fallbackLocale: 'hr',
messages: {
hr: {
welcome: 'Dobrodošli'
},
en: {
welcome: 'Welcome'
}
}
}
}
},
// Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
vuetify: {
customVariables: ['~/assets/variables.scss'],
theme: {
dark: false,
themes: {
dark: {
primary: colors.blue.darken2,
accent: colors.grey.darken3,
secondary: colors.amber.darken3,
info: colors.teal.lighten1,
warning: colors.amber.base,
error: colors.deepOrange.accent4,
success: colors.green.accent3
}
}
}
},
// Build Configuration: https://go.nuxtjs.dev/config-build
build: {
}
}
I've tried installing vuetify-loader and vue-loader and adding them to the nuxt.config.js file. However after that I get another error:
TypeError: loaderContext.emitError is not a function
Please help.

Running Unit Test with Intern 4

We migrate our intern 3 test to intern 4.
Unfortunately I get following error for my unit tests (functional tests works)
Error: scriptError
No stack or location
Error: Dojo loader error:scriptError
No stack or location
My test:
File located:
build/webapp/app/tests/unit/test.js
define([], function () {
const {registerSuite} = intern.getInterface("object");
let assert = intern.getPlugin("chai").assert;
registerSuite("Test", function () {
return {
beforeEach() {
console.log("test");
},
tests: {
defaults() {
console.log("test3");
console.log("test2");
},
toggle() {
console.log("test4");
console.log("test5");
console.log("test8");
console.log("test9");
}
}
};
});
});
My intern.json (see below)
{
"loader": {
"script": "dojo",
"options": {
"packages": [
{
"name": "app",
"location": "build/webapp/app"
},
{
"name": "dojo",
"location": "lib/dojo"
},
{
"name": "dojox",
"location": "lib/dojox"
},
{
"name": "dijit",
"location": "lib/dijit"
},
{
"name": "dstore",
"location": "lib/dstore"
}
]
}
},
"suites": [
"./build/webapp/app/tests/unit/test.js"
],
"functionalSuites": [
"./build/webapp/app/tests/functional/TestDocumentation.js"
],
"functionalTimeouts": {
"connectTimeout": 60000
},
"defaultTimeout": 180000,
"filterErrorStack": true,
"tunnel": "selenium",
"tunnelOptions": {
"version": "3.8.0",
"drivers": [
{
"name": "ie",
"arch": "Win64",
"version": "3.8.0"
}
]
},
"debug": true,
"environments": [
"node",
{
"browserName": "internet explorer",
"fixSessionCapabilities": "no-detect"
}
]
}
If I execute the unit test in the node envrioment it works fine but after launching to the ie my test failed with the Dojo loader error.
Dojo & intern are aviable in the node_moudles directory.
Best Regards
Kai
Add the lines below to the json file solved my problem
{
"name": "tests",
"location": "build/webapp/app/tests/"
}

deploying webpack + vuejs + django to Heroku, procfile configurations

I'm trying to deploy my VueJS Django app to Heroku but running into issues with running webpack on Heroku. I'm able to collect the static files but it doesn't seem like webpack is running (webpack not found) so the website isn't running webpack, which means not only will VueJs files not be transpiled to ES5, but my index.html page will not even call the bundled up code that webpack outputs. Any ideas why this is happening and how to fix it?
On somewhat related notes: I'm using Gunicorn as web server and whitenoise to serve my static files.
Also, once I am able to run webpack, how do I get ride of this error in the console even though I have put es2015 preset in my .babelrc
vendor.js:1 Uncaught SyntaxError: Unexpected token import
import Vue from 'vue'
import ElementUI from 'element-ui'
Here's what I have (mostly everything is based off of VueJS Element starter kit)
Package.json:
{
"name": "element-starter",
"description": "A Vue.js project",
"author": "yi.shyang#ele.me",
"private": true,
"scripts": {
"dev": "webpack-dev-server -d --inline --hot --env.dev",
"heroku-postbuild": "rimraf static && webpack -p --config ./webpack.config.js --progress"
},
"dependencies": {
"element-ui": "^1.1.2",
"vue": "^2.1.8"
},
"engines": {
"node": ">=6"
},
"devDependencies": {
"autoprefixer": "^6.6.0",
"babel-core": "^6.21.0",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.4.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.24.1",
"babel-preset-es2015": "^6.13.2",
"css-loader": "^0.27.0",
"eslint": "^3.12.2",
"eslint-config-enough": "^0.2.2",
"eslint-loader": "^1.6.3",
"file-loader": "^0.10.1",
"html-loader": "^0.4.5",
"html-webpack-plugin": "^2.24.1",
"postcss-loader": "^1.3.3",
"rimraf": "^2.5.4",
"style-loader": "^0.13.2",
"url-loader": "^0.5.8",
"vue-loader": "^11.1.4",
"vue-template-compiler": "^2.1.8",
"webpack": "^2.4.1",
"webpack-dev-server": "^2.4.2"
}
}
Procfile:
web: ./manage.py collectstatic --noinput; npm install; npm run heroku-postbuild; gunicorn dashboard.wsgi --log-file -
.babelrc:
{
"presets": [
["es2015", { "modules": false }]
]
}
webpack.config.js
const {
resolve
} = require('path')
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const url = require('url')
// where the static files will be accessed from publicly
const publicPath = '/static/'
module.exports = (options = {}) => ({
entry: {
vendor: './src/vendor',
index: './src/main.js'
},
output: {
path: resolve(__dirname, 'static'),
filename: options.dev ? '[name].js' : '[name].js?[chunkhash]',
chunkFilename: '[id].js?[chunkhash]',
publicPath: options.dev ? '/assets/' : publicPath
},
module: {
rules: [{
test: /\.vue$/,
use: ['vue-loader']
},
{
test: /\.js$/,
use: ['babel-loader'],
include: [resolve(__dirname, 'src'), resolve(__dirname, 'static')],
exclude: /node_modules/
},
{
test: /\.html$/,
use: [{
loader: 'html-loader',
options: {
root: resolve(__dirname, 'src'),
attrs: ['img:src', 'link:href']
}
}]
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader', 'postcss-loader']
},
{
test: /favicon\.png$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}]
},
{
test: /\.(png|jpg|jpeg|gif|eot|ttf|woff|woff2|svg|svgz)(\?.+)?$/,
exclude: /favicon\.png$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000
}
}]
}
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
names: ['vendor', 'manifest']
}),
new HtmlWebpackPlugin({
template: 'src/index.html',
chunksSortMode: 'dependency'
})
// options:dev ? '' : new webpack.DefinePlugin({
// 'process.env': {
// NODE_ENV: '"production"'
// }
// }),
// options:dev ? '' : new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: false
// }
// })
],
resolve: {
alias: {
'~': resolve(__dirname, 'src')
}
},
devServer: {
host: '127.0.0.1',
port: 8010,
proxy: {
'/api/': {
target: 'http://127.0.0.1:8080',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
},
historyApiFallback: {
index: url.parse(options.dev ? '/assets/' : publicPath).pathname
}
},
devtool: options.dev ? '#eval-source-map' : '#source-map'
})