How can I force nrwl nx to respect tag updates? - tslint

When I update project tags in nx.json, TSLint seems unaware that the tags have changed, and lints and builds the project even though the dependencies are violated.
Example
Currently my nx.json file looks like
{
"npmScope": "patient-engagement",
"implicitDependencies": {
"package.json": "*",
"tsconfig.json": "*",
"nx.json": "*"
},
"projects": {
"hep": {
"tags": ["scope:hep", "compatibility:ie10"],
"implicitDependencies": []
},
"mb-ui": {
"tags": ["scope:shared", "compatibility:ie10"],
"implicitDependencies": []
},
"utils": {
"tags": ["scope:shared", "compatibility:ie10"],
"implicitDependencies": []
}
}
}
And my root tslint.json includes:
"nx-enforce-module-boundaries": [
true,
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "scope:hep",
"onlyDependOnLibsWithTags": [
"scope:hep",
"scope:shared"
]
},
{
"sourceTag": "compatibility:ie10",
"onlyDependOnLibsWithTags": [
"compatibility:ie10"
]
},
{
"sourceTag": "scope:shared",
"onlyDependOnLibsWithTags": [
"scope:shared"
]
}
]
}
],
This passes linting as expected when I run ng lint hep.
However, if I edit the tags in nx.json, the linter does not show any errors. For example, if I modify nx.json to look like this (removing tags from the libraries), it still lints and builds without any errors.
{
"npmScope": "patient-engagement",
"implicitDependencies": {
"package.json": "*",
"tsconfig.json": "*",
"nx.json": "*"
},
"projects": {
"hep": {
"tags": ["scope:hep", "compatibility:ie10"],
"implicitDependencies": []
},
"mb-ui": {
"tags": [],
"implicitDependencies": []
},
"utils": {
"tags": [],
"implicitDependencies": []
}
}
}
If it's useful, when I update the rules in tslint.json, the linter DOES throw errors, but I would like it to also acknowledge changes to nx.json.
Is there a way I can get the linter to show errors when tags in nx.json are updated?

Nx caches a bunch of information concerning dependencies in generated file: /dist/nxdeps.json
You can simply delete this file to immediately see changes to nx.json.

It could also be VS Code's caching causing problems
You might need to restart the Typescript service before changes to tslint.json or tsconfig.json files go through.
ctrl + shift + p and then Typescript: Restart TS Server

In Webstorm, restarting the typescript service does not help but restarting IDE helps (looks like indexing files).
In my case, I am doing steps like this when editing nx.json:
Remove dir node_modules/.cache/nx
Run nx lint (will generate new cache)
Restart IDE

Related

Hide + avoid loading specific files in visual studio code workspace

