composer config: add "extra" value as array - composer-php

MediaWiki's merge-plugin requires a data structure as follows:
{
"extra": {
"merge-plugin": {
"include": [
"extensions/OpenIDConnect/composer.json"
]
}
}
}
How can this data structure (note the array) be created via CLI?
config extra.merge-plugin.include ["extensions/OpenIDConnect/composer.json"]
will not create the desired output

With Composer 2, this can be accomplished by passing a flag such as --json:
For the example above (note the single quotes parameterizing the JSON object:
composer config --json extra.merge-plugin.include '["extensions/OpenIDConnect/composer.json"]'
Results in:
"merge-plugin": {
"include": ["extensions/OpenIDConnect/composer.json"]
}
Reference: https://github.com/composer/composer/pull/8779

Related

Issues getting flow to send the correct json in body when using powerautomate's http request

I'm using a PowerAutomate Flow to call a native SmartSheet API that does a POST. The POST IS working but my MULTI_PICKLIST type field is not being populated correctly in SmartSheet due to the double quotes.
The API is: concat('https://api.smartsheet.com/2.0/sheets/', variables('vSheetID'), '/rows')
In the Body section of the http rest API I form my JSON and the section of interest looks like this:
{
"columnId": 6945615984781188,
"objectValue": {
"objectType": "MULTI_PICKLIST",
"values": [
#{variables('vServices')}
]
}
}
My variable vServices raw output looks like:
{
"body":
{
"name": "vServices",
"value": "Test1, Test2"
}
}
The format needs to be like this (it works using PostMan).
{
"columnId": 6945615984781188,
"objectValue": {
"objectType": "MULTI_PICKLIST",
"values": [
"Test1","Test2"
]
}
}
As a step in formatting my vServices variable I tried to do a replace function to replace the ',' with a '","' but this ultimately ends up as a \",\"
Any suggestion on how to get around this? Again, ultimately I need the desired JSON Body to read but haven't been able to achieve this in the Body section:
{
"columnId": 6945615984781188,
"objectValue": {
"objectType": "MULTI_PICKLIST",
"values": [
"Test1","Test2"
]
}
}
vs this (when using replace function).
{
"columnId": 6945615984781188,
"objectValue": {
"objectType": "MULTI_PICKLIST",
"values": [
"Test1\",\"Test2"
]
}
}
Thank you in advance,
I resolved my issue by taking the original variable, sending it to a compose step that did a split on the separator of a comma. I then added a step to set a new variable to the output of the compose step. This left me with a perfectly setup array in the exact format I needed! This seemed to resolve any of the issues I was having with double quotes and escape sequences.

Generate multiple output tokens from a single input token in Amazon Style Dictionary

I am using Amazon Style Dictionary to generate SCSS variables from JS definition files. Given the following input:
module.exports = {
color: {
border: {
focus: { value: '#0071ff' }
}
}
}
I would like to generate not one output variable for this, but two (HEX and RGB). Is it possible to write a custom value transformer that spits out multiple values for a given input? Or do I need to run a separate pipeline for this use case?
This could be your colors.json file configuration
"source": ["sources/colors.js"],
"platforms": {
"css-rgb": {
"transforms": ["color/rgb"],
"buildPath": "dist/rgb/",
"files": [
{
"destination": "colors-rgb.css",
"format": "css/variables"
}
]
},
"css-hex": {
"transforms": ["color/hex"],
"buildPath": "dist/hex/",
"files": [
{
"destination": "colors-hex.css",
"format": "css/variables"
}
]
}
}
to provide to your StyleDictionary configuration.
So you grab the sources from your sources/colors.js file and create in output in the dist folder two subfolders, rgb containing colors-rgb.css and hex containing colors-hex.css.

GraphQL Query access all transformed json files within a folder located in subdirectories

I have a project structure like so:
-$PROJECT
--src
---data
----projects
-----project1
------project.json
------images
-------project1-preview.png
-----project2
------project.json
-------images
...
And so on, for however many projects. I could query these project.json files when they were named the title of the project and within a projects folder using allProjectsJson in graphQl, however now they are within subfolders within projects. I can only query them individually as allProject1Json and so on. Is there a way to query allProjectsJson so I get all the project.json files?
I can find my projects files by querying allFile with a filter for json files, however, these files are not transformed json so I can't access the elements.
In my gatsby-config file I am importing src/data as a source for files.
From my answer at https://github.com/gatsbyjs/gatsby/issues/20734:
Ahh, I see what you mean :)
luckily gatsby-transformer-json has a plugin option that will help get you unstuck!
It's the typeName option. You should be able to check for a field on each JSON node, and use that as the type name. Something like this:
{
resolve: `gatsby-transformer-json`,
options: {
typeName: ({ node, object, isArray }) =>
object.project ? `Project` : `Json`,
},
},
That way anything with the field project defined will show up as allProject { ... }, where any other json files will show up as allJson { ... }
{
allProject {
nodes {
project
}
}
}
{
"data": {
"allProject": {
"nodes": [
{
"project": "project1"
},
{
"project": "project2"
}
]
}
}
}
My project works very similarly. Here's how I have my gatsby-config.js setup:
module.exports = {
...
plugins: [
...,
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'project', // Identifier. Will then be queried as `allProjectsJson`
path: './data', // Source folder containing the JSON files
},
},
...,
]
};
Example JSON file:
[
{
"title": "Hello",
"description": "World",
"url": "https://www.google.com",
"image": "./images/img1.jpg"
},
{
"title": "World",
"description": "Hello",
"url": "https://www.google.com",
"image": "./images/img2.jpg"
},
]
Example query:
query projects {
allProjectsJson {
edges {
node {
id
title
description
url
image {
childImageSharp {
fluid {
...GatsbyImageSharpFluid
}
}
}
}
}
}
}
Hope this helps!

How to add attribute to existing array using JoltTransformJson in Apache-NiFi

If input is something like this:
{
"Vendor":[{"a":"..."},{"b":"..."}]
}
and attribute is something like this:
{
"Vendor":[{"c":"..."},{"d":"..."}]
}
how can I generate this output:
{
"Vendor":[{"a":"..."},{"b":"..."},{"c":"..."},{"d":"..."}]
}
I think joltTransformJson is best option, but I couldn't generate desired output.
If the attribute is named json then this should work:
[
{
"operation": "default",
"spec": {
// extract vendor array from json attribute and put it in a temporary array
"tempArray": ${json:jsonPath('$.Vendor')}
}
},
{
"operation": "shift",
"spec": {
"Vendor": "Vendor", // keep Vendor array as is
"tempArray": { // put temp array elements inside Vendor
"*": "Vendor"
},
"*": "&" // keep all of the other elements of the json
}
}
]
I provided explanation in comments, don't forget to remove them though the json will be valid!
How about putting the attribute to content by using AttributesToJson processor and then merging the two flow files by using MergeContent processor?

How to pass output folder parameter to jasmine JUnitHtmlReporter via jasmine.json

I see in the docs of Jasmine JUnit reporter: https://www.npmjs.com/package/jasmine-xml-reporter that I can pass parameters of output location and --junitreport however I'm not using the command line I'm using jasmine.json.
I could not figure out how to pass the --output and --junitreport parameters via jasmine.json at least I don't see any output files this is what I'm trying:
{
"spec_dir": "src/test",
"spec_files": [
"ts/**/*.test.ts"
],
"reporters": [
{
"name": "jasmine-reporters#JUnitXmlReporter",
"options": {
"output": "../dist"
}
}
]
}
Any ideas how to pass the --output and --junitreport parameters to this library?

Resources