5.4.6 • Published 4 years ago

@scaff/vue-cli-context v5.4.6

Weekly downloads
4
License
MIT
Repository
-
Last release
4 years ago

vue-cli-context

Sampily to get the Packages in Directory

npm i vue-cli-context
# or
yarn add vue-cli-context
import contextual from "vue-cli-context";

contextual({
  // context
  context: require.context(
    // directory
    `@/pages/`
    // recursive
    true,
    // regular
    /.js$/
  ),
  // expect
  expect: pkg => pkg
  // if need some injections, it must be export a function within the file
  inject: {
    say: `hello world`
  }
}).then( pkgs => console.log(pkgs));
// sample package with option: `inject`
export default ({ say }) => {
  console.log(say);
  // each package must set propert: `name`
  return {
    name: `sample`
  };
};