aurelia / aurelia/framework

Building all public files to www folder

Open
#933 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.7k
Forks
608
PR merge metrics
No merged PRs in 30d

Description

I am trying to setup an app, but I am not really happy with the project structure. I use aurelia-cli to build app. My which is to have all files like ts, less, in `src` folder, and after build move it to `www` so that this folder becomes app web root and contains only website files. My root of the project might have so many other configuration files, so I do not want to have that mess in the project root.

I have been able to configure everything as I want and only one thing is not working. First let me say what I did in `aurelia.json`

```
"platform": {
"port": 9000,
"index": "index.html",
"baseDir": "www",
"output": "www/scripts"
},
"build": {
"targets": [
{
"port": 9000,
"index": "index.html",
"baseDir": "www",
"output": "www/scripts"
}
],
```

this is places where ш added `www`. Output for build process mode bundles to www folder. baseDir so that web server on `au run --watch` starts in the www folder as root.

But I have problem that `vendor-bundle.js` at the end generate

```
function _aureliaConfigureModuleLoader(){window.define=SystemJS.amdDefine; window.require=window.requirejs=SystemJS.amdRequire; SystemJS.config({
"map": {
"text": "text",
"app-bundle": "www/scripts/app-bundle.js"
},
"bundles": {
"app-bundle": [
"app",
"app.html!text",
"ext/home/home",
"ext/home/index",
"ext/home/tmpl/home.html!text",
"ext/home/tmpl/index.html!text",
"main",
"unknow",
"unknow.html!text",
]
}
});
```

You can see that it adds `www/` to `app-bundle.js` directory. So that when it is loaded, it cannot load app-bundle. If I fix it by hand, everything works until the new update of vendor-bundle file.

And there is not way to fix it from configuration as I can see. If I delete www in `aurelia.json` then is generates scripts in the other folder, not inside www, if ш keep it, it adds www to that path.

I think that `baseDir` has to be deleted from the path to file. So fix have to be applied in aurelia-cli. I tried to find it and make PR, but I could not find, it is too complicated for me.

Contributor guide

Open the contributing guide

Research direction

Reproduce the build with the shown aurelia.json platform and build targets, keeping baseDir and output set to www and www/scripts. Trace aurelia-cli's vendor-bundle generation and inspect the generated vendor-bundle.js; done means app-bundle.js is referenced without the www/ prefix while the bundle still belongs under www/scripts and loads correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
build-system, tooling, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.