Apply Drupal Patch using composer.json file - json

How to apply a patch for Drupal modules files through a composer.json file?
Basically, I have installed slick module and customised code and created a patch file using "git diff" command. Slick module file path is modules/contrib/slick/ directory. Below is the code that i have written in the composser.json file.
"require": {
"drupal/slick": "^2.7",
}
----------------------------------
"patches": {
"drupal/slick": {
"Slick custom changes": "patches/slick/slick.patch"
},
But when running composer install, it just removes this slick package from "modules/contrib/slick, but does not reinstall or add the patch.
If i remove "Slick custom changes": "patches/slick/slick.patch" from composer.json and execute composer install cmd then it install slick module.
How to avoid removing this package and applying the patch?

Related

'react-scripts' is not recognized as an internal or external command, operable program or batch file. json file deleted

the errror is 'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
ive tried
npm install
npm install react-scripts --save
npm i -g react-scripts
https://github.com/mareyam/Complete-Maryam-s-Restaurant
i uploaded this code on github without .json file
now im trying to donwnload and use it but cant because ,json file ive lost. ive tried using json file from anothr project but not working
I would recommend using create-react-app to build this project. Run the command, cd into the directory then start the app.
npx create-react-app name_of_app
cd name_of_app
npm start
This will be good enough for development, and you can add all your components into the src/ folder. Here's the documentation for how to start building react web apps.
To get the production build (which I think is what you're trying to go for), run npm run build which will save the build in the build/ folder.
Any time you use a different machine, just pull the project from github and run npm i. I'm assuming that you were talking about the package.json file. This shouldn't be a big deal if you set everything up correctly.

Convert SCSS to CSS automatically on live server

I am new to SCSS. I love using SASS for my local development, but when I publish a client’s website and need to make a change, it’s a pain to have to dig out the old project and set everything up so I can edit locally and then publish those changes on the production site.
Currently, I make changes in the SCSS file and then I go to online SCSS to CSS converter tool and convert SCSS to CSS and then put that CSS into CSS file.
Is there any way that if I make a change in the SCSS file in the server then it should directly update the CSS file?
Currently, I use HTML, CSS, SCSS, and Javascript
Thanks,
Use sass package instead of VSCode Extensions like Live SASS Compiler.
Why should not we use "Live SASS Compiler" VSCode extension?
Live SASS Compiler extension is old and hasn't been updated for a while.
Some features like #debug, #warn, #error won't work, so if you are using it, you have to use the sass npm package for that.
So, How to install the sass package?
So simple, just run these commands.
npm install -g sass
And convert SASS to CSS automatically by running the below command on your terminal.
sass -w source/stylesheets/index.scss build/stylesheets/index.css
More information is available on the sass docs here
Source - https://pineco.de/the-simplest-sass-compile-setup
By - Adam Laki
Make sure your project has a package.json file (and you have Node installed on your machine). Run npm init if you have Node but not package.json file, to initialize one.
Install sass package:
npm install sass --save-dev
Learn more about the package and its CLI
In the package.json file's scripts section, add these:
"scripts": {
"sass-dev": "sass --watch --update --style=expanded assets/css",
"sass-prod": "sass --no-source-map --style=compressed assets/css"
},
Run scripts:
npm run sass-dev
// or
npm run sass-prod
What is a source map? A particular file that allows the browser to map back from the processed, concatenated files to the original ones. It is helpful because we can see the original file names when we debug the CSS in the developer tools.
The above is a very basic setup to compiling SCSS files and "watching" them for changes. Your server should have a pipeline or some sort of build system that it would be able to run this npm command in order to compile SCSS files, so theoretically you don't need to push your pre-compiled CSS files to the server, but it does it by itself.

grunt - config object

This sample grunt file https://gruntjs.com/sample-gruntfile reads in a config object from package.json and stores it in the pkg property:
pkg: grunt.file.readJSON('package.json')
However, the page doesn't give a sample package.json file. Later on it refers to pkg.name. I assume this is a top level key in package.json. E.g.
{
"name": "this value here",
}
Is that correct?
Yes that's correct.
The package.json file is the heart of npm which is used by grunt.
You can generate one for your project using npm initand filling out the options or you can manually create and update it.
It gets updated automatically when using the --save option when adding modules to grunt.
npm install grunt-contrib-copy --save
This will install the module to your node_modules folder and update the dependencies section in your package.json
You only need to save the package.json file in your repo and each developer can download all dependencies listed in your package.json by calling npm install

Typings install gives 'No dependencies' as output

I am trying to install a Ionic 2 template.
Following the readme gets until the point where I need to install typings dependencies. After the installation of the typings CLI with npm install typings --global, I should install all the dependencies stated in the typings.json package (already provided by the template in the project folder).
This is how the typings.json file looks like:
{
"dependencies": {},
"devDependencies": {},
"ambientDependencies": {
"cordova": "registry:dt/cordova#0.0.0+20160316155526",
"cordova/plugins/statusbar": "registry:dt/cordova/plugins/statusbar#0.0.0+20160316155526",
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#4de74cb527395c13ba20b438c3a7a419ad931f1c"
}
}
As stated in the title, it gives me No dependencies as output and it doesn not install anything contained in that config file.
Could it be something related to having installed typings with sudo as a global package? Maybe it is looking for a config file in another directory?
Thanks!
This is most likely the update from 0.* to 1.*. Check the release notes
https://github.com/typings/typings/releases/tag/v1.0.0
Changes
Many breaking changes (see https://github.com/typings/core/releases/tag/v1.0.0)
Renamed ambient to global
Updated typings/ directory structure (removed browser.d.ts by default, should use typings/index.d.ts by default)
Killed defaultAmbientSource (no more auto-install of DefinitelyTyped when using --ambient, explicitly use dt~)
Replace ! parser expansion symbol with ~ (! is a reserved bash symbol)
Ability to specify different resolutions and output directories using resolution in typings.json
Using tslint-config-standard for linting rules
Fixing it for me was just replacing "devDependencies" with "globalDependencies" in my typings.json.
I had the same problem. I had to install node.js again (there was a newer version when I installed it again, 6.2.0) with the installer, node-sass with npm (I don't know if you need this one) and then the installation of typings worked.

My composer.json does not install new dependencies using composer update command

I am installing external dependencies using composer update command. The following is the section of the composer.json file in c:\xampp\htdocs\myproject\vendor\laravel\framework\ directory.
"require": {
"laravelcollective/html": "~5.0",
"matriphe/imageupload": "5.1.*"
"illuminate/html": "5.0.*#dev"
},
I am getting the following results after running the composer update command:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
I have also tried to create another require array in the composer.json and added the packages I want to install with no success.
The composer update command could not install any unstalled dependency using the composer update command. Even composer self-update did not solve the problem.
Kindly assist me, I have been stuck here for some days now trying all I would do but without success.
I am changing the composer.json under the following directory: c:\xampp\htdocs\myproject\vendor\laravel\framework\ Is this ok?
Don't change any files inside the vendor directory, they are managed by Composer. To install further packages use the composer.json in your project's directory.
And use composer install to install new packages as composer update will update already installed packages to newer versions (if available) too.
composer self-update just updates Composer itself.
You missed column after "matriphe/imageupload": "5.1.*", try to change it:
"require": {
"laravelcollective/html": "~5.0",
"matriphe/imageupload": "5.1.*",
"illuminate/html": "5.0.*#dev"
}