Conversation
| "url": "git+https://github.com/storybooks/storybook.git" | ||
| }, | ||
| "main": "src/index.js", | ||
| "main": "dist/index.js", |
There was a problem hiding this comment.
I'm not sure if the old main field was a mistake or if I'm missing something
There was a problem hiding this comment.
This package is never ever required by anything. This explains why this bug was never found.
|
I've tested this on a CRA project on OSX. It would be great if we could test it on: (A) React Native |
| } | ||
|
|
||
| function updateSourceCode() { | ||
| const jscodeshiftPath = path.dirname(require.resolve('jscodeshift')); |
There was a problem hiding this comment.
Is this a reliable way to get the path to the compiled package? jscodeshift doesn't appear to offer its commandline functionality via an API
There was a problem hiding this comment.
Have you found this method to be unreliable?
There was a problem hiding this comment.
No, but it feels a little hacky. For instance it hard codes the path of the binary into this file (rather than npm run jscodeshift which uses the bin field of jscodeshift's package.json).
Codecov Report
@@ Coverage Diff @@
## master #1146 +/- ##
==========================================
- Coverage 12.75% 12.72% -0.04%
==========================================
Files 199 199
Lines 4571 4582 +11
Branches 724 727 +3
==========================================
Hits 583 583
- Misses 3347 3356 +9
- Partials 641 643 +2
Continue to review full report at Codecov.
|
shilman
left a comment
There was a problem hiding this comment.
@tmeasday how do I properly link? What I did:
npm run bootstrap
cd lib/cli
npm link
cd path/to/testapp_with_storybook2
getstorybook
Then I get the following error:
MBP:testapp shilman$ getstorybook
getstorybook - the simplest way to add a storybook to your project.
• Detecting project type. ✓
module.js:471
throw err;
^
Error: Cannot find module './transforms/update-organisation-name'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/shilman/projects/storybook/new/storybook/lib/codemod/dist/index.js:7:31)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
I get the same error when I try to run ../../path/to/storybook/lib/cli/bin/generate.js directly
|
You may need to npm install inside the cli sir? |
|
@tmeasday bootstrap already does the install? Even when I manually install inside the clr, I still get the same error. |
|
Hmm, I think the culprit is this line: https://github.com/storybooks/storybook/blob/master/lib/codemod/package.json#L15 which does something a bit weird. (Fill me in @ndelangen? It seems weird/broken to have the compiled behaviour/file locations be different from the uncompiled ones) [I'm not sure why but for some combination of commands it actually didn't move the file from the I can update the PR to remove that weirdness, but let's find out why it's there first. |
|
@tmeasday I suspect it was just to make this upgrade instruction shorter for users: |
20aa565 to
f1c4474
Compare
|
Ok, I'll make the change now and @ndelangen can approve that specific change. |
| }, | ||
| "scripts": { | ||
| "prepublish": "node ../../scripts/prepublish.js && mv dist/transforms/* dist" | ||
| "prepublish": "node ../../scripts/prepublish.js" |
There was a problem hiding this comment.
@ndelangen you should perhaps check this change.
There was a problem hiding this comment.
I added this to shorten the paths, if this is removed the manual needs to be updated
There was a problem hiding this comment.
I updated the README for the package, was there anything else that needed to change?
1b75f8b to
b534551
Compare
This allows us to go from 2.x -> 3.0 A future version of storybook may include a version # that allows us to be more subtle, but we don't need it yet.
b534551 to
104ca51
Compare
|
FTR I think this worked for @shilman, he needs to approve the review now I guess. |
Issue: You need to apply codemod and update your
package.jsonto upgrade to v3What I did
Added a mode to
getstorybook[1] that picks up when it is run in an pre-v3 project and updates all package references inpackage.jsonand using the codemod.[1] Should we rename the command to
storybook [install]now as well?How to test
Grab a 2.0 project, run
getstorybook(afternpm link-ing of course). It should have correctly updated all references to the packages in bothpackage.jsonand JS files.