Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
build() {
this._checkForOutdatedConfig();
// When testing it sometimes helps to look a just one example directory like so:
// var stackblitzPaths = path.join(this.basePath, '**/testing/*stackblitz.json');
var stackblitzPaths = path.join(this.basePath, '**/*stackblitz.json');
var fileNames = globby.sync(stackblitzPaths, { ignore: ['**/node_modules/**'] });
fileNames.forEach((configFileName) => {
try {
// console.log('***'+configFileName)
this._buildStackblitzFrom(configFileName);
} catch (e) {
console.log(e);
}
});
}
doc.content = doc.content.replace(EXAMPLE_REGEX, function processExample(match, attributeText, exampleText) {
var example = extractAttributes(attributeText);
example.files = extractFiles(exampleText);
example.id = 'example-' + uniqueName(example.name || 'example');
example.doc = doc;
example.outputFolder = path.join(outputFolder, example.id);
// store the example information for later
examples.push(example);
return generateExampleDirective(example);
});
});
create: function(config) {
var currentVersion = config.get('currentVersion');
var docsBase = path.join(config.get('basePath'), config.get('rendering.outputFolder'), 'docs');
var versionDir = path.join(docsBase, currentVersion);
// create the folders for the current version
mkdirp.sync(versionDir);
}
};
_createPostData(config, configFileName) {
var postData = {};
// If `config.main` is specified, ensure that it points to an existing file.
if (config.main && !this._existsSync(path.join(config.basePath, config.main))) {
throw Error(`The main file ('${config.main}') specified in '${configFileName}' does not exist.`);
}
config.fileNames.forEach((fileName) => {
var content;
var extn = path.extname(fileName);
if (extn == '.png') {
content = this._encodeBase64(fileName);
fileName = fileName.substr(0, fileName.length - 4) + '.base64.png'
} else {
content = fs.readFileSync(fileName, 'utf-8');
}
if (extn == '.js' || extn == '.ts' || extn == '.css') {
content = content + this.copyrights.jsCss;
} else if (extn == '.html') {
mkdirp(versionDir, function() {
copy(latestDir, path.join(versionDir, 'api'), {
deleteFirst: true,
overwrite: true
}, function(err, files) {
deferred.resolve(docs);
});
});
return vfs.src(src).pipe(through2.obj(function (file, enc, callback) {
name = name === undefined ? path.normalize(file.path).split('/').pop() : name;
this.push(new File({
base: dest,
cwd: dest,
path: path.join(dest, dir, name),
contents: file.contents
}));
callback(null);
}));
};
function createFileDoc(example, file) {
var fileDoc = {
docType: 'example-' + file.type,
id: example.id + '/' + file.name,
template: path.join(templateFolder, 'template.' + file.type),
file: example.doc.file,
startingLine: example.doc.startingLine,
example: example,
path: file.name,
outputPath: outputPath(example, file.name),
fileContents: file.fileContents
};
return fileDoc;
}
config.set('logging.level', 'info');
config.prepend('rendering.templateFolders', [
path.resolve(__dirname, 'templates')
]);
config.set('basePath', __dirname);
config.set('source.projectPath', '.');
config.set('rendering.outputFolder', '../temp/ionic-site');
var versionData = require('./generate-versions')(config);
config.set('versionData', versionData);
config.set('rendering.contentsFolder', path.join('docs', versionData.current.folder));
config.set('demos.outputFolder', path.join(__dirname, '../temp/ionic-demo'));
config.set('processing.api-docs', {
outputPath: 'api/${docType}/${name}/index.md',
path: 'api/${docType}/${name}/',
moduleOutputPath: 'api/module/${name}/index.md',
modulePath: 'api/module/${name}/',
mergeableTypes: {
demo: 'demos'
}
});
config.append('rendering.filters', [
require('./filters/capital')
]);
config.set('source.files', [
return function(component) {
return require(path.join(sourceFolder, component, packageFile)).version;
};
};
export default function() {
const files = glob.sync(path.join(__dirname, 'widgets/**/*'), { nodir: true });
const prefix = path.join(__dirname, 'widgets');
return files.map((file) => file.replace(`${prefix}/`, ''));
}