Skip to content
This repository has been archived by the owner on May 19, 2021. It is now read-only.

Commit

Permalink
[chore] set environment
Browse files Browse the repository at this point in the history
  • Loading branch information
cedoor committed Feb 3, 2019
1 parent e6c7333 commit a3744ac
Show file tree
Hide file tree
Showing 12 changed files with 3,786 additions and 42 deletions.
9 changes: 9 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"presets": [
"@babel/env"
],
"plugins": [
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread"
]
}
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.idea

.idea/
dist/
node_modules
package-lock.json
npm-debug.log
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2018 Omar Desogus
Copyright (c) 2019 Omar Desogus

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Utils
# Cutils

Some JavaScript util functions.
3,692 changes: 3,692 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

35 changes: 26 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
{
"name": "utils",
"name": "cutils",
"version": "0.1.0",
"author": "Omar Desogus",
"description": "Some JavaScript util functions.",
"author": {
"name": "Omar Desogus",
"url": "https://cedoor.org"
},
"license": "MIT",
"main": "index.js",
"main": "dist/cutils.js",
"unpkg": "dist/cutils.min.js",
"jsdelivr": "dist/cutils.min.js",
"module": "src/index.js",
"scripts": {
"test": "mocha test.js"
"pretest": "rollup -c",
"test": "standard --fix 'src/**/*.js' 'test/**/*-test.js' && tape 'test/**/*.js'",
"prepublishOnly": "rm -rf dist && npm run test"
},
"homepage": "https://github.com/cedoor/utils#readme",
"homepage": "https://github.com/cedoor/cutils",
"repository": {
"type": "git",
"url": "git+https://github.com/cedoor/utils.git"
"url": "git+https://github.com/cedoor/cutils.git"
},
"bugs": {
"url": "https://github.com/cedoor/utils/issues"
"url": "https://github.com/cedoor/cutils/issues"
},
"devDependencies": {
"mocha": "5.2.0",
"standard": "12.0.1"
"@babel/core": "7.2.2",
"@babel/plugin-proposal-class-properties": "7.3.0",
"@babel/plugin-proposal-object-rest-spread": "7.3.1",
"@babel/preset-env": "7.3.1",
"rollup": "1.1.2",
"rollup-plugin-babel": "4.3.2",
"rollup-plugin-commonjs": "9.2.0",
"rollup-plugin-node-resolve": "4.0.0",
"rollup-plugin-terser": "4.0.3",
"standard": "12.0.1",
"tape": "4.9.2"
}
}
41 changes: 41 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import commonjs from 'rollup-plugin-commonjs'
import resolve from 'rollup-plugin-node-resolve'
import babel from 'rollup-plugin-babel'
import { terser } from 'rollup-plugin-terser'
import * as meta from './package.json'

const config = {
input: meta.module,
output: {
file: `dist/${meta.name}.js`,
name: meta.name,
format: 'umd',
indent: false,
extend: true,
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`,
},
plugins: [
resolve({extensions: ['.js']}),
commonjs(),
babel({extensions: ['.js'], include: ['src/**/*']})
]
}

export default [
config,
{
...config,
output: {
...config.output,
file: `dist/${meta.name}.min.js`
},
plugins: [
...config.plugins,
terser({
output: {
preamble: config.output.banner
}
})
]
}
]
5 changes: 2 additions & 3 deletions index.js → src/general/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ function capitalizeWordList (wordList) {
return wordList.map(capitalizeWords)
}

// Exports
module.exports = {
export default {
capitalizeWord,
capitalizeWords,
capitalizeWordList
}
}
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as general } from './general/index'
25 changes: 0 additions & 25 deletions test.js

This file was deleted.

9 changes: 9 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const tape = require('tape');
const cutils = require('../dist/cutils')

tape('timing test', function (test) {
test.equal(cutils.general.capitalizeWord('hello'), 'Hello')
test.equal(cutils.general.capitalizeWords('hello world'), 'Hello World')
test.deepEqual(cutils.general.capitalizeWordList(['hello', 'world']), ['Hello', 'World'])
test.end()
});

0 comments on commit a3744ac

Please sign in to comment.