Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a CommonJS build script #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions scripts/build-commonjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh -e

JSX=node_modules/jsx-loader/node_modules/react-tools/bin/jsx

rm -rf build
mkdir -p build

node -p 'p=require("./package");p.name="react-menu";p.main="build/lib/index.js";p.scripts=p.devDependencies=undefined;JSON.stringify(p,null,2)' > build/package.json

for FILE in $(find lib -name '*.js'); do
DIRNAME=$(dirname ${FILE})
mkdir -p build/${DIRNAME}
DESTNAME=build/${FILE}

${JSX} --harmony ${FILE} > ${DESTNAME}
done

echo "Now run \`npm deploy build\` to push the latest to npm"
14 changes: 14 additions & 0 deletions scripts/release-commonjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash -e

VERSION=$(node -p 'p=require("./package");p.version')

git checkout -b common-js/v${VERSION}

./scripts/build-commonjs
node -p 'p=require("./build/package");p.main="build/lib/index.js";JSON.stringify(p,null,2)' > package.json

git add build package.json
git commit -m "Updates to v${VERSION}"
git push -u origin common-js/v${VERSION}

git checkout -