[ADF-3299] and [ADF-3300] upgrade to Angular and Material 6 (#3579)

* upgrade to HttpClient

* upgrade to Renderer2

* upgrade Document reference

* remove useless test with deprecated ReflectiveInjector

* upgrade to latest typescript

* upgrade libs

* upgrade package scripts

* remove rxjs blacklists and duplicate rules

* add rxjs compat to help with migration

* fix breaking changes

* fix breaking changes in material

* fix breaking changes (material 6)

* upgrade rxjs, ngx-translate and flex layout

* update unit tests

* restore providers

* upgrade deprecated Observable.error

* rebase
fix first configuration problems

* fix style issues commented

* fix core build

* fix lib template errors

* move lib test execution in angular.json

* ignore

* karma conf files

* fix import statement test

* single run option

* update packages reporter

* restore report

* increase timeout

* improve karma conf test configuration

* fix test issues about lint

* fix test analytics

* fix process service test

* content service fix test

* fix logout directive test

* fix core test

* fix build

* update node-sass to latest

* update angular cli dependencies

* improve build script

create directorites and move files only if previous command succeded

* upgrade individual libs to 6.0

* remove old webpack files

* revert sass change

* fix type issues
fix style issues

* fix tslint demo shell issue

* fix peerdependencies

* fix test e2e BC

* package upate

* fix style import issue

* extract-text-webpack-plugin beta

* fix test dist build command

* remove alpha js-api

* fix tslint issue
add banner tslint rule

* upload service fix

* change BC script

* fix test dist script

* increase demo shell timeout test

* verbose copy

* path absolute

* fix script bc

* fix copy part

* fix path warning
fix monaco editor

* remove duplicate header

* remove unused import

* fix align and check ago tests

* add missing import

* fix notification button selector

* [ANGULAR6] fixed core tests

* fix CS test

* fix cs test step 2

* increase travis_wait for dist

* fix attachment PS

* fix checklist test

* use pdf min
This commit is contained in:
Denys Vuika
2018-08-07 11:58:16 +01:00
committed by Eugenio Romano
parent c510ec864d
commit 6b24bfb1d4
371 changed files with 16287 additions and 24504 deletions

View File

@@ -1,16 +0,0 @@
/*!
* @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.
*/

View File

@@ -1,14 +0,0 @@
@license
Copyright <%= moment().format('YYYY') %> 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.

View File

@@ -3,23 +3,17 @@ var writeFileSync = require('fs-extra').writeFileSync;
var mkdirpSync = require('fs-extra').mkdirpSync;
new Bundler().Bundle('./lib/core/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('core');
writeFileSync('./lib/dist/core/_theming.scss', result.bundledContent);
});
new Bundler().Bundle('./lib/insights/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('insights');
writeFileSync('./lib/dist/insights/_theming.scss', result.bundledContent);
});
new Bundler().Bundle('./lib/process-services/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('process-services');
writeFileSync('./lib/dist/process-services/_theming.scss', result.bundledContent);
});
new Bundler().Bundle('./lib/content-services/styles/_index.scss', '**/*.scss').then(result => {
mkdirpSync('content-services');
writeFileSync('./lib/dist/content-services/_theming.scss', result.bundledContent);
});

View File

@@ -1,155 +0,0 @@
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);
}

View File

@@ -1,67 +0,0 @@
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);
};

View File

@@ -1,10 +0,0 @@
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;

View File

@@ -1,56 +0,0 @@
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 NoopAnimationsModule = require('@angular/platform-browser/animations').NoopAnimationsModule;
const CoreModule = require('../core').CoreModule;
const AppConfigService = require('../core').AppConfigService;
const AppConfigServiceMock = require('../core').AppConfigServiceMock;
const TranslationService = require('../core').TranslationService;
const TranslationMock = require('../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;
const AlfrescoApiService = require('../core').AlfrescoApiService;
const AlfrescoApiServiceMock = require('../core').AlfrescoApiServiceMock;
TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
NoopAnimationsModule,
CoreModule,
TranslateModule,
CommonModule,
FormsModule,
ReactiveFormsModule
],
providers: [
{provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock},
{provide: AppConfigService, useClass: AppConfigServiceMock},
{provide: TranslationService, useClass: TranslationMock}
]
});
});
afterEach(() => {
TestBed.resetTestingModule();
});

View File

