Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions utils/scripts/get-cids.sh
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
#!/bin/bash

AWKCMD='
# Split record by (=)
BEGIN { FS = "="; }
# Remove all semicolons
{ gsub(/;/, "") }
# Split record by (= | :)
BEGIN { FS = "[=:]"; }
# Remove all semicolons and commas
{ gsub(/[;,]/, "") }
{
# On first record
if ( NR == 1) {
# Remove single quotes
gsub(/\047/, "");
} else {
# Replace first single quote with (,)
sub(/\047/, ",");
sub(/\047/, ",", $4);
# Remove single quotes
gsub(/\047/, "");
gsub(/\047/, ""i, $4);
}
}
# Print second column only which contains component_id
{ print $2 }
{ print $4 }
'

grep \
--exclude-dir=.template \
--exclude-dir=node_modules \
--exclude-dir=dist \
--include=\*.js \
--exclude=\*.spec.js \
-rnw '../../packages' \
-e 'const [A-Z_]*COMPONENT_ID = ' | # Find all COMPONENT_IDs
-rn '../../packages' \
-e "\'data-garden-id\': \'" \
-e "const [A-Z_]*COMPONENT_ID =" |
sort | # Sort alphabetically
awk "$AWKCMD" | # Run the above awk program
tr '\n' ' ' # Collapse result to single line