i have react library created inside nx mono repo using this version
nx: 15.6.3
i've added inside the packages/my-library command to run multiple commands
generate react component
generate react-stories
using these plugins #nrwl/react:component - #nrwl/react:component-story
this is the target
"generate-atom": {
"executor": "nx:run-commands",
"options": {
"commands": [
{
"command": "nx g #nrwl/react:component --project=core --style=#emotion/styled --export --directory=atoms/{args.group} --name={args.name}",
"forwardAllArgs": true,
"bgColor": "bgBlue"
},
{
"command": "nx g #nrwl/react:component-story --project=core --componentPath=atoms/{args.group || 'common'}/{args.name}/{args.name}.tsx",
"forwardAllArgs": true
}
],
"cwd": "packages/core",
"parallel": false
}
},
the components is been created inside when i call this target from nx
packages/core/src/atoms/undefined/button
this is the command i'm using
npx nx run core:generate-atom --args="--name=button"
any idea how can we default the value of group if was not passed?
Related
I have some packer code to generate a VHD from an Azure Marketplace image. The result produces a OSDiskUriReadOnlySas that I can't see in the manifest.
Packer Output:
OSType: Windows
StorageAccountLocation: australiaeast
OSDiskUri: https://<storage_account>.blob.core.windows.net/<container>/Microsoft.Compute/Images/<folder>/windows_server2019-osDisk.25d65d12-f827-45af-a37e-6b361ea2d380.vhd
OSDiskUriReadOnlySas: https://<storage_account>.blob.core.windows.net/<container>/Microsoft.Compute/Images/<folder>/windows_server2019-osDisk.25d65d12-f827-45af-a37e-6b361ea2d380.vhd?se=2022-10-26T21%3A12%3fghfghrtyh45%$45y7DBrTtDNmVIB5YZ7SUESheShmTGGYfAWm9c%3D&sp=r&sr=b&sv=2018-03-28
TemplateUri: https://<storage_account>.blob.core.windows.net/<container>/Microsoft.Compute/Images/<folder>/windows_server2019-vmTemplate.25d65d12-f827-45af-a37e-6b361ea2d380.json
TemplateUriReadOnlySas: https://<storage_account>.blob.core.windows.net/<container>/Microsoft.Compute/Images/<folder>/windows_server2019-vmTemplate.25d65d12-f827-45af-a37e-6b361ea2d380.json?se=2022-10-26T21%3A12%3A00Z&sig=z7WEFGEGE#FW#QWWHiFYJS0lqsGIM%3D&sp=r&sr=b&sv=2018-03-28
And I have some code to output the manifest:
post-processor "manifest" {
output = "server2019_manifest_${uuidv4()}.json"
strip_path = true
}
The manifest is missing OSDiskUriReadOnlySas:
"builds": [
{
"name": "server_2019_vhd",
"builder_type": "azure-arm",
"build_time": 1664226720,
"files": null,
"artifact_id": "https://<storage_account>.blob.core.windows.net/<container>/Microsoft.Compute/Images/<folder>/windows_server2019-osDisk.25d65d12-f827-45af-a37e-6b361ea2d380.vhd",
"packer_run_uuid": "20d6c483-e9eb-493b-b729-e9a4987916f4",
"custom_data": null
}
],
"last_run_uuid": "20d6c483-e9eb-493b-b729-e9a4987913f4"
}
]
How can I get OSDiskUriReadOnlySas in the manifest?
There is some similiarity between my question and How to measure common coverage for Polymer components + .js files?. Nevertheless, it is accepted as answer "split to .js files and include it to components" in order to use wct-istanbul and all my web components and tests are in .html files (the javascript is inside of each .html file).
My straight question is: can I still use wct-istambul to check how much from my code is covered by tests? If so, what is wrong in configuration described bellow? If not, is wct-istanbub planned to replace wct-istanbul for polymer projects?
package.json
"polyserve": "^0.18.0",
"web-component-tester": "^6.0.0",
"web-component-tester-istanbul": "^0.10.0",
...
wct.conf.js
var path = require('path');
var ret = {
'suites': ['test'],
'webserver': {
'pathMappings': []
},
'plugins': {
'local': {
'browsers': ['chrome']
},
'sauce': {
'disabled': true
},
"istanbul": {
"dir": "./coverage",
"reporters": ["text-summary", "lcov"],
"include": [
"/*.html"
],
"exclude": [
],
thresholds: {
global: {
statements: 100
}
}
}
}
};
var mapping = {};
var rootPath = (__dirname).split(path.sep).slice(-1)[0];
mapping['/components/' + rootPath + '/bower_components'] = 'bower_components';
ret.webserver.pathMappings.push(mapping);
module.exports = ret;
Well, I tried WCT-istanbub (https://github.com/Bubbit/wct-istanbub) which seams to be a temporary workaround (Code coverage of Polymer Application with WCT), it works.
wct.conf.js
"istanbub": {
"dir": "./coverage",
"reporters": ["text-summary", "lcov"],
"include": [
"**/*.html"
],
"exclude": [
"**/test/**",
"*/*.js"
],
thresholds: {
global: {
statements: 100
}
}
}
...
and the result is
...
chrome 66 RESPONSE quit()
chrome 66 BrowserRunner complete
Test run ended with great success
chrome 66 (2/0/0)
=============================== Coverage summary ===============================
Statements : 21.18% ( 2011/9495 )
Branches : 15.15% ( 933/6160 )
Functions : 18.08% ( 367/2030 )
Lines : 21.14% ( 2001/9464 )
================================================================================
Coverage for statements (21.18%) does not meet configured threshold (100%)
Error: Coverage failed
I'm currently trying to set the debugging startup arguments for a CMake based project in Visual Studio Community 2017. Normally this would be done via the launch.vs.json file. However, the arguments that I need to pass contain spaces in them. For example, the below launch.vs.json file should pass the arguemnts FIRST ARGUMENT and SECOND ARGUMENT as the first and second argument. However, the program ends up getting 4 arguments: FIRST, ARGUMENT, SECOND, and ARGUMENT. I've tried various different encodings for spaces, but cannot get a space to be encoded properly in the resulting arguments. This is especially problematic as one of the arguments to my program is a path inside C:\Program Files. As such, the path is broken into 2 separate arguments, rather than one as it should be. How do I make Visual Studio allow spaces within an argument?
For reference, launching via the command line with this command works as expected:
argtest.exe "FIRST ARGUMENT" "SECOND ARGUMENT"
launch.vs.json
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "argtest.exe",
"name": "argtest.exe",
"args": ["FIRST ARGUMENT", "SECOND ARGUMENT"]
}
]
}
test.c
#include <stdio.h>
int main(int argc, char ** argv) {
int i;
for (i = 0; i < argc; i++)
printf("%d = %s\n", i, argv[i]);
return 0;
}
CMakeLists.txt
cmake_minimum_required (VERSION 2.8.8)
project (argtest)
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/ )
add_executable(argtest test.c)
You need to include the quotes in the args strings and escape them. For example:
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "argtest.exe",
"name": "argtest.exe",
"args": ["\"FIRST ARGUMENT\"", "\"SECOND ARGUMENT\""]
}
]
}
It is easier doing this through Visual Studio itself. To run a program with command-line arguments follow these steps:
Open the project in Visual Studio
Click on the 'Debug' tab in the menu bar.
Click on the '[NAME OF PROJECT] Properties' menu item.
A window will popup and should automatically go into the Debug menu within that window. Under the 'Start options' section enter your command-line arguments with a space between each argument.
Hope this helps.
OK I just ran into an issue. I am using Auth0 to create users with different rights (not scopes just rights) in the App Metadata. When I decode the Token I get this json:
{
"iss": "https://testing.auth0.com/",
"sub": "auth0|58e7bae154941844b507eaf5",
"aud": "OSBkLd832tIhpDe0QFJbQ9vutgB2s6cJ",
"exp": 1497016797,
"iat": 1496980797,
"https://thetestgroup.com/app_metadata": {
"is_admin": true
}
}
As you can see the app metadata is in the element "https://thetestgroup.com/app_metadata". Normally I would just do something like this in my code (auth.payload.iat) to get the iat but for the app_metadata it rejects it because of the :. Is there a good way to get at that data?
ok lets talk javascript (node) and your json
Firefox Scratchpad (Shift-F4)
var x = {
"iss": "https://testing.auth0.com/",
"sub": "auth0|58e7bae154941844b507eaf5",
"aud": "OSBkLd832tIhpDe0QFJbQ9vutgB2s6cJ",
"exp": 1497016797,
"iat": 1496980797,
"https://thetestgroup.com/app_metadata": {
"is_admin": true
}
}
x['https://thetestgroup.com/app_metadata'].is_admin // hit run
/*
true
*/
node.js
~ $ node -v
v8.1.0
~ $ node
> var x = {
... "iss": "https://testing.auth0.com/",
... "sub": "auth0|58e7bae154941844b507eaf5",
... "aud": "OSBkLd832tIhpDe0QFJbQ9vutgB2s6cJ",
... "exp": 1497016797,
... "iat": 1496980797,
... "https://thetestgroup.com/app_metadata": {
..... "is_admin": true
..... }
... }
undefined
> x['https://thetestgroup.com/app_metadata'].is_admin
true
>
Please provide a mcve since pure JS and JSON are quite happily using the (strange) key - as demonstrated.
I am working on Sensu. I have installed sensu in CentOS. I need to get the event messages which is generated by Sensu checks.I have added some of the sensu community plugins like check-procs.rb,check-load.rb,check-banner.rb, metrics-ebs-volume.rb etc. I have written some handler files to event handle these .rb files. I am getting events in sensu-server.log.
Example:
{"timestamp":"2016-08-10T07:32:08.000003+0000","level":"info","message":"publishing check request","payload":{"name":"swap-free","issued":1470814327,"command":"check-swap.sh 20 10"},"subscribers":["base_centos_monitoring"]}
I have written a ruby file "nephele_events_handler.rb" which sends events messages through rest call to another server. The ruby file is in the location "/etc/sensu/handlers/". I am reading events from STDIN.read, i have read from official sensu documentation that events will be stored inside STDIN.
#!/opt/sensu/embedded/bin/ruby
require "#{File.dirname(__FILE__)}/base"
require 'rubygems'
require 'json'
require 'uri'
require 'net/http'
require 'net/https'
require 'json'
class RunProcs < BaseHandler
def payload_check
#Read event data
sensuhash = "{ \"SensuMessage\"" + ":"
braces = "}"
s = sensuhash.to_s
event = JSON.parse(STDIN.read, :symbolize_names => true)
eventPayload = event.to_json
sensujson = s + eventPayload + braces
uri = URI.parse("https://localhost:8080/Processor/services/sourceEvents/requestMsg")
https = Net::HTTP.new(uri.host,uri.port)
https.use_ssl = false
req = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})
req.body = "[ #{sensujson} ]"
res = https.request(req)
end
info = RunProcs.new
info.payload_check
end
Am writing handler json file "processor.json" inside the location "/etc/sensu/conf.d/handlers".
{
"handlers": {
"nephele_processor": {
"type": "pipe",
"command": "nephele_events_handler.rb"
}
}
}
But the issue am facing is am only getting events from 'check-procs'
{"client":{"address":"10.81.1.105","subscriptions":["base_centos","base_chef-client","python","base_centos_monitoring","base_centos_monitoring_metrics","sensu_client","base_aws","base_aws_monitoring","sensu_master","all"],"name":"ip-localhost.internal","hostname":"ip-localhost","version":"0.25.3","timestamp":1470896756},"check":{"command":"check-procs.rb --pattern='chef-client' -W=1","subscribers":["base_centos_monitoring"],"handlers":["base_with_jira"],"interval":60,"team":"ops","aggregate":true,"occurrences":3,"refresh":300,"ticket":true,"name":"process-chef-client","issued":1470896771,"executed":1470896771,"duration":0.864,"output":"CheckProcs CRITICAL: Found 0 matching processes; cmd /chef-client/\n","status":2,"type":"standard","history":["2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2","2"],"total_state_change":0},"occurrences":19879,"action":"create","timestamp":1470896772,"id":"dc2b0698-dbac-416d-a9ae-42aa09d53cc3","last_state_change":1469690268,"last_ok":null}
The Check which is getting executed
{
"checks": {
"process-chef-client": {
"command": "check-procs.rb --pattern='chef-client' -W=1",
"subscribers": [
"base_centos_monitoring"
],
"handlers": [
"base_with_jira"
],
"interval": 60,
"team": "ops",
"aggregate": true,
"occurrences": 3,
"interval": 60,
"refresh": 300,
"ticket": true
}
}
}
base_with_jira.json
{
"handlers": {
"base_with_jira": {
"type": "set",
"handlers": [
"jira",
"nephele_processor"
],
"config": "http://apache.enron.nephele.solutions/uchiwa"
}
}
}
I am not getting events from other plugins. Can you explain what i have to do for this.