First pass at build-shred-map complete
This commit is contained in:
parent
713a428bb6
commit
64ea3b6f9a
21
gulpfile.js
21
gulpfile.js
|
@ -3,13 +3,14 @@ var watch = require('gulp-watch');
|
||||||
var gutil = require('gulp-util');
|
var gutil = require('gulp-util');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var del = require('del');
|
var del = require('del');
|
||||||
|
var _ = require('lodash');
|
||||||
|
|
||||||
var docShredder = require('./public/doc-shredder/doc-shredder');
|
var docShredder = require('./public/doc-shredder/doc-shredder');
|
||||||
|
|
||||||
var _shredOptions = {
|
var _shredOptions = {
|
||||||
basePath: path.resolve('./public/docs'),
|
basePath: path.resolve('./public/docs'),
|
||||||
sourceDir: "_examples",
|
examplesDir: "_examples",
|
||||||
destDir: "_fragments"
|
fragmentsDir: "_fragments"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -42,19 +43,29 @@ gulp.task('serve-and-watch', function (cb) {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('shred-full', ['shred-clean'], function() {
|
gulp.task('shred-full', ['shred-clean'], function() {
|
||||||
docShredder.shred( _shredOptions);
|
return docShredder.shred( _shredOptions);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('shred-clean', function(cb) {
|
gulp.task('shred-clean', function(cb) {
|
||||||
var cleanPath = path.join(_shredOptions.basePath, _shredOptions.destDir, '**/*.*')
|
var cleanPath = path.join(_shredOptions.basePath, _shredOptions.fragmentsDir, '**/*.*')
|
||||||
del([ cleanPath, '!**/*.ovr.*'], function (err, paths) {
|
del([ cleanPath, '!**/*.ovr.*'], function (err, paths) {
|
||||||
// console.log('Deleted files/folders:\n', paths.join('\n'));
|
// console.log('Deleted files/folders:\n', paths.join('\n'));
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
gulp.task('build-shred-maps', ['shred-full'], function() {
|
||||||
|
var options = _.extend(_shredOptions, {
|
||||||
|
jadeDir: '.',
|
||||||
|
outputDir: '.'
|
||||||
|
});
|
||||||
|
return docShredder.buildShredMap(options).then(function(x) {
|
||||||
|
// var json = x[2];
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
function shredWatch(shredOptions, postShredAction) {
|
function shredWatch(shredOptions, postShredAction) {
|
||||||
var pattern = path.join(shredOptions.basePath, shredOptions.sourceDir, "**/*.*");
|
var pattern = path.join(shredOptions.basePath, shredOptions.examplesDir, "**/*.*");
|
||||||
watch([pattern], function (event, done) {
|
watch([pattern], function (event, done) {
|
||||||
console.log('Event type: ' + event.event); // added, changed, or deleted
|
console.log('Event type: ' + event.event); // added, changed, or deleted
|
||||||
console.log('Event path: ' + event.path); // The path of the modified file
|
console.log('Event path: ' + event.path); // The path of the modified file
|
||||||
|
|
|
@ -7,28 +7,7 @@ var delPromise = Q.denodeify(del);
|
||||||
var Dgeni = require('dgeni');
|
var Dgeni = require('dgeni');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
|
|
||||||
var resolveShredOptions = function(shredOptions) {
|
|
||||||
return _.defaults({}, shredOptions, {
|
|
||||||
basePath: path.resolve('.'),
|
|
||||||
// read files from any subdir under here
|
|
||||||
sourceDir: "docs/_examples",
|
|
||||||
// shredded files get copied here with same subdir structure.
|
|
||||||
destDir: "docs/_fragments",
|
|
||||||
// whether to include subdirectories when shredding.
|
|
||||||
includeSubdirs: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var resolveMapOptions = function(mapOptions) {
|
|
||||||
return _.defaults({}, mapOptions, {
|
|
||||||
basePath: path.resolve('.'),
|
|
||||||
// read files from any subdir under here
|
|
||||||
sourceDir: "docs",
|
|
||||||
destDir: "docs",
|
|
||||||
// whether to include subdirectories when shredding.
|
|
||||||
includeSubdirs: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var shred = function(shredOptions) {
|
var shred = function(shredOptions) {
|
||||||
try {
|
try {
|
||||||
|
@ -42,26 +21,26 @@ var shred = function(shredOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var shredSingleDir = function(shredOptions, filePath) {
|
var shredSingleDir = function(shredOptions, filePath) {
|
||||||
shredOptions = resolveOptions(shredOptions);
|
shredOptions = resolveShredOptions(shredOptions);
|
||||||
var root = path.resolve(shredOptions.basePath, shredOptions.sourceDir);
|
var root = path.resolve(shredOptions.basePath, shredOptions.examplesDir);
|
||||||
var fileDir = path.dirname(filePath);
|
var fileDir = path.dirname(filePath);
|
||||||
var relativePath = path.relative(root, fileDir);
|
var relativePath = path.relative(root, fileDir);
|
||||||
var sourceDir = path.join(shredOptions.sourceDir, relativePath);
|
var examplesDir = path.join(shredOptions.examplesDir, relativePath);
|
||||||
var destDir = path.join(shredOptions.destDir, relativePath);
|
var fragmentsDir = path.join(shredOptions.fragmentsDir, relativePath);
|
||||||
var options = {
|
var options = {
|
||||||
basePath: shredOptions.basePath,
|
basePath: shredOptions.basePath,
|
||||||
includeSubdirs: false,
|
includeSubdirs: false,
|
||||||
sourceDir: sourceDir,
|
examplesDir: examplesDir,
|
||||||
destDir: destDir
|
fragmentsDir: fragmentsDir
|
||||||
}
|
}
|
||||||
var cleanPath = path.join(shredOptions.basePath, destDir, '*.*')
|
var cleanPath = path.join(shredOptions.basePath, fragmentsDir, '*.*')
|
||||||
return delPromise([ cleanPath, '!**/*.ovr.*']).then(function(paths) {
|
return delPromise([ cleanPath, '!**/*.ovr.*']).then(function(paths) {
|
||||||
// console.log('Deleted files/folders:\n', paths.join('\n'));
|
// console.log('Deleted files/folders:\n', paths.join('\n'));
|
||||||
return shred(options);
|
return shred(options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var getShredMap = function(shredMapOptions) {
|
var buildShredMap = function(shredMapOptions) {
|
||||||
try {
|
try {
|
||||||
var pkg = createShredMapPackage(shredMapOptions);
|
var pkg = createShredMapPackage(shredMapOptions);
|
||||||
var dgeni = new Dgeni([ pkg]);
|
var dgeni = new Dgeni([ pkg]);
|
||||||
|
@ -73,11 +52,11 @@ var getShredMap = function(shredMapOptions) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
shred: shred,
|
shred: shred,
|
||||||
shredSingleDir: shredSingleDir,
|
shredSingleDir: shredSingleDir,
|
||||||
resolveShredOptions: resolveShredOptions,
|
buildShredMap: buildShredMap
|
||||||
getShredMap: getShredMap
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function createShredPackage(shredOptions) {
|
function createShredPackage(shredOptions) {
|
||||||
|
@ -103,9 +82,9 @@ function createShredPackage(shredOptions) {
|
||||||
var extns = ['*.js', '*.html', '*.ts', '*.css' ];
|
var extns = ['*.js', '*.html', '*.ts', '*.css' ];
|
||||||
var includeFiles = extns.map(function(extn) {
|
var includeFiles = extns.map(function(extn) {
|
||||||
if (options.includeSubdirs) {
|
if (options.includeSubdirs) {
|
||||||
return path.join(options.sourceDir, '**', extn);
|
return path.join(options.examplesDir, '**', extn);
|
||||||
} else {
|
} else {
|
||||||
return path.join(options.sourceDir, extn);
|
return path.join(options.examplesDir, extn);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
readFilesProcessor.sourceFiles = [ {
|
readFilesProcessor.sourceFiles = [ {
|
||||||
|
@ -113,18 +92,18 @@ function createShredPackage(shredOptions) {
|
||||||
include: includeFiles,
|
include: includeFiles,
|
||||||
// When calculating the relative path to these files use this as the base path.
|
// When calculating the relative path to these files use this as the base path.
|
||||||
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
|
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
|
||||||
basePath: options.sourceDir
|
basePath: options.examplesDir
|
||||||
} ];
|
} ];
|
||||||
})
|
})
|
||||||
.config(function(writeFilesProcessor) {
|
.config(function(writeFilesProcessor) {
|
||||||
// Specify where the writeFilesProcessor will write our generated doc files
|
// Specify where the writeFilesProcessor will write our generated doc files
|
||||||
writeFilesProcessor.outputFolder = options.destDir;
|
writeFilesProcessor.outputFolder = options.fragmentsDir;
|
||||||
});
|
});
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
var createShredMapPackage = function(mapOptions) {
|
var createShredMapPackage = function(mapOptions) {
|
||||||
var pkg = new Dgeni.Package('docshred-mapper', [
|
var pkg = new Dgeni.Package('doc-shred-mapper', [
|
||||||
require('dgeni-packages/base'),
|
require('dgeni-packages/base'),
|
||||||
require('dgeni-packages/nunjucks')
|
require('dgeni-packages/nunjucks')
|
||||||
]);
|
]);
|
||||||
|
@ -133,7 +112,9 @@ var createShredMapPackage = function(mapOptions) {
|
||||||
initializePackage(pkg)
|
initializePackage(pkg)
|
||||||
.factory(require('./extractPathsReader'))
|
.factory(require('./extractPathsReader'))
|
||||||
.processor(require('./shredMapProcessor'))
|
.processor(require('./shredMapProcessor'))
|
||||||
|
.config(function(shredMapProcessor) {
|
||||||
|
shredMapProcessor.options = options;
|
||||||
|
})
|
||||||
.config(function(readFilesProcessor, extractPathsReader ) {
|
.config(function(readFilesProcessor, extractPathsReader ) {
|
||||||
readFilesProcessor.fileReaders = [ extractPathsReader];
|
readFilesProcessor.fileReaders = [ extractPathsReader];
|
||||||
})
|
})
|
||||||
|
@ -146,9 +127,9 @@ var createShredMapPackage = function(mapOptions) {
|
||||||
var extns = ['*.jade' ];
|
var extns = ['*.jade' ];
|
||||||
var includeFiles = extns.map(function(extn) {
|
var includeFiles = extns.map(function(extn) {
|
||||||
if (options.includeSubdirs) {
|
if (options.includeSubdirs) {
|
||||||
return path.join(options.sourceDir, '**', extn);
|
return path.join(options.jadeDir, '**', extn);
|
||||||
} else {
|
} else {
|
||||||
return path.join(options.sourceDir, extn);
|
return path.join(options.jadeDir, extn);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
readFilesProcessor.sourceFiles = [ {
|
readFilesProcessor.sourceFiles = [ {
|
||||||
|
@ -156,15 +137,15 @@ var createShredMapPackage = function(mapOptions) {
|
||||||
include: includeFiles,
|
include: includeFiles,
|
||||||
// When calculating the relative path to these files use this as the base path.
|
// When calculating the relative path to these files use this as the base path.
|
||||||
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
|
// So `src/foo/bar.js` will have relative path of `foo/bar.js`
|
||||||
basePath: options.sourceDir
|
basePath: options.jadeDir
|
||||||
} ];
|
} ];
|
||||||
})
|
})
|
||||||
.config(function(writeFilesProcessor) {
|
.config(function(writeFilesProcessor) {
|
||||||
// Specify where the writeFilesProcessor will write our generated doc files
|
// Specify where the writeFilesProcessor will write our generated doc files
|
||||||
writeFilesProcessor.outputFolder = options.destDir;
|
writeFilesProcessor.outputFolder = options.outputDir;
|
||||||
})
|
})
|
||||||
.config(function(templateFinder) {
|
.config(function(templateFinder) {
|
||||||
// Add a folder to search for our own templates to use when rendering docs
|
// look for templates in this folder
|
||||||
templateFinder.templateFolders = [ path.resolve(__dirname) ];
|
templateFinder.templateFolders = [ path.resolve(__dirname) ];
|
||||||
|
|
||||||
// Specify how to match docs to templates.
|
// Specify how to match docs to templates.
|
||||||
|
@ -174,6 +155,7 @@ var createShredMapPackage = function(mapOptions) {
|
||||||
.config(function(computePathsProcessor, computeIdsProcessor) {
|
.config(function(computePathsProcessor, computeIdsProcessor) {
|
||||||
computePathsProcessor.$enabled = false;
|
computePathsProcessor.$enabled = false;
|
||||||
computeIdsProcessor.$enabled = false;
|
computeIdsProcessor.$enabled = false;
|
||||||
|
// Unused for now.
|
||||||
//computePathsProcessor.pathTemplates.push({
|
//computePathsProcessor.pathTemplates.push({
|
||||||
// docTypes: ['foo'],
|
// docTypes: ['foo'],
|
||||||
// pathTemplate: '',
|
// pathTemplate: '',
|
||||||
|
@ -192,6 +174,30 @@ var createShredMapPackage = function(mapOptions) {
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resolveShredOptions(shredOptions) {
|
||||||
|
return _.defaults({}, shredOptions, {
|
||||||
|
basePath: path.resolve('.'),
|
||||||
|
// read files from any subdir under here
|
||||||
|
examplesDir: "docs/_examples",
|
||||||
|
// shredded files get copied here with same subdir structure.
|
||||||
|
fragmentsDir: "docs/_fragments",
|
||||||
|
// whether to include subdirectories when shredding.
|
||||||
|
includeSubdirs: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveMapOptions(mapOptions) {
|
||||||
|
return _.defaults({}, mapOptions, {
|
||||||
|
basePath: path.resolve('.'),
|
||||||
|
// read files from any subdir under here
|
||||||
|
jadeDir: "docs",
|
||||||
|
fragmentsDir: "docs/_fragments",
|
||||||
|
examplesDir: "docs/_examples",
|
||||||
|
// whether to include subdirectories when shredding.
|
||||||
|
includeSubdirs: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function initializePackage(pkg) {
|
function initializePackage(pkg) {
|
||||||
return pkg
|
return pkg
|
||||||
.processor(require('dgeni-packages/base/processors/read-files'))
|
.processor(require('dgeni-packages/base/processors/read-files'))
|
||||||
|
|
|
@ -1,29 +1,30 @@
|
||||||
/**
|
/**
|
||||||
* @dgService htmlFileShredder
|
* @dgService extractPathsReader
|
||||||
* @description
|
* @description
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var path = require('canonical-path');
|
var path = require('canonical-path');
|
||||||
|
|
||||||
module.exports = function extractPathsReader(log) {
|
module.exports = function extractPathsReader(log) {
|
||||||
|
// regex for makeTabs line
|
||||||
var rx = /\s*\+makeTabs\(\s*["'](.*?)["']\s*,\s*["'](.*?)["'].*?\)/g
|
var rx = /\s*\+makeTabs\(\s*["'](.*?)["']\s*,\s*["'](.*?)["'].*?\)/g
|
||||||
return {
|
return {
|
||||||
name: 'extractPathsReader',
|
name: 'extractPathsReader',
|
||||||
|
|
||||||
getDocs: function (fileInfo) {
|
getDocs: function (fileInfo) {
|
||||||
var content = fileInfo.content;
|
var content = fileInfo.content;
|
||||||
var refPaths = [];
|
var fragPaths = [];
|
||||||
var r;
|
var r;
|
||||||
while ((r = rx.exec(content)) !== null) {
|
while ((r = rx.exec(content)) !== null) {
|
||||||
var basePath = r[1];
|
var basePath = r[1];
|
||||||
var fileNames = r[2].split(',');
|
var fileNames = r[2].split(',');
|
||||||
fileNames.forEach(function(fn) {
|
fileNames.forEach(function(fn) {
|
||||||
refPaths.push(path.join(basePath, fn));
|
fragPaths.push(path.join(basePath, fn.trim()));
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (refPaths.length) {
|
if (fragPaths.length) {
|
||||||
return [{
|
return [{
|
||||||
refPaths: refPaths
|
fragPaths: fragPaths
|
||||||
}];
|
}];
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
|
|
|
@ -29,6 +29,7 @@ module.exports = function regionExtractor() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var rx = new RegExp(nullLine + '\n', 'g');
|
||||||
docs.forEach(function(doc) {
|
docs.forEach(function(doc) {
|
||||||
var content;
|
var content;
|
||||||
if (doc.endIx) {
|
if (doc.endIx) {
|
||||||
|
@ -37,8 +38,7 @@ module.exports = function regionExtractor() {
|
||||||
content = lines.slice(doc.startIx + 1).join('\n');
|
content = lines.slice(doc.startIx + 1).join('\n');
|
||||||
}
|
}
|
||||||
// eliminate all #docregion lines
|
// eliminate all #docregion lines
|
||||||
var rx = new RegExp(nullLine + '\n', 'g');
|
content = content.replace(rx, '');
|
||||||
var content = content.replace(rx, '');
|
|
||||||
if (content.substr(-3) === nullLine) {
|
if (content.substr(-3) === nullLine) {
|
||||||
content = content.substr(0, content.length-3);
|
content = content.substr(0, content.length-3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,28 +3,53 @@
|
||||||
* @description
|
* @description
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
var path = require('canonical-path');
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
module.exports = function shredMapProcessor(log) {
|
module.exports = function shredMapProcessor(log) {
|
||||||
return {
|
return {
|
||||||
$runAfter: ['readFilesProcessor'],
|
$runAfter: ['readFilesProcessor'],
|
||||||
$runBefore: ['rendering-docs'],
|
$runBefore: ['rendering-docs'],
|
||||||
|
|
||||||
$process: function(docs) {
|
$process: function(docs) {
|
||||||
var docMaps = []
|
var options = this.options;
|
||||||
|
var jadeToFragMap = {};
|
||||||
|
var fragToJadeMap = {};
|
||||||
docs.forEach(function(doc) {
|
docs.forEach(function(doc) {
|
||||||
var docMap = {
|
var jadePath = path.join(options.jadeDir, doc.fileInfo.relativePath);
|
||||||
jadePath: doc.fileInfo.filePath,
|
var fragInfos = doc.fragPaths.map(function(fragPath) {
|
||||||
jadeRelativePath: doc.fileInfo.projectRelativePath,
|
fragPath = path.join(options.fragmentsDir, fragPath) + '.md';
|
||||||
refPaths: doc.refPaths
|
var fullPath = path.join(options.basePath, fragPath);
|
||||||
}
|
var fragInfo = { fragPath: fragPath, exists: fs.existsSync(fullPath) };
|
||||||
docMaps.push(docMap);
|
if (fragInfo.exists) {
|
||||||
|
var jadePaths = fragToJadeMap[fragInfo];
|
||||||
|
if (!jadePaths) {
|
||||||
|
jadePaths = [];
|
||||||
|
fragToJadeMap[fragPath] = jadePaths;
|
||||||
|
}
|
||||||
|
jadePaths.push(jadePath);
|
||||||
|
}
|
||||||
|
return fragInfo;
|
||||||
|
});
|
||||||
|
jadeToFragMap[jadePath] = fragInfos;
|
||||||
});
|
});
|
||||||
var newDocs = [{
|
var newDocs = [{
|
||||||
docType: 'xref-doc.html',
|
docType: 'xref-jade.html',
|
||||||
docMaps: docMaps,
|
basePath: this.options.basePath,
|
||||||
outputPath: 'xref-doc.html'
|
jadeToFragMap: jadeToFragMap,
|
||||||
|
outputPath: 'xref-jade-to-frag.html'
|
||||||
}, {
|
}, {
|
||||||
docType: 'xref-doc.js',
|
docType: 'xref-frag.html',
|
||||||
json: JSON.stringify(docMaps),
|
basePath: this.options.basePath,
|
||||||
outputPath: 'xref-doc.js'
|
fragToJadeMap: fragToJadeMap,
|
||||||
|
outputPath: 'xref-frag-to-jade.html'
|
||||||
|
}, {
|
||||||
|
docType: 'xref-doc.json',
|
||||||
|
json: JSON.stringify({
|
||||||
|
basePath: this.options.basePath,
|
||||||
|
jadeToFragMap: jadeToFragMap,
|
||||||
|
}, null, 2),
|
||||||
|
outputPath: 'xref-jade.json'
|
||||||
}]
|
}]
|
||||||
return newDocs;
|
return newDocs;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,17 @@ var watch = require('gulp-watch');
|
||||||
|
|
||||||
var docShredder = require('../doc-shredder');
|
var docShredder = require('../doc-shredder');
|
||||||
|
|
||||||
var shredOptions = docShredder.resolveShredOptions({
|
var shredOptions = {
|
||||||
sourceDir: "test_source",
|
examplesDir: "test_source",
|
||||||
destDir: "test_fragments"
|
fragmentsDir: "test_fragments"
|
||||||
});
|
};
|
||||||
|
|
||||||
gulp.task('shred', function() {
|
gulp.task('shred', function() {
|
||||||
return docShredder.shred(shredOptions);
|
return docShredder.shred(shredOptions);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('clean', function (cb) {
|
gulp.task('clean', function (cb) {
|
||||||
var cleanPath = path.join(shredOptions.destDir, '**/*.*')
|
var cleanPath = path.join(shredOptions.fragmentsDir, '**/*.*')
|
||||||
del([ cleanPath, '!**/*.ovr.*'], function (err, paths) {
|
del([ cleanPath, '!**/*.ovr.*'], function (err, paths) {
|
||||||
// console.log('Deleted files/folders:\n', paths.join('\n'));
|
// console.log('Deleted files/folders:\n', paths.join('\n'));
|
||||||
cb();
|
cb();
|
||||||
|
@ -24,7 +24,7 @@ gulp.task('clean', function (cb) {
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('watch', function (cb) {
|
gulp.task('watch', function (cb) {
|
||||||
var pattern = path.join(shredOptions.sourceDir, "**/*.*");
|
var pattern = path.join(shredOptions.examplesDir, "**/*.*");
|
||||||
watch([ pattern], function(event, done) {
|
watch([ pattern], function(event, done) {
|
||||||
console.log('Event type: ' + event.event); // added, changed, or deleted
|
console.log('Event type: ' + event.event); // added, changed, or deleted
|
||||||
console.log('Event path: ' + event.path); // The path of the modified file
|
console.log('Event path: ' + event.path); // The path of the modified file
|
||||||
|
@ -34,10 +34,12 @@ gulp.task('watch', function (cb) {
|
||||||
|
|
||||||
gulp.task('map', function() {
|
gulp.task('map', function() {
|
||||||
var options = {
|
var options = {
|
||||||
sourceDir: 'test_jade',
|
jadeDir: 'test_jade',
|
||||||
destDir: 'test_jade'
|
examplesDir: 'test_source',
|
||||||
|
fragmentsDir: 'test_fragments',
|
||||||
|
outputDir: '.'
|
||||||
}
|
}
|
||||||
return docShredder.getShredMap(options).then(function(x) {
|
return docShredder.buildShredMap(options).then(function(x) {
|
||||||
var docMaps = x.docMaps;
|
var docMaps = x.docMaps;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
# Jade file -> Example file cross references
|
|
||||||
|
|
||||||
Jade file: - C:/xxx/yyy/zzz
|
|
||||||
References:
|
|
||||||
- a/b/c
|
|
||||||
- b/d/e
|
|
|
@ -36,7 +36,7 @@ include ../../../../_includes/_util-fns
|
||||||
|
|
||||||
The TypeScript setup includes System.js, a third-party open-source library that adds ES6 module loading functionality to browsers. This step isn't needed for the ES5 version.
|
The TypeScript setup includes System.js, a third-party open-source library that adds ES6 module loading functionality to browsers. This step isn't needed for the ES5 version.
|
||||||
|
|
||||||
+makeTabs('gettingstarted', 'ts/index.html,js/index.html', 'TypeScript, JavaScript')
|
+makeTabs('gettingstarted', 'ts/index2.html,js/index.html', 'TypeScript, JavaScript')
|
||||||
|
|
||||||
.callout.is-helpful
|
.callout.is-helpful
|
||||||
header Don't use code.angularjs.org in a live app
|
header Don't use code.angularjs.org in a live app
|
||||||
|
@ -52,7 +52,7 @@ include ../../../../_includes/_util-fns
|
||||||
`<my-app>` element in `index.html`, and call Angular's `bootstrap()` to kick
|
`<my-app>` element in `index.html`, and call Angular's `bootstrap()` to kick
|
||||||
it all off like this:
|
it all off like this:
|
||||||
|
|
||||||
+makeTabs("gettingstarted", "ts/main.ts, js/main.js", "TypeScript, JavaScript")
|
+makeTabs("gettingstarted", "ts/main.ts, js/main2.js", "TypeScript, JavaScript")
|
||||||
|
|
||||||
.callout.is-helpful
|
.callout.is-helpful
|
||||||
header Annotations vs Decorators
|
header Annotations vs Decorators
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
<h1> Jade document --> example Cross Reference Report
|
|
||||||
|
|
||||||
<ol>
|
|
||||||
<li>
|
|
||||||
Jade file: <strong>test_jade/guides/setupAlt2.jade</strong>
|
|
||||||
<p>Reference paths</p>
|
|
||||||
<ul>
|
|
||||||
<li>Path: gettingstarted/ts/index.html</li>
|
|
||||||
<li>Path: gettingstarted/js/index.html</li>
|
|
||||||
<li>Path: gettingstarted/ts/main.ts</li>
|
|
||||||
<li>Path: gettingstarted/ js/main.js</li>
|
|
||||||
<li>Path: gettingstarted/ts/main-import.ts</li>
|
|
||||||
</ul>
|
|
||||||
<br>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Jade file: <strong>test_jade/setupAlt.jade</strong>
|
|
||||||
<p>Reference paths</p>
|
|
||||||
<ul>
|
|
||||||
<li>Path: gettingstarted/ts/index.html</li>
|
|
||||||
<li>Path: gettingstarted/js/index.html</li>
|
|
||||||
<li>Path: gettingstarted/ts/main.ts</li>
|
|
||||||
<li>Path: gettingstarted/ js/main.js</li>
|
|
||||||
<li>Path: gettingstarted/ts/main-import.ts</li>
|
|
||||||
</ul>
|
|
||||||
<br>
|
|
||||||
</li>
|
|
||||||
</ol>
|
|
|
@ -1 +0,0 @@
|
||||||
[{"jadePath":"c:/GitHub/angular.io.ideablade/public/doc-shredder/test/test_jade/guides/setupAlt2.jade","jadeRelativePath":"test_jade/guides/setupAlt2.jade","refPaths":["gettingstarted/ts/index.html","gettingstarted/js/index.html","gettingstarted/ts/main.ts","gettingstarted/ js/main.js","gettingstarted/ts/main-import.ts"]},{"jadePath":"c:/GitHub/angular.io.ideablade/public/doc-shredder/test/test_jade/setupAlt.jade","jadeRelativePath":"test_jade/setupAlt.jade","refPaths":["gettingstarted/ts/index.html","gettingstarted/js/index.html","gettingstarted/ts/main.ts","gettingstarted/ js/main.js","gettingstarted/ts/main-import.ts"]}]
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<!-- #docregion -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="https://code.angularjs.org/2.0.0-alpha.26/angular2.sfx.dev.js"></script>
|
||||||
|
<script src="main.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<my-app></my-app>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,17 @@
|
||||||
|
// #docregion
|
||||||
|
function AppComponent() {}
|
||||||
|
|
||||||
|
AppComponent.annotations = [
|
||||||
|
new angular.ComponentAnnotation({
|
||||||
|
selector: 'my-app'
|
||||||
|
}),
|
||||||
|
new angular.ViewAnnotation({
|
||||||
|
template: '<h1 id="output">My first Angular 2 App</h1>'
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
// #docregion bootstrap
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
angular.bootstrap(AppComponent);
|
||||||
|
});
|
||||||
|
// #enddocregion
|
|
@ -0,0 +1,20 @@
|
||||||
|
// protractor-spec.js
|
||||||
|
describe('Protractor quick start test', function() {
|
||||||
|
|
||||||
|
// #docregion javascript
|
||||||
|
it('should display Alice with JavaScript', function() {
|
||||||
|
browser.get('gettingstarted/js/index.html');
|
||||||
|
});
|
||||||
|
// #enddocregion
|
||||||
|
|
||||||
|
// #docregion typescript
|
||||||
|
it('should display Alice with TypeScrip', function() {
|
||||||
|
browser.get('gettingstarted/ts/index.html');
|
||||||
|
});
|
||||||
|
// #enddocregion
|
||||||
|
|
||||||
|
afterEach(function() {
|
||||||
|
expect(element(by.id('output')).getText()).toEqual('My first Angular 2 App');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<!-- #docregion -->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="https://github.jspm.io/jmcriffey/bower-traceur-runtime@0.0.87/traceur-runtime.js"></script>
|
||||||
|
<script src="https://jspm.io/system@0.16.js"></script>
|
||||||
|
<script src="https://code.angularjs.org/2.0.0-alpha.26/angular2.dev.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<my-app></my-app>
|
||||||
|
<script>
|
||||||
|
System.import('main');
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,33 @@
|
||||||
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
|
||||||
|
switch (arguments.length) {
|
||||||
|
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
|
||||||
|
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
|
||||||
|
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||||
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||||
|
};
|
||||||
|
// #docregion
|
||||||
|
// #docregion import
|
||||||
|
var angular2_1 = require('angular2/angular2');
|
||||||
|
// #enddocregion
|
||||||
|
var AppComponent = (function () {
|
||||||
|
function AppComponent() {
|
||||||
|
}
|
||||||
|
AppComponent = __decorate([
|
||||||
|
angular2_1.Component({
|
||||||
|
selector: 'my-app'
|
||||||
|
}),
|
||||||
|
angular2_1.View({
|
||||||
|
template: '<h1 id="output">My first Angular 2 App</h1>'
|
||||||
|
}),
|
||||||
|
__metadata('design:paramtypes', [])
|
||||||
|
], AppComponent);
|
||||||
|
return AppComponent;
|
||||||
|
})();
|
||||||
|
// #docregion bootstrap
|
||||||
|
angular2_1.bootstrap(AppComponent);
|
||||||
|
// #enddocregion
|
||||||
|
//# sourceMappingURL=main.js.map
|
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":["AppComponent","AppComponent.constructor"],"mappings":";;;;;;;;;;;AAEA,AAFA,UAAU;AACV,iBAAiB;AACjB,yBAAyC,mBAAmB,CAAC,CAAA;AAG7D,AAFA,aAAa;;IAEbA;IAOAC,CAACA;IAPDD;QAACA,oBAASA,CAACA;YACTA,QAAQA,EAAEA,QAAQA;SACnBA,CAACA;QACDA,eAAIA,CAACA;YACJA,QAAQA,EAAEA,6CAA6CA;SACxDA,CAACA;;qBAEDA;IAADA,mBAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,oBAAoB;AACpB,oBAAS,CAAC,YAAY,CAAC,CAAC;AACxB,aAAa"}
|
|
@ -0,0 +1,16 @@
|
||||||
|
// #docregion
|
||||||
|
// #docregion import
|
||||||
|
import {Component, View, bootstrap} from 'angular2/angular2';
|
||||||
|
// #enddocregion
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'my-app'
|
||||||
|
})
|
||||||
|
@View({
|
||||||
|
template: '<h1 id="output">My first Angular 2 App</h1>'
|
||||||
|
})
|
||||||
|
class AppComponent {
|
||||||
|
}
|
||||||
|
// #docregion bootstrap
|
||||||
|
bootstrap(AppComponent);
|
||||||
|
// #enddocregion
|
|
@ -0,0 +1,38 @@
|
||||||
|
<h1> Frament path to jade path cross reference report
|
||||||
|
|
||||||
|
<p>Base path: c:/GitHub/angular.io.ideablade/public/doc-shredder/test</p>
|
||||||
|
<ol>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
Fragment file: <strong>test_fragments/gettingstarted/ts/index.html.md</strong>
|
||||||
|
<p>Jade files</p>
|
||||||
|
<ul>
|
||||||
|
<li>test_jade/guides/setupAlt2.jade</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Fragment file: <strong>test_fragments/gettingstarted/js/index.html.md</strong>
|
||||||
|
<p>Jade files</p>
|
||||||
|
<ul>
|
||||||
|
<li>test_jade/setupAlt.jade</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Fragment file: <strong>test_fragments/gettingstarted/ts/main.ts.md</strong>
|
||||||
|
<p>Jade files</p>
|
||||||
|
<ul>
|
||||||
|
<li>test_jade/setupAlt.jade</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Fragment file: <strong>test_fragments/gettingstarted/ts/main-import.ts.md</strong>
|
||||||
|
<p>Jade files</p>
|
||||||
|
<ul>
|
||||||
|
<li>test_jade/setupAlt.jade</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
</ol>
|
|
@ -0,0 +1,20 @@
|
||||||
|
<h1> Jade path to fragment path cross reference report
|
||||||
|
|
||||||
|
<p>Base path: c:/GitHub/angular.io.ideablade/public/doc-shredder/test</p>
|
||||||
|
<ol>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
Jade file: <strong>test_jade/guides/setupAlt2.jade</strong>
|
||||||
|
<p>Fragment files</p>
|
||||||
|
<ul><li>test_fragments/gettingstarted/ts/index.html.md</li><li>test_fragments/gettingstarted/js/index.html.md</li><li>test_fragments/gettingstarted/ts/main.ts.md</li><li> *** NOT FOUND*** : test_fragments/gettingstarted/ js/main.js.md</li><li>test_fragments/gettingstarted/ts/main-import.ts.md</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Jade file: <strong>test_jade/setupAlt.jade</strong>
|
||||||
|
<p>Fragment files</p>
|
||||||
|
<ul><li> *** NOT FOUND*** : test_fragments/gettingstarted/ts/index2.html.md</li><li>test_fragments/gettingstarted/js/index.html.md</li><li>test_fragments/gettingstarted/ts/main.ts.md</li><li> *** NOT FOUND*** : test_fragments/gettingstarted/ js/main2.js.md</li><li>test_fragments/gettingstarted/ts/main-import.ts.md</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
</ol>
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"test_jade/guides/setupAlt2.jade": [
|
||||||
|
{
|
||||||
|
"fragPath": "test_fragments/gettingstarted/ts/index.html.md",
|
||||||
|
"exists": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "test_fragments/gettingstarted/js/index.html.md",
|
||||||
|
"exists": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "test_fragments/gettingstarted/ts/main.ts.md",
|
||||||
|
"exists": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "test_fragments/gettingstarted/ js/main.js.md",
|
||||||
|
"exists": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "test_fragments/gettingstarted/ts/main-import.ts.md",
|
||||||
|
"exists": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"test_jade/setupAlt.jade": [
|
||||||
|
{
|
||||||
|
"fragPath": "test_fragments/gettingstarted/ts/index2.html.md",
|
||||||
|
"exists": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "test_fragments/gettingstarted/js/index.html.md",
|
||||||
|
"exists": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "test_fragments/gettingstarted/ts/main.ts.md",
|
||||||
|
"exists": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "test_fragments/gettingstarted/ js/main2.js.md",
|
||||||
|
"exists": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "test_fragments/gettingstarted/ts/main-import.ts.md",
|
||||||
|
"exists": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,16 +0,0 @@
|
||||||
<h1> Jade document --> example Cross Reference Report
|
|
||||||
|
|
||||||
<ol>
|
|
||||||
{%- for docMap in doc.docMaps %}
|
|
||||||
<li>
|
|
||||||
Jade file: <strong>{{ docMap.jadeRelativePath }}</strong>
|
|
||||||
<p>Reference paths</p>
|
|
||||||
<ul>
|
|
||||||
{%- for refPath in docMap.refPaths %}
|
|
||||||
<li>Path: {{ refPath }}</li>
|
|
||||||
{%- endfor %}
|
|
||||||
</ul>
|
|
||||||
<br>
|
|
||||||
</li>
|
|
||||||
{%- endfor %}
|
|
||||||
</ol>
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<h1> Frament path to jade path cross reference report
|
||||||
|
|
||||||
|
<p>Base path: {{ doc.basePath }}</p>
|
||||||
|
<ol>
|
||||||
|
{% for fragPath, jadePaths in doc.fragToJadeMap %}
|
||||||
|
<li>
|
||||||
|
Fragment file: <strong>{{ fragPath }}</strong>
|
||||||
|
<p>Jade files</p>
|
||||||
|
<ul>
|
||||||
|
{%- for jadePath in jadePaths %}
|
||||||
|
<li>{{ jadePath }}</li>
|
||||||
|
{%- endfor %}
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
{%- endfor %}
|
||||||
|
</ol>
|
|
@ -0,0 +1,21 @@
|
||||||
|
<h1> Jade path to fragment path cross reference report
|
||||||
|
|
||||||
|
<p>Base path: {{ doc.basePath }}</p>
|
||||||
|
<ol>
|
||||||
|
{% for jadePath, fragInfos in doc.jadeToFragMap %}
|
||||||
|
<li>
|
||||||
|
Jade file: <strong>{{ jadePath }}</strong>
|
||||||
|
<p>Fragment files</p>
|
||||||
|
<ul>
|
||||||
|
{%- for fragInfo in fragInfos %}
|
||||||
|
{%- if fragInfo.exists -%}
|
||||||
|
<li>{{ fragInfo.fragPath }}</li>
|
||||||
|
{%- else -%}
|
||||||
|
<li> *** NOT FOUND*** : {{ fragInfo.fragPath }}</li>
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endfor %}
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
{%- endfor %}
|
||||||
|
</ol>
|
|
@ -13,5 +13,5 @@ AppComponent.annotations = [
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
angular.bootstrap(AppComponent);
|
angular.bootstrap(AppComponent);
|
||||||
});
|
});
|
||||||
###
|
|
||||||
```
|
```
|
|
@ -0,0 +1,46 @@
|
||||||
|
<h1> Frament path to jade path cross reference report
|
||||||
|
|
||||||
|
<p>Base path: c:\GitHub\angular.io.ideablade\public\docs</p>
|
||||||
|
<ol>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
Fragment file: <strong>_fragments/gettingstarted/ts/index.html.md</strong>
|
||||||
|
<p>Jade files</p>
|
||||||
|
<ul>
|
||||||
|
<li>js/latest/guide/setupAlt.jade</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Fragment file: <strong>_fragments/gettingstarted/js/index.html.md</strong>
|
||||||
|
<p>Jade files</p>
|
||||||
|
<ul>
|
||||||
|
<li>js/latest/guide/setupAlt.jade</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Fragment file: <strong>_fragments/gettingstarted/ts/main.ts.md</strong>
|
||||||
|
<p>Jade files</p>
|
||||||
|
<ul>
|
||||||
|
<li>js/latest/guide/setupAlt.jade</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Fragment file: <strong>_fragments/gettingstarted/js/main.js.md</strong>
|
||||||
|
<p>Jade files</p>
|
||||||
|
<ul>
|
||||||
|
<li>js/latest/guide/setupAlt.jade</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
Fragment file: <strong>_fragments/gettingstarted/ts/main-import.ts.md</strong>
|
||||||
|
<p>Jade files</p>
|
||||||
|
<ul>
|
||||||
|
<li>js/latest/guide/setupAlt.jade</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
</ol>
|
|
@ -0,0 +1,13 @@
|
||||||
|
<h1> Jade path to fragment path cross reference report
|
||||||
|
|
||||||
|
<p>Base path: c:\GitHub\angular.io.ideablade\public\docs</p>
|
||||||
|
<ol>
|
||||||
|
|
||||||
|
<li>
|
||||||
|
Jade file: <strong>js/latest/guide/setupAlt.jade</strong>
|
||||||
|
<p>Fragment files</p>
|
||||||
|
<ul><li>_fragments/gettingstarted/ts/index.html.md</li><li>_fragments/gettingstarted/js/index.html.md</li><li>_fragments/gettingstarted/ts/main.ts.md</li><li>_fragments/gettingstarted/js/main.js.md</li><li>_fragments/gettingstarted/ts/main-import.ts.md</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</li>
|
||||||
|
</ol>
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"basePath": "c:\\GitHub\\angular.io.ideablade\\public\\docs",
|
||||||
|
"jadeToFragMap": {
|
||||||
|
"js/latest/guide/setupAlt.jade": [
|
||||||
|
{
|
||||||
|
"fragPath": "_fragments/gettingstarted/ts/index.html.md",
|
||||||
|
"exists": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "_fragments/gettingstarted/js/index.html.md",
|
||||||
|
"exists": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "_fragments/gettingstarted/ts/main.ts.md",
|
||||||
|
"exists": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "_fragments/gettingstarted/js/main.js.md",
|
||||||
|
"exists": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fragPath": "_fragments/gettingstarted/ts/main-import.ts.md",
|
||||||
|
"exists": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue