hauler 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generators/hauler/install_generator.rb +7 -1
- data/lib/generators/hauler/install_npm_generator.rb +1 -1
- data/lib/generators/hauler/templates/package.json +1 -0
- data/lib/hauler/version.rb +1 -1
- data/package.json +5 -5
- data/src/bin/dev-server.js +9 -7
- data/src/bin/read-config.js +6 -6
- data/src/defaults/compiler_config_factory.js +0 -1
- data/src/index.js +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6cb5e994895c6ec1f1fd43894c85b5b8b4dbfa3
|
4
|
+
data.tar.gz: ca388ac352dc98f86929f93d9a85021c355040ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43cced488b291575b476f790b99d54a7ac4f16c15eed7d441892396b3a5ebc272e17e4042cb4731d20e8e10ed5e08d7a27d9666407dde6cda32eeca3d453ab8a
|
7
|
+
data.tar.gz: 4b96959984b6372ed7534ffc20db343b69c31abe0095b687d5c62d36ef0d2df4d315571926adb5723895c92fa89f48e76847c9bd8427c9230995d078d1cf05a5
|
@@ -32,7 +32,7 @@ module Hauler
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def add_node_modules_to_gitignore
|
35
|
-
has_gitignore = File.exist?(Rails.root.join('
|
35
|
+
has_gitignore = File.exist?(Rails.root.join('.gitignore'))
|
36
36
|
return if !has_gitignore
|
37
37
|
|
38
38
|
has_node_modules = IO.read('.gitignore').include? 'node_modules'
|
@@ -48,6 +48,12 @@ module Hauler
|
|
48
48
|
def install_npm
|
49
49
|
generate 'hauler:install_npm'
|
50
50
|
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def rails_app_name
|
55
|
+
Rails.application.class.parent.name
|
56
|
+
end
|
51
57
|
end
|
52
58
|
end
|
53
59
|
end
|
data/lib/hauler/version.rb
CHANGED
data/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "hauler",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.3",
|
4
4
|
"description": "NodeJS binary for the hauler gem",
|
5
5
|
"author": "Arturo Guzman @guzart",
|
6
6
|
"license": "MIT",
|
@@ -8,11 +8,11 @@
|
|
8
8
|
"type": "git",
|
9
9
|
"url": "https://github.com/guzart/hauler.git"
|
10
10
|
},
|
11
|
-
"main": "
|
11
|
+
"main": "dist/index.js",
|
12
12
|
"bin": {
|
13
|
-
"hauler-read-config": "
|
14
|
-
"hauler-server": "
|
15
|
-
"hauler-update-scripts": "
|
13
|
+
"hauler-read-config": "dist/bin/read-config.js",
|
14
|
+
"hauler-server": "dist/bin/dev-server.js",
|
15
|
+
"hauler-update-scripts": "dist/bin/update-scripts.js"
|
16
16
|
},
|
17
17
|
"scripts": {
|
18
18
|
"build": "npm-run-all clean generate_package compile",
|
data/src/bin/dev-server.js
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
|
+
// @flow
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
import webpack from 'webpack';
|
5
|
+
import WebpackDevServer from 'webpack-dev-server';
|
6
|
+
import { getAppName, getCompilerConfig, getDevServerConfig, getEnvName } from '../index';
|
6
7
|
|
7
|
-
const env =
|
8
|
-
const railsRoot = process.argv[2];
|
8
|
+
const env = getEnvName();
|
9
|
+
const railsRoot = process.argv[2] || process.cwd();
|
10
|
+
const appName = process.argv[3] || getAppName(railsRoot);
|
9
11
|
|
10
|
-
const devServerConfig =
|
11
|
-
const compilerConfig =
|
12
|
+
const devServerConfig = getDevServerConfig(env, railsRoot, appName);
|
13
|
+
const compilerConfig = getCompilerConfig(env, railsRoot, appName);
|
12
14
|
|
13
15
|
// console.log(devServerConfig);
|
14
16
|
// console.log(compilerConfig);
|
data/src/bin/read-config.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env node
|
2
2
|
// @flow
|
3
|
-
'use strict';
|
4
3
|
|
5
|
-
|
4
|
+
import { getAppName, getCompilerConfig, getDevServerConfig, getEnvName } from '../index';
|
6
5
|
|
7
|
-
const
|
8
|
-
const
|
6
|
+
const env = getEnvName();
|
7
|
+
const railsRoot = process.argv[2] || process.cwd();
|
8
|
+
const appName = process.argv[3] || getAppName(railsRoot);
|
9
9
|
|
10
|
-
const devServerConfig =
|
11
|
-
const compilerConfig =
|
10
|
+
const devServerConfig = getDevServerConfig(env, railsRoot, appName);
|
11
|
+
const compilerConfig = getCompilerConfig(env, railsRoot, appName);
|
12
12
|
const config = { devServerConfig, compilerConfig };
|
13
13
|
const output = JSON.stringify(config);
|
14
14
|
|
data/src/index.js
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
// @flow
|
2
2
|
|
3
|
+
import fs from 'fs';
|
4
|
+
import path from 'path';
|
3
5
|
import * as utils from './utils';
|
4
6
|
|
5
7
|
function getProjectConfig(env: string): ProjectConfig {
|
@@ -51,3 +53,9 @@ export function getCompilerConfig(
|
|
51
53
|
}
|
52
54
|
|
53
55
|
export { getEnvName } from './utils';
|
56
|
+
|
57
|
+
export function getAppName(railsRoot: string): string {
|
58
|
+
const contents = fs.readFileSync(path.join(railsRoot, 'package.json'));
|
59
|
+
const pkg = JSON.parse(contents.toString());
|
60
|
+
return pkg.name;
|
61
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hauler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arturo Guzman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|