NPM and have package.json file for Prettier - prettier

I am new to this and trying to install Prettier to keep my VSCode neat. I am following a help file to install prettier and the first thing it says is:
I assume you are using NPM and have package.json file inside the repository. Install Prettier
Can someone help me understand 'NPM and have package.json file inside the repository'?

Which technology stack you are using?
If it is javascript based then in root folder open cmd and type "npm init" this will create package.json automatically.

Related

Create-React-App "npm run build" results in partially populated build folder when run inside Docker container

I have an old project that I started by using Create React App to generate boilerplate. At some point down the line I "ejected" the project. Running npm run build successfully generates all of the expected build artifacts inside the /build folder when run on my dev machine and serving the build folder works perfectly.
Now I'm trying to Dockerize this app and have created the following Dockerfile
FROM node:16-alpine
WORKDIR /app
COPY package.json .
COPY package-lock.json .
ENV NODE_ENV production
RUN npm install
COPY . .
RUN npm run build
CMD [ "npx", "serve", "-l", "3000", "build" ]
I can build and run the image as a Docker container, and the build folder is served fine except that most of its contents are missing. The only two files present are favicon.ico and manifest.json. If I open a shell and list out the build folder it's the same. For some reason the webpack bundles, index.html, styles etc. are all missing.
I've been Googling around for hours but can't find anything. I can't even find out how to log the output of CRA's npm run build command to a file so that I can see the build log.
Can anyone give me a hint at where the problem might lie? Thanks

AWS device farm Appium Node.js - package.json not being found in bundled .zip file?

I am getting the following error after the .tgz command runs. Has anyone seen this?
npm WARN saveError ENOENT: no such file or directory, open '/tmp/scratchXEFHVJ.scratch/test-packageptX7bd/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/tmp/scratchXEFHVJ.scratch/test-packageptX7bd/package.json
This will later cause the wdio to not be found, as the node_modules never install I believe.
Running Appium v1.17.0
webdriverio
any help would be much appreciated
It might be due to missing files
Try
npm init -y // intializing for the package JSON
Add Webdriver CLI tool
npm install --save webdriverio #wdio/cli
Update the config file
npx wdio config
// after upadting
npx wdio ./wdio.conf.js
npm install
then create the bundle
npm install -g npm-bundle
Then create a zip
zip -r MyTest.zip *.tgz
then start testing part on AWS

Installing an old version of Foundation

Is there any way to easily install a Foundation version, other that the latest one? Instructions for "manual" install start with
git clone https://github.com/zurb/foundation-sites-template projectname
Ideally, I'd like to be able to do something like
git clone https://github.com/zurb/foundation-sites-template/tree/v6.1.2 projectname
but there is no such v6.1.2 tag
EDIT:
I have found a workaround - I run
git clone https://github.com/zurb/foundation-sites-template projectname
And then I edit the dependencies in bower.json and proceed with the rest of the installation. At least it works for my purposes, as I mainly need the scss stuff, not the whole project. And I still have to hunt for the correct versions of scss/app.scss and scss/_settings.scss as the ones getting downloaded are for the latest version.
Would be nice if there was a fully automated way of installing a version other than the latest.
There is actualy NO TAG for the Zurb-Foundation TEMPLATE project on github (https://github.com/zurb/foundation-sites-template):
Maybe you could switch to the actual Site project if it is what you are looking for.
EDIT:
I suggest making a ps1 or .bat script that would do the following
git clone https://github.com/zurb/foundation-zurb-template projectname
cd projectname
cp C://bower.json bower.json -f
npm install
bower install
You could also fork the template project on Github and edit it's bower.json so it's always up to date and there is no need to use the cp command
Or make a git repo of the variables you are using and do something like
git clone https://github.com/zurb/foundation-zurb-template projectname
git clone https://github.com/you/foundation-version foundation-version
cd projectname
cp ../foundation-version/bower.json bower.json -f
npm install
bower install

Ember Cli on windows

I m trying to get Ember cli on Windows 7.I have installed node and npm.
But when I type npm install -g ember-cli I get the following error.Is there anything that I am missing?
Try running:
npm package.json
to see errors in the package.json file. Otherwise try:
npm cache clean

Using gulp.src to match all subdirectories of a given directory, excluding given directory

I'm using gulp and gulp-chug to match all subdirectories of a given directory. What I want to perform is to watch several projects gulpfiles.
I want to match all gulpfile.js files inside subdirectories:
/path/to/dir/dir1/gulpfile.js
/path/to/dir/dir2/dir3/gulpfile.js
/path/to/dir/dir4/gulpfile.js
While excluding:
/path/to/dir/
I'm using the following pattern on gulp.src:
/path/to/dir/**/*.js
When I run the gulp task, I get the following error:
Unable to find local gulp. Try running 'npm install gulp' from /path/to/dir/.
Shouldn't /path/to/dir/ be excluded by the given pattern? Why is it looking for gulp on a directory that I don't want to be matched? Gulp is not installed on /path/to/dir/ because I don't want to search for gulpfiles on this directory.
Thanks in advance!
Look again. The error message actually tells you what's wrong and how to fix it.
You don't have the gulp npm package installed in your local project. There's two parts to gulp. The global gulp only installs the command-line application, you still need gulp installed within your project.
Go to your directory, and run the command it tells you to:
npm install gulp
// or, better run this:
npm install --save-dev gulp
Or, rather, follow the installation instructions for gulp.