Skip to content

Commit 2a4d182

Browse files
committed
Change process to reading instead of requiring package.json
1 parent 5f7b390 commit 2a4d182

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

package.js

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
var path = require("path");
22
var fs = require("fs");
33

4-
var typeConverters = {
5-
stache: 'html',
6-
mustache: 'html',
7-
component: 'html'
8-
};
9-
10-
var convertType = function(type) {
11-
return typeConverters[type] || type;
12-
};
13-
144
module.exports = {
155
add: function(line, curData, scope, objects, currentWrite) {
16-
var sourcePath = path.join(path.dirname(this.src.path));
17-
var pkgPath = line.split(' ')[1];
18-
var pkg = require(path.join(sourcePath, pkgPath));
19-
curData.package = pkg;
6+
var pkgPath = path.join(path.dirname(this.src.path), line.replace("@package", "").trim());
7+
var pkg = fs.readFileSync(pkgPath).toString();
8+
curData.package = JSON.parse(pkg);
209
}
2110
};

test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var pkg = require("../package");
33
var path = require("path");
44
var assert = require("assert");
55

6-
describe("sourceref", function() {
6+
describe("package", function() {
77
it("adds the package.json info", function() {
88
var docMap = {};
99

0 commit comments

Comments
 (0)