Skip to content

Commit

Permalink
fix(oracle): Add a webpack config for oracle. Remove import from core…
Browse files Browse the repository at this point in the history
…/* alias
  • Loading branch information
christopherthielen authored and mergify[bot] committed Feb 8, 2020
1 parent a777a51 commit f386e53
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

import { module } from 'angular';

import { AccountService, AuthenticationService, BakeryReader, Registry, PipelineTemplates } from '@spinnaker/core';
import {
AccountService,
AuthenticationService,
BakeryReader,
BakeExecutionLabel,
Registry,
PipelineTemplates,
} from '@spinnaker/core';
import { ORACLE_PIPELINE_STAGES_BAKE_BAKEEXECUTIONDETAILS_CONTROLLER } from './bakeExecutionDetails.controller';

export const ORACLE_PIPELINE_STAGES_BAKE_OCIBAKESTAGE = 'spinnaker.oracle.pipeline.stage.bakeStage';
Expand All @@ -16,7 +23,7 @@ module(ORACLE_PIPELINE_STAGES_BAKE_OCIBAKESTAGE, [ORACLE_PIPELINE_STAGES_BAKE_BA
description: 'Bakes an image',
templateUrl: require('./bakeStage.html'),
executionDetailsUrl: require('./bakeExecutionDetails.html'),
executionLabelTemplateUrl: require('core/pipeline/config/stages/bake/BakeExecutionLabel'),
executionLabelComponent: BakeExecutionLabel,
supportsCustomTimeout: true,
validators: [
{ type: 'requiredField', fieldName: 'accountName' },
Expand Down
126 changes: 126 additions & 0 deletions app/scripts/modules/oracle/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
'use strict';

const path = require('path');
const basePath = path.join(__dirname, '..', '..', '..', '..');
const NODE_MODULE_PATH = path.join(basePath, 'node_modules');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const nodeExternals = require('webpack-node-externals');
const TerserPlugin = require('terser-webpack-plugin');
const exclusionPattern = /(node_modules|\.\.\/deck)/;
const WEBPACK_THREADS = Math.max(require('physical-cpu-count') - 1, 1);

const WATCH = process.env.WATCH === 'true';
const WEBPACK_MODE = WATCH ? 'development' : 'production';
const IS_PRODUCTION = WEBPACK_MODE === 'production';

module.exports = {
context: basePath,
mode: WEBPACK_MODE,
stats: 'minimal',
watch: WATCH,
entry: {
lib: path.join(__dirname, 'src', 'index.ts'),
},
output: {
path: path.join(__dirname, 'lib'),
filename: '[name].js',
library: '@spinnaker/oracle',
libraryTarget: 'umd',
umdNamedDefine: true,
},
devtool: 'source-map',
optimization: {
minimizer: IS_PRODUCTION
? [
new TerserPlugin({
cache: true,
parallel: true,
sourceMap: true,
terserOptions: {
ecma: 6,
mangle: false,
output: {
comments: false,
},
},
}),
]
: [], // disable minification in development mode
},
resolve: {
extensions: ['.json', '.js', '.jsx', '.ts', '.tsx', '.css', '.less', '.html'],
modules: [NODE_MODULE_PATH, path.resolve('.')],
alias: {
'@spinnaker/core': path.resolve(basePath, 'app', 'scripts', 'modules', 'core', 'src'),
coreImports: path.resolve(
basePath,
'app',
'scripts',
'modules',
'core',
'src',
'presentation',
'less',
'imports',
'commonImports.less',
),
oracle: path.join(__dirname, 'src'),
},
},
module: {
rules: [
{
test: /\.js$/,
use: [
{ loader: 'cache-loader' },
{ loader: 'thread-loader', options: { workers: WEBPACK_THREADS } },
{ loader: 'babel-loader' },
{ loader: 'envify-loader' },
{ loader: 'eslint-loader' },
],
exclude: exclusionPattern,
},
{
test: /\.tsx?$/,
use: [
{ loader: 'cache-loader' },
{ loader: 'thread-loader', options: { workers: WEBPACK_THREADS } },
{ loader: 'ts-loader', options: { happyPackMode: true } },
{ loader: 'eslint-loader' },
],
exclude: exclusionPattern,
},
{
test: /\.less$/,
use: [
{ loader: 'style-loader' },
{ loader: 'css-loader' },
{ loader: 'postcss-loader' },
{ loader: 'less-loader' },
],
},
{
test: /\.css$/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader' }, { loader: 'postcss-loader' }],
},
{
test: /\.html$/,
exclude: exclusionPattern,
use: [
{ loader: 'ngtemplate-loader?relativeTo=' + path.resolve(__dirname) + '&prefix=ecs' },
{ loader: 'html-loader' },
],
},
{
test: /\.(woff|woff2|otf|ttf|eot|png|gif|ico|svg)$/,
use: [{ loader: 'file-loader', options: { name: '[name].[hash:5].[ext]' } }],
},
{
test: require.resolve('jquery'),
use: [{ loader: 'expose-loader?$' }, { loader: 'expose-loader?jQuery' }],
},
],
},
plugins: [new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true })],
externals: ['@spinnaker/core', nodeExternals({ modulesDir: '../../../../node_modules' })],
};

0 comments on commit f386e53

Please sign in to comment.