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

consolidate configuration and compilation objects #11

Closed
1 of 5 tasks
thescientist13 opened this issue Mar 27, 2019 · 1 comment · Fixed by #43
Closed
1 of 5 tasks

consolidate configuration and compilation objects #11

thescientist13 opened this issue Mar 27, 2019 · 1 comment · Fixed by #43
Assignees
Labels
chore unit testing, maintenance, etc v0.2.0
Milestone

Comments

@thescientist13
Copy link
Member

thescientist13 commented Mar 27, 2019

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

It might make sense to consolidate these two objects, to reduce the cumbersome nature of passing them around.

Note: this should only focus on internal configuration / refactoring. Have opened #40 for exposing userland APIs

Details

  1. Consolidate config into compilation object
  2. Update all references throughout the build pipeline
  3. All tests should pass
  4. Unify with webpack configuration per [RFC] User Workspace PoC #33 (comment)
  5. A number of TODOs raised discussed in Internal dev watching/rebuilding script and commander interface #36
    • publicPath
    • userWorkspace, pagesDir in webpack configs
    • config
    • entry in webpack.config.develop.js

This will help clear a path forward for the following issues:

@thescientist13 thescientist13 added the chore unit testing, maintenance, etc label Mar 27, 2019
This was referenced Apr 3, 2019
@thescientist13 thescientist13 added this to the MVP milestone Apr 3, 2019
@thescientist13 thescientist13 added the RFC Proposal and changes to workflows, architecture, APIs, etc label Apr 14, 2019
@thescientist13 thescientist13 removed the RFC Proposal and changes to workflows, architecture, APIs, etc label Apr 16, 2019
@thescientist13
Copy link
Member Author

Might make sense to think of less as a configuration object, and more as a sort of internal state just for greenwood to configure itself appropriately and to provide a single source of truth (compilation) for all tasks and configurations.

So we can hoist it all to index.js or init and setup it up like

const userHasWorkspace = /* test for user's source directory */;
const userHasWorkspacePages = /* test for user's source directory */;
const rootContext = userHasWorkspace ? /* users src/ directory */ : /* internal templates */ ;
const pagesDir = userHasWorkspacePages ? userHasWorkspacePages : /* internal templates */ ;
const hasTemplates = /* etc */;
// figure out all context situations

const contexts = {
   pagesDir: path.join(rootContext, pagesDir),
   scratchDir: path.join(process.cwd(), './.greenwood/'),
   templatesDir: path.join(rootContext, '../templates/'),
   publicDir: path.join(process.cwd(), './public'),
   pageTemplatePath: 'page-template.js',
   appTemplatePath: 'app-template.js',
   default: true
}

Then have this "cascade" / passed down as needed. Then for #40 , we can just expose a single file in the user's root directory where they can pass in their own src/ directory and then all we would need to do is override rootContext . 👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore unit testing, maintenance, etc v0.2.0
Projects
None yet
2 participants