* Initial GraphQL implementation This is the bare minimum amount of code to make graphql work. Turns out it's pretty easy to add support for other languages :) * Fixing support for `graphql` parsing There was a few structural changes with the addition of CSS and Typescript that we had to take into account. * Fixing file glob, adding `graphql` to yarn.lock * Removing extraneous file * Adding `graphql` parser, style changes * Splitting out graphql printer * Removing merge conflict * Fixing yarn.lock * Addressing code review, using `createError` * Adding release config * Using exact version * Removing destructuring
67 lines
2.2 KiB
Bash
Executable File
67 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
cd "$(dirname "$0")";
|
|
cd ../..;
|
|
|
|
rm -Rf dist/
|
|
rm -f docs/*.js
|
|
|
|
echo 'The warning about eval being strongly discouraged is normal.'
|
|
|
|
## --- Lib ---
|
|
|
|
echo 'Bundling lib index...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.index.config.js
|
|
|
|
echo 'Bundling lib bin...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.bin.config.js
|
|
chmod +x ./dist/bin/prettier.js
|
|
|
|
echo 'Bundling lib babylon...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.parser.config.js --environment parser:babylon
|
|
|
|
echo 'Bundling lib flow...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.parser.config.js --environment parser:flow
|
|
|
|
echo 'Bundling lib graphql...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.parser.config.js --environment parser:graphql
|
|
|
|
echo 'Bundling lib typescript...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.parser.config.js --environment parser:typescript
|
|
|
|
echo 'Bundling lib postcss...';
|
|
# PostCSS has dependency cycles and won't work correctly with rollup :(
|
|
./node_modules/.bin/webpack src/parser-postcss.js dist/src/parser-postcss.js
|
|
# Prepend module.exports =
|
|
echo "module.exports =" > dist/src/parser-postcss.js.tmp
|
|
cat dist/src/parser-postcss.js >> dist/src/parser-postcss.js.tmp
|
|
mv dist/src/parser-postcss.js.tmp dist/src/parser-postcss.js
|
|
|
|
## --- Docs ---
|
|
|
|
echo 'Bundling docs index...';
|
|
cp dist/index.js docs/index.js
|
|
|
|
echo 'Bundling docs babylon...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.docs.config.js --environment filepath:src/parser-babylon.js
|
|
|
|
echo 'Bundling docs flow...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.docs.config.js --environment filepath:src/parser-flow.js
|
|
|
|
echo 'Bundling docs graphql...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.docs.config.js --environment filepath:src/parser-graphql.js
|
|
|
|
echo 'Bundling docs typescript...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.docs.config.js --environment filepath:src/parser-typescript.js
|
|
|
|
echo 'Bundling docs postcss...';
|
|
node_modules/.bin/rollup -c scripts/build/rollup.docs.config.js --environment filepath:src/parser-postcss.js
|
|
|
|
## --- Misc ---
|
|
|
|
echo 'Remove eval'
|
|
sed -i '' -e 's/eval("require")/require/g' dist/index.js dist/bin/prettier.js
|
|
|
|
echo 'Copy package.json'
|
|
cp package.json dist/
|