Last active
November 11, 2020 14:19
-
-
Save Faliszek/d66449c8a6837a013e59143b5f92df0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
: ' | |
To use snowpack we want purge all /require() from our code | |
unfortunately the graphql-ppx adding gql tag by require | |
require("apollo/client").gql so we must get rid of it | |
1. We store our mutations and queries in /queries and /mutations folders | |
2. We add graphql-tag import and remove require | |
' | |
MUT='/mutations/' | |
QUE='/queries/' | |
for i; do | |
FILE_NAME=$i | |
if [[ "$FILE_NAME" == *"$MUT"* || "$FILE_NAME" == *"$QUE"* ]]; then | |
sed -i '' '1s/^/import gql from "graphql-tag";\'$'\n/g' $FILE_NAME | |
sed -i '' 's/require("@apollo\/client").//' $FILE_NAME | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment