forked from ManageIQ/manageiq-ui-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the result of `rake webpacker:install` and `webpacker:install:angular`, except moved to ui-classic. (This does not add bin/yarn, nor the rake tasks by itself)
- Loading branch information
Showing
26 changed files
with
409 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
plugins: | ||
postcss-smart-import: {} | ||
precss: {} | ||
autoprefixer: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'hello-angular', | ||
template: `<h1>Hello {{name}}</h1>` | ||
}) | ||
export class AppComponent { | ||
name = 'Angular!'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { BrowserModule } from '@angular/platform-browser'; | ||
import { NgModule } from '@angular/core'; | ||
|
||
import { AppComponent } from './app.component'; | ||
|
||
@NgModule({ | ||
declarations: [ | ||
AppComponent | ||
], | ||
imports: [ | ||
BrowserModule | ||
], | ||
providers: [], | ||
bootstrap: [AppComponent] | ||
}) | ||
export class AppModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import './polyfills.ts'; | ||
|
||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; | ||
import { AppModule } from './app/app.module'; | ||
|
||
platformBrowserDynamic().bootstrapModule(AppModule); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// This file includes polyfills needed by Angular and is loaded before | ||
// the app. You can add your own extra polyfills to this file. | ||
import 'core-js/es6/symbol'; | ||
import 'core-js/es6/object'; | ||
import 'core-js/es6/function'; | ||
import 'core-js/es6/parse-int'; | ||
import 'core-js/es6/parse-float'; | ||
import 'core-js/es6/number'; | ||
import 'core-js/es6/math'; | ||
import 'core-js/es6/string'; | ||
import 'core-js/es6/date'; | ||
import 'core-js/es6/array'; | ||
import 'core-js/es6/regexp'; | ||
import 'core-js/es6/map'; | ||
import 'core-js/es6/set'; | ||
import 'core-js/es6/reflect'; | ||
|
||
import 'core-js/es7/reflect'; | ||
import 'zone.js/dist/zone'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* eslint no-console:0 */ | ||
// This file is automatically compiled by Webpack, along with any other files | ||
// present in this directory. You're encouraged to place your actual application logic in | ||
// a relevant structure within app/javascript and only use these pack files to reference | ||
// that code so it'll be compiled. | ||
// | ||
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate | ||
// layout file, like app/views/layouts/application.html.erb | ||
|
||
console.log('Hello World from Webpacker') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Run this Angular example by adding the following HTML markup to your view: | ||
// | ||
// <hello-angular>Loading...</hello-angular> | ||
// | ||
// <%= javascript_pack_tag 'hello_angular' %> | ||
|
||
require('../hello_angular') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env ruby | ||
$stdout.sync = true | ||
|
||
require "shellwords" | ||
require "yaml" | ||
|
||
ENV["RAILS_ENV"] ||= "development" | ||
RAILS_ENV = ENV["RAILS_ENV"] | ||
|
||
ENV["NODE_ENV"] ||= RAILS_ENV | ||
NODE_ENV = ENV["NODE_ENV"] | ||
|
||
APP_PATH = File.expand_path("../", __dir__) | ||
CONFIG_PATH = File.join(APP_PATH, "config/webpack/paths.yml") | ||
DEV_SERVER_CONFIG_PATH = File.join(APP_PATH, "config/webpack/development.server.yml") | ||
|
||
begin | ||
paths = YAML.load(File.read(CONFIG_PATH)) | ||
dev_server = YAML.load(File.read(DEV_SERVER_CONFIG_PATH)) | ||
|
||
NODE_MODULES_PATH = File.join(APP_PATH.shellescape, paths["node_modules"]) | ||
WEBPACK_CONFIG_PATH = File.join(APP_PATH.shellescape, paths["config"]) | ||
|
||
if NODE_ENV == "development" && dev_server["enabled"] | ||
puts "Warning: webpack-dev-server is currently enabled in #{DEV_SERVER_CONFIG_PATH}. " \ | ||
"Disable to serve assets directly from public/packs directory" | ||
end | ||
rescue Errno::ENOENT, NoMethodError | ||
puts "Configuration not found in config/webpack/paths.yml or config/webpack/development.server.yml." | ||
puts "Please run bundle exec rails webpacker:install to install webpacker" | ||
exit! | ||
end | ||
|
||
WEBPACK_BIN = "#{NODE_MODULES_PATH}/.bin/webpack" | ||
WEBPACK_CONFIG = "#{WEBPACK_CONFIG_PATH}/#{NODE_ENV}.js" | ||
|
||
Dir.chdir(APP_PATH) do | ||
exec "NODE_PATH=#{NODE_MODULES_PATH} #{WEBPACK_BIN} --config #{WEBPACK_CONFIG}" \ | ||
" #{ARGV.join(" ")}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env ruby | ||
$stdout.sync = true | ||
|
||
require "shellwords" | ||
require "yaml" | ||
|
||
ENV["RAILS_ENV"] ||= "development" | ||
RAILS_ENV = ENV["RAILS_ENV"] | ||
|
||
ENV["NODE_ENV"] ||= RAILS_ENV | ||
NODE_ENV = ENV["NODE_ENV"] | ||
|
||
APP_PATH = File.expand_path("../", __dir__) | ||
CONFIG_PATH = File.join(APP_PATH, "config/webpack/paths.yml") | ||
|
||
begin | ||
paths = YAML.load(File.read(CONFIG_PATH)) | ||
|
||
NODE_MODULES_PATH = File.join(APP_PATH.shellescape, paths["node_modules"]) | ||
WEBPACK_CONFIG_PATH = File.join(APP_PATH.shellescape, paths["config"]) | ||
|
||
WEBPACK_BIN = "#{NODE_MODULES_PATH}/.bin/webpack-dev-server" | ||
DEV_SERVER_CONFIG = "#{WEBPACK_CONFIG_PATH}/development.server.js" | ||
rescue Errno::ENOENT, NoMethodError | ||
puts "Configuration not found in config/webpacker/paths.yml." | ||
puts "Please run bundle exec rails webpacker:install to install webpacker" | ||
exit! | ||
end | ||
|
||
Dir.chdir(APP_PATH) do | ||
exec "NODE_PATH=#{NODE_MODULES_PATH} #{WEBPACK_BIN} --progress --color " \ | ||
"--config #{DEV_SERVER_CONFIG}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env ruby | ||
|
||
ENV['RAILS_ENV'] ||= 'development' | ||
ENV['NODE_ENV'] ||= ENV['RAILS_ENV'] | ||
|
||
BIN_PATH = File.expand_path('.', __dir__) | ||
|
||
Dir.chdir(BIN_PATH) do | ||
exec "./webpack --watch --progress --color #{ARGV.join(" ")}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Common configuration for webpacker loaded from config/webpack/paths.yml | ||
|
||
const { join, resolve } = require('path') | ||
const { env } = require('process') | ||
const { safeLoad } = require('js-yaml') | ||
const { readFileSync } = require('fs') | ||
|
||
const configPath = resolve('config', 'webpack') | ||
const loadersDir = join(__dirname, 'loaders') | ||
const paths = safeLoad(readFileSync(join(configPath, 'paths.yml'), 'utf8')) | ||
const devServer = safeLoad(readFileSync(join(configPath, 'development.server.yml'), 'utf8')) | ||
const publicPath = env.NODE_ENV !== 'production' && devServer.enabled ? | ||
`http://${devServer.host}:${devServer.port}/` : `/${paths.entry}/` | ||
|
||
module.exports = { | ||
devServer, | ||
env, | ||
paths, | ||
loadersDir, | ||
publicPath | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Note: You must restart bin/webpack-watcher for changes to take effect | ||
|
||
const merge = require('webpack-merge') | ||
const sharedConfig = require('./shared.js') | ||
|
||
module.exports = merge(sharedConfig, { | ||
devtool: 'sourcemap', | ||
|
||
stats: { | ||
errorDetails: true | ||
}, | ||
|
||
output: { | ||
pathinfo: true | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Note: You must restart bin/webpack-dev-server for changes to take effect | ||
|
||
const { resolve } = require('path') | ||
const merge = require('webpack-merge') | ||
const devConfig = require('./development.js') | ||
const { devServer, publicPath, paths } = require('./configuration.js') | ||
|
||
module.exports = merge(devConfig, { | ||
devServer: { | ||
host: devServer.host, | ||
port: devServer.port, | ||
compress: true, | ||
historyApiFallback: true, | ||
contentBase: resolve(paths.output, paths.entry), | ||
publicPath | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Restart webpack-dev-server if you make changes here | ||
enabled: true | ||
host: localhost | ||
port: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
test: /.ts$/, | ||
loader: 'ts-loader' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { env, publicPath } = require('../configuration.js') | ||
|
||
module.exports = { | ||
test: /\.(jpeg|png|gif|svg|eot|ttf|woff|woff2)$/i, | ||
use: [{ | ||
loader: 'file-loader', | ||
options: { | ||
publicPath, | ||
name: env.NODE_ENV === 'production' ? '[name]-[hash].[ext]' : '[name].[ext]' | ||
} | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
test: /\.js(\.erb)?$/, | ||
exclude: /node_modules/, | ||
loader: 'babel-loader', | ||
options: { | ||
presets: [ | ||
['env', { modules: false }] | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
test: /\.coffee(\.erb)?$/, | ||
loader: 'coffee-loader' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
test: /\.erb$/, | ||
enforce: 'pre', | ||
exclude: /node_modules/, | ||
loader: 'rails-erb-loader', | ||
options: { | ||
runner: 'DISABLE_SPRING=1 bin/rails runner' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const ExtractTextPlugin = require('extract-text-webpack-plugin') | ||
|
||
module.exports = { | ||
test: /\.(scss|sass|css)$/i, | ||
use: ExtractTextPlugin.extract({ | ||
fallback: 'style-loader', | ||
use: ['css-loader', 'postcss-loader', 'sass-loader'] | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Restart webpack-watcher or webpack-dev-server if you make changes here | ||
config: config/webpack | ||
entry: packs | ||
output: public | ||
node_modules: node_modules | ||
source: app/javascript | ||
extensions: | ||
- .coffee | ||
- .js | ||
- .jsx | ||
- .ts | ||
- .vue | ||
- .sass | ||
- .scss | ||
- .css | ||
- .png | ||
- .svg | ||
- .gif | ||
- .jpeg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* eslint global-require: 0 */ | ||
// Note: You must run bin/webpack for changes to take effect | ||
|
||
const webpack = require('webpack') | ||
const merge = require('webpack-merge') | ||
const CompressionPlugin = require('compression-webpack-plugin') | ||
const sharedConfig = require('./shared.js') | ||
|
||
module.exports = merge(sharedConfig, { | ||
output: { filename: '[name]-[chunkhash].js' }, | ||
|
||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin(), | ||
new CompressionPlugin({ | ||
asset: '[path].gz[query]', | ||
algorithm: 'gzip', | ||
test: /\.(js|css|svg|eot|ttf|woff|woff2)$/ | ||
}) | ||
] | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Note: You must restart bin/webpack-watcher for changes to take effect | ||
/* eslint global-require: 0 */ | ||
/* eslint import/no-dynamic-require: 0 */ | ||
|
||
const webpack = require('webpack') | ||
const { basename, join, resolve } = require('path') | ||
const { sync } = require('glob') | ||
const { readdirSync } = require('fs') | ||
const ExtractTextPlugin = require('extract-text-webpack-plugin') | ||
const ManifestPlugin = require('webpack-manifest-plugin') | ||
const extname = require('path-complete-extname') | ||
const { env, paths, publicPath, loadersDir } = require('./configuration.js') | ||
|
||
const extensionGlob = `*{${paths.extensions.join(',')}}*` | ||
const packPaths = sync(join(paths.source, paths.entry, extensionGlob)) | ||
|
||
module.exports = { | ||
entry: packPaths.reduce( | ||
(map, entry) => { | ||
const localMap = map | ||
localMap[basename(entry, extname(entry))] = resolve(entry) | ||
return localMap | ||
}, {} | ||
), | ||
|
||
output: { filename: '[name].js', path: resolve(paths.output, paths.entry) }, | ||
|
||
module: { | ||
rules: readdirSync(loadersDir).map(file => ( | ||
require(join(loadersDir, file)) | ||
)) | ||
}, | ||
|
||
plugins: [ | ||
new webpack.EnvironmentPlugin(JSON.parse(JSON.stringify(env))), | ||
new ExtractTextPlugin(env.NODE_ENV === 'production' ? '[name]-[hash].css' : '[name].css'), | ||
new ManifestPlugin({ fileName: 'manifest.json', publicPath, writeToFileEmit: true }) | ||
], | ||
|
||
resolve: { | ||
extensions: paths.extensions, | ||
modules: [ | ||
resolve(paths.source), | ||
resolve(paths.node_modules) | ||
] | ||
}, | ||
|
||
resolveLoader: { | ||
modules: [paths.node_modules] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.