I have a Workspace navigating to bunch of directories that contains around 7000 files each.
How to hide all files of specific extension (and not load them, they are slowing PC extremely)?
so far:
"folders": [
{
"path": "directory1"
}
],
"settings": {
"files.exclude": {
"*.log": true,
"*.lib": true,
"*.sbr": true,
"*.bak": true,
"*.error": true
},
"files.associations": {
"*.tsl": "C++"
}
}
} ```
But I'm still seining all the files on the left side in workspace tab.

Use Artifactory JFrog CLI to delete all *-SNAPSHOT builds but always ensure to leave one behind

I have been using Artifactory JFrog cli & AQL lanaguage to cleanup maven SNAPSHOT builds. So far I have been deleting everything by pattern matching *-SNAPSHOT. However I wish to have 1 build (the youngest) remain, as these are required for other builds. Would anyone be able to point me in the right direction, as I cant find anything obvious in Artifactorys docs.
My current query looks like the following
{
"files": [
{
"aql": {
"items.find": {
"repo": "test-repo",
"path": {"$match":"root-folder/*"},
"name": {"$match":"*-SNAPSHOT"},
"type": "folder",
"$or": [
{
"$and": [
{
"created": { "$before":"7d" }
}
]
}
]
}
}
}
]
}
Directory structure looks like the following
test-repo/root-folder/maven-project1/1.7.0-SNAPSHOT/
test-repo/root-folder/maven-project1/1.8.0-SNAPSHOT/
test-repo/root-folder/maven-project2/1.7.0-SNAPSHOT/
test-repo/root-folder/maven-project2/1.8.0-SNAPSHOT/
In this example I would want to keep the latest builds i.e. v1.8.0

Is there a list of events for when Heroku runs scripts?

I find the documentation at - https://devcenter.heroku.com/articles/app-json-schema#scripts - is poor. It doesn't list all of the different events which can be hooked into to run scripts. I want to run a script for when the app is first created and another with each release. The first is objective is already achieved with a script with runs on the "postdeploy" event. I can't see anything though to help with the second. If using a procfile I know I just specify the "release" process type but I'm trying to do this with an app.json file so I believe the procfile is not relevant.
Does anybody know how I can do what I want? Even better the whereabouts of this explained on Heroku.
At the moment I have this for my app.json -
{
"name": "accounts",
"success_url": "/users/signup",
"addons": [
{
"plan": "heroku-postgresql:hobby-dev"
}
],
"env": {
"NEW_USERS_ARE_SUPERUSERS": "0"
},
"formation": {
"web": {
"quantity": 1,
"size": "free",
"command": "gunicorn proj.wsgi"
}
},
"buildpacks": [
{
"url": "heroku/python"
}
],
"scripts": {
"postdeploy": "psql -c \"create extension pg_trgm\" $DATABASE_URL && ./bin/setup.sh"
}
}
Can I just add a "release" key to the "scripts" dictionary? I saw somewhere somebody had "heroky-postbuild" but that didn't seem to work when I tried it.

How to customize the color of custom syntax tokens in VSCode extension

TLDR; How can I have an extension colorize the syntax the extension is defining without it actually being a color theme the user has to enable?
I'm attempting to port this Sublime Text plugin (ToDone) to VSCode.
It creates a grammar for todo lists and then uses syntax highlighting to emphasize important tasks, mute completed tasks, etc.
I found "editor.tokenColorCustomizations", via Customize a Color Theme. It works with the new syntax when I use it in my user settings, but fails when I use it in the package.json#contributes portion of the extension manifest.
{
"contributes": {
"languages": [
{
"id": "todone",
"aliases": [
"ToDone",
"To-Done"
],
"extensions": [
".todone",
".todo"
]
}
],
"grammars": [
{
"language": "todone",
"scopeName": "text.todone",
"path": "./todone.tmLanguage"
}
],
"configurationDefaults": {
"[todone]": {
"editor.insertSpaces": false,
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "symbol.definition.task-heading.todone",
"settings": {
"foreground": "#ff8800"
}
}
]
}
}
}
}
}
So far, the syntax seems ok — it's exactly what is being used by the Sublime plugin and the colors from the user-settings are applied correctly. Also, the format of the settings seems ok because "editor.insertSpaces" is being applied and the colors are working when present in the user-settings.
Lastly, I get a very disappointing 'Warning' 'Unknown editor configuration setting' message on the "editor.tokenColorCustomizations" setting in the extension package.json.
So, sounds like this setting is not enabled for extensions?
Another possible route I saw was to use decorators. But, I didn't see anything on inspecting the syntax tokens associated with a portion of text in the docs, e.g. some way to iterate through the syntax tokens of the document to apply decorators. So, the decorator route sounds like the hard-way compared to "editor.tokenColorCustomizations".
Any suggestions on how to make this work would be greatly appreciated.
Edit: The code, so far, is on GitHub: tiffon/vscode-todone
It only fails if you specify a specific language. It is working for me if I do not specify the todone extension.
"configurationDefaults": {
"editor.insertSpaces": false,
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "symbol.definition.task-heading.todone",
"settings": {
"foreground": "#ff8800"
}
}
]
}
}

Using simple-prefs module in Firefox addon

I have problem with simple-prefs module in my addon (simple-prefs documentation). I'm trying to use menulist or radio types. Problem is addon isn't loaded or started - function main isn't called.
I don't have this problem when I use cfx run command, which starts new, clear instace of Firefox - everything works correctly. I tried run this addon on two different computers, unfortunately with the same result.
Below I put code snippets:
main.js:
var prefs = require("simple-prefs").prefs;
...
exports.main = function (options, callbacks) {
console.log("Addon loaded: " + self.loadReason);
var modLogic = pageMod.PageMod({
include: "*",
contentScriptWhen: "start",
contentScriptFile: data.url("myContentScript.js"),
onAttach: function (worker) {
console.log("Page worker attached to: " + worker.tab.url);
// here I'm using prefs object: if(prefs.decision === "Y")
}
});
}
package.json:
{
"name": "myaddon",
...
"preferences" : [{
"name": "decision",
"title": "someTitle",
"type": "radio", // or menulist
"value": "D",
"options": [{
"value": "D",
"label": "Default"
},
{
"value": "Y",
"label": "Yes"
},
{
"value": "N",
"label": "No"
}
]
}]
}
I'm using addon-sdk 1.12 and Firefox 18.0. In my code snippets can be bugs - I've just written it here.
I'd created this example repo a while ago:
https://github.com/canuckistani/jp-prefs-example
All of the functionality works for me, see this screenshot:
https://dl.dropbox.com/u/44296964/Screen%20Shot%202013-01-18%20at%201.50.31%20PM.png
I'm also using Firefox 18 and SDK 1.12. In your example you have a comment in your JSON, that might be causing you problems.
That module will be changed in future versions so I don't know how safe is it to be used.
I use simple-storage to keep data between browser session.
Also the cfx environment has sometimes some weird behavior not registering types correctly.
I use JSON.parse() just to make sure.

Resources