Skip to content

Commit

Permalink
add: first version
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali Torki committed Jun 18, 2018
0 parents commit 4294c15
Show file tree
Hide file tree
Showing 35 changed files with 9,184 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"presets": [
[
"env",
{
"modules": false
}
]
],
"env": {
"test": {
"presets": [
[
"env",
{
"modules": "commonjs"
}
]
]
}
}
}
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/**
test/**
node_modules/**
173 changes: 173 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
{
"root": true,
"parser": "babel-eslint",
"extends": ["standard"],
"plugins": ["import", "security"],
"env": {
"commonjs": true,
"es6": true,
"node": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"generators": true,
"experimentalObjectRestSpread": true
}
},
"rules": {
"import/extensions": [
0,
"always",
{
"js": "never"
}
],
"array-callback-return": "warn",
"default-case": [
"warn",
{
"commentPattern": "^no default$"
}
],
"quotes": ["error", "double"],
"no-tabs": 0,
"space-before-function-paren": 0,
"indent": [0, "tab"],
"semi": [1, "always"],
"dot-location": ["warn", "property"],
"eqeqeq": ["warn", "allow-null"],
"new-parens": "warn",
"no-array-constructor": "warn",
"no-caller": "warn",
"no-cond-assign": ["warn", "always"],
"no-const-assign": "warn",
"no-control-regex": "warn",
"no-delete-var": "warn",
"no-dupe-args": "warn",
"no-dupe-class-members": "warn",
"no-dupe-keys": "warn",
"no-duplicate-case": "warn",
"no-empty-character-class": "warn",
"no-empty-pattern": "warn",
"no-eval": "warn",
"no-ex-assign": "warn",
"no-extend-native": "warn",
"no-extra-bind": "warn",
"no-extra-label": "warn",
"no-fallthrough": "warn",
"no-func-assign": "warn",
"no-implied-eval": "warn",
"no-invalid-regexp": "warn",
"no-iterator": "warn",
"no-label-var": "warn",
"no-labels": [
"warn",
{
"allowLoop": true,
"allowSwitch": false
}
],
"no-lone-blocks": "warn",
"no-loop-func": "warn",
"no-mixed-operators": [
"warn",
{
"groups": [
["&", "|", "^", "~", "<<", ">>", ">>>"],
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"]
],
"allowSamePrecedence": false
}
],
"no-multi-str": "warn",
"no-native-reassign": "warn",
"no-negated-in-lhs": "warn",
"no-new-func": "warn",
"no-new-object": "warn",
"no-new-symbol": "warn",
"no-new-wrappers": "warn",
"no-obj-calls": "warn",
"no-octal": "warn",
"no-octal-escape": "warn",
"no-redeclare": "warn",
"no-regex-spaces": "warn",
"no-restricted-syntax": ["warn", "WithStatement"],
"no-script-url": "warn",
"no-self-assign": "warn",
"no-self-compare": "warn",
"no-sequences": "warn",
"no-shadow-restricted-names": "warn",
"no-sparse-arrays": "warn",
"no-template-curly-in-string": "warn",
"no-this-before-super": "warn",
"no-throw-literal": "warn",
"no-undef": "error",
"no-unexpected-multiline": "warn",
"no-unreachable": "warn",
"no-unused-expressions": [
"warn",
{
"allowShortCircuit": true,
"allowTernary": true,
"allowTaggedTemplates": true
}
],
"no-unused-labels": "warn",
"no-unused-vars": [
"warn",
{
"args": "none",
"ignoreRestSiblings": true
}
],
"no-use-before-define": [
"warn",
{
"functions": false,
"classes": false,
"variables": false
}
],
"no-useless-computed-key": "warn",
"no-useless-concat": "warn",
"no-useless-constructor": "warn",
"no-useless-escape": "warn",
"no-useless-rename": [
"warn",
{
"ignoreDestructuring": false,
"ignoreImport": false,
"ignoreExport": false
}
],
"no-with": "warn",
"no-whitespace-before-property": "warn",
"radix": "warn",
"require-yield": "warn",
"rest-spread-spacing": ["warn", "never"],
"strict": ["warn", "never"],
"unicode-bom": ["warn", "never"],
"use-isnan": "warn",
"valid-typeof": "warn",
"no-restricted-properties": [
"error",
{
"object": "System",
"property": "import",
"message":
"Please use import() instead. More info: https://webpack.js.org/guides/code-splitting/"
}
],
"import/first": "error",
"import/no-amd": "error",
"import/no-webpack-loader-syntax": "error"
},
"ecmaFeatures": {
"modules": true
}
}
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
dist/**

.DS_STORE
# Logs
logs
*.log
npm-debug.log*

# Dependency directories
node_modules
jspm_packages

package-lock.json
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_STORE
*.log

node_modules
22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
sudo: false
language: node_js
node_js:
- "stable"
- "4"
- "6"

cache:
directories:
- node_modules

before_script:
- npm run lint

script:
- node --version
- npm --version
- npm run test

after_script:
- npm run lint:fix
- npm run build
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Ali Torki

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[![Build Status](https://travis-ci.org/ali-master/persian-tools.svg?branch=master)](https://travis-ci.org/ali-master/persian-tools)

# Welcome to Persian Tools!
81 changes: 81 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"name": "persian-tools",
"version": "0.0.0",
"description":
"An anthology of a variety of tools for Persian language in javascript",
"main": "src/index.js",
"scripts": {
"test": "jest",
"lint": "eslint src test scripts",
"lint:fix": "npm run lint -- --fix",
"build": "node scripts/build.js",
"build:esm": "rollup -c scripts/rollup.config.esm.js",
"build:umd": "rollup -c scripts/rollup.config.umd.js",
"build:modules": "rollup -c scripts/rollup.config.modules.js",
"watch": "rollup -c scripts/rollup.config.umd.js --watch",
"release": "npm run build && npm run test && standard-version"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ali-master/persian-tools.git"
},
"files": ["src", "dist"],
"keywords": [
"persian tools",
"number to persian words",
"persian words to number",
"Arabic numbers to Persian",
"Arabic numbers to English",
"English numbers to Persian",
"Persian numbers to English",
"verify iranian national id",
"verify iranian card-number"
],
"author": "Ali Torki <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/ali-master/persian-tools/issues"
},
"homepage": "https://github.com/ali-master/persian-tools#readme",
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3",
"babel-jest": "^23.0.1",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.7.0",
"chalk": "^2.4.1",
"eslint": "^4.19.1",
"eslint-config-standard": "^11.0.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-prettier": "^2.6.0",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-security": "^1.4.0",
"eslint-plugin-standard": "^3.1.0",
"globby": "^8.0.1",
"jest-cli": "^23.1.0",
"prettier": "^1.13.5",
"prettier-eslint": "^8.8.1",
"rollup": "^0.60.7",
"rollup-plugin-babel": "^3.0.4",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-json": "^3.0.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-progress": "^0.4.0",
"rollup-plugin-uglify": "^4.0.0",
"shelljs": "^0.8.2",
"standard-version": "^4.4.0",
"uglify-es": "^3.3.9"
},
"jest": {
"transform": {
"^.+\\.js$": "babel-jest"
},
"testEnvironment": "node",
"modulePathIgnorePatterns": ["dist/.*", "src/.*"],
"testPathIgnorePatterns": ["/node_modules/", "/dist/", "/src/"]
},
"dependencies": {}
}
30 changes: 30 additions & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const shell = require("shelljs");
const chalk = require("chalk");

// remove dist dir
shell.rm("-rf", "./dist");

const umdBuild = shell.exec("npm run build:umd", { silent: true }).code;
const esmBuild = shell.exec("npm run build:esm", { silent: true }).code;
const modulesBuild = shell.exec("npm run build:modules", { silent: true }).code;

if (umdBuild !== 0) {
console.log(chalk.red("Error: UMD build failed"));
shell.exit(1);
} else {
console.log(chalk.green("UMD build was successfully created"));
}

if (esmBuild !== 0) {
console.log(chalk.red("Error: ESM build failed"));
shell.exit(1);
} else {
console.log(chalk.green("ESM build was successfully created"));
}

if (modulesBuild !== 0) {
console.log(chalk.red("Error: Modules build failed"));
shell.exit(1);
} else {
console.log(chalk.green("The build of modules was successfully created"));
}
10 changes: 10 additions & 0 deletions scripts/rollup.config.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import path from "path";
import config, { dist, name } from "./rollup.config";

export default config({
output: {
format: "es",
sourcemap: true,
file: path.resolve(dist, name + ".esm.js")
}
});
Loading

0 comments on commit 4294c15

Please sign in to comment.