Skip to content

Commit

Permalink
feat: add distributed package and example
Browse files Browse the repository at this point in the history
  • Loading branch information
sachinkiranti committed May 2, 2022
1 parent 01308b6 commit 58ce264
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.vscode/
coverage/
dist/
build/
node_modules/
38 changes: 38 additions & 0 deletions dist/demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Textual String Manipulation Demo</title>
</head>
<body>
<h1>Textual String Manipulation Demo</h1>
<p>Try the given button to count the words and characters for the given input.</p>

<textarea name="textStr" id="textStr" cols="30" rows="10"></textarea>
<br>
<span id="info-message"></span>
<div>
<button type="button" id="btn-count">Words Count</button>
</div>

<!-- Load jQuery -->
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="./textual.min.js"></script>

<script>
$(function () {
$('#btn-count').on('click', function () {
var strText = $('textarea[name=textStr]').val();

$('#info-message').html(
'The word count is : ' + strText.wordCount() +
' and the character count is : ' + strText.charCount()
)

})
});
</script>
</body>
</html>
1 change: 1 addition & 0 deletions dist/textual.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"url": "https://github.com/sachinkiranti/textual.git"
},
"scripts": {
"clean": "rimraf dist && rimraf coverage",
"clean": "rimraf build && rimraf coverage",
"build": "npm run compile && npm run copy:html && npm run bundle && npm run minify",
"compile": "tsc",
"copy:html": "cpx src/**.html dist",
"test": "karma start",
"bundle": "rollup -c",
"minify": "uglifyjs dist/textual-bundle.js --output dist/textual.min.js --source-map \"filename='dist/textual.min.js.map',url='textual.min.js.map',content='dist/textual.js.map'\""
"minify": "uglifyjs build/textual-bundle.js --output dist/textual.min.js"
},
"keywords": [],
"author": "Sachin Kiranti <[email protected]>",
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import babel from 'rollup-plugin-babel';
import sourcemaps from 'rollup-plugin-sourcemaps';

export default {
input: 'dist/textual.js', // Starting point for bundling
input: 'build/textual.js', // Starting point for bundling

// Output options for the generated bundle
output: {
file: 'dist/textual-bundle.js',
file: 'build/textual-bundle.js',
format: 'iife',
sourcemap: true
},
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"outDir": "build",
"target": "es2015",
"module": "es2015",
"moduleResolution": "node",
Expand Down

0 comments on commit 58ce264

Please sign in to comment.