Skip to content

Commit

Permalink
Scaffold: Normalize repository
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Jun 17, 2017
1 parent 2e7ffe4 commit 952a521
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 50 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
23 changes: 11 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
Expand All @@ -14,24 +13,24 @@ lib-cov
# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules
jspm_packages

# Optional npm cache directory
.npm
# Users Environment Variables
.lock-wscript

# Garbage files
.DS_Store

# Optional REPL history
.node_repl_history
# Generated by integration tests
test/fixtures/tmp
test/fixtures/out
3 changes: 3 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"preset": "gulp"
}
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
sudo: false
language: node_js
node_js:
- '6'
- '5'
- '4'
- '0.12'
- '0.10'
after_script:
- npm run coveralls
25 changes: 25 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# http://www.appveyor.com/docs/appveyor-yml
# http://www.appveyor.com/docs/lang/nodejs-iojs

environment:
matrix:
# node.js
- nodejs_version: "0.10"
- nodejs_version: "0.12"
- nodejs_version: "4"
- nodejs_version: "5"
- nodejs_version: "6"

install:
- ps: Install-Product node $env:nodejs_version
- npm install

test_script:
- node --version
- npm --version
- cmd: npm test

build: off

# build version format
version: "{build}"
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ function add(file, callback) {
}

var state = {
path: '', //root path for the sources in the map
path: '', // Root path for the sources in the map
map: null,
content: file.contents.toString(),
preExistingComment: null
// TODO: handle this?
preExistingComment: null,
};

helpers.addSourceMaps(file, state, callback);
Expand Down
13 changes: 4 additions & 9 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,10 @@ function mapsLoaded(file, state, callback) {
names: [],
mappings: '',
sources: [normalizePath(file.relative)],
sourcesContent: [state.content]
sourcesContent: [state.content],
};
}

// TODO: add this
// else if (preExistingComment !== null && typeof preExistingComment !== 'undefined') {
// sourceMap.preExistingComment = preExistingComment;
// }

state.map.file = normalizePath(file.relative);
file.sourceMap = state.map;

Expand Down Expand Up @@ -196,16 +191,16 @@ function createSourceMapFile(opts) {
},
isSocket: function () {
return false;
}
}
},
},
});
}

var needsMultiline = ['.css'];

function getCommentOptions(extname) {
var opts = {
multiline: (needsMultiline.indexOf(extname) !== -1)
multiline: (needsMultiline.indexOf(extname) !== -1),
};

return opts;
Expand Down
60 changes: 39 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,52 @@
{
"name": "vinyl-sourcemap",
"version": "0.3.0",
"description": "Add sourcemaps to vinyl files, extracted from gulp-sourcemaps by Florian Reiterer (https://github.com/floridoo/gulp-sourcemaps)",
"main": "index.js",
"scripts": {
"test": "mocha --async-only"
},
"keywords": [
"vinyl",
"sourcemap",
"gulp"
"description": "Add sourcemaps to Vinyl files.",
"author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)",
"contributors": [
"Robin Venneman",
"Blaine Bublitz <blaine.bublitz@gmail.com>"
],
"author": "Robin Venneman",
"repository": "gulpjs/vinyl-sourcemap",
"license": "MIT",
"repository": "github:gulpjs/vinyl-sourcemap",
"devDependencies": {
"eslint": "^3.4.0",
"eslint-config-gulp": "github:robinvenneman/eslint-config-gulp",
"expect": "^1.20.2",
"mississippi": "^1.3.0",
"mocha": "^3.2.0",
"vinyl-fs": "^2.4.3"
"engines": {
"node": ">= 0.10"
},
"main": "index.js",
"files": [
"LICENSE",
"index.js",
"lib/"
],
"scripts": {
"lint": "eslint index.js lib/ test/add.js test/write.js && jscs index.js test/add.js test/write.js",
"pretest": "npm run lint",
"test": "mocha --async-only",
"cover": "istanbul cover _mocha --report lcovonly",
"coveralls": "npm run cover && istanbul-coveralls"
},
"dependencies": {
"async": "^2.1.4",
"convert-source-map": "^1.5.0",
"file-normalize": "^1.1.0",
"graceful-fs": "^4.1.6",
"object.defaults": "^1.0.0",
"through2": "^2.0.1",
"vinyl": "^1.2.0"
}
"vinyl": "^2.0.0"
},
"devDependencies": {
"eslint": "^1.10.3",
"eslint-config-gulp": "^2.0.0",
"expect": "^1.20.2",
"istanbul": "^0.4.3",
"istanbul-coveralls": "^1.0.3",
"jscs": "^2.4.0",
"jscs-preset-gulp": "^1.0.0",
"mississippi": "^1.3.0",
"mocha": "^3.2.0"
},
"keywords": [
"vinyl",
"sourcemap",
"gulp"
]
}
8 changes: 4 additions & 4 deletions test/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function makeFile() {
cwd: __dirname,
base: path.join(__dirname, 'assets'),
path: path.join(__dirname, 'assets', 'helloworld.js'),
contents: new Buffer(sourceContent)
contents: new Buffer(sourceContent),
});
}

Expand All @@ -30,7 +30,7 @@ function makeSourcemap() {
sourceRoot: path.join(__dirname, 'assets'),
sources: ['test1.js', 'test2.js'],
sourcesContent: ['console.log("line 1.1");\nconsole.log("line 1.2");\n', 'console.log("line 2.1");\nconsole.log("line 2.2");'],
version: 3
version: 3,
};
}

Expand All @@ -40,7 +40,7 @@ function makeFileWithInlineSourceMap() {
cwd: __dirname,
base: path.join(__dirname, 'assets'),
path: path.join(__dirname, 'assets', 'all.js'),
contents: new Buffer('console.log("line 1.1"),console.log("line 1.2"),console.log("line 2.1"),console.log("line 2.2");\n' + inline)
contents: new Buffer('console.log("line 1.1"),console.log("line 1.2"),console.log("line 2.1"),console.log("line 2.2");\n' + inline),
});
}

Expand Down Expand Up @@ -233,7 +233,7 @@ describe('add', function() {
});
});

it('loads external sourcemap by filename if no source mapping comment', function (done) {
it('loads external sourcemap by filename if no source mapping comment', function(done) {
var file = makeFile();
file.path = file.path.replace('helloworld.js', 'helloworld2.js');
sourcemaps.add(file, function(err, data) {
Expand Down
4 changes: 2 additions & 2 deletions test/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function makeSourceMap() {
names: [],
mappings: '',
sources: ['helloworld.js'],
sourcesContent: [sourceContent]
sourcesContent: [sourceContent],
};
}

Expand All @@ -39,7 +39,7 @@ function makeNestedFile() {
cwd: __dirname,
base: path.join(__dirname, 'assets'),
path: path.join(__dirname, 'assets', 'dir1', 'dir2', 'helloworld.js'),
contents: new Buffer(sourceContent)
contents: new Buffer(sourceContent),
});
file.sourceMap = makeSourceMap();
return file;
Expand Down

0 comments on commit 952a521

Please sign in to comment.