Skip to content

Commit

Permalink
chore(build/azure): made azure follow module conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinawoo authored and christopherthielen committed Jun 6, 2019
1 parent c9cb288 commit 0ef7676
Show file tree
Hide file tree
Showing 116 changed files with 269 additions and 84 deletions.
3 changes: 2 additions & 1 deletion app/scripts/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import { KAYENTA_MODULE } from '@spinnaker/kayenta';
import { TITUS_MODULE } from '@spinnaker/titus';
import { ECS_MODULE } from '@spinnaker/ecs';
import '@spinnaker/cloudfoundry';
import { AZURE_MODULE } from '@spinnaker/azure';

module('netflix.spinnaker', [
CORE_MODULE,
AMAZON_MODULE,
GOOGLE_MODULE,
ECS_MODULE,
require('./modules/azure/azure.module').name,
AZURE_MODULE,
KUBERNETES_V1_MODULE,
DOCKER_MODULE,
ORACLE_MODULE,
Expand Down
4 changes: 4 additions & 0 deletions app/scripts/modules/azure/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
yalc.*
.*
tsconfig.json
webpack.config.js
82 changes: 0 additions & 82 deletions app/scripts/modules/azure/azure.module.js

This file was deleted.

11 changes: 11 additions & 0 deletions app/scripts/modules/azure/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@spinnaker/azure",
"version": "0.0.248",
"main": "lib/lib.js",
"typings": "lib/index.d.ts",
"scripts": {
"clean": "../../../../node_modules/rimraf/bin.js lib",
"lib": "npm run clean && ../../../../node_modules/typescript/bin/tsc && node ../../../../node_modules/webpack/bin/webpack.js",
"prepublishOnly": "npm run lib"
}
}
79 changes: 79 additions & 0 deletions app/scripts/modules/azure/src/azure.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { module } from 'angular';

import { CloudProviderRegistry, DeploymentStrategyRegistry } from '@spinnaker/core';

import './help/azure.help';
import './logo/azure.logo.less';

// load all templates into the $templateCache
const templates = require.context('./', true, /\.html$/);
templates.keys().forEach(function(key) {
templates(key);
});

export const AZURE_MODULE = 'spinnaker.azure';
module(AZURE_MODULE, [
require('./pipeline/stages/destroyAsg/azureDestroyAsgStage').name,
require('./pipeline/stages/enableAsg/azureEnableAsgStage').name,
require('./pipeline/stages/disableAsg/azureDisableAsgStage').name,
require('./pipeline/stages/bake/azureBakeStage').name,
require('./serverGroup/details/serverGroup.details.module').name,
require('./serverGroup/serverGroup.transformer').name,
require('./serverGroup/configure/wizard/CloneServerGroup.azure.controller').name,
require('./serverGroup/configure/serverGroup.configure.azure.module').name,
require('./instance/azureInstanceType.service').name,
require('./loadBalancer/loadBalancer.transformer').name,
require('./loadBalancer/details/loadBalancerDetail.controller').name,
require('./loadBalancer/configure/createLoadBalancer.controller').name,
require('./instance/details/instance.details.controller').name,
require('./securityGroup/details/securityGroupDetail.controller').name,
require('./securityGroup/configure/CreateSecurityGroupCtrl').name,
require('./securityGroup/configure/EditSecurityGroupCtrl').name,
require('./securityGroup/securityGroup.transformer').name,
require('./securityGroup/securityGroup.reader').name,
require('./image/image.reader').name,
require('./validation/applicationName.validator').name,
]).config(function() {
CloudProviderRegistry.registerProvider('azure', {
name: 'Azure',
logo: {
path: require('./logo/logo_azure.png'),
},
image: {
reader: 'azureImageReader',
},
serverGroup: {
transformer: 'azureServerGroupTransformer',
detailsTemplateUrl: require('./serverGroup/details/serverGroupDetails.html'),
detailsController: 'azureServerGroupDetailsCtrl',
cloneServerGroupTemplateUrl: require('./serverGroup/configure/wizard/serverGroupWizard.html'),
cloneServerGroupController: 'azureCloneServerGroupCtrl',
commandBuilder: 'azureServerGroupCommandBuilder',
configurationService: 'azureServerGroupConfigurationService',
},
instance: {
instanceTypeService: 'azureInstanceTypeService',
detailsTemplateUrl: require('./instance/details/instanceDetails.html'),
detailsController: 'azureInstanceDetailsCtrl',
},
loadBalancer: {
transformer: 'azureLoadBalancerTransformer',
detailsTemplateUrl: require('./loadBalancer/details/loadBalancerDetail.html'),
detailsController: 'azureLoadBalancerDetailsCtrl',
createLoadBalancerTemplateUrl: require('./loadBalancer/configure/createLoadBalancer.html'),
createLoadBalancerController: 'azureCreateLoadBalancerCtrl',
CreateLoadBalancerModal: require('./loadBalancer/configure/AzureLoadBalancerChoiceModal')
.AzureLoadBalancerChoiceModal,
},
securityGroup: {
transformer: 'azureSecurityGroupTransformer',
reader: 'azureSecurityGroupReader',
detailsTemplateUrl: require('./securityGroup/details/securityGroupDetail.html'),
detailsController: 'azureSecurityGroupDetailsCtrl',
createSecurityGroupTemplateUrl: require('./securityGroup/configure/createSecurityGroup.html'),
createSecurityGroupController: 'azureCreateSecurityGroupCtrl',
},
});
});

DeploymentStrategyRegistry.registerProvider('azure', ['redblack']);
File renamed without changes.
1 change: 1 addition & 0 deletions app/scripts/modules/azure/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './azure.module';
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions app/scripts/modules/azure/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"buildOnSave": false,
"compileOnSave": true,
"compilerOptions": {
"allowJs": false,
"baseUrl": "./src",
"declaration": true,
"declarationDir": "lib",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"jsx": "react",
"lib": ["es2016", "dom", "es2017.object"],
"moduleResolution": "node",
"module": "esnext",
"noEmitHelpers": false,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": false, // should really get to a place where we can turn this on
"noUnusedLocals": true,
"noUnusedParameters": true,
"outDir": "lib",
"pretty": true,
"removeComments": false,
"rootDir": "./src",
"skipLibCheck": true,
"sourceMap": true,
"inlineSources": true,
"strictNullChecks": false, // should really get to a place where we can turn this on
"target": "es6",
"typeRoots": ["../../../../node_modules/@types"],
"paths": {
"@spinnaker/core": ["../../core/lib"],
"core/*": ["../../core/lib/*"]
}
},
"files": ["src/index.ts"],
"include": ["src/**/*.ts", "src/**/*.tsx"],
"exclude": ["./lib", "**/*.spec.*"]
}
130 changes: 130 additions & 0 deletions app/scripts/modules/azure/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
'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/azure',
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',
),
azure: path.join(__dirname),
},
},
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: 'tslint-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=azure' },
{ 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',
'exports-loader?"n3-line-chart"!n3-charts/build/LineChart.js',
nodeExternals({ modulesDir: '../../../../node_modules' }),
],
};
2 changes: 1 addition & 1 deletion gradle/buildModules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ nvm install ${NODE_JS_VERSION}

# go find all the modules and add them
if [[ ${#MODULES_TO_BE_BUILT[0]} -eq 0 ]]; then
SKIPPED_MODULES=("dcos" "azure" "canary" "oracle") # skipped modules that are not following the module format
SKIPPED_MODULES=("dcos" "canary" "oracle") # skipped modules that are not following the module format

MODULES_TO_BE_BUILT=("core") # enforce module build order

Expand Down
2 changes: 2 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ function configure(env, webpackOpts) {
'@spinnaker/cloudfoundry': path.join(__dirname, 'app', 'scripts', 'modules', 'cloudfoundry', 'src'),
titus: path.join(__dirname, 'app', 'scripts', 'modules', 'titus', 'src'),
'@spinnaker/titus': path.join(__dirname, 'app', 'scripts', 'modules', 'titus', 'src'),
azure: path.join(__dirname, 'app', 'scripts', 'modules', 'azure', 'src'),
'@spinnaker/azure': path.join(__dirname, 'app', 'scripts', 'modules', 'azure', 'src'),
},
},
module: {
Expand Down

0 comments on commit 0ef7676

Please sign in to comment.