How do I configure the output-path of ember-cli as a setting? - ember-cli

I'm using ember as part of a bigger project and so both dev and production build into a subdirectory somewhere else. Can I specify output-path as a setting rather than on the commnad line?

You could modify your package.json and add in the scripts there such as:
"scripts": {
"buildprod": "ember build --environment=production --output-path=yourProdPath",
"builddev": "ember build --output-path=yourDevPath"
}
And just run them in the cli npm buildprod.

Create a file named .ember-cli inside the app folder and mention the output path. Ember will recognize the path automatically when we do "ember build"
{
"outputPath" : "D:/MyApplication/working/ember"
}

Related

How to use (environment) variables for a package.json dependency in npm?

In npm, I want to be able to install a package from a private GitHub repo as a dependency through the git+https way without having to hardcode the actual github_username:personal_access_token, but rather plug them into the dependency string as (environment) variables.
So instead of
package.json:
...
"dependencies": {
...
"my-private-github-repo": "git+https://<github_username>:<personal_access_token>#github.com/some/package.git",
...
}
I would like something like this:
package.json:
...
"dependencies": {
...
"my-private-github-repo": "git+https://${github_username}:${personal_access_token}#github.com/some/package.git",
...
}
Hardcoding credentials is a major no-no when applying version control to package.json which I'd like to be able to do.
What is the best way to do this?
Create .env file at the same directory level where package.json resides.
Mention PERSONAL_ACCESS_TOKEN=******************************* into .env file
Don't forget to add .env into .gitingore list which will prevent exposing key to outside world while you make git commit to your repo.
Now you can add your dependency in package.json as below,
"dependencies": {
...
"my-private-github-repo": "git+https://${ENV.PERSONAL_ACCESS_TOKEN}#github.com/USER/abcd-repo-3.4.0.git",
...
}
There are other ways using 'DOTENV' npm package, but it could not do much when we are trying to resolve "Github" package dependency. Above seems to be straight forward solution.

Deploying .NET Core Application with Windows Compatibility Pack

I'm busy deploying a .NET Core 2.1 application into our testing environment, but I'm getting the following error.
Error:
An assembly specified in the application dependencies manifest (MyApp.deps.json) was not found:
package: 'System.Diagnostics.EventLog', version: '4.5.0'
path: 'runtimes/win/lib/netcoreapp2.1/System.Diagnostics.EventLog.dll'
We are using the Windows Compatibility Pack to access the Event Log.
I have the following item in the dependency Json file:
"System.Diagnostics.EventLog/4.5.0": {
"dependencies": {
"Microsoft.Win32.Registry": "4.5.0",
"System.Security.Permissions": "4.5.0",
"System.Security.Principal.Windows": "4.5.0",
"System.Threading.AccessControl": "4.5.0"
},
"runtime": {
"lib/netstandard2.0/System.Diagnostics.EventLog.dll": {
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.26515.6"
}
},
"runtimeTargets": {
"runtimes/win/lib/netcoreapp2.0/System.Diagnostics.EventLog.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.0.0.0",
"fileVersion": "4.6.26515.6"
}
}
}
Please advise how one should deploy these dependencies. Also, what is the root folder to this relative path runtimes/win/lib/netcoreapp2.0?
We actually found a solution for our scenario:
- Our situation was that we tried to run a netcoreapp based test project on our test agent
- dotnet test on the project file worked
- dotnet vstest sometimes worked on the project output directory (we are not sure why and on which setup)
- dotnet vstest did run into the above error when run into an other directory & downloaded from CI
- dotnet vstest did run into an AssemblyNotFoundException on the test agent (which didn't make any sense for us)
The solution was to use dotnet publish for our test project and use the "self-contained" output to run on the test agent. dotnet publish copied the required runtimes/win/lib/netcoreappX.X/*.dll files into the publish output directory.
After a lot of testing, the key issue seems to be the "RuntimeIdentifiers". There is a visible option for this when you publish, but in order to use it when just building you need to add a couple of tags to your .csproj file.
The first is:
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
This will cause NuGet to retrieve the correct dlls (change the value depending on your needs). For me I was compiling to platform x86. I don't know what NuGet was getting by default, but whatever it was had different file sizes for the same files.
You also should then add this tag:
<SelfContained>false</SelfContained>
or else your build will default to copying the entire framework.
Also note that using the RuntimeIdentifier tag will cause your default output folder to include the value you specified. For example my subfolder became:
Project\bin\x86\Debug\netcoreapp3.1\win-86\
For publishing you should be able to do something similar; the problem will be to match your RuntimeIdentifier to your platform. You shouldn't need to specify SelfContained unless you specifically need to.

Visual Studio Code - Exclude NPM Scripts in Explorer

In Visual Studio Code 1.23 you can now run npm scripts from the Explorer window with the setting "npm.enableScriptExplorer": true. I know you can exclude whole package.json files with the "npm.exclude" setting, but is it possible to exlude just specific scripts from a package.json file? Or at least have them not show up in the Explorer window?
Current:
>NPM SCRIPTS
  >package.json
    🔧stuff
    🔧start
    🔧build
    🔧stuff2
Desired:
(exclude scripts 'stuff' and 'stuff2' from 'package.json')
>NPM SCRIPTS
  >package.json
    🔧start
    🔧build
Based on this :
// Enable an explorer view for npm scripts.
"npm.enableScriptExplorer": false,
// Configure glob patterns for folders that should be excluded from automatic script detection.
"npm.exclude": "",
You can not exclude part of a script in a single file package.json
Should be in vscode v1.63: See Add setting to exclude scripts from NPM scripts view.
config.npm.scriptExplorerExclude
"An array of regular expressions that indicate which scripts should be
excluded from the NPM Scripts view."
In my testing the filter exclusion works on the key/name of the npm script, not on the actual script itself. So if you had these scripts:
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "node ./test/runTest.js"
},
the filter works on lint, pretest and test NOT on the corresponding scripts themselves (i.e., what you see in the NPM Scripts explorer view). NOT for example on the word node (since it isn't part of any script name).
So to filter out stuff and stuff2 in the original question you would have to filter based on something in their script names.

Babel file structure is duplicating

Using latest babel preset. My .babelrc contains
{
"presets": ["env"]
}
In my package.json, I run it as follows:
"build:babel": "babel app.js app/** venue/** -d build",
My original code structure is:
But after running babel my build folder looks like the following:
The problem I'm seeing is that it's building the file in the sub-directories correctly but it also putting it into the root build folder. Example: "containers" is in the build folder under app/plugins/containers which is correct. But its also in the root build folder. Also, the files "border, button, card, checkbox, click, color_picker, ..." belong in other sub-directories (which it is), but is also in the root build folder.
I'm wondering if I'm running it incorrectly?

Bundling looking for text.js in dist directory

Using the gulp tasks from the yeoman generated Aurelia app I'm trying to bundle a custom application. When I run gulp bundle the following error is reported.
Where can I find a log to help track down this file or the reference to this file?
Double check your config.js
I've seen this from time to time, and it's usually an issue of the config.js. You'll want to make sure:
The github, npm, or wherever your text plugin is located is above your '*' line.
The text plugin is mapped.
The plugin files are located where (1) and (2) are pointing.
So, something like this:
config.js
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*",
"*": "dist/*"
},
map: {
"text": "github:systemjs/plugin-text#0.0.4"
}
And jspm_packages/github/systemjs/plugin-text#0.0.4 exists.
If all else fails, try deleting your jspm_packages folder, and typing jspm install text.