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

Unable to load package metadata of ... #930

Closed
fragsalat opened this Issue Oct 10, 2018 · 7 comments

Comments

Projects
None yet
2 participants
@fragsalat
Contributor

fragsalat commented Oct 10, 2018

I'm submitting a bug report

  • Library Version:
    1.0.0-beta.1

Please tell us about your environment:

  • Operating System:
    Ubuntu 18.10

  • Node Version:
    10.7.0

  • NPM Version:
    6.1.0
  • Browser:
    all

  • Language:
    ESNext

  • Loader/bundler:
    RequireJS

Current behavior:
When importing a yaml file as text like this: import 'app/feature/i18n/locale/de.yaml'; and you're using the new bundler, an error is thrown. In this case app is the source root for the application and the folder structure looks like this:

root/
  aurelia_project/
  src/
    app/
      feature/
      model/
      view/
      ...
    styles/
    tests/

The actual error is the following:

INFO [Bundler] Tracing files ...
ERROR [PackageAnalyzer] Unable to load package metadata (package.json) of app:
INFO [PackageAnalyzer] Error: cannot resolve npm package folder for "app"
ERROR [Bundler] Unable to analyze app
  • What is the expected behavior?
    By configuring the loader plugin to allow the .yaml extension and adding the yaml extension to the app-bundle source expression it should be possible to import a .yaml file as text into the application.

  • What is the motivation / use case for changing the behavior?
    To include the translation files used for i18n they must be required by the code (at least that worked previously)

@fragsalat

This comment has been minimized.

Contributor

fragsalat commented Oct 10, 2018

I also tested to include the yaml files via the bundle config and got an empty bundle as result

{
  "name": "some2-bundle.js",
  "source": [
    "text!**/*.yaml",
    "**/*.yaml"
  ]
}

As mentioned above I configured the loader as well

"loader": {
  "type": "require",
  "configTarget": "vendor-bundle.js",
  "includeBundleMetadataInConfig": "auto",
  "plugins": [
    {
      "name": "text",
      "extensions": [
        ".html",
        ".css",
        ".yaml"
      ],
      "stub": true
    }
  ]
}
@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 10, 2018

I will get this sorted.

Meantime, temporary fix:
if your aurelia_project/tasks/process-markup.js didn't use htmlmin, update your aurelia.json, that's all you need.

"markupProcessor": {
  // ...
  "source": "src/**/*.{html,yaml}"
},

If you did use htmlmin, make another task aurelia_project/tasks/process-yaml.js, you need to adjust the content if using TypeScript.

import gulp from 'gulp';
import changedInPlace from 'gulp-changed-in-place';
import project from '../aurelia.json';
import {build} from 'aurelia-cli';

export default function processMarkup() {
  return gulp.src('src/**/*.yaml')
    .pipe(changedInPlace({firstPass: true}))
    .pipe(build.bundle());
}

Update aurelia_project/tasks/build.js to take the new task.

import processYaml from './process-yaml';

let build = gulp.series(
  readProjectConfiguration,
  gulp.parallel(
    transpile,
    processMarkup,
    processYaml,
    processCSS,
    copyFiles
  ),
  writeBundles
);
@fragsalat

This comment has been minimized.

Contributor

fragsalat commented Oct 10, 2018

i'll try this tomorrow thank you! :)

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 10, 2018

fix(bundler): fix a regression on missing yaml file for some users
Additional files like yaml were not processed by any gulp tasks. Previously amodro-trace was able to pull them in directly from file system. This fix mimic the same behaviour.

closes aurelia#930

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 10, 2018

fix(bundler): fix a regression on missing yaml file for some users
Additional files like yaml were not processed by any gulp tasks. Previously amodro-trace was able to pull them in directly from file system. This fix mimics the same behaviour.

closes aurelia#930
@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 10, 2018

You can try the cli branch "aurelia-cli": "huochunpeng/cli#missing-yaml",

huochunpeng added a commit to huochunpeng/cli that referenced this issue Oct 10, 2018

fix(bundler): fix a regression on missing yaml file for some users
Additional files like yaml were not processed by any gulp tasks. Previously amodro-trace was able to pull them in directly from file system. This fix mimics the same behaviour.

closes aurelia#930
@fragsalat

This comment has been minimized.

Contributor

fragsalat commented Oct 11, 2018

Your branch seem to work for me 👍
Thanks for the fast help :)

When is the next release day?

@huochunpeng

This comment has been minimized.

Member

huochunpeng commented Oct 11, 2018

It should be soon.

@fragsalat

This comment has been minimized.

Contributor

fragsalat commented Oct 11, 2018

I've another bug for you^^
It's about revisions are not inserted into index.html for other bundles as vendor-bundle.
I'll create a new issue for it, just a second :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment