Variables in build.gradle for NativeScript plugins - plugins

I'm building a plugin for OneSignal and it requires an app ID and
google project number.
So in our package.json file in the project root, we have:
"nativescript": {
"id": "org.nativescript.demo",
"tns-ios": {
"version": "2.2.1"
},
"tns-android": {
"version": "2.2.0"
}
},
In a plugins build.gradle we can access variables like __PACKAGE__ and ${applicationId}.
Can we add a custom variable to the project's package.json object
and use it in the build.gradle file? If not, where can I find a list of possible variables to use?
For example:
"nativescript": {
"id": "org.nativescript.demo",
"OneSignalID": "2345-3245-2345-9087",
"OneSignalProjectNumber": "342875320456",
"tns-ios": {
"version": "2.2.1"
},
"tns-android": {
"version": "2.2.0"
}
},
Then in build.gradle something like:
android {
defaultConfig {
manifestPlaceholders = [
manifestApplicationId: "${applicationId}",
onesignal_app_id: "${nativescript-OneSignalID}",
onesignal_google_project_number: "${nativescript-OneSignalProjectNumber}"
]
}
}

Related

I have plugin built in craft cms3, I want to use same plugin in craft cms4

I have simply copy and paste plugin( plugin name is websitetoolbox) folder to craft cms4's vendor folder. And modify root composer.json like below.
{
"require": {
"craftcms/cms": "^4.2.0.2",
"swishdigital/template-selector": "^1.0",
"vlucas/phpdotenv": "^5.4.0",
"websitetoolbox/websitetoolboxforum": "1.4.0"
},
"require-dev": {
"yiisoft/yii2-shell": "^2.0.3"
},
"autoload": {
"psr-4": {
"modules\\": "modules/"
}
},
"config": {
"allow-plugins": {
"craftcms/plugin-installer": true,
"yiisoft/yii2-composer": true
},
"sort-packages": true,
"optimize-autoloader": true,
"platform": {
"php": "8.0.2"
}
},
"scripts": {
"post-root-package-install": [
"#php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
},
"minimum-stability": "dev",
"prefer-stable": true
}
When I run command composer update it gives below error
Problem 1
- Root composer.json requires websitetoolbox/websitetoolboxforum 1.4.0, found websitetoolbox/websitetoolboxforum[dev-master, 1.0.0, 1.3.0] but it does not match the constraint.
The line:
"websitetoolbox/websitetoolboxforum": "1.4.0"
Should probably be:
"websitetoolbox/websitetoolboxforum": "1.3.0"
I'm no expert on semantic versioning, but it seems a bit odd that you have a higher version number? Could it be a typo on your end? Cause if another dependency requires this version you might be in trouble.

VS Code: Add single file (README) to multi-root workspace

You can configure a vs-code multi-root workspace to include several folders. Eg,
{
"folders": [
{
// Source code
"name": "Product",
"path": "vscode"
},
{
// Docs and release notes
"name": "Documentation",
"path": "vscode-docs"
},
{
// Yeoman extension generator
"name": "Extension generator",
"path": "vscode-generator-code"
}
]
}
I would also like to include a README file from a root directory that pertains to all those folders. Is there a way to do this?

Writing a vscode plugin for adding snippets but only for file composer.json

Did you know if it's possible to write a vscode plugin to match only a given file?
My plugin already works but add snippets for all .json files. I wish to be able to add these snippets only if the current file is composer.json.
My current package.json (partial) is:
{
"contributes": {
"snippets": [
{
"language": "json",
"path": "./snippets/snippets.code-snippets"
}
]
}
}
The idea is to be able to having something like:
{
"contributes": {
"snippets": [
{
"filename": "composer.json", <-- JUST FOR ILLUSTRATION PURPOSE
"path": "./snippets/snippets.code-snippets"
}
]
}
}
Thanks.

Using Airbnb's JavaScript styling guide in Eclipse without Babel

How can I use the Airbnb JavaScript styling guide without using any additional tools? I already installed Tern (Tern IDE) for my Eclipse oxygen. I downloaded the latest release of the eslint-config-airbnb-base-v12.0.1 and selected under
Project -> Properties -> Tern ->Validation -> ESLint the .eslintrc file from the release. My Tern configuration is stored in a .tern-project file:
{
"ecmaVersion": 6,
"plugins": {
"guess-types": {
},
"outline": {
},
"eslint": {
"configFile": "C:\\dev\\workspace\\pyqt_web\\eslint-config-airbnb-base\\.eslintrc"
},
"browser-extension": {
},
"bootstrap": {
}
},
"libs": [
"browser",
"jquery"
]
}
The .eslintrc looks like:
{
"extends": "./index.js",
"rules": {
// disable requiring trailing commas because it might be nice to revert to
// being JSON at some point, and I don't want to make big changes now.
"comma-dangle": 0
},
}
and index.js:
module.exports = {
extends: [
'./rules/best-practices',
'./rules/errors',
'./rules/node',
'./rules/style',
'./rules/variables',
'./rules/es6',
'./rules/imports',
].map(require.resolve),
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module',
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
},
rules: {
strict: 'error',
},
};
From here i dont know how to go further. I would expect, that i get new warning which match these of airbnb style guide. Would this work for js code in html files?

Cannot run 'dotnet ef' on EF6 after upgrading to .NET Core 1.0 project files

After upgrading all project.json files to the new format for .NET core I cannot run 'dotnet ef' for Entity Framework 6 migrations. Can anybody see what is wrong with the project.json below?
Before my project.json looked like this:
{
"frameworks": {
"dnx46": {
"dependencies": {
}
}
},
"dependencies": {
"EntityFramework": "6.1.3",
"EntityFramework.DynamicFilters": "1.4.8-*",
"Migrator.EF6": "1.1.0",
....
},
"commands": {
"ef": "Migrator.EF6"
}
}
Now it looks like this:
{
...
"frameworks": {
"net46": {
"dependencies": {
}
}
},
"dependencies": {
"EntityFramework": "6.1.3",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.0",
"EntityFramework.DynamicFilters": "1.4.8-*",
"Migrator.EF6": "1.2.0",
"Migrator.EF6.Tools": {
"version": "1.0.3",
"target": "package",
"type": "build"
},
...
},
"tools": {
"Migrator.EF6.Tools": {
"version": "1.0.3",
"imports": "portable-net45+win8+dnxcore50"
}
}
}
This is the error message I currently have when I run 'dotnet ef':
Unhandled Exception:
Microsoft.DotNet.Cli.Utils.CommandUnknownException: No executable
found matching command "dotnet-ef"
You have to add this in your project.json file.
"buildOptions": {
"emitEntryPoint": true
}
Also, if you don't have a Main class add an empty Main class like this:
public class Program
{
public static void Main(string[] args)
{
}
}