lanes 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0feadcbac0b7bbdcc56d60c45bbdcf69a208e9fc
4
- data.tar.gz: e447deaa92b26506ec973523a75725d6b93e8a2a
3
+ metadata.gz: 4e996b32bc8dc10aa628ae2eaf9683e14f070ae9
4
+ data.tar.gz: 7b1e8f708c347328a33e5962068db0df86669ad6
5
5
  SHA512:
6
- metadata.gz: fce5c603ac1ba03e5501882ad502436c7eb19b1fa11949ce52bd82b44971512500a729537fd86e1eacb680e4a24168a44cc7b42a67c3aded99691c20d9d8c9d7
7
- data.tar.gz: f61a9c8e78347ec0963a171b048f58c46f4ce25941da5bce39c9c1dbe8304dd07806cd6e6b29f879a43e4fbb2aa4049bfecf47964295f9835bb458ede63165a9
6
+ metadata.gz: 841d9120509bc907ea6e434068b82346e37efdf9ed85baefa2e3f1293c3e947af65ed3c53ae4060f47e89caddcff2e02c72e9c4f785ce869b86a2651dd31fb49
7
+ data.tar.gz: 9828cea8c1618a6635b090a19c93260b6ffe1939484325b2e4f26d41040cd786319a9d3893bb692e867a198cd6c0a31f6f461ecdff714ee0948df79c2e31f52d
@@ -35,111 +35,3 @@ class Config {
35
35
 
36
36
  const ConfigInstance = new Config();
37
37
  export default ConfigInstance;
38
-
39
-
40
-
41
- // static initClass() {
42
-
43
- // this.prototype.mixins = [ Lanes.Models.Mixins.FileSupport ];
44
-
45
- // this.prototype.props = {
46
- // id: {type:"integer"},
47
- // settings: "object"
48
- // };
49
-
50
- // this.prototype.associations = {
51
- // logo: { model: "Lanes.Models.Asset" },
52
- // smtp: { model: "Lanes.Models.SmtpSettings" },
53
- // print_logo: { model: "Lanes.Models.Asset" }
54
- // };
55
- // }
56
-
57
- // modelTypeIdentifier() { return 'system-settings'; }
58
- // url() { return Lanes.config.api_path + '/system-settings'; }
59
- // initialize() {
60
- // this.on('change:settings', this.setDefaultSettings);
61
- // this.smtp.set(__guard__(__guard__(this.settings, x1 => x1.lanes), x => x.smtp));
62
- // return this.setDefaultSettings();
63
- // }
64
-
65
- // setDefaultSettings() {
66
- // if (!this.settings) { this.settings = {}; }
67
- // return this.settings.lanes || (this.settings.lanes = {});
68
- // }
69
-
70
- // forExtension(ext) {
71
- // return this.settings[ext] || (this.settings[ext] = {});
72
- // }
73
-
74
- // setValueForExtension(ext, key, value) {
75
- // return this.forExtension(ext)[key] = value;
76
- // }
77
-
78
- // set(data) {
79
- // let ret = super.set(...arguments);
80
- // this.smtp.set(__guard__(__guard__(this.settings, x1 => x1.lanes), x => x.smtp));
81
- // return ret;
82
- // }
83
-
84
- // dataForSave() {
85
- // let data = super.dataForSave(...arguments);
86
- // data.settings.lanes.smtp = this.smtp.serialize();
87
- // return data;
88
- // }
89
-
90
-
91
- // SystemSettings.initClass();
92
-
93
- // class Config extends Lanes.Models.State {
94
- // static initClass() {
95
-
96
- // this.prototype.session = {
97
- // csrf_token: { type: 'string', setOnce: true },
98
- // root_path: { type: 'string', setOnce: true },
99
- // api_path: { type: 'string', default: '/api' },
100
- // environment: { type: 'string', setOnce: true },
101
- // system_settings: { type: 'state', required: true },
102
- // assets_path_prefix: { type: 'string', setOnce: true },
103
- // api_host: { type: 'string', default: `//${window.location.host }` },
104
- // initial_workspace_screen_id: { type: 'string', setOnce: true }
105
- // };
106
-
107
- // this.prototype.derived = {
108
- // env: {
109
- // deps: ['environment'], fn() {
110
- // return {
111
- // test: this.environment === 'test',
112
- // development: this.environment === 'development',
113
- // production: this.environment === 'production'
114
- // };
115
- // }
116
- // }
117
- // };
118
- // }
119
-
120
- // initialize() {
121
- // return this.system_settings = new SystemSettings;
122
- // }
123
-
124
- // bootstrap(options) {
125
- // if (options.system_settings) {
126
- // this.system_settings.set(options.system_settings);
127
- // delete options.system_settings;
128
- // }
129
- // this.set(options);
130
- // if (_.isObject(options)) { return Lanes.Extensions.setBootstrapData(options); }
131
- // }
132
- // }
133
- // Config.initClass();
134
-
135
- // let configInstance = new Config;
136
-
137
- // Object.defineProperty(Lanes, 'config', {
138
- // get() { return configInstance; },
139
- // set() { throw new Error("Unable to reset config"); }
140
- // }
141
- // );
142
-
143
- // function __guard__(value, transform) {
144
- // return (typeof value !== 'undefined' && value !== null) ? transform(value) : undefined;
145
- // }
data/lanes.gemspec CHANGED
@@ -55,7 +55,7 @@ Gem::Specification.new do |spec|
55
55
  spec.add_dependency "pg", "~> 0.8"
56
56
  spec.add_dependency "rake", "~> 12.0"
57
57
  spec.add_dependency "require_all", "~> 1.3"
58
- spec.add_dependency "resque", "~> 1.25"
58
+ spec.add_dependency "resque", "~> 1.27"
59
59
  spec.add_dependency "sanitize", "~> 3.0"
60
60
  spec.add_dependency "webpack_driver", "~> 0.2"
61
61
  spec.add_dependency "knitter", "~> 0.2"
@@ -3,11 +3,6 @@
3
3
  "notify": false,
4
4
  "testMatch": [ "**/?(*.)(spec|test).js?(x)" ],
5
5
  "moduleFileExtensions": [ "js", "jsx", "json" ],
6
- "setupTestFrameworkScriptFile": "<rootDir>/lib/js/jest/setup.js",
7
- "modulePaths": [
8
- "<rootDir>/client",
9
- "<rootDir>/lib/js/jest/stubs"
10
- ],
11
6
  "transform": {
12
7
  "^.+\\.jsx?$": "babel-jest"
13
8
  },
data/lib/js/jest/mocks.js CHANGED
@@ -49,4 +49,4 @@ fetch.mockResponses = (...responses) => {
49
49
  // Default mock is just a empty string.
50
50
  fetch.mockResponse('');
51
51
 
52
- export { fetch };
52
+ module.exports = { fetch };
data/lib/js/jest/setup.js CHANGED
@@ -1,19 +1,12 @@
1
- import { shallow, mount } from 'enzyme';
2
- import { useStrict } from 'mobx';
3
- import { fetch } from './mocks';
4
-
5
- import 'jest-enzyme';
6
- // jest.mock('flexboxgrid', () => {
7
- // return {};
8
- // });
9
-
10
- //useStrict(true);
1
+ const { shallow, mount } = require('enzyme');
2
+ const { fetch } = require('./mocks');
11
3
 
12
4
  global.shallow = shallow;
13
5
  global.mount = mount;
14
6
  global.fetch = fetch;
7
+ global.React = require('React');
15
8
 
16
- jasmine.addMatchers({
9
+ jest.addMatchers({
17
10
 
18
11
  toHaveRendered() {
19
12
  return {
@@ -25,7 +18,6 @@ jasmine.addMatchers({
25
18
  } else {
26
19
  result.message = `Expected wrapper to contain '${selector}' only once, but it was found ${matchCount} times`;
27
20
  }
28
-
29
21
  return result;
30
22
  },
31
23
  };
@@ -2,8 +2,12 @@
2
2
  const HtmlWebpackPlugin = require('html-webpack-plugin');
3
3
  const webpack = require('webpack');
4
4
  const path = require('path');
5
- const roots = process.env.LANES_EXT_ROOTS || './client';
6
- const generated_dir = process.env.LANES_GENERATED_DIR;
5
+ // const roots = process.env.LANES_EXT_ROOTS || './client';
6
+ // const controlling_root = process.env.LANES_CONTROLLER_DIR;
7
+ // roots.split(',').concat([
8
+ // 'node_modules',
9
+ // generated_dir,
10
+ // ]),
7
11
 
8
12
  const config = {
9
13
  entry: {
@@ -18,16 +22,13 @@ const config = {
18
22
  filename: 'lanes.js',
19
23
  },
20
24
  resolve: {
21
- modules: roots.split(',').concat([
22
- 'node_modules',
23
- generated_dir,
24
- ]),
25
+ modules: process.env.LANES_MODULES.split(':'),
25
26
  extensions: ['.js', '.jsx'],
26
27
  },
27
28
  module: {
28
29
  rules: [
29
30
  { test: /\.css$/, use: ['style-loader', 'css-loader'] },
30
- { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader' },
31
+ { loader: 'babel-loader', test: /\.jsx?$/, exclude: /node_modules/ },
31
32
  { test: /\.scss$/,
32
33
  use: [
33
34
  'style-loader',
@@ -50,7 +51,7 @@ const config = {
50
51
  new HtmlWebpackPlugin({
51
52
  title: 'My App',
52
53
  filename: 'index.html',
53
- template: `${generated_dir}/root-view.tmpl.html`,
54
+ template: `${process.env.GENERATED_CONFIG_DIR}/root-view.tmpl.html`,
54
55
  }),
55
56
  new webpack.DefinePlugin({
56
57
  'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
data/lib/lanes.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'active_record'
2
+ require 'pathname'
2
3
 
3
4
  module Lanes
4
5
  ROOT_PATH = Pathname.new(__FILE__).dirname.join('..')
@@ -23,10 +23,11 @@ module Lanes
23
23
  end
24
24
 
25
25
  def create_files
26
- [ "Gemfile", "Rakefile", "Guardfile", "config.ru",
27
- "config/database.yml"
26
+ [
27
+ "Gemfile", "Rakefile", "Guardfile", "config.ru",
28
+ ".babelrc", "config/database.yml"
28
29
  ].each{ |f| template(f) }
29
- [ ".eslintrc.js", ".babelrc", ".rubocop.yml"
30
+ [ ".eslintrc.js", ".rubocop.yml"
30
31
  ].each{ |f| template("../#{f}", f) }
31
32
  template "lib/namespace.rb", "lib/#{identifier}.rb"
32
33
  template "lib/namespace/version.rb", "lib/#{identifier}/version.rb"
@@ -34,6 +35,7 @@ module Lanes
34
35
  template "lib/namespace/base_model.rb", "lib/#{identifier}/model.rb"
35
36
  template "config/screens.rb"
36
37
  template "config/routes.rb"
38
+ template "config/webpack.config.js"
37
39
  template "config/lanes.rb"
38
40
  template "gitignore",".gitignore"
39
41
 
@@ -65,8 +67,13 @@ module Lanes
65
67
  say 'Installing node modules', :green
66
68
  yarn = Knitter::Yarn.new(self.destination_root)
67
69
  yarn.init
68
- ['lanes-framework', 'jest', 'webpack-dev-server'].each do | package_name |
69
- say(sprintf(' %-20s…', package_name), nil, false)
70
+ [
71
+ 'jest',
72
+ 'lanes-framework',
73
+ 'react-router',
74
+ 'webpack-dev-server'
75
+ ].each do | package_name |
76
+ say(sprintf(' %-20s', package_name + '…'), nil, false)
70
77
  package = Knitter::Package.new(package_name, yarn: yarn)
71
78
  package.add
72
79
  say 'done', :green
@@ -5,7 +5,7 @@ require 'guard/jest'
5
5
 
6
6
  require_relative '../extension'
7
7
  require_relative '../command'
8
-
8
+ require 'irb'
9
9
  module Lanes
10
10
  module Command
11
11
 
@@ -20,6 +20,7 @@ module Lanes
20
20
  attr_accessor :lanes_root_path
21
21
  attr_accessor :extension_path
22
22
  attr_accessor :config_file
23
+ attr_accessor :module_paths
23
24
 
24
25
  def apply_lanes_config
25
26
  Lanes::Configuration.apply
@@ -29,18 +30,19 @@ module Lanes
29
30
  def configure
30
31
  say 'Generating Jest Config', :green
31
32
  ext = Command.load_current_extension(raise_on_fail: true)
32
-
33
33
  self.extension_path = ext.root_path
34
-
35
34
  self.lanes_root_path = ROOT
36
35
  config_dir = Pathname.new(Dir.mktmpdir)
37
36
  self.config_file = config_dir.join("jest.config.json")
37
+ self.module_paths = Extensions.asset_paths(ext, config_dir.to_s)
38
38
  template('js/jest.config.json', config_file, verbose: false, force: true)
39
- return self
39
+ self
40
40
  end
41
41
 
42
42
  def start
43
43
  say 'Starting Jest', :green
44
+ say Dir.pwd, :yellow
45
+ puts "$(npm bin)/jest --watch --config #{config_file};"
44
46
  exec("$(npm bin)/jest --watch --config #{config_file};")
45
47
  end
46
48
  end
@@ -1,10 +1,5 @@
1
1
  require 'guard/cli'
2
- require 'webpack_driver'
3
- require 'puma/cli'
4
- require 'guard/jest'
5
- #require 'lanes/api'
6
2
  require_relative '../webpack'
7
- require_relative 'jest_runner'
8
3
 
9
4
  module Lanes
10
5
  module Command
@@ -16,9 +11,7 @@ module Lanes
16
11
  say "Launching testing server at http://localhost:8888/", :green
17
12
  require 'lanes/api'
18
13
  Lanes::Configuration.apply
19
-
20
- API.webpack = Lanes::Webpack.server
21
-
14
+ API.webpack = Lanes::Webpack.new
22
15
  threads = []
23
16
  Thread.abort_on_exception = true
24
17
  threads << Thread.new { API::Root.run! }
@@ -31,19 +24,14 @@ module Lanes
31
24
  end
32
25
  Lanes.logger.info "ok, ctrl-c trap registered"
33
26
  end
34
-
35
27
  API.webpack.start
36
-
37
28
  sleep(1) # give webpack a bit of time to fail if it's going to
38
-
39
29
  unless API.webpack.alive?
40
30
  puts API.webpack.messages
41
31
  exit 1
42
32
  end
43
-
44
- Guard.start
45
-
46
- API.webpack.stop
33
+ Guard.start # will block until complete
34
+ API.webpack.stop # stop webpack after guard completes
47
35
  end
48
36
  end
49
37
  end
@@ -17,6 +17,13 @@ module Lanes
17
17
  end
18
18
  end
19
19
 
20
+ def asset_paths(controller, additional)
21
+ map { |ext| ext.root_path.join('client').to_s }.reverse + [
22
+ controller.root_path.join('node_modules').to_s,
23
+ additional
24
+ ]
25
+ end
26
+
20
27
  # lock the current controlling extension so that it can't
21
28
  # be changed by other extensions that are loaded later
22
29
  def lock_controlling!
data/lib/lanes/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Lanes
2
2
 
3
- VERSION = "0.8.1"
3
+ VERSION = "0.8.2"
4
4
 
5
5
  end
data/lib/lanes/webpack.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require 'forwardable'
2
+ require 'fileutils'
3
+ require 'pathname'
2
4
  require 'erb'
3
5
 
4
6
  module Lanes
@@ -10,53 +12,53 @@ module Lanes
10
12
 
11
13
  extend Forwardable
12
14
  def_delegators :@process, :port, :environment, :stop, :alive?, :start, :wait
15
+ attr_reader :process
13
16
 
14
- attr_reader :generated_asset_dir
17
+ def initialize
18
+ controller = Command.load_current_extension(raise_on_fail: true)
15
19
 
16
- def self.server
17
20
  config = WebpackDriver::Configuration.new(
18
- Pathname.new(__FILE__).dirname.join('..','js','webpack.config.js'),
19
- directory: Pathname.new(__FILE__).dirname.join('..', '..'),
21
+ controller.root_path.join('config', 'webpack.config.js'),
20
22
  cmd_line_flags: ['--hot', '--inline'],
21
- logger: Lanes.logger
23
+ logger: Lanes.logger,
24
+ directory: controller.root_path
22
25
  )
23
26
 
24
- Webpack.new(config)
27
+ generated_asset_dir = write_asset_files
28
+
29
+ config.environment.merge!(
30
+ EXTENSION_ID: controller.identifier,
31
+ LANES_MODULES: modules(controller, generated_asset_dir).join(':'),
32
+ ENTRY: 'show-maker/index.js',
33
+ GENERATED_CONFIG_DIR: generated_asset_dir.to_s
34
+ )
35
+ @process = ::WebpackDriver::DevServer.new(config)
25
36
  end
26
37
 
27
- attr_reader :process
28
38
 
29
39
  def api_host
30
- Lanes.env.production? ? '' : "http://localhost:#{API::Root.settings.port}"
40
+ Lanes.env.production? ?
41
+ '' : "http://localhost:#{API::Root.settings.port}"
31
42
  end
32
43
 
33
- def initialize(config)
34
-
35
- @generated_asset_dir = Pathname.new(Dir.mktmpdir)
36
- generated_asset_dir.join('lanes').mkpath
37
- write_asset_files
38
-
39
- puts Extensions.map{|ext| ext.root_path.join('client').to_s }.join(',')
40
-
41
- config.environment.merge!(
42
- LANES_EXT_ROOTS: Extensions.map{|ext|
43
- ext.root_path.join('client').to_s
44
- }.join(','),
45
- LANES_GENERATED_DIR: generated_asset_dir.to_s
46
- )
47
-
48
- @process = ::WebpackDriver::DevServer.new(config)
44
+ def modules(controller, generated_asset_dir)
45
+ Extensions.asset_paths(controller, generated_asset_dir.to_s)
49
46
  end
50
47
 
51
48
  def write_asset_files
49
+ dir = Pathname.new(Dir.mktmpdir)
50
+ dir.join('lanes').mkpath
51
+
52
52
  screens = ERB.new(TEMPLATES.join('screens.js').read)
53
- root_view = ERB.new(TEMPLATES.join('root-view.html').read)
54
- generated_asset_dir
53
+ root_view = ERB.new(TEMPLATES.join('root-view.html').read)
54
+ dir
55
55
  .join('lanes', 'screen-definitions.js')
56
56
  .write(screens.result(binding))
57
- generated_asset_dir
58
- .join('root-view.tmpl.html')
59
- .write(root_view.result(binding))
57
+ template = dir.join('root-view.tmpl.html')
58
+ template.write(root_view.result(binding))
59
+ # set the mtime to the past, otherwise Webpack will build repeatedly for a second
60
+ FileUtils.touch template.to_s, :mtime => Time.now - 1.minute
61
+ return dir
60
62
  end
61
63
 
62
64
  def assets
data/package.json CHANGED
@@ -6,38 +6,10 @@
6
6
  "repository": "https://github.com/argosity/lanes",
7
7
  "author": "Nathan Stitt <nathan@stitt.org>",
8
8
  "license": "MIT",
9
- "files": [ "client" ],
9
+ "files": [
10
+ "client"
11
+ ],
10
12
  "dependencies": {
11
- "classnames": "^2.2.5",
12
- "domtastic": "^0.12.3",
13
- "flexboxgrid": "^6.3.1",
14
- "formous": "^0.9.2",
15
- "grommet": "^1.2.1",
16
- "history": "^4.5.1",
17
- "invariant": "^2.2.2",
18
- "lodash": "^4.17.4",
19
- "loglevel": "^1.4.1",
20
- "mobx": "^3.0.0",
21
- "mobx-decorated-models": "^0.4.4",
22
- "mobx-react": "^4.1.0",
23
- "pluralize": "^3.1.0",
24
- "qs": "^6.3.0",
25
- "react": "^15.4.2",
26
- "react-addons-shallow-compare": "^15.4.2",
27
- "react-async-component": "^0.2.2",
28
- "react-dom": "^15.4.2",
29
- "react-dropzone": "^3.10.0",
30
- "react-flexbox-grid": "nathanstitt/react-flexbox-grid#devel",
31
- "react-motion": "^0.4.7",
32
- "react-router": "^3.0.2",
33
- "react-sidebar": "^2.3.0",
34
- "react-virtualized": "^9.0.0",
35
- "rsvp": "^3.3.3",
36
- "serializr": "^1.1.9",
37
- "validator": "^6.2.1",
38
- "whatwg-fetch": "^2.0.2",
39
- "when-dom-ready": "^1.2.4",
40
-
41
13
  "babel-core": "^6.21.0",
42
14
  "babel-eslint": "latest",
43
15
  "babel-jest": "^18.0.0",
@@ -53,25 +25,54 @@
53
25
  "babel-preset-react": "^6.16.0",
54
26
  "babel-preset-stage-0": "^6.22.0",
55
27
  "babel-preset-stage-1": "^6.16.0",
28
+ "classnames": "^2.2.5",
56
29
  "css-loader": "^0.26.1",
30
+ "domtastic": "^0.12.3",
57
31
  "enzyme": "^2.7.0",
58
32
  "eslint": "^3.13.1",
59
33
  "eslint-config-airbnb": "latest",
60
34
  "eslint-plugin-import": "^2.2.0",
61
35
  "eslint-plugin-jsx-a11y": "latest",
62
36
  "eslint-plugin-react": "^6.9.0",
37
+ "flexboxgrid": "^6.3.1",
38
+ "formous": "^0.9.2",
39
+ "grommet": "^1.2.1",
40
+ "history": "^4.5.1",
63
41
  "html-webpack-plugin": "^2.28.0",
64
42
  "identity-obj-proxy": "^3.0.0",
43
+ "invariant": "^2.2.2",
65
44
  "jest": "^19.0.2",
66
45
  "jest-enzyme": "^2.1.2",
67
46
  "jest-fetch-mock": "^1.0.7",
47
+ "lodash": "^4.17.4",
48
+ "loglevel": "^1.4.1",
49
+ "mobx": "^3.0.0",
50
+ "mobx-decorated-models": "^0.4.4",
51
+ "mobx-react": "^4.1.0",
68
52
  "node-sass": "^4.5.0",
53
+ "pluralize": "^3.1.0",
54
+ "qs": "^6.3.0",
55
+ "react": "^15.4.2",
56
+ "react-addons-shallow-compare": "^15.4.2",
69
57
  "react-addons-test-utils": "^15.4.2",
58
+ "react-async-component": "^0.2.2",
59
+ "react-dom": "^15.4.2",
60
+ "react-dropzone": "^3.10.0",
61
+ "react-flexbox-grid": "nathanstitt/react-flexbox-grid#devel",
70
62
  "react-hot-loader": "3.0.0-beta.6",
63
+ "react-motion": "^0.4.7",
64
+ "react-router": "^3.0.2",
65
+ "react-sidebar": "^2.3.0",
71
66
  "react-test-renderer": "^15.4.2",
67
+ "react-virtualized": "^9.0.0",
68
+ "rsvp": "^3.3.3",
72
69
  "sass-loader": "^4.1.1",
70
+ "serializr": "^1.1.9",
73
71
  "style-loader": "^0.13.1",
72
+ "validator": "^6.2.1",
74
73
  "webpack": "v2.2.0-rc.4",
75
- "webpack-dev-server": "v2.2.0-rc.0"
74
+ "webpack-dev-server": "v2.2.0-rc.0",
75
+ "whatwg-fetch": "^2.0.2",
76
+ "when-dom-ready": "^1.2.4"
76
77
  }
77
78
  }
File without changes
data/templates/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # For development while Lanes is evolving track master branch
4
- gem "lanes", git: "https://github.com/argosity/lanes", branch: 'next-gen'
4
+ gem "lanes", git: "https://github.com/argosity/lanes", branch: 'master'
5
5
 
6
6
  # gem "lanes", '<%= Lanes::VERSION %>'
7
7
 
@@ -1,19 +1,6 @@
1
- //=require ./models/Base
2
- //=require ./components/Base
3
- //=require_tree ./models
4
- //=require_tree ./components
5
- //=require ./screens/Base
6
- //=require ./Extension
7
-
8
1
  /*
9
- Files located in the above directories are part of the default
10
- Javascript build and are downloaded to the client on the initial
11
- request.
12
-
13
- Accordingly, only essential files should be included here. Code that
14
- relates to a screen should be placed in the "screens" directory,
15
- where it will be loaded dynamically when the screen is displayed.
2
+ This is the main entry point for your application
3
+ By default it simply imports the standard lanes boot file
4
+ */
16
5
 
17
- Alternatively, feel free to modify the require statements above to
18
- only include the paths you need.
19
- */
6
+ import 'lanes/boot';
@@ -0,0 +1,105 @@
1
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
2
+ const webpack = require('webpack');
3
+ const path = require('path');
4
+
5
+ const config = {
6
+ entry: {
7
+ lanes: [
8
+ 'react-hot-loader/patch',
9
+ process.env.ENTRY,
10
+ ],
11
+ },
12
+ output: {
13
+ path: __dirname,
14
+ publicPath: '/',
15
+ filename: `${process.env.EXTENSION_ID}/.js`,
16
+ },
17
+ resolve: {
18
+ modules: process.env.LANES_MODULES.split(':'),
19
+ extensions: ['.js', '.jsx'],
20
+ },
21
+ module: {
22
+ rules: [
23
+ { test: /\.css$/, use: ['style-loader', 'css-loader'] },
24
+ {
25
+ loader: 'babel-loader',
26
+ test: /\.jsx?$/,
27
+ exclude: /node_modules/,
28
+ options: {
29
+ plugins: [
30
+ 'react-hot-loader/babel',
31
+ 'babel-plugin-transform-decorators-legacy',
32
+ 'babel-plugin-transform-class-properties',
33
+ 'babel-plugin-transform-function-bind',
34
+ 'babel-plugin-transform-react-jsx',
35
+ 'babel-plugin-transform-runtime',
36
+ ].map(require.resolve),
37
+ presets: [
38
+ [require.resolve('babel-preset-es2015'), { modules: false }],
39
+ require.resolve('babel-preset-react'),
40
+ require.resolve('babel-preset-stage-1'),
41
+ ],
42
+ },
43
+ },
44
+ { test: /\.scss$/,
45
+ use: [
46
+ 'style-loader',
47
+ 'css-loader',
48
+ {
49
+ loader: 'sass-loader',
50
+ options: {
51
+ includePaths: [path.resolve('./node_modules')],
52
+ },
53
+ },
54
+ ],
55
+ },
56
+ ],
57
+ },
58
+ devtool: 'source-map',
59
+ plugins: [
60
+ new webpack.optimize.CommonsChunkPlugin({
61
+ name: 'vendor', minChunks: Infinity, filename: '[name].[hash].js',
62
+ }),
63
+ new HtmlWebpackPlugin({
64
+ filename: 'index.html',
65
+ template: `${process.env.GENERATED_CONFIG_DIR}/root-view.tmpl.html`,
66
+ }),
67
+ new webpack.DefinePlugin({
68
+ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
69
+ }),
70
+ ],
71
+ node: {
72
+ fs: 'empty',
73
+ },
74
+ devServer: {
75
+ hot: true,
76
+ inline: true,
77
+ port: 8889,
78
+ historyApiFallback: true,
79
+ proxy: [{
80
+ context: '/api',
81
+ target: 'http://localhost:4567',
82
+ }],
83
+ stats: {
84
+ colors: true,
85
+ profile: true,
86
+ hash: false,
87
+ version: false,
88
+ timings: false,
89
+ assets: true,
90
+ chunks: false,
91
+ modules: false,
92
+ reasons: true,
93
+ children: false,
94
+ source: true,
95
+ errors: true,
96
+ errorDetails: false,
97
+ warnings: true,
98
+ publicPath: false,
99
+ },
100
+ },
101
+ };
102
+
103
+ // console.log(config)
104
+
105
+ module.exports = config;
@@ -1,14 +1,19 @@
1
1
  {
2
- "rootDir": "<%= lanes_root_path %>",
3
- "preset": "<rootDir>/lib/js/jest.config.json",
2
+ "preset": "<%= lanes_root_path %>/lib/js/jest.config.json",
4
3
  "roots": [
5
4
  "<%= extension_path %>/client",
6
- "<%= extension_path %>/spec",
7
- "<rootDir>/client"
5
+ "<%= extension_path %>/spec"
8
6
  ],
7
+ "setupTestFrameworkScriptFile": "<%= lanes_root_path %>/lib/js/jest/setup.js",
8
+ "transform": {
9
+ "^.+\\.jsx?$": "babel-jest"
10
+ },
9
11
  "modulePaths": [
10
- "<%= extension_path %>/client",
11
- "<rootDir>/client",
12
- "<rootDir>/lib/js/jest/stubs"
13
- ]
12
+ <%= module_paths.map{|mod| "\"#{mod}\"" }.join(", ") %>,
13
+ "<%= lanes_root_path %>/lib/js/jest/stubs"
14
+ ],
15
+ "moduleNameMapper": {
16
+ "\\.(css|less|scss)$": "<rootDir>/lib/js/jest/styleMock.js",
17
+ "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/lib/js/jest/fileMock.js"
18
+ }
14
19
  }
@@ -14,7 +14,7 @@ module <%= namespace %>
14
14
  # is returned from this method, it will be passed to
15
15
  # the setBootstrapData method in client/<%= identifier %>/Extension.coffee
16
16
  # when the app boots
17
- def client_bootstrap_data(view)
17
+ def client_bootstrap_data
18
18
  nil
19
19
  end
20
20
  end
File without changes
File without changes
File without changes
File without changes
data/yarn.lock CHANGED
@@ -2965,14 +2965,10 @@ https-browserify@0.0.1:
2965
2965
  version "0.0.1"
2966
2966
  resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82"
2967
2967
 
2968
- iconv-lite@0.4.13:
2968
+ iconv-lite@0.4.13, iconv-lite@~0.4.13:
2969
2969
  version "0.4.13"
2970
2970
  resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2"
2971
2971
 
2972
- iconv-lite@~0.4.13:
2973
- version "0.4.15"
2974
- resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb"
2975
-
2976
2972
  icss-replace-symbols@^1.0.2:
2977
2973
  version "1.0.2"
2978
2974
  resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.0.2.tgz#cb0b6054eb3af6edc9ab1d62d01933e2d4c8bfa5"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lanes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Stitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2017-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -380,14 +380,14 @@ dependencies:
380
380
  requirements:
381
381
  - - "~>"
382
382
  - !ruby/object:Gem::Version
383
- version: '1.25'
383
+ version: '1.27'
384
384
  type: :runtime
385
385
  prerelease: false
386
386
  version_requirements: !ruby/object:Gem::Requirement
387
387
  requirements:
388
388
  - - "~>"
389
389
  - !ruby/object:Gem::Version
390
- version: '1.25'
390
+ version: '1.27'
391
391
  - !ruby/object:Gem::Dependency
392
392
  name: sanitize
393
393
  requirement: !ruby/object:Gem::Requirement
@@ -509,7 +509,6 @@ executables:
509
509
  extensions: []
510
510
  extra_rdoc_files: []
511
511
  files:
512
- - ".babelrc"
513
512
  - ".dir-locals.el"
514
513
  - ".eslintrc.js"
515
514
  - ".flowconfig"
@@ -791,7 +790,6 @@ files:
791
790
  - lib/js/jest/setup.js
792
791
  - lib/js/jest/stubs/screen-definitions.js
793
792
  - lib/js/jest/styleMock.js
794
- - lib/js/webpack-status-plugin.js
795
793
  - lib/js/webpack.config.js
796
794
  - lib/lanes.rb
797
795
  - lib/lanes/access.rb
@@ -851,7 +849,6 @@ files:
851
849
  - lib/lanes/command/generate_screen.usage
852
850
  - lib/lanes/command/guard.rb
853
851
  - lib/lanes/command/jest.rb
854
- - lib/lanes/command/jest_runner.rb
855
852
  - lib/lanes/command/migration_support.rb
856
853
  - lib/lanes/command/model_attribute.rb
857
854
  - lib/lanes/command/named_command.rb
@@ -885,7 +882,6 @@ files:
885
882
  - lib/lanes/extension/definition.rb
886
883
  - lib/lanes/guard_tasks.rb
887
884
  - lib/lanes/hot_reload_plugin.rb
888
- - lib/lanes/jest.rb
889
885
  - lib/lanes/job.rb
890
886
  - lib/lanes/job/failure_logger.rb
891
887
  - lib/lanes/lanes_guard_plugin.rb
@@ -1037,6 +1033,7 @@ files:
1037
1033
  - spec/server/system_settings_spec.rb
1038
1034
  - tasks/migrations.rake
1039
1035
  - tasks/publish.rake
1036
+ - templates/.babelrc
1040
1037
  - templates/Gemfile
1041
1038
  - templates/Guardfile
1042
1039
  - templates/Rakefile
@@ -1059,6 +1056,7 @@ files:
1059
1056
  - templates/config/routes.rb
1060
1057
  - templates/config/screen.rb
1061
1058
  - templates/config/screens.rb
1059
+ - templates/config/webpack.config.js
1062
1060
  - templates/db/create_table_migration.rb
1063
1061
  - templates/gitignore
1064
1062
  - templates/js/jest.config.json
@@ -1070,13 +1068,13 @@ files:
1070
1068
  - templates/lib/namespace/model.rb
1071
1069
  - templates/lib/namespace/version.rb
1072
1070
  - templates/public/.gitkeep
1073
- - templates/specs/client/Screen.coffee
1074
- - templates/specs/client/components/ComponentSpec.coffee
1075
- - templates/specs/client/models/ModelSpec.coffee
1076
- - templates/specs/client/setup.js
1077
- - templates/specs/fixtures/namespace/model.yml
1078
- - templates/specs/server/model_spec.rb
1079
- - templates/specs/server/spec_helper.rb
1071
+ - templates/spec/client/Screen.coffee
1072
+ - templates/spec/client/components/ComponentSpec.coffee
1073
+ - templates/spec/client/models/ModelSpec.coffee
1074
+ - templates/spec/client/setup.js
1075
+ - templates/spec/fixtures/namespace/model.yml
1076
+ - templates/spec/server/model_spec.rb
1077
+ - templates/spec/server/spec_helper.rb
1080
1078
  - test.js
1081
1079
  - views/lanes_root_view.erb
1082
1080
  - yard_ext/all.rb
@@ -1113,7 +1111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1113
1111
  version: '0'
1114
1112
  requirements: []
1115
1113
  rubyforge_project:
1116
- rubygems_version: 2.6.8
1114
+ rubygems_version: 2.6.10
1117
1115
  signing_key:
1118
1116
  specification_version: 4
1119
1117
  summary: Lanes is a framework for easily writing single page web applications
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- var webpack = require("webpack");
4
-
5
- function DashboardPlugin(options) {
6
- this.options = options;
7
- }
8
-
9
- function log(type, value) {
10
- console.log('STATUS:', JSON.stringify({type, value}));
11
- }
12
-
13
- DashboardPlugin.prototype.apply = function(compiler) {
14
- var timer;
15
-
16
- if ( compiler.options.devServer ) {
17
- let {port, host, outputPath} = compiler.options.devServer;
18
- log("dev-server", { port, host, outputPath });
19
- }
20
-
21
- // compiler.apply(new webpack.ProgressPlugin(function (percent, msg) {
22
- // log("compile", {
23
- // "progress": percent,
24
- // "operation": msg,
25
- // "ms": Date.now() - timer
26
- // });
27
- // }));
28
-
29
- compiler.plugin("compile", function() {
30
- timer = Date.now();
31
- log("compile", {
32
- "progress": 0,
33
- "operation": "idle"
34
- })
35
- });
36
-
37
- compiler.plugin("invalid", function() {
38
- log("status", "invalid");
39
- });
40
-
41
- compiler.plugin("failed-module", function(module) {
42
- log("failed-module", module);
43
- });
44
- compiler.plugin("done", function(stats) {
45
- if (stats.compilation.errors && stats.compilation.errors.length){
46
- log("status", "invalid");
47
- for(var i = 0; i < stats.compilation.errors.length; i++){
48
- var err = stats.compilation.errors[i];
49
- log("error", {
50
- name: err.name, message: err.message,
51
- resource: err.module ? err.module.resource : ''
52
- });
53
- }
54
- } else {
55
- log("status", "success");
56
- }
57
- });
58
-
59
- compiler.plugin("failed", function() {
60
- log("status", "failed");
61
- });
62
-
63
- compiler.plugin("valid", function() {
64
- log("status", "valid");
65
- });
66
-
67
- compiler.plugin("after-emit", function(compilation, callback) {
68
- for (var k in compilation.assets){
69
- if(!compilation.assets[k].parents){
70
- log("asset", {name: k, size: compilation.assets[k].size()});
71
- }
72
- }
73
- callback();
74
- });
75
-
76
- }
77
-
78
- module.exports = DashboardPlugin;
@@ -1,63 +0,0 @@
1
- module Lanes
2
- module Command
3
-
4
- class JestRunner
5
-
6
- attr_reader :proc
7
-
8
- extend Forwardable
9
-
10
- def_delegators :@proc, :alive?, :environment, :wait
11
-
12
- def initialize
13
- @proc = ::ChildProcess.build(
14
- Lanes::ROOT_PATH.join('node_modules/jest-cli/bin/jest.js').to_s,
15
- '--watch', '--config',
16
- Lanes::ROOT_PATH.join('lib', 'js', 'jest.config.js').to_s
17
- )
18
- end
19
-
20
- def stop
21
- @proc.stop
22
- @output.close unless @output.closed?
23
- @listener.exit
24
- end
25
-
26
- def write(str)
27
- @proc.io.stdin.write(str + "\n")
28
- puts "WRote #{str}"
29
- end
30
-
31
- def start
32
- @proc.start
33
- @output, w = IO.pipe
34
- @proc.io.stdout = @proc.io.stderr = w
35
-
36
- @proc.duplex = true
37
- puts "one"
38
- puts "two"
39
- @proc.start
40
-
41
-
42
- @listener = Thread.new do
43
- @output.each_line do | l |
44
- Lanes.logger.info l.chomp
45
- print "\r"
46
- end
47
-
48
- # # match = l.match(/^STATUS: (.*)/)
49
- # # if match
50
- # # record_message(JSON.parse(match[1]))
51
- # # # WebpackDriver.config.logger.debug(l.chomp)
52
- # # else
53
- # # WebpackDriver.config.logger.info(l.chomp)
54
- # # end
55
- # end
56
- end
57
- end
58
-
59
-
60
- end
61
-
62
- end
63
- end
data/lib/lanes/jest.rb DELETED
@@ -1,19 +0,0 @@
1
- require 'forwardable'
2
- require 'erb'
3
-
4
- module Lanes
5
- class Jest
6
- attr_reader :config_dir
7
-
8
- def self.launch
9
- puts 'Jest'
10
- @config_dir = Pathname.new(Dir.mktmpdir)
11
-
12
- template config_dir.join('jest.config'), "#{client_dir}/screens/#{screen_id}/index.js"
13
-
14
- puts Dir.glob(config_dir + '*')
15
- end
16
-
17
- end
18
-
19
- end