Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 8e4b78d

Browse files
bendruckerpetebacondarwin
authored andcommitted
chore(commonjs): generate commonjs files for all locales
Files are regenerated with each build so deleted locales will be removed Closes #12
1 parent f5df14d commit 8e4b78d

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
precommit.sh

bower.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"ignore": [
55
"**/.*",
66
"node_modules",
7-
"components"
7+
"components",
8+
"precommit.sh"
89
]
910
}

precommit.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# precommit script for assembling CommonJS compatible modules
2+
# allows require('angular-i18n'/aa) === 'ngLocale'
3+
# run by angular.js build script
4+
5+
# delete all js files that don't begin with angular-
6+
# ensures that removed locales have their CJS file removed
7+
find . -maxdepth 1 -not -name 'angular-*.js' -name '*.js' -delete
8+
for file in angular-locale_*.js
9+
do
10+
newFile=${file//angular-locale_/}
11+
require=${file%.js}
12+
echo "-- adding CommonJS exports file: $newFile"
13+
echo "require('./$require');" > $newFile
14+
echo "module.exports = 'ngLocale';" >> $newFile
15+
done

0 commit comments

Comments
 (0)