Skip to content

Commit 28db4a4

Browse files
committed
[js] Use the gendocs script from the deploy script
Can't believe I didn't do this before
1 parent 9bcba27 commit 28db4a4

File tree

1 file changed

+3
-68
lines changed

1 file changed

+3
-68
lines changed

javascript/node/deploy.js

Lines changed: 3 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var assert = require('assert'),
2828
vm = require('vm');
2929

3030
var optparse = require('./optparse');
31+
var gendocs = require('./gendocs');
3132

3233

3334
/**
@@ -121,71 +122,6 @@ function copyResources(outputDirPath, resources, exclusions) {
121122
}
122123

123124

124-
function generateDocs(outputDir, callback) {
125-
var libDir = path.join(outputDir, 'lib');
126-
127-
var excludedDirs = [
128-
path.join(outputDir, 'example'),
129-
path.join(libDir, 'test'),
130-
path.join(outputDir, 'test')
131-
];
132-
133-
var excludedFiles = [
134-
path.join(libDir, 'safari/client.js'),
135-
];
136-
137-
var endsWith = function(str, suffix) {
138-
var l = str.length - suffix.length;
139-
return l >= 0 && str.indexOf(suffix, l) == l;
140-
};
141-
142-
var getFiles = function(dir) {
143-
var files = [];
144-
fs.readdirSync(dir).forEach(function(file) {
145-
file = path.join(dir, file);
146-
if (fs.statSync(file).isDirectory() &&
147-
excludedDirs.indexOf(file) == -1) {
148-
files = files.concat(getFiles(file));
149-
} else if (endsWith(path.basename(file), '.js') &&
150-
excludedFiles.indexOf(file) == -1) {
151-
files.push(file);
152-
}
153-
});
154-
return files;
155-
};
156-
157-
var moduleFiles = getFiles(outputDir).filter(function(file) {
158-
return file.indexOf(path.join(outputDir, 'test')) == -1;
159-
});
160-
161-
var output = outputDir + '-docs';
162-
var config = {
163-
'output': output,
164-
'customPages': [
165-
{'name': 'Changes', 'path': path.join(outputDir, 'CHANGES.md')}
166-
],
167-
'readme': path.join(outputDir, 'README.md'),
168-
'language': 'ES6_STRICT',
169-
'modules': moduleFiles,
170-
'excludes': [
171-
path.join(outputDir, 'docs'),
172-
path.join(outputDir, 'node_modules')
173-
],
174-
'typeFilters': ['goog']
175-
};
176-
177-
var configFile = output + '.json';
178-
fs.writeFileSync(configFile, JSON.stringify(config), 'utf8');
179-
180-
var command = [
181-
'java -jar', path.join(
182-
__dirname, '../../third_party/java/dossier/dossier-0.7.2.jar'),
183-
'-c', configFile
184-
].join(' ');
185-
child_process.exec(command, callback);
186-
}
187-
188-
189125
function main() {
190126
var parser = new optparse.OptionParser().
191127
path('output', { help: 'Path to the output directory' }).
@@ -219,9 +155,8 @@ function main() {
219155
console.log('Copying resource files...');
220156
copyResources(options.output, options.resource, options.exclude_resource);
221157
console.log('Generating documentation...');
222-
generateDocs(options.output, function(e) {
223-
if (e) throw e;
224-
console.log('ALL DONE');
158+
gendocs().then(() => console.log('ALL DONE'), function(e) {
159+
setTimeout(() => {throw e}, 0);
225160
});
226161
}
227162

0 commit comments

Comments
 (0)