Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cycle one-fits-all #1

Merged
merged 9 commits into from
Feb 5, 2017
Merged

Cycle one-fits-all #1

merged 9 commits into from
Feb 5, 2017

Conversation

jvanbruegge
Copy link
Collaborator

This is not finished yet, have to add package.json dependencies and I have to adjust eject.js

'xstream'
]

switch (streamLib) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

streamLib options are not supported anymore

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied your ts-webpack one and adjusted it :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is everything xstream now?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its up to your flavor, that what a flavor is all about.

appPackage.dependencies = appPackage.dependencies || {}
appPackage.devDependencies = appPackage.devDependencies || {}
appPackage.scripts = {
'start': 'NODE_ENV=development webpack --config webpack.config.js',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see what you doing here, and I can also see what lead to that. Up till version 3, we were less cleaner with things. for example we were adding dependencies to the package.json while the only dependency that should be there (until you decide to eject) should only be your flavor (that will hide behind all the complexity). By using webpack in this way you leaking into the package json some of the module dependencies...

As a reference check the latest cycle-scripts - This is now the only core-flavor.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, I've updated the reference, somehow during v3 release scripts weren't installing basics dependencies as a separate step -> https://github.com/cyclejs-community/create-cycle-app/blob/master/packages/cycle-scripts/scripts/init.js#L8-L12

@jvanbruegge
Copy link
Collaborator Author

Should I use a .babelrc file in the template or should I modify the package.json?

@nickbalestra
Copy link
Collaborator

nickbalestra commented Feb 4, 2017

At the moment we are extending the package.json

@jvanbruegge
Copy link
Collaborator Author

I think I got everything

@jvanbruegge jvanbruegge force-pushed the cycle-scripts-one-fits-all branch 3 times, most recently from b6520c1 to 8a95635 Compare February 4, 2017 18:56
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2017 Nick Balestra
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should put your name here :)

@jvanbruegge
Copy link
Collaborator Author

If I'm not completely wrong, the .babelrc file is now read and added to the package.json, so there is no double configuration

Copy link
Collaborator

@nickbalestra nickbalestra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! I've tried to run it locally, The eject script seems to works fine. The others require few minor fixes. To reproduce just install flavor from local: create-cycle-app appName --flavor /absolute/path/to/flavor-directory

}

const babelrc = JSON.parse(fs.readFileSync(
path.join(__dirname, 'scripts', '.babelrx'), { encoding: 'utf-8' })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This throws an error as there is not such file. I guess you meaned something like: path.join(__dirname, 'configs', '.babelrc')

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, of course. Will fix in a minute

const port = 8080
process.env.NODE_ENV = 'development'

const config = require('./configs/webpack.config.js')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to run it and it throws the following errors:

fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"
fallbackLoader option has been deprecated - replace with "fallback"
loader option has been deprecated - replace with "use"

testApp/node_modules/webpack-merge/lib/join-arrays-smart.js:124
  var _entry$loader$match = entry.loader.match(loaderNameRe),

Some how your setup is generate a webpack1 configuration while you running on webpack2

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same error when running the build script

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, I dont get those errors

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I had a typo in '--flavor' and create-cycle-app downloaded the core flavor. You should add an error if there is an unknown option given

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks for that I'll open an issue!

const spawn = require('cross-spawn')
const chalk = require('chalk')

const mocha = path.resolve(process.cwd(), 'node_modules', '.bin', 'mocha')
Copy link
Collaborator

@nickbalestra nickbalestra Feb 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could easily break, as you are referencing an executable that we are not sure is going to be present (if you want to use mocha, it should be added as dependency I guess)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, forgot to add it

@nickbalestra
Copy link
Collaborator

nickbalestra commented Feb 5, 2017

There still one thing that I'm thinking, don't you think that the webpack.config should still be hidden behind the flavor module until eject happen? (same for all the devDependencies added to the package.json as those are dependencies related to the flavor (used by various scripts) not the the app). The idea is that until you eject, you can simply update the flavor to get all the benefit of having someone mantaining it, and you only care about the dependencies you are using for building your app.

@jvanbruegge
Copy link
Collaborator Author

It is currently. Normally the config lives only in the modules and the scripts just use it. Eject copies it over.

@SteveALee
Copy link
Contributor

Given the amount of to and fro on this I'd love to see a guide for making a flavor once this one is complete. Just bullets would probably do with refs to this one.

@nickbalestra
Copy link
Collaborator

@SteveALee good idea, do you want to open an issue for that?

@jvanbruegge
Copy link
Collaborator Author

I have to update the tslint.json and then everything should be fine

@nickbalestra
Copy link
Collaborator

Awesomeness @jvanbruegge seems pretty solid to me. Feel free to merge it once ready.
I'll publish them afterward and work on the readme (both on how to create one, and how to use existing ones with a list). Thank you so much for this!!!

@jvanbruegge jvanbruegge changed the title WIP: Cycle one-fits-all Cycle one-fits-all Feb 5, 2017
@jvanbruegge
Copy link
Collaborator Author

OK, merging now

@jvanbruegge jvanbruegge merged this pull request into master Feb 5, 2017
@nickbalestra
Copy link
Collaborator

@SteveALee i've ported over from the create-cycle-app repo the documentation relative to creating custom flavors, and added a list of the ones we have. Feel free to edit and improve it

@SteveALee
Copy link
Contributor

That's great! Also the table is very useful.

Actually I think @jvanbruegge's will work fine for me. I'll raise an issue.

What is the way to menton a specific lerna package in a monrepo's issues? Just stick it in the subject in []?

@nickbalestra
Copy link
Collaborator

^ yes @SteveALee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants