Skip to content

Commit

Permalink
modify build script to generate minified version
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshiki Shibukawa committed Mar 28, 2015
1 parent cceb224 commit b9b91f8
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 9 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## ignore ##
/node_modules/
/doc/

*.tar.gz
.*.swp
dest
snowball-stemmer
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules
*.tgz
*.tar.gz
deploy.sh
.*.swp
snowball-stemmer
4 changes: 4 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change History
=================

## 0.2.1 (2015/03/28)

* Modify build script to generate minified version.

## 0.2.0 (2013/11/10)

* Restructure folder structure
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ define(['german-stemmer.jsx'], function (germanstemmer) {
### Use via standard JSX function

```html
<script src="spanish-stemmer.js}}" type="text/javascript"></script>
<script src="spanish-stemmer.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function () {
var SpanishStemmer = JSX.require("lib/spanish-stemmer.js").SpanishStemmer;
Expand All @@ -65,7 +65,7 @@ window.onload = function () {
### Use via global variables

```html
<script src="snowball-stemmer.global.js}}" type="text/javascript"></script>
<script src="snowball-stemmer.global.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function () {
var RussianStemmer = new RussianStemmer();
Expand Down
4 changes: 4 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#~/bin/sh
./node_modules/.bin/grunt build
cp -r dest snowball-stemmer
tar cvfz snowball-stemmer.tar.gz snowball-stemmer
89 changes: 84 additions & 5 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function(grunt) {
},
add_search_path: ['<%= libDir %>'],
minify: false,
release: false,
release: true,
linker: 'commonjs-lib'
},

Expand All @@ -54,7 +54,7 @@ module.exports = function(grunt) {
},
add_search_path: ['<%= libDir %>'],
minify: false,
release: false,
release: true,
linker: 'amd-lib'
},

Expand Down Expand Up @@ -83,7 +83,7 @@ module.exports = function(grunt) {
replace: 'dest\/$1.global.js'
},
add_search_path: ['<%= libDir %>'],
minify: true,
minify: false,
release: true,
linker: 'export-global'
},
Expand All @@ -98,10 +98,84 @@ module.exports = function(grunt) {
replace: 'dest\/$1.js'
},
add_search_path: ['<%= libDir %>'],
release: false,
release: true,
minify: false
},

commonjs_min: {
src: ['src/danish-stemmer.jsx', 'src/dutch-stemmer.jsx', 'src/english-stemmer.jsx', 'src/finnish-stemmer.jsx', 'src/french-stemmer.jsx',
'src/german-stemmer.jsx', 'src/hungarian-stemmer.jsx', 'src/italian-stemmer.jsx', 'src/norwegian-stemmer.jsx', 'src/porter-stemmer.jsx',
'src/portuguese-stemmer.jsx', 'src/romanian-stemmer.jsx', 'src/russian-stemmer.jsx', 'src/spanish-stemmer.jsx', 'src/swedish-stemmer.jsx',
'src/turkish-stemmer.jsx'],
output_rule: {
regexp: /src\/(.+)\.jsx/,
replace: 'dest\/$1.common.min.js'
},
add_search_path: ['<%= libDir %>'],
minify: true,
release: true,
linker: 'commonjs-lib'
},

amd_min: {
src: ['src/danish-stemmer.jsx', 'src/dutch-stemmer.jsx', 'src/english-stemmer.jsx', 'src/finnish-stemmer.jsx', 'src/french-stemmer.jsx',
'src/german-stemmer.jsx', 'src/hungarian-stemmer.jsx', 'src/italian-stemmer.jsx', 'src/norwegian-stemmer.jsx', 'src/porter-stemmer.jsx',
'src/portuguese-stemmer.jsx', 'src/romanian-stemmer.jsx', 'src/russian-stemmer.jsx', 'src/spanish-stemmer.jsx', 'src/swedish-stemmer.jsx',
'src/turkish-stemmer.jsx'],
output_rule: {
regexp: /src\/(.+)\.jsx/,
replace: 'dest\/$1.amd.min.js'
},
add_search_path: ['<%= libDir %>'],
minify: true,
release: true,
linker: 'amd-lib'
},

