Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

Commit

Permalink
Service Framework Diff #1.5 - Validation Script
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshvarun committed Aug 28, 2015
1 parent a0778c3 commit fbbc130
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
33 changes: 33 additions & 0 deletions pkg/nuclide/service-parser/bin/validate
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env node --harmony

/*
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the license found in the LICENSE file in
* the root directory of this source tree.
*/

// Load nuclide-node-transpiler to start transpiling.
require('nuclide-node-transpiler');

// Load the service parser module.
var serviceParser = require('../lib/main');

// There must be exactly one argument.
if (process.argv.length !== 3) {
console.error('No file specified. Usage: <file>');
process.exit(1);
}

try {
// Try to generate a proxy from the file.
var file = process.argv[2];
var fakeClient = {};
var proxy = serviceParser.getProxy(require('path').resolve(file), fakeClient);
} catch (e) {
// Proxy generation failed.
console.error('Failed to validate ' + file);
console.error(e.stack);
process.exit(1);
}
4 changes: 4 additions & 0 deletions pkg/nuclide/service-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
"devDependencies": {
"nuclide-external-interfaces": "0.0.0",
"nuclide-jasmine": "0.0.0",
"nuclide-node-transpiler": "0.0.0",
"nuclide-test-helpers": "0.0.0"
},
"bin": {
"validate": "bin/validate"
},
"scripts": {
"test": "node --harmony node_modules/.bin/jasmine-node-transpiled spec"
}
Expand Down

0 comments on commit fbbc130

Please sign in to comment.