@@ -1,151 +0,0 @@
const webpackCoverage = require('./webpack.coverage');
const webpackTest = require('./webpack.test');
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},
// 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: './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
},
{pattern: './lib/core/i18n/**/en.json', included: false, served: true, watched: false},
{pattern: './lib/content-services/i18n/**/en.json', included: false, served: true, watched: false},
{pattern: './lib/process-services/i18n/**/en.json', included: false, served: true, watched: false},
{pattern: './lib/**/*.ts', included: false, served: true, watched: false},
{pattern: './lib/config/app.config.json', included: false, served: true, watched: false},
{pattern: './lib/core/viewer/assets/fake-test-file.pdf', included: false, served: true, watched: false},
{pattern: './lib/core/viewer/assets/fake-test-file.txt', included: false, served: true, watched: false},
{
pattern: './lib/core/viewer/assets/fake-test-password-file.pdf',
included: false,
served: true,
watched: false
},
{pattern: './lib/' + config.component + '/karma-test-shim.js', watched: false}
],
webpack: (config.mode === 'coverage') ? webpackCoverage(config) : webpackTest(config),
webpackMiddleware: {
noInfo: true,
stats: {
chunks: false
}
},
port: 9876,
proxies: {
'/app.config.json': '/base/lib/config/app.config.json',
'/fake-test-file.pdf': '/base/lib/core/viewer/assets/fake-test-file.pdf',
'/fake-test-file.txt': '/base/lib/core/viewer/assets/fake-test-file.txt',
'/fake-test-password-file.pdf': '/base/lib/core/viewer/assets/fake-test-password-file.pdf'
},
// 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,
browserDisconnectTimeout: 200000,
browserNoActivityTimeout: 2400000,
captureTimeout: 1200000,
browsers: ['Chrome'],
// browsers: ['ChromeHeadless'],
customLaunchers: {
ChromeHeadless: {
base: 'Chrome',
flags: [
'--no-sandbox',
'--headless',
'--disable-gpu',
'--remote-debugging-port=9222'
]
}
},
// 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'],
mochaReporter: {
ignoreSkipped: true
},
preprocessors: {
'**/karma-test-shim.js': ['webpack'],
'(core|content-services|process-services)/**/!(*spec|index|*mock|*model|*event).js': 'coverage'
},
coverageReporter: {
includeAllSources: true,
dir: './lib/coverage/' + config.component + '/',
subdir: 'report',
reporters: [
{type: 'text'},
{type: 'text-summary'},
{type: 'json', file: 'coverage-final.json'},
{type: 'html'},
{type: 'lcov'}
]
}
// client: {
// jasmine: {
// random: true
// }
// }
};
config.set(_config);
};

View File

@@ -1 +0,0 @@
console.log('Start');

View File

@@ -1,60 +0,0 @@
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: 'dist-webpack/[name]/bundles/adf-[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
})
]
});

View File

@@ -1,10 +0,0 @@
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()
]
});

View File

@@ -1,178 +0,0 @@
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',
'insights'
];
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/adf-content-services": path.resolve(__dirname, '../content-services/'),
"@alfresco/adf-content-services$": path.resolve(__dirname, '../content-services/index.ts'),
"@alfresco/adf-process-services": path.resolve(__dirname, '../process-services/'),
"@alfresco/adf-process-services$": path.resolve(__dirname, '../process-services/index.ts'),
"@alfresco/adf-core": path.resolve(__dirname, '../core/'),
"@alfresco/adf-core$": path.resolve(__dirname, '../core/index.ts'),
"@alfresco/adf-insights": path.resolve(__dirname, '../insights/'),
"@alfresco/adf-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)=> {
var component = resourcePath.substring(0, resourcePath.indexOf('/'));
var path = resourcePath.replace(component, '');
return path + url;
}
}
}
]
},
plugins: [
new ForkTsCheckerWebpackPlugin(),
new HappyPack({
id: 'ts',
threads: 4,
loaders: [
{
path: 'ts-loader',
query: {
happyPackMode: true,
"compilerOptions": {
"outDir": "./",
"declaration": true,
"paths": {
}
}
}
}
]
}),
new HappyPack({
id: 'css',
threads: 4,
loaders: ['to-string-loader', 'css-loader' ]
}),
new CopyWebpackPlugin([
... alfrescoLibs.map(lib => {
return {
from: `lib/${lib}/i18n/`,
to: `lib/${lib}/bundles/assets/adf-${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
}
};

View File

@@ -1,36 +0,0 @@
const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const commonConfig = require('./webpack.common.js');
const helpers = require('./helpers');
module.exports = function (config) {
return 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');
}
}
},
{
enforce: 'post',
test: /^(?!(.*spec|index|.*mock|.*model|.*event)).*\.ts?$/,
loader: 'istanbul-instrumenter-loader',
include: [helpers.root(config.component)],
exclude: [
/node_modules/,
/test/
]
}
]
}
});
};

View File

@@ -1,23 +0,0 @@
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/]
}
]
}
});

View File

@@ -1,9 +1,12 @@
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractScss = new ExtractTextPlugin('./lib/dist/core/prebuilt-themes/[name].css');
const extractScss = new ExtractTextPlugin('./core/prebuilt-themes/[name].css');
var path = require("path");
module.exports = {
mode: 'production',
entry: {
'adf-blue-orange': './lib/core/styles/prebuilt/adf-blue-orange.scss',
'adf-blue-purple': './lib/core/styles/prebuilt/adf-blue-purple.scss',
@@ -17,7 +20,9 @@ module.exports = {
},
output: {
filename: './dist/[name].js'
path: path.resolve(__dirname, '../dist/'),
filename: '[name].js',
publicPath: '/dist'
},
module: {

View File

@@ -1,24 +0,0 @@
const webpackMerge = require('webpack-merge');
const commonConfig = require('./webpack.common.js');
module.exports = function (config) {
return 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');
}
}
}
]
}
});
};