How to exclude files from bundling in aurelia.json - aurelia

I'd like to prevent src/config.js to be bundled in scripts/app-bundle.js
I saw that previously the syntax was:
"bundles": {
"dist/app-build": {
"includes": [
"[**/*.js]",
"**/*.html!text",
"**/*.css!text",
"cloneya",
"dexie",
"jquery",
"jquery-ui",
"medium-editor-webpack",
"moment",
"polymer/mutationobservers",
"safe-json-stringify"
],
excludes: [
"config.js" // So our wildcard globbing doesn't include this config file
],
...
However the new syntax is different: aurelia.json:
"bundles": [
{
"name": "app-bundle.js",
"source": [
"[**/*.js]",
"**/*.{css,html}"
],
"excludes" : [
"**/config.js"
]
},
My temptative 'exclude' statement doesn't do the trick

Solution is actually given on the GitHub page: https://github.com/aurelia/cli
Optionally, you can define an exclude list by setting the source
property to be an object containing both an include and exclude array
of patterns. This is helpful when you're trying to define multiple
bundles from your source code.
{
"name": "app-bundle.js",
"source": {
"include": [
"[**/*.js]",
"**/*.{css,html}"
],
"exclude": [
"**/sub-module/**/*",
]
}
},
{
"name": "sub-module-bundle.js",
"source": [
"**/sub-module/**/*",
]
}
Make sure you have version > 0.19.0

Related

routes[0].headers is not a object in vercel.json

I have been trying to deploy an a Flask API to vercel and I am getting error that routes[0].header should be an object.
I am a beginner and trying to figure this out, any help is appreciated
my vercel.json is
`
{
"version": 2,
"builds": [
{
"src": "./index.py",
"use": "#vercel/python"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/",
"headers": [
{
"key": "access-control-allow-origin",
"value": "*"
}
]
}
]
}
`
i deployed earlier without headers and it deployed successfully but it was giving me CORS error then i addded the headers and now it is giving me a new error that headers is not a object.
i tried a few different methods but i still can not figure this out
I encountered similar issue and after going through vercel documents https://vercel.com/guides/how-to-enable-cors and few different tries, this worked for me:
The header has to be its own key for specifying access-control-allow-origin and "routes" will need to be replaced with "rewrite" as header and route keys don't go together. And If there are few different domains for your app, you need to duplicate header object within the outer header array for each path for access control origin issue.
Eg:
{
"version": 2,
"builds": [
{
"src": "./index.py",
"use": "#vercel/python"
}
],
"rewrites": [
{ "source": "/(.*)", "destination": "src/app.js" }
],
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "Access-Control-Allow-Origin", "value": "*" }
]
},
{
"source": "/vercel_app_domain_name/(.*)",
"headers": [
{ "key": "Access-Control-Allow-Origin", "value": "*" }
]
}
]
}

Variable name `PieGraphLayout` must match one of the following formats: camelCase eslint#typescript-eslint/naming-convention

This is a question similar to Why eslint consider class as variable in naming-convention rule?, but that one is pretty old and I see no consistency in the handling now.
When I statically import a class type then ESLint recognizes it as such and applies the class naming rule, for example:
import { PieGraphLayout } from import("../console.worker-types");
When I do this with a dynamic import, however, I get an error:
const { PieGraphLayout } = await import("../console.worker-types");
leads to:
Variable name PieGraphLayout must match one of the following formats: camelCase eslint#typescript-eslint/naming-convention
I have to suppress this warning, but would like to modify my ESLint rules instead, if possible. My current naming-convention rule is:
"#typescript-eslint/naming-convention": [
"error",
{
"selector": "default",
"format": [
"camelCase"
],
"filter": {
"regex": "^_",
"match": false
}
},
{
"selector": "class",
"format": [
"PascalCase"
]
},
{
"selector": "typeParameter",
"format": [
"PascalCase"
]
},
{
"selector": "enum",
"format": [
"PascalCase"
]
},
{
"selector": "enumMember",
"format": [
"PascalCase"
]
},
{
"selector": "typeAlias",
"format": [
"PascalCase"
]
},
{
"selector": "interface",
"format": [
"PascalCase"
],
"prefix": [
"I"
]
}
],
What needs to be changed so that ESLint no longer gives a warning for such dynamic imports?
You don't have defined formats for variable entities, and ESLint uses your default selector format, which is camelCase in the provided configuration.
To provide formats for a variable, please configure variable selector.
In your case, there should be something like
{
"selector": "variable",
"format": [
"PascalCase"
]
},
Here is a doc for all available selectors.

