Skip to content

Commit

Permalink
Fix editing package version
Browse files Browse the repository at this point in the history
(Did this ever work? I thought it did... but I don't see how...)
  • Loading branch information
1j01 committed Jun 2, 2016
1 parent f1c4722 commit e08e587
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions app/src/components/package-editor/PackageIdentification.coffee
Expand Up @@ -3,15 +3,10 @@ latest_versions = {}
semver = require "semver"

class @PackageVersion extends React.Component
constructor: ->
@state = version: null
# FIXME: edited version state persists between packages

render: ->
{exec_npm} = @props
{version, exec_npm, update_package} = @props
package_name = @props.name
is_private = @props.private
version = @state.version ? @props.version

CHECKING_NPM = "checking npm..."

Expand Down Expand Up @@ -43,8 +38,10 @@ class @PackageVersion extends React.Component
key: "version-input"
value: version
onChange: (e)=>
# FIXME: doesn't update the actual package
@setState version: e.target.value
# FIXME: cursor moves to end of input
# because rerender doesn't occur immediately
update_package (pkg)=>
pkg.version = e.target.value
if "#{version}".match /^\d+\.\d+\.\d+\b/
[_, major, minor, patch, after] = version.match /^(\d+)\.(\d+)\.(\d+)\b(.*)/
segment_strings = [major, minor, patch]
Expand Down Expand Up @@ -74,8 +71,10 @@ class @PackageVersion extends React.Component
else
segment
[major, minor, patch] = segments
# FIXME: doesn't update the actual package
@setState version: "#{major}.#{minor}.#{patch}#{after}"

update_package (pkg)=>
pkg.version = "#{major}.#{minor}.#{patch}#{after}"

E "i.octicon.octicon-plus"

unless is_private
Expand Down Expand Up @@ -115,6 +114,8 @@ class @PackageName extends React.Component
E "input.input.package-name",
value: name
onChange: (e)=>
# FIXME: cursor moves to end of input
# because rerender doesn't occur immediately
update_package (pkg)=>
pkg.name = e.target.value

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "project-nexus",
"description": "A hub for all your programming projects",
"version": "1.13.1",
"version": "1.13.2",
"repository": {
"type": "git",
"url": "http://github.com/1j01/project-nexus.git"
Expand Down

0 comments on commit e08e587

Please sign in to comment.