mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
5
lib/config/app.config.json
Normal file
5
lib/config/app.config.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"ecmHost": "http://{hostname}:{port}/ecm",
|
||||
"bpmHost": "http://{hostname}:{port}/bpm",
|
||||
"logLevel" : "silent"
|
||||
}
|
16
lib/config/assets/license_header.txt
Normal file
16
lib/config/assets/license_header.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
14
lib/config/assets/license_header_add.txt
Normal file
14
lib/config/assets/license_header_add.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
@license
|
||||
Copyright 2016 Alfresco Software, Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
238
lib/config/buildFullDocIndex.js
Normal file
238
lib/config/buildFullDocIndex.js
Normal file
@@ -0,0 +1,238 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var angFilenameRegex = /([a-zA-Z0-9\-]+)\.((component)|(directive)|(model)|(pipe)|(service)|(widget))\.ts/;
|
||||
|
||||
var indexFileName = path.resolve('..', 'docs', 'README.md');
|
||||
var summaryFileName = path.resolve('..', 'docs', 'summary.json');
|
||||
var undocStoplistFileName = path.resolve('..', 'docs', 'undocStoplist.json');
|
||||
|
||||
|
||||
// Search source folders for .ts files to discover all components, directives, etc,
|
||||
// that are in the supplied library.
|
||||
function searchLibraryRecursive(libData, folderPath) {
|
||||
var items = fs.readdirSync(folderPath);
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
var itemPath = path.resolve(folderPath, items[i]);
|
||||
var info = fs.statSync(itemPath);
|
||||
|
||||
if (info.isFile() && (items[i].match(angFilenameRegex))) {
|
||||
var nameNoSuffix = path.basename(items[i], '.ts');
|
||||
|
||||
var itemCategory = nameNoSuffix.split('.')[1];
|
||||
|
||||
if(nameNoSuffix in docDict) {
|
||||
switch (itemCategory) {
|
||||
case "component":
|
||||
libData.componentsWithDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
case "directive":
|
||||
libData.directivesWithDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
case "model":
|
||||
libData.modelsWithDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
case "pipe":
|
||||
libData.pipesWithDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
case "service":
|
||||
libData.servicesWithDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
case "widget":
|
||||
libData.widgetsWithDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (!rejectItemViaStoplist(undocStoplist, items[i])) {
|
||||
switch (itemCategory) {
|
||||
case "component":
|
||||
libData.componentsWithoutDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
case "directive":
|
||||
libData.directivesWithoutDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
case "model":
|
||||
libData.modelsWithoutDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
case "pipe":
|
||||
libData.pipesWithoutDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
case "service":
|
||||
libData.servicesWithoutDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
case "widget":
|
||||
libData.widgetsWithoutDocs.push(itemPath);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (info.isDirectory()) {
|
||||
searchLibraryRecursive(libData, itemPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get a list of all items that have a file in the docs folder.
|
||||
function getDocFolderItems(docFolderPath) {
|
||||
var result = {};
|
||||
var items = fs.readdirSync(path.resolve(docFolderPath));
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].endsWith('.md')) {
|
||||
var nameNoSuffix = path.basename(items[i], '.md');
|
||||
result[nameNoSuffix] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Convert an Angular-style name (eg, "card-view") into one with correct spaces and uppercase (eg, "Card View").
|
||||
function tidyName(name) {
|
||||
var result = name.replace(/-/g, " ");
|
||||
result = result.substr(0, 1).toUpperCase() + result.substr(1);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Generate the Markdown index for the files from the guide summary.
|
||||
function makeSummaryIndex() {
|
||||
var summaryJson = fs.readFileSync(summaryFileName, 'utf8');
|
||||
var summary = JSON.parse(summaryJson);
|
||||
|
||||
var result = '';
|
||||
|
||||
for (var i = 0; i < summary.length; i++) {
|
||||
var item = summary[i];
|
||||
result += '- [' + item.title + '](' + item.file + ')\n';
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Create a stoplist of regular expressions.
|
||||
function makeStoplist(slFilePath) {
|
||||
var listExpressions = JSON.parse(fs.readFileSync(slFilePath, 'utf8'));
|
||||
|
||||
var result = [];
|
||||
|
||||
for (var i = 0; i < listExpressions.length; i++) {
|
||||
result.push(new RegExp(listExpressions[i]));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Check if an item is covered by the stoplist and reject it if so.
|
||||
function rejectItemViaStoplist(stoplist, itemName) {
|
||||
for (var i = 0; i < stoplist.length; i++) {
|
||||
if (stoplist[i].test(itemName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function buildIndexSection(name, documented, undocumented) {
|
||||
var listItems = [];
|
||||
|
||||
if ((documented.length > 0) || (undocumented.length > 0)) {
|
||||
listItems.push('\n### ' + name + '\n');
|
||||
}
|
||||
|
||||
for (var i = 0; i < documented.length; i++) {
|
||||
var libFilePath = documented[i];
|
||||
var libFileName = path.basename(libFilePath, '.ts');
|
||||
var nameSections = libFileName.split('.');
|
||||
var visibleName = tidyName(nameSections[0]) + ' ' + nameSections[1];
|
||||
var mdListItem = '- [' + visibleName + '](' + libFileName + '.md)';
|
||||
listItems.push(mdListItem);
|
||||
}
|
||||
|
||||
for (var i = 0; i < undocumented.length; i++) {
|
||||
var libFilePath = undocumented[i].replace(/\\/g, '/');
|
||||
var libFileName = path.basename(libFilePath, '.ts');
|
||||
var nameSections = libFileName.split('.');
|
||||
var visibleName = tidyName(nameSections[0]) + ' ' + nameSections[1];
|
||||
var relPath = libFilePath.substr(libFilePath.indexOf('/ng2-') + 1);
|
||||
var mdListItem = '- [*' + visibleName + '](../' + relPath + ')';
|
||||
listItems.push(mdListItem);
|
||||
}
|
||||
|
||||
return listItems;
|
||||
}
|
||||
|
||||
|
||||
var undocStoplist = makeStoplist(undocStoplistFileName);
|
||||
|
||||
var docDict = getDocFolderItems(path.resolve('..', 'docs'));
|
||||
|
||||
var rootItems = fs.readdirSync(path.resolve('.'));
|
||||
|
||||
var libs = {}
|
||||
|
||||
for (var i = 0; i < rootItems.length; i++) {
|
||||
var itemPath = path.resolve(rootItems[i]);
|
||||
var info = fs.statSync(itemPath);
|
||||
|
||||
if (info.isDirectory() && rootItems[i].match(/ng2-/)) {
|
||||
libs[rootItems[i]] = {
|
||||
componentsWithDocs: [], componentsWithoutDocs: [],
|
||||
directivesWithDocs: [], directivesWithoutDocs: [],
|
||||
modelsWithDocs: [], modelsWithoutDocs: [],
|
||||
pipesWithDocs: [], pipesWithoutDocs: [],
|
||||
servicesWithDocs: [], servicesWithoutDocs: [],
|
||||
widgetsWithDocs: [], widgetsWithoutDocs: [],
|
||||
};
|
||||
|
||||
searchLibraryRecursive(libs[rootItems[i]], path.resolve(itemPath, 'src'));
|
||||
}
|
||||
}
|
||||
|
||||
var indexFileText = fs.readFileSync(indexFileName, 'utf8');
|
||||
|
||||
var libNames = Object.keys(libs);
|
||||
|
||||
for (var i = 0; i < libNames.length; i++) {
|
||||
var libName = libNames[i];
|
||||
var libData = libs[libName];
|
||||
|
||||
var listItems = buildIndexSection('Components', libData.componentsWithDocs, libData.componentsWithoutDocs);
|
||||
listItems = listItems.concat(buildIndexSection('Directives', libData.directivesWithDocs, libData.directivesWithoutDocs));
|
||||
listItems = listItems.concat(buildIndexSection('Models', libData.modelsWithDocs, libData.modelsWithoutDocs));
|
||||
listItems = listItems.concat(buildIndexSection('Pipes', libData.pipesWithDocs, libData.pipesWithoutDocs));
|
||||
listItems = listItems.concat(buildIndexSection('Services', libData.servicesWithDocs, libData.servicesWithoutDocs));
|
||||
listItems = listItems.concat(buildIndexSection('Widgets', libData.widgetsWithDocs, libData.widgetsWithoutDocs));
|
||||
|
||||
var libText = listItems.join('\n');
|
||||
var libStartMarker = '<!-- ' + libName + ' start -->';
|
||||
var libEndMarker = '<!-- ' + libName + ' end -->';
|
||||
var contentRegex = new RegExp('(?:' + libStartMarker + ')([\\s\\S]*)(?:' + libEndMarker + ')');
|
||||
indexFileText = indexFileText.replace(contentRegex, libStartMarker + '\n' + libText + '\n' + libEndMarker);
|
||||
}
|
||||
|
||||
var guideStartMarker = '<!-- guide start -->';
|
||||
var guideEndMarker = '<!-- guide end -->';
|
||||
var contentRegex = new RegExp('(?:' + guideStartMarker + ')([\\s\\S]*)(?:' + guideEndMarker + ')');
|
||||
indexFileText = indexFileText.replace(contentRegex, guideStartMarker + '\n' + makeSummaryIndex() + '\n' + guideEndMarker);
|
||||
|
||||
fs.writeFileSync(indexFileName, indexFileText, 'utf-8');
|
70
lib/config/custom-loaders/file-loader-multi.js
Normal file
70
lib/config/custom-loaders/file-loader-multi.js
Normal file
@@ -0,0 +1,70 @@
|
||||
var path = require('path');
|
||||
var loaderUtils = require('loader-utils');
|
||||
|
||||
module.exports = function(content) {
|
||||
this.cacheable && this.cacheable();
|
||||
if(!this.emitFile) throw new Error('emitFile is required from module system');
|
||||
|
||||
var query = loaderUtils.getOptions(this) || {};
|
||||
var configKey = query.config || 'multiFileLoader';
|
||||
var options = this.options[configKey] || {};
|
||||
var config = {
|
||||
publicPath: false,
|
||||
useRelativePath: false,
|
||||
name: '[hash].[ext]'
|
||||
};
|
||||
|
||||
// options takes precedence over config
|
||||
Object.keys(options).forEach(function(attr) {
|
||||
config[attr] = options[attr];
|
||||
});
|
||||
|
||||
// query takes precedence over config and options
|
||||
Object.keys(query).forEach(function(attr) {
|
||||
config[attr] = query[attr];
|
||||
});
|
||||
|
||||
var context = config.context || this.options.context;
|
||||
var url = loaderUtils.interpolateName(this, config.name, {
|
||||
context: context,
|
||||
content: content,
|
||||
regExp: config.regExp
|
||||
});
|
||||
var path = loaderUtils.interpolateName(this, '[path]', {
|
||||
context: context,
|
||||
content: content,
|
||||
regExp: config.regExp
|
||||
});
|
||||
|
||||
var outputPath = '';
|
||||
|
||||
if (config.outputPath) {
|
||||
outputPath = (
|
||||
typeof config.outputPath === 'function'
|
||||
? config.outputPath(url, path)
|
||||
: config.outputPath + url
|
||||
);
|
||||
} else {
|
||||
outputPath = url;
|
||||
}
|
||||
|
||||
var publicPath = JSON.stringify(url);
|
||||
|
||||
if (config.publicPath) {
|
||||
publicPath = JSON.stringify(
|
||||
typeof config.publicPath === 'function'
|
||||
? config.publicPath(url, path)
|
||||
: config.publicPath + url
|
||||
);
|
||||
}
|
||||
|
||||
publicPath = '__webpack_public_path__ + ' + publicPath;
|
||||
|
||||
if (query.emitFile === undefined || query.emitFile) {
|
||||
this.emitFile(outputPath, content);
|
||||
}
|
||||
|
||||
return 'module.exports = ' + publicPath + ';';
|
||||
};
|
||||
|
||||
module.exports.raw = true;
|
155
lib/config/custom-loaders/generateListComponent.js
Normal file
155
lib/config/custom-loaders/generateListComponent.js
Normal file
@@ -0,0 +1,155 @@
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
|
||||
var erase = true;
|
||||
var readmeContent = null;
|
||||
var readmeFilePath = '';
|
||||
|
||||
function isFileEmpty(fileContents) {
|
||||
return fileContents.toString('utf8').trim() === '';
|
||||
}
|
||||
|
||||
function writeFile(file, newValue) {
|
||||
fs.writeFileSync(file, newValue, 'utf-8');
|
||||
}
|
||||
|
||||
function readFile(file) {
|
||||
return fs.readFileSync(file, 'utf8');
|
||||
}
|
||||
|
||||
function eraseContentList() {
|
||||
if (erase) {
|
||||
erase = false;
|
||||
|
||||
var businessRegex = /(?:<!-- BUSINESS START-->)([\s\S]*?)(?:<!-- BUSINESS END-->)/;
|
||||
var contentRegex = /(?:<!-- CONTENT START-->)([\s\S]*?)(?:<!-- CONTENT END-->)/;
|
||||
var coreRegex = /(?:<!-- CORE START-->)([\s\S]*?)(?:<!-- CORE END-->)/;
|
||||
var businessRegexDirective = /(?:<!-- BUSINESS DIRECTIVE START-->)([\s\S]*?)(?:<!-- BUSINESS DIRECTIVE END-->)/;
|
||||
var contentRegexDirective = /(?:<!-- CONTENT DIRECTIVE START-->)([\s\S]*?)(?:<!-- CONTENT DIRECTIVE END-->)/;
|
||||
var coreRegexDirective = /(?:<!-- CORE DIRECTIVE START-->)([\s\S]*?)(?:<!-- CORE DIRECTIVE END-->)/;
|
||||
var servicessRegex = /(?:<!-- SERVICES START-->)([\s\S]*?)(?:<!-- SERVICES END-->)/;
|
||||
|
||||
|
||||
readmeContent = readmeContent.replace(businessRegex, '<!-- BUSINESS START--><!-- BUSINESS END-->');
|
||||
readmeContent = readmeContent.replace(contentRegex, '<!-- CONTENT START--><!-- CONTENT END-->');
|
||||
readmeContent = readmeContent.replace(coreRegex, '<!-- CORE START--><!-- CORE END-->');
|
||||
|
||||
readmeContent = readmeContent.replace(businessRegexDirective, '<!-- BUSINESS DIRECTIVE START--><!-- BUSINESS DIRECTIVE END-->');
|
||||
readmeContent = readmeContent.replace(contentRegexDirective, '<!-- CONTENT DIRECTIVE START--><!-- CONTENT DIRECTIVE END-->');
|
||||
readmeContent = readmeContent.replace(coreRegexDirective, '<!-- CORE DIRECTIVE START--><!-- CORE DIRECTIVE END-->');
|
||||
|
||||
readmeContent = readmeContent.replace(servicessRegex, '<!-- SERVICES START--><!-- SERVICES END-->');
|
||||
|
||||
writeFile(readmeFilePath, readmeContent)
|
||||
}
|
||||
}
|
||||
|
||||
function generateListComponent(currentFileContent, webpackInstance) {
|
||||
if (!isFileEmpty(currentFileContent)) {
|
||||
|
||||
var componentReg = /(@Component)(\s?)\((\s?){(\s?)((.|[\n\r])*)}(\s?)\)/gm;
|
||||
var componentSection = componentReg.exec(currentFileContent);
|
||||
|
||||
if (componentSection) {
|
||||
|
||||
var selectorReg = /(adf)([a-zA-Z]|-)+((?!,)|(?! ))/g;
|
||||
var selector = selectorReg.exec(componentSection[0]);
|
||||
|
||||
if (selector) {
|
||||
var rawPath = webpackInstance.resourcePath.replace(/\\/g, "/");
|
||||
var removeRoot = rawPath.substr(rawPath.indexOf('/ng2-components') + 16, rawPath.length);
|
||||
var url = removeRoot.substr(0, removeRoot.indexOf('src')) + 'README.md';
|
||||
|
||||
var link = '- [' + selector[0] + '](' + url + ')';
|
||||
|
||||
if (webpackInstance.resourcePath.match('ng2-alfresco-core')) {
|
||||
readmeContent = readmeContent.replace('<!-- CORE START-->', '<!-- CORE START-->\n' + link);
|
||||
} else if (webpackInstance.resourcePath.match('ng2-alfresco-')) {
|
||||
readmeContent = readmeContent.replace('<!-- CONTENT START-->', '<!-- CONTENT START-->\n' + link);
|
||||
} else if (webpackInstance.resourcePath.match('ng2-activiti-')) {
|
||||
readmeContent = readmeContent.replace('<!-- BUSINESS START-->', '<!-- BUSINESS START-->\n' + link);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var directiveReg = /(@Directive)(\s?)\((\s?){(\s?)((.|[\r\n])*)}(\s?)\)/gm;
|
||||
var directiveSection = directiveReg.exec(currentFileContent);
|
||||
|
||||
if (directiveSection) {
|
||||
var selectorReg = /(adf)([a-zA-Z]|-)+((?!,)|(?! ))/g;
|
||||
var selector = selectorReg.exec(directiveSection[0]);
|
||||
|
||||
if (selector) {
|
||||
var selector = selector[0].replace("selector: '[", "").replace("']", '').replace("]", '').replace("selector: '", "").replace("'", '');
|
||||
|
||||
var rawPath = webpackInstance.resourcePath.replace(/\\/g, "/");
|
||||
var removeRoot = rawPath.substr(rawPath.indexOf('/ng2-components') + 16, rawPath.length);
|
||||
var url = removeRoot.substr(0, removeRoot.indexOf('src')) + 'README.md';
|
||||
|
||||
var link = '- [' + selector + '](' + url + ')';
|
||||
|
||||
if (webpackInstance.resourcePath.match('ng2-alfresco-core')) {
|
||||
readmeContent = readmeContent.replace('<!-- CORE DIRECTIVE START-->', '<!-- CORE DIRECTIVE START-->\n' + link);
|
||||
}
|
||||
//else if (webpackInstance.resourcePath.match('ng2-alfresco-')) {
|
||||
// readmeContent = readmeContent.replace('<!-- CONTENT DIRECTIVE START-->', '<!-- CONTENT DIRECTIVE START-->\n' + link);
|
||||
//}
|
||||
//else if (webpackInstance.resourcePath.match('ng2-activiti-')) {
|
||||
// readmeContent = readmeContent.replace('<!-- BUSINESS DIRECTIVE START-->', '<!-- BUSINESS DIRECTIVE START-->\n' + link);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
writeFile(readmeFilePath, readmeContent);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function generateListservices(currentFileContent, webpackInstance) {
|
||||
if (!isFileEmpty(currentFileContent)) {
|
||||
|
||||
var servicesReg = /(@Injectable\(\))(([a-zA-Z ]|[\r\n])*)/gm;
|
||||
var servicesSection = servicesReg.exec(currentFileContent);
|
||||
|
||||
if (servicesSection) {
|
||||
|
||||
var selectorReg = /([a-zA-Z])+Service/g;
|
||||
var selector = selectorReg.exec(servicesSection[0]);
|
||||
|
||||
if (selector) {
|
||||
var rawPath = webpackInstance.resourcePath.replace(/\\/g, "/");
|
||||
var url = rawPath.substr(rawPath.indexOf('/ng2-components') + 16, rawPath.length);
|
||||
|
||||
var link = '- [' + selector[0] + '](' + url + ')';
|
||||
|
||||
readmeContent = readmeContent.replace('<!-- SERVICES START-->', '<!-- SERVICES START-->\n' + link);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
writeFile(readmeFilePath, readmeContent);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function (input, map) {
|
||||
this.cacheable && this.cacheable();
|
||||
var callback = this.async();
|
||||
|
||||
readmeFilePath = path.resolve(__dirname, '../../README.md');
|
||||
|
||||
if (!readmeContent) {
|
||||
readmeContent = readFile(readmeFilePath);
|
||||
}
|
||||
|
||||
if (readmeContent) {
|
||||
eraseContentList();
|
||||
generateListComponent(input, this);
|
||||
generateListservices(input, this);
|
||||
}
|
||||
callback(null, input, map);
|
||||
}
|
67
lib/config/custom-loaders/license-check.js
Normal file
67
lib/config/custom-loaders/license-check.js
Normal file
@@ -0,0 +1,67 @@
|
||||
var path = require('path');
|
||||
var loaderUtils = require('loader-utils');
|
||||
var fs = require('fs');
|
||||
|
||||
var licenseFileUtf8Store = undefined;
|
||||
|
||||
function readLicenseHeaderFile(licenseFilePath) {
|
||||
if (licenseFileUtf8Store) {
|
||||
return licenseFileUtf8Store;
|
||||
}
|
||||
|
||||
if (fs.existsSync(licenseFilePath)) {
|
||||
licenseFileUtf8Store = fs.readFileSync(licenseFilePath, 'utf8').split(/\r?\n/);
|
||||
return licenseFileUtf8Store;
|
||||
}
|
||||
|
||||
throw new Error('The license header file path is wrong ' + licenseFilePath);
|
||||
}
|
||||
|
||||
function isFileEmpty(fileContents) {
|
||||
return fileContents.toString('utf8').trim() === '';
|
||||
}
|
||||
|
||||
function readCurrentFile(fileContent) {
|
||||
return fileContent.toString('utf8').split(/\r?\n/);
|
||||
}
|
||||
|
||||
function isLicenseHeaderPresent(currentFileContent, licenseFilePath) {
|
||||
if (!isFileEmpty(currentFileContent)) {
|
||||
var currentFileUtf8 = readCurrentFile(currentFileContent),
|
||||
licenseFileUtf8 = readLicenseHeaderFile(licenseFilePath);
|
||||
skipStrict = 0;
|
||||
|
||||
if(currentFileUtf8[0] === '"use strict";' ) {
|
||||
skipStrict = 1;
|
||||
}
|
||||
|
||||
for (var i = skipStrict; i < licenseFileUtf8.length; i++) {
|
||||
if (currentFileUtf8[i + skipStrict] !== licenseFileUtf8[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function report(hasHeader, emitter, filename) {
|
||||
if (hasHeader) return;
|
||||
emitter('Missing license header file : ' + filename);
|
||||
}
|
||||
|
||||
function licenseCheck(webpackInstance, input, options) {
|
||||
var isLicensePresent = isLicenseHeaderPresent(input, options.licenseFile);
|
||||
|
||||
var emitter = options.emitErrors ? webpackInstance.emitError : webpackInstance.emitWarning;
|
||||
|
||||
report(isLicensePresent, emitter, webpackInstance.resourcePath);
|
||||
}
|
||||
|
||||
module.exports = function(input, map) {
|
||||
this.cacheable && this.cacheable();
|
||||
var callback = this.async();
|
||||
|
||||
var options = loaderUtils.getOptions(this);
|
||||
licenseCheck(this, input, options);
|
||||
callback(null, input, map);
|
||||
};
|
96
lib/config/generateSeeAlso.js
Normal file
96
lib/config/generateSeeAlso.js
Normal file
@@ -0,0 +1,96 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var docFolderPath = path.resolve("..", "docs");
|
||||
var graphFileName = path.resolve(docFolderPath, "seeAlsoGraph.json");
|
||||
|
||||
|
||||
// Get a list of all items that have a file in the docs folder.
|
||||
function getDocFolderItems(docFolderPath) {
|
||||
var result = {};
|
||||
var items = fs.readdirSync(path.resolve(docFolderPath));
|
||||
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (items[i].endsWith('.md')) {
|
||||
var nameNoSuffix = path.basename(items[i], '.md');
|
||||
result[nameNoSuffix] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Convert an Angular-style name (eg, "card-view") into one with correct spaces and uppercase (eg, "Card view").
|
||||
function tidyName(name) {
|
||||
var result = name.replace(/-/g, " ");
|
||||
result = result.substr(0, 1).toUpperCase() + result.substr(1);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
function buildSeeAlsoList(arcs) {
|
||||
var listItems = [];
|
||||
|
||||
for (var i = 0; i < arcs.length; i++) {
|
||||
var parts = arcs[i].split('.');
|
||||
var itemName = tidyName(parts[0]);
|
||||
|
||||
if (parts[1]) {
|
||||
itemName += ' ' + parts[1];
|
||||
}
|
||||
|
||||
listItems.push('- [' + itemName + '](' + arcs[i] + '.md)');
|
||||
}
|
||||
|
||||
return listItems.join('\n');
|
||||
}
|
||||
|
||||
|
||||
// If item is not in the arcs array then add it at
|
||||
// the end.
|
||||
function fixArcs(arcsArray, item) {
|
||||
if (arcsArray.indexOf(item) == -1) {
|
||||
arcsArray.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Makes link symmetrical between items (ie, if A links to B but not the other way
|
||||
// around then it adds the missing link).
|
||||
function tidyGraph(graph) {
|
||||
var nodeNames = Object.keys(graph);
|
||||
|
||||
for (var n = 0; n < nodeNames.length; n++) {
|
||||
var currNodeName = nodeNames[n];
|
||||
|
||||
var currNodeArcs = graph[currNodeName];
|
||||
|
||||
for (var a = 0; a < currNodeArcs.length; a++) {
|
||||
var linkedNode = graph[currNodeArcs[a]];
|
||||
fixArcs(linkedNode, currNodeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var graphJson = fs.readFileSync(graphFileName, 'utf8');
|
||||
var graph = JSON.parse(graphJson);
|
||||
tidyGraph(graph);
|
||||
|
||||
var nodeNames = Object.keys(graph);
|
||||
|
||||
for (var i = 0; i < nodeNames.length; i++) {
|
||||
var seeAlsoText = '## See also\n\n' + buildSeeAlsoList(graph[nodeNames[i]]);
|
||||
|
||||
var docFileName = path.resolve(docFolderPath, nodeNames[i] + '.md');
|
||||
var docFileText = fs.readFileSync(docFileName, 'utf8');
|
||||
|
||||
var seeAlsoStartMarker = '<!-- seealso start -->';
|
||||
var seeAlsoEndMarker = '<!-- seealso end -->';
|
||||
|
||||
var seeAlsoRegex = new RegExp('(?:' + seeAlsoStartMarker + ')([\\s\\S]*)(?:' + seeAlsoEndMarker + ')');
|
||||
docFileText = docFileText.replace(seeAlsoRegex, seeAlsoStartMarker + '\n' + seeAlsoText + '\n' + seeAlsoEndMarker);
|
||||
|
||||
fs.writeFileSync(docFileName, docFileText, 'utf-8');
|
||||
}
|
10
lib/config/helpers.js
Normal file
10
lib/config/helpers.js
Normal file
@@ -0,0 +1,10 @@
|
||||
var path = require('path');
|
||||
|
||||
var _root = path.resolve(__dirname, '..');
|
||||
|
||||
function root(args) {
|
||||
args = Array.prototype.slice.call(arguments, 0);
|
||||
return path.join.apply(path, [_root].concat(args));
|
||||
}
|
||||
|
||||
exports.root = root;
|
44
lib/config/karma-test-shim.js
Normal file
44
lib/config/karma-test-shim.js
Normal file
@@ -0,0 +1,44 @@
|
||||
Error.stackTraceLimit = Infinity;
|
||||
|
||||
require('core-js/es6');
|
||||
require('core-js/es7/reflect');
|
||||
|
||||
require('zone.js/dist/zone');
|
||||
require('zone.js/dist/long-stack-trace-zone');
|
||||
require('zone.js/dist/proxy');
|
||||
require('zone.js/dist/sync-test');
|
||||
require('zone.js/dist/jasmine-patch');
|
||||
require('zone.js/dist/async-test');
|
||||
require('zone.js/dist/fake-async-test');
|
||||
|
||||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;
|
||||
|
||||
var appContext = require.context(".", true, /.spec.ts/);appContext.keys().forEach(appContext);
|
||||
|
||||
const TestBed = require('@angular/core/testing').TestBed;
|
||||
const browser = require('@angular/platform-browser-dynamic/testing');
|
||||
const CoreModule = require('@alfresco/core').CoreModule;
|
||||
const AppConfigService = require('@alfresco/core').AppConfigService;
|
||||
const AppConfigServiceMock = require('@alfresco/core').AppConfigServiceMock;
|
||||
const TranslationService = require('@alfresco/core').TranslationService;
|
||||
const TranslationMock = require('@alfresco/core').TranslationMock;
|
||||
const TranslateModule = require('@ngx-translate/core').TranslateModule;
|
||||
const CommonModule = require('@angular/common').CommonModule;
|
||||
const FormsModule = require('@angular/forms').FormsModule;
|
||||
const ReactiveFormsModule = require('@angular/forms').ReactiveFormsModule;
|
||||
|
||||
TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreModule, TranslateModule, CommonModule, FormsModule, ReactiveFormsModule],
|
||||
providers: [
|
||||
{provide: AppConfigService, useClass: AppConfigServiceMock},
|
||||
{provide: TranslationService, useClass: TranslationMock}
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
123
lib/config/karma.conf-all.js
Normal file
123
lib/config/karma.conf-all.js
Normal file
@@ -0,0 +1,123 @@
|
||||
const webpackCoverage = require('./webpack.coverage');
|
||||
|
||||
module.exports = function (config) {
|
||||
var _config = {
|
||||
basePath: './',
|
||||
|
||||
frameworks: ['jasmine-ajax', 'jasmine'],
|
||||
|
||||
files: [
|
||||
{pattern: './node_modules/core-js/client/core.js', included: true, watched: false},
|
||||
{pattern: './node_modules/tslib/tslib.js', included: true, watched: false},
|
||||
{pattern: './node_modules/hammerjs/hammer.min.js', included: true, watched: false},
|
||||
{pattern: './node_modules/hammerjs/hammer.min.js.map', included: false, watched: false},
|
||||
|
||||
{
|
||||
pattern: './node_modules/@angular/material/prebuilt-themes/indigo-pink.css',
|
||||
included: true,
|
||||
watched: false
|
||||
},
|
||||
|
||||
//diagrams
|
||||
{pattern: './node_modules/chart.js/dist/Chart.js', included: true, watched: false},
|
||||
{pattern: './node_modules/alfresco-js-api/dist/alfresco-js-api.min.js', included: true, watched: false},
|
||||
{pattern: './node_modules/raphael/raphael.min.js', included: true, watched: false},
|
||||
{pattern: './node_modules/moment/min/moment.min.js', included: true, watched: false},
|
||||
{
|
||||
pattern: './node_modules/ng2-charts/bundles/ng2-charts.umd.js',
|
||||
included: false,
|
||||
served: true,
|
||||
watched: false
|
||||
},
|
||||
|
||||
// pdf-js
|
||||
{pattern: './node_modules/pdfjs-dist/build/pdf.js', included: true, watched: false},
|
||||
{pattern: './node_modules/pdfjs-dist/build/pdf.worker.js', included: true, watched: false},
|
||||
{pattern: './node_modules/pdfjs-dist/web/pdf_viewer.js', included: true, watched: false},
|
||||
|
||||
{pattern: config.component + '/karma-test-shim.js', watched: false},
|
||||
|
||||
{pattern: './core/i18n/**/en.json', included: false, served: true, watched: false},
|
||||
{pattern: './content-services/i18n/**/en.json', included: false, served: true, watched: false},
|
||||
{pattern: './process-services/i18n/**/en.json', included: false, served: true, watched: false},
|
||||
|
||||
{pattern: config.component + '/**/*.ts', included: false, served: true, watched: false},
|
||||
|
||||
{pattern: './config/app.config.json', included: false, served: true, watched: false}
|
||||
],
|
||||
|
||||
webpack: webpackCoverage(config),
|
||||
|
||||
webpackMiddleware: {
|
||||
noInfo: true,
|
||||
stats: {
|
||||
chunks: false
|
||||
}
|
||||
},
|
||||
|
||||
port: 9876,
|
||||
|
||||
proxies: {
|
||||
'/app.config.json': '/base/config/app.config.json'
|
||||
},
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_DISABLE,
|
||||
|
||||
colors: true,
|
||||
|
||||
autoWatch: false,
|
||||
|
||||
captureTimeout: 4800000,
|
||||
browserDisconnectTimeout: 4800000,
|
||||
browserDisconnectTolerance: 10,
|
||||
browserNoActivityTimeout: 3000000,
|
||||
|
||||
browsers: ['Chrome'],
|
||||
|
||||
// Karma plugins loaded
|
||||
plugins: [
|
||||
require('../node_modules/karma-jasmine'),
|
||||
require('../node_modules/karma-coverage'),
|
||||
require('../node_modules/karma-sourcemap-loader'),
|
||||
require('../node_modules/karma-jasmine-ajax'),
|
||||
require('../node_modules/karma-chrome-launcher'),
|
||||
require('../node_modules/karma-webpack'),
|
||||
require('../node_modules/karma-jasmine-html-reporter'),
|
||||
require('../node_modules/karma-mocha-reporter')
|
||||
],
|
||||
|
||||
webpackServer: {
|
||||
noInfo: true
|
||||
},
|
||||
|
||||
// Coverage reporter generates the coverage
|
||||
reporters: ['mocha', 'coverage', 'kjhtml'],
|
||||
|
||||
preprocessors: {
|
||||
'**/karma-test-shim.js': ['webpack'],
|
||||
'(core|content-services|process-services)/**/!(*spec|index|*mock|*model|*event).js': 'coverage'
|
||||
},
|
||||
|
||||
coverageReporter: {
|
||||
includeAllSources: true,
|
||||
dir: './coverage/' + config.component + '/',
|
||||
subdir: 'report',
|
||||
reporters: [
|
||||
{type: 'text'},
|
||||
{type: 'text-summary'},
|
||||
{type: 'json', file: 'coverage-final.json'},
|
||||
{type: 'html'},
|
||||
{type: 'lcov'}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
config.browsers = ['ChromeHeadless'];
|
||||
config.reporters = ['dots', 'coverage'];
|
||||
}
|
||||
|
||||
config.set(_config);
|
||||
};
|
60
lib/config/webpack.build.js
Normal file
60
lib/config/webpack.build.js
Normal file
@@ -0,0 +1,60 @@
|
||||
const webpackMerge = require('webpack-merge');
|
||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
|
||||
const commonConfig = require('./webpack.common.js');
|
||||
const fs = require('fs');
|
||||
const webpack = require('webpack');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = webpackMerge(commonConfig, {
|
||||
|
||||
// require those dependencies but don't bundle them
|
||||
externals: [
|
||||
/^\@angular\//,
|
||||
/^rxjs\//,
|
||||
/^\@ngx-translate\//,
|
||||
'moment',
|
||||
'minimatch',
|
||||
'raphael',
|
||||
'ng2-charts',
|
||||
'alfresco-js-api',
|
||||
/^\@alfresco\//,
|
||||
'content-services',
|
||||
'process-services',
|
||||
'core'
|
||||
],
|
||||
|
||||
output: {
|
||||
filename: '[name]/bundles/[name].js',
|
||||
library: '[name]',
|
||||
libraryTarget: 'umd',
|
||||
chunkFilename: '[id].chunk.js'
|
||||
},
|
||||
|
||||
entry: {
|
||||
"core": "./core/index.ts",
|
||||
"insights": "./insights/index.ts",
|
||||
"content-services": "./content-services/index.ts",
|
||||
"process-services": "./process-services/index.ts"
|
||||
},
|
||||
|
||||
plugins: [
|
||||
|
||||
new UglifyJSPlugin({
|
||||
sourceMap: true,
|
||||
uglifyOptions: {
|
||||
ie8: false,
|
||||
ecma: 6,
|
||||
output: {
|
||||
comments: false,
|
||||
beautify: false
|
||||
},
|
||||
warnings: false
|
||||
}
|
||||
}),
|
||||
|
||||
new webpack.BannerPlugin({
|
||||
banner: fs.readFileSync(path.resolve(__dirname, './assets/license_header_add.txt'), 'utf8'),
|
||||
entryOnly: true
|
||||
})
|
||||
]
|
||||
});
|
10
lib/config/webpack.bundle-check.js
Normal file
10
lib/config/webpack.bundle-check.js
Normal file
@@ -0,0 +1,10 @@
|
||||
const webpackMerge = require('webpack-merge');
|
||||
const webpackBuild = require('./webpack.build.js');
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
|
||||
module.exports = webpackMerge(webpackBuild, {
|
||||
|
||||
plugins: [
|
||||
new BundleAnalyzerPlugin()
|
||||
]
|
||||
});
|
173
lib/config/webpack.common.js
Normal file
173
lib/config/webpack.common.js
Normal file
@@ -0,0 +1,173 @@
|
||||
const webpack = require('webpack');
|
||||
const helpers = require('./helpers');
|
||||
const path = require('path');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
var HappyPack = require('happypack');
|
||||
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
||||
|
||||
const alfrescoLibs = [
|
||||
'content-services',
|
||||
'process-services',
|
||||
'core'
|
||||
];
|
||||
|
||||
const ENV = process.env.NODE_ENV = process.env.ENV = 'production';
|
||||
|
||||
module.exports = {
|
||||
|
||||
devtool: 'source-map',
|
||||
|
||||
resolveLoader: {
|
||||
alias: {
|
||||
"file-multi-loader": path.resolve(__dirname, "./custom-loaders/file-loader-multi"),
|
||||
"license-check": path.resolve(__dirname, "./custom-loaders/license-check")
|
||||
}
|
||||
},
|
||||
|
||||
resolve: {
|
||||
alias: {
|
||||
"@alfresco/content-services": path.resolve(__dirname, '../content-services/'),
|
||||
"@alfresco/content-services$": path.resolve(__dirname, '../content-services/index.ts'),
|
||||
"@alfresco/process-services": path.resolve(__dirname, '../process-services/'),
|
||||
"@alfresco/process-services$": path.resolve(__dirname, '../process-services/index.ts'),
|
||||
"@alfresco/core": path.resolve(__dirname, '../core/'),
|
||||
"@alfresco/core$": path.resolve(__dirname, '../core/index.ts'),
|
||||
"@alfresco/insights": path.resolve(__dirname, '../insights/'),
|
||||
"@alfresco/insights": path.resolve(__dirname, '../insights/index.ts')
|
||||
},
|
||||
extensions: ['.ts', '.js', '.scss'],
|
||||
modules: [helpers.root('node_modules')]
|
||||
},
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.js$/,
|
||||
loader: 'source-map-loader',
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
|
||||
},
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.ts$/,
|
||||
use: 'source-map-loader',
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
|
||||
},
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.ts$/,
|
||||
loader: 'tslint-loader',
|
||||
options: {
|
||||
configFile : helpers.root('tslint.json'),
|
||||
emitErrors: true,
|
||||
failOnHint: true,
|
||||
fix: true
|
||||
},
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
|
||||
},
|
||||
{
|
||||
test: /\.ts$/,
|
||||
loader: ['happypack/loader?id=ts', 'angular2-template-loader'],
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
|
||||
},
|
||||
{
|
||||
test: /\.html$/,
|
||||
loader: 'html-loader',
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
loader: ['happypack/loader?id=css'],
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [{
|
||||
loader: "to-string-loader"
|
||||
}, {
|
||||
loader: "raw-loader"
|
||||
}, {
|
||||
loader: "sass-loader"
|
||||
}]
|
||||
},
|
||||
{
|
||||
enforce: 'pre',
|
||||
test: /\.ts$/,
|
||||
loader: 'license-check',
|
||||
options: {
|
||||
emitErrors: true,
|
||||
licenseFile: path.resolve(__dirname, './assets/license_header.txt')
|
||||
},
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/, /rendering-queue.services.ts/]
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)$/,
|
||||
loader: 'file-multi-loader',
|
||||
query: {
|
||||
name: '[name].[hash].[ext]',
|
||||
outputPath: (url, resourcePath)=> {
|
||||
return resourcePath.replace('assets/', 'bundles/assets/') + url;
|
||||
},
|
||||
publicPath: (url, resourcePath)=> {
|
||||
return resourcePath + url;
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
plugins: [
|
||||
new ForkTsCheckerWebpackPlugin(),
|
||||
new HappyPack({
|
||||
id: 'ts',
|
||||
threads: 4,
|
||||
loaders: [
|
||||
{
|
||||
path: 'ts-loader',
|
||||
query: {
|
||||
happyPackMode: true,
|
||||
"compilerOptions": {
|
||||
"paths": {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}),
|
||||
|
||||
new HappyPack({
|
||||
id: 'css',
|
||||
threads: 4,
|
||||
loaders: ['to-string-loader', 'css-loader' ]
|
||||
}),
|
||||
|
||||
new CopyWebpackPlugin([
|
||||
... alfrescoLibs.map(lib => {
|
||||
return {
|
||||
from: `${lib}/i18n/`,
|
||||
to: `${lib}/bundles/assets/${lib}/i18n/`
|
||||
}
|
||||
})
|
||||
]),
|
||||
|
||||
new webpack.NoEmitOnErrorsPlugin(),
|
||||
|
||||
new webpack.ContextReplacementPlugin( /angular(\\|\/)core(\\|\/)/, path.resolve(__dirname, './src') ),
|
||||
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
'ENV': JSON.stringify(ENV)
|
||||
}
|
||||
}),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
htmlLoader: {
|
||||
minimize: false // workaround for ng2
|
||||
}
|
||||
})
|
||||
],
|
||||
|
||||
node: {
|
||||
fs: 'empty',
|
||||
module: false
|
||||
}
|
||||
};
|
26
lib/config/webpack.coverage.js
Normal file
26
lib/config/webpack.coverage.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const webpack = require('webpack');
|
||||
const webpackMerge = require('webpack-merge');
|
||||
const testConfig = require('./webpack.test.js');
|
||||
const helpers = require('./helpers');
|
||||
|
||||
module.exports = function (config) {
|
||||
return webpackMerge(testConfig, {
|
||||
|
||||
devtool: 'inline-source-map',
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
enforce: 'post',
|
||||
test: /^(?!(.*spec|index|.*mock|.*model|.*event)).*\.ts?$/,
|
||||
loader: 'istanbul-instrumenter-loader',
|
||||
include: [helpers.root(config.component)],
|
||||
exclude: [
|
||||
/node_modules/,
|
||||
/test/
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
};
|
23
lib/config/webpack.doc.js
Normal file
23
lib/config/webpack.doc.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const helpers = require('./helpers');
|
||||
const webpackMerge = require('webpack-merge');
|
||||
const webpackBuild = require('./webpack.build');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = webpackMerge(webpackBuild, {
|
||||
|
||||
resolveLoader: {
|
||||
alias: {
|
||||
"generate-list-component-loader": path.resolve(__dirname, "./custom-loaders/generateListComponent")
|
||||
}
|
||||
},
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts/,
|
||||
loader: 'generate-list-component-loader',
|
||||
exclude: [/node_modules/, /bundles/, /dist/, /demo/]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
36
lib/config/webpack.style.js
Normal file
36
lib/config/webpack.style.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const ExtractTextPlugin = require("extract-text-webpack-plugin");
|
||||
|
||||
const extractScss = new ExtractTextPlugin('./core/prebuilt-themes/[name].css');
|
||||
|
||||
module.exports = {
|
||||
|
||||
entry: {
|
||||
'adf-blue-orange': './core/styles/prebuilt/adf-blue-orange.scss',
|
||||
'adf-blue-purple': './core/styles/prebuilt/adf-blue-purple.scss',
|
||||
'adf-cyan-orange': './core/styles/prebuilt/adf-cyan-orange.scss',
|
||||
'adf-cyan-purple': './core/styles/prebuilt/adf-cyan-purple.scss',
|
||||
'adf-green-purple': './core/styles/prebuilt/adf-green-purple.scss',
|
||||
'adf-green-orange': './core/styles/prebuilt/adf-green-orange.scss',
|
||||
'adf-pink-bluegrey': './core/styles/prebuilt/adf-pink-bluegrey.scss',
|
||||
'adf-indigo-pink': './core/styles/prebuilt/adf-indigo-pink.scss',
|
||||
'adf-purple-green': './core/styles/prebuilt/adf-purple-green.scss'
|
||||
},
|
||||
|
||||
output: {
|
||||
filename: './dist/[name].js'
|
||||
},
|
||||
|
||||
module: {
|
||||
rules: [{
|
||||
test: /\.scss$/,
|
||||
use: extractScss.extract([{
|
||||
loader: "raw-loader"
|
||||
}, {
|
||||
loader: "sass-loader"
|
||||
}])
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
extractScss
|
||||
]
|
||||
};
|
22
lib/config/webpack.test.js
Normal file
22
lib/config/webpack.test.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const webpackMerge = require('webpack-merge');
|
||||
const commonConfig = require('./webpack.common.js');
|
||||
|
||||
module.exports = webpackMerge(commonConfig, {
|
||||
|
||||
devtool: 'inline-source-map',
|
||||
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.(txt|pdf)$/,
|
||||
loader: 'file-loader',
|
||||
query: {
|
||||
name: '[path][name].[ext]',
|
||||
outputPath: (url)=> {
|
||||
return url.replace('src', 'dist');
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user