Visual Stuiod Code Intellisense not working with React Native alias

My React Native project already has alias of some folder. They are put in babel.config.js file:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
'plugins': [
[
'module-resolver',
{
'root': [
'.',
],
'alias': {
'assets/*': './src/assets/*',
'images': './src/assets/images',
'navigation': './src/navigation',
'navigation/*': './src/navigation/*',
'screens': './src/screens',
'screens/*': './src/screens/*',
'splash': './src/modules/splash',
'utils': './src/utils',
'utils/*': './src/utils/*',
'translations': './src/utils/translations',
'translations/*': './src/utils/translations/*',
'msg': './src/utils/translations/msg',
'languages': './languages',
'styles': './src/styles',
'styles/*': './src/styles/*',
'components': './src/components',
'constant': './src/constant',
'context': './src/context',
'api': './src/API',
'store': './src/store',
'store/*': './src/store/*',
},
},
],
'react-native-reanimated/plugin',
],
'env': {
'production': {
'plugins': [
'transform-remove-console',
],
},
},
};
But when I import a function using these alias, the intellisense does not work. I also try to create jsonconfig.json follow this document (https://code.visualstudio.com/docs/languages/jsconfig)
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"app/*": ["src/app/*"],
"assets/*": ["src/assets/*"],
"images": ["/src/assets/images"],
"navigation": ["/src/navigation"],
"navigation/*": ["/src/navigation/*"],
"screens": ["/src/screens"],
"screens/*": ["/src/screens/*"],
"splash": ["/src/modules/splash"],
"utils": ["/src/utils"],
"utils/*": ["/src/utils/*"],
"translations": ["/src/utils/translations"],
"translations/*": ["/src/utils/translations/*"],
"msg": ["/src/utils/translations/msg"],
"languages": ["/languages"],
"styles": ["/src/styles"],
"styles/*": ["/src/styles/*"],
"components": ["/src/components"],
"constant": ["/src/constant"],
"context": ["/src/context"],
"api": ["/src/API"],
"store": ["/src/store"],
"store/*": ["/src/store/*"],
}
}
}
but still not working. Anyone can help me to fix the intellisense in VS Code?

vs code C++ include list of paths

I am using C++ in vs code and would like to automatically pull in changing external include paths that for clang to find. Currently I have to edit the c_cpp_properties.json file as so:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/some/path/headers1/**",
"/some/path/headers2/**",
"/some/path/headers3/**",
...
"/some/path/headersN/**"
],
...
}
],
}
Can I instead do something like this?
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${workspaceFolder}/headers.txt"
],
...
}
],
}
Where ${workspaceFolder}/headers.txt is:
/some/path/headers1/
/some/path/headers2/
/some/path/headers3/
OR
"/some/path/headers1/**",
"/some/path/headers2/**",
"/some/path/headers3/**"
to be compliant with the original json includePath format. So there a way for me to reference the ${workspaceFolder}/headers.txt in the c_cpp_properties.json so that I don't have to manually update the paths?

can I use variables in packer templates user_data_file

Can I use variables defined in my web-packer.json template to the file in user_data_file.
I am using user_data_file to setup wimrm and add a user to the administrator group. Before installing the webserver.
Some of the web-packer.json template
"builders": [
{
"type": "amazon-ebs",
"vpc_id": "{{user `vpc_id`}}",
"subnet_id": "{{user `subnet_id`}}",
"associate_public_ip_address": true,
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "eu-west-1",
"source_ami": "ami-40003a26",
"instance_type": "c4.xlarge",
"ami_name": "cms-sitecore",
"communicator": "winrm",
"winrm_username": "{{user `winrm_username`}}",
"winrm_timeout": "30m",
"user_data_file": "./bootstrap-aws.ps1"
}
],
"provisioners": [
{
"type": "file",
"source": "./install/",
"destination": "C:/install"
},
{
"type": "powershell",
"inline": [
"Install-WindowsFeature -Name Web-Asp-Net45,Web-Static-Content,Web-Mgmt-Console,Web-Http-Errors,Web-Http-Logging,Web-Stat-Compression"
]
}
]
No you can't. user_data_file is not a template and hence not interpolated. You have to use user_data for that or preprocess your user_data_file outside of Packer.