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

Intelligent list of paths. #31

Open
rwjblue opened this issue Jul 31, 2017 · 7 comments
Open

Intelligent list of paths. #31

rwjblue opened this issue Jul 31, 2017 · 7 comments

Comments

@rwjblue
Copy link
Member

rwjblue commented Jul 31, 2017

By default (e.g. no customized arguments) the codemod should process the following directories:

  • If in an addon (determined by keywords in package.json):
    • addon, addon-test-support, and tests
  • If in an app:
    • app and tests
  • Both addon and app types should process any require('./package)['ember-addon'].paths

The codemod should also allow an explicit path to be specified on the command line. When specified on the command line, the default paths (described above) should not be processed and only the specific path provided in the first arg should be processed.

@rwjblue
Copy link
Member Author

rwjblue commented Jul 31, 2017

@Turbo87 - You 👍 on the general plan laid out above?

@Turbo87
Copy link
Contributor

Turbo87 commented Jul 31, 2017

in general I'm 👍

I'm just not sure what the require() stuff is for 🤔

@rwjblue
Copy link
Member Author

rwjblue commented Jul 31, 2017

Haha, I was just too lazy to write it out manually. For the auto-detect bit, this is basically what I'm proposing:

const ADDON_PATHS = ['addon', 'addon-test-support', 'tests'];
const APP_PATHS = ['app', 'tests'];

let paths;
let package = JSON.parse(fs.readFileSync('package.json'));
if (package.keywords && package.keywords.indexOf('ember-addon') > -1) {
  // addon
  paths = ADDON_PATHS.slice();
} else {
  // app
  paths = APP_PATHS.slice();
}

if (package['ember-addon'] && package['ember-addon'].paths) {
  package['ember-addon'].paths).filter(Boolean);
  package['ember-addon'].paths.forEach(inRepoAddonBasePath => {
    ADDON_PATHS.forEach(addonFolderName => {
      let fullPath = path.join(inRepoAddonBasePath, addonFolderName);
      paths.push(fullPath);
    });
  });
}

@Turbo87
Copy link
Contributor

Turbo87 commented Jul 31, 2017

aka. in-repo-addons, right?

@rwjblue
Copy link
Member Author

rwjblue commented Jul 31, 2017

c

@rwjblue
Copy link
Member Author

rwjblue commented Jul 31, 2017

currently we auto-process all of lib which isn't guaranteed to be an addon at all (e.g. many addons use lib for node-land code also)

@cyril-sf
Copy link
Contributor

Is this still needed?

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

No branches or pull requests

3 participants