closure_min: {
src: ['src/danish-stemmer.jsx', 'src/dutch-stemmer.jsx', 'src/english-stemmer.jsx', 'src/finnish-stemmer.jsx', 'src/french-stemmer.jsx',
'src/german-stemmer.jsx', 'src/hungarian-stemmer.jsx', 'src/italian-stemmer.jsx', 'src/norwegian-stemmer.jsx', 'src/porter-stemmer.jsx',
'src/portuguese-stemmer.jsx', 'src/romanian-stemmer.jsx', 'src/russian-stemmer.jsx', 'src/spanish-stemmer.jsx', 'src/swedish-stemmer.jsx',
'src/turkish-stemmer.jsx'],
output_rule: {
regexp: /src\/(.+)\.jsx/,
replace: 'dest\/$1.closure.min.js'
},
add_search_path: ['<%= libDir %>'],
minify: true,
release: true,
linker: 'closure-lib'
},

global_min: {
src: ['src/danish-stemmer.jsx', 'src/dutch-stemmer.jsx', 'src/english-stemmer.jsx', 'src/finnish-stemmer.jsx', 'src/french-stemmer.jsx',
'src/german-stemmer.jsx', 'src/hungarian-stemmer.jsx', 'src/italian-stemmer.jsx', 'src/norwegian-stemmer.jsx', 'src/porter-stemmer.jsx',
'src/portuguese-stemmer.jsx', 'src/romanian-stemmer.jsx', 'src/russian-stemmer.jsx', 'src/spanish-stemmer.jsx', 'src/swedish-stemmer.jsx',
'src/turkish-stemmer.jsx'],
output_rule: {
regexp: /src\/(.+)\.jsx/,
replace: 'dest\/$1.global.min.js'
},
add_search_path: ['<%= libDir %>'],
minify: true,
release: true,
linker: 'export-global'
},

standard_min: {
src: ['src/danish-stemmer.jsx', 'src/dutch-stemmer.jsx', 'src/english-stemmer.jsx', 'src/finnish-stemmer.jsx', 'src/french-stemmer.jsx',
'src/german-stemmer.jsx', 'src/hungarian-stemmer.jsx', 'src/italian-stemmer.jsx', 'src/norwegian-stemmer.jsx', 'src/porter-stemmer.jsx',
'src/portuguese-stemmer.jsx', 'src/romanian-stemmer.jsx', 'src/russian-stemmer.jsx', 'src/spanish-stemmer.jsx', 'src/swedish-stemmer.jsx',
'src/turkish-stemmer.jsx'],
output_rule: {
regexp: /src\/(.+)\.jsx/,
replace: 'dest\/$1.min.js'
},
add_search_path: ['<%= libDir %>'],
release: true,
minify: true
},

test: {
src: ['<%= testDir %>/*.jsx'],
add_search_path: ['<%= libDir %>'],
Expand Down Expand Up @@ -129,7 +203,12 @@ module.exports = function(grunt) {
'jsx:amd',
'jsx:closure',
'jsx:standard',
'jsx:global'
'jsx:global',
'jsx:commonjs_min',
'jsx:amd_min',
'jsx:closure_min',
'jsx:standard_min',
'jsx:global_min'
]);
grunt.registerTask('sample', ['jsx:sample']);
grunt.registerTask('doc', ['jsx:doc']);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "snowball-stemmer.jsx",
"version": "0.2.0",
"version": "0.2.1",
"description": "This is a collection of stemmers for JSX/JS/AMD/Common.js.",
"scripts": {
"build": "./node_modules/.bin/grunt build",
Expand Down
4 changes: 4 additions & 0 deletions samples/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var PorterStemmer = require('./porter-stemmer.common.js').PorterStemmer;

var stemmer = new PorterStemmer();
console.log(stemmer.stemWord("baby"));

0 comments on commit b9b91f8

Please sign in to comment.