Skip to content
This repository was archived by the owner on Aug 19, 2019. It is now read-only.

Commit 0469d1c

Browse files
author
deepsweet
committed
🐣
0 parents  commit 0469d1c

File tree

11 files changed

+201
-0
lines changed

11 files changed

+201
-0
lines changed

.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": [ "es2015" ],
3+
"plugins": [ "transform-runtime", "add-module-exports" ]
4+
}

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# http://editorconfig.org/
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
charset = utf-8
9+
indent_style = space
10+
indent_size = 4
11+
12+
[*.{json,yml}]
13+
indent_size = 2
14+
15+
[{.babelrc,.eslintrc}]
16+
indent_size = 2

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": [
3+
"rebem/configs/common",
4+
"rebem/configs/babel"
5+
]
6+
}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
build/
3+
coverage/
4+
tmp/
5+
*.sublime-*
6+
*.log
7+
.DS_Store

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
sudo: false
2+
3+
language: node_js
4+
5+
# cache:
6+
# directories:
7+
# - node_modules
8+
9+
node_js:
10+
- "5"
11+
12+
branches:
13+
only:
14+
- master
15+
16+
script: npm start ci

lib/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export default (callback) => (input) => {
2+
return function rename(log) {
3+
return Promise.all(
4+
input.map(file => {
5+
return Promise.resolve(callback(file.path)).then(newPath => {
6+
log(newPath);
7+
8+
return {
9+
path: newPath,
10+
data: file.data
11+
};
12+
});
13+
})
14+
);
15+
};
16+
};

license.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) 2016–present Kir Belevich
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

package.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"name": "start-rename",
3+
"version": "0.1.0",
4+
"description": "Rename task for Start",
5+
"keywords": [ "start", "start-task", "rename" ],
6+
"homepage": "https://github.com/start-runner/rename",
7+
"repository": "start-runner/rename",
8+
"author": "Kir Belevich <kir@soulshine.in> (https://github.com/deepsweet)",
9+
"files": [ "build/" ],
10+
"main": "build/index.js",
11+
"dependencies": {
12+
"babel-runtime": "6.x.x"
13+
},
14+
"devDependencies": {
15+
"start-babel-cli": "1.0.x",
16+
"start-start-preset": "1.0.x",
17+
18+
"babel-preset-es2015": "6.5.x",
19+
"babel-plugin-transform-runtime": "6.5.x",
20+
"babel-plugin-add-module-exports": "0.1.x",
21+
22+
"babel-eslint": ">5.0.0-beta1",
23+
"eslint-plugin-babel": "3.1.x",
24+
"eslint-config-rebem": "0.3.x",
25+
26+
"tape": "4.4.x",
27+
"husky": "0.10.x"
28+
},
29+
"scripts": {
30+
"start": "start-runner start-start-preset",
31+
"prepush": "npm start prepush",
32+
"prepublish": "npm start build"
33+
},
34+
"engines": {
35+
"node": ">=0.12.0",
36+
"npm": ">=2.7.0"
37+
},
38+
"license": "MIT"
39+
}

readme.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# start-rename
2+
3+
[![npm](https://img.shields.io/npm/v/start-rename.svg?style=flat-square)](https://www.npmjs.com/package/start-rename)
4+
[![travis](http://img.shields.io/travis/start-runner/rename.svg?style=flat-square)](https://travis-ci.org/start-runner/rename)
5+
[![coverage](https://img.shields.io/codecov/c/github/start-runner/rename.svg?style=flat-square)](https://codecov.io/github/start-runner/rename)
6+
[![deps](https://img.shields.io/gemnasium/start-runner/rename.svg?style=flat-square)](https://gemnasium.com/start-runner/rename)
7+
[![gitter](https://img.shields.io/badge/gitter-join_chat_%E2%86%92-00d06f.svg?style=flat-square)](https://gitter.im/start-runner/start)
8+
9+
Rename task for [Start](https://github.com/start-runner/start).
10+
11+
## Install
12+
13+
```
14+
npm i -S start-rename
15+
```
16+
17+
## Usage
18+
19+
```js
20+
import start from 'start';
21+
import reporter from 'start-pretty-reporter';
22+
import files from 'start-files';
23+
import clean from 'start-clean';
24+
import less from 'start-less';
25+
import rename from 'start-rename';
26+
import write from 'start-write';
27+
28+
export function build() {
29+
return start(reporter())(
30+
files('build/'),
31+
clean(),
32+
files('lib/**/*.less'),
33+
less(),
34+
rename(file => file.replace(/\.less$/, '.css')),
35+
write('build/')
36+
);
37+
}
38+
```
39+
40+
Task is rely on `[{ path, data }]` input and provide the same, see [documentation](https://github.com/start-runner/start#readme) for details.
41+
42+
## Arguments
43+
44+
`rename(callback)`
45+
46+
* `callback(file)` – function called with an absolute file path. Must return new (modified) absolute file path or a Promise with it.

test/.eslintrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extends": [
3+
"rebem/configs/test"
4+
]
5+
}

0 commit comments

Comments
 (0)