Skip to content

Commit 2e6ff86

Browse files
refactor: use a src/ directory (#105)
1 parent d34a901 commit 2e6ff86

File tree

8 files changed

+13
-29
lines changed

8 files changed

+13
-29
lines changed

.npmignore

-3
This file was deleted.

package.json

+7-20
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88
"node": ">=6.0.0"
99
},
1010
"repository": "googleapis/nodejs-proto-files",
11-
"main": "index.js",
11+
"main": "src/index.js",
1212
"files": [
1313
"google/",
14-
"index.js",
15-
"load.js"
14+
"src"
1615
],
1716
"keywords": [
1817
"google",
@@ -21,17 +20,6 @@
2120
"protocol buffer",
2221
"grpc"
2322
],
24-
"standard": {
25-
"global": [
26-
"before",
27-
"describe",
28-
"it"
29-
],
30-
"ignore": [
31-
"google/",
32-
"overrides/"
33-
]
34-
},
3523
"contributors": [
3624
"Alexander Fenster <[email protected]>",
3725
"Dave Gramlich <[email protected]>",
@@ -43,14 +31,13 @@
4331
],
4432
"scripts": {
4533
"generate-scaffolding": "repo-tools generate all",
46-
"prepublishOnly": "node ./prepublish.js",
47-
"lint": "eslint ./ test/",
48-
"mocha": "mocha -R spec test/*.test.js",
49-
"pretest": "node ./prepublish.js",
34+
"prepare": "node ./tools/prepublish.js",
35+
"prepublish": "npm run prepare",
36+
"lint": "eslint '**/*.js'",
37+
"mocha": "nyc mocha",
5038
"test": "npm run cover",
5139
"cover": "nyc --reporter=lcov mocha test/*.js && nyc report",
52-
"test-no-cover": "mocha test/*.js",
53-
"prettier": "prettier --write *.js test/*.js",
40+
"fix": "npm run lint -- --fix",
5441
"system-test": "echo no system tests 😱",
5542
"samples-test": "echo no sample tests 😱",
5643
"docs": "echo no docs 🤷‍♂️"

index.js renamed to src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const loader = require('./load');
55

66
const googleProtoFiles = (module.exports = function() {
77
const args = [].slice.call(arguments);
8-
return path.join.apply(null, [__dirname, 'google'].concat(args));
8+
return path.join.apply(null, [__dirname, '../', 'google'].concat(args));
99
});
1010

1111
module.exports.load = loader.load;

load.js renamed to src/load.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class GoogleProtoFilesRoot extends protobuf.Root {
2626
];
2727

2828
const commonProtoGlobPatterns = commonProtoDirs.map(dir =>
29-
path.join(__dirname, 'google', dir, '**', '*.proto')
29+
path.join(__dirname, '../', 'google', dir, '**', '*.proto')
3030
);
3131

3232
if (!COMMON_PROTO_FILES) {

test/index.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const assert = require('assert');
44
const path = require('path');
5-
const googleProtoFiles = require('../');
5+
const googleProtoFiles = require('../src');
66

77
function resolve(protoPath) {
88
return path.join(__dirname, '../google', protoPath);

test/load.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const assert = require('assert');
4-
const googleProtoFiles = require('../');
4+
const googleProtoFiles = require('../src');
55
const path = require('path');
66
const protobuf = require('protobufjs');
77

test/prepublish.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const decompressZipMock = sinon.stub();
2323

2424
describe('prepublish', function() {
2525
before(function() {
26-
proxyquire('../prepublish', {
26+
proxyquire('../tools/prepublish', {
2727
child_process: childProcessMock,
2828
'decompress-zip': decompressZipMock,
2929
fs: {

prepublish.js renamed to tools/prepublish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async.series(
4040

4141
function(next) {
4242
extract(
43-
'https://github.com/google/googleapis/archive/master.zip',
43+
'https://github.com/googleapis/googleapis/archive/master.zip',
4444
{
4545
strip: 1,
4646
},

0 commit comments

Comments
 (0)