What should the entry point be for a pure CSS npm project? - npm

I have a CSS file that I want to upload to npm. My project's folder structure is as follows:
my-project (folder)
|
+---- css (folder)
|
+---- my-project.css
|
+---- my-project.min.css
When I try to upload my project to NPM, it asks for an entry point, where the default is set to index.js. For my case where there are only 2 files inside a folder called css, what should it be? Moreover, what is the meaning of the entry-point for an npm project?

Entry point is a JavaScript file that gets called when your module is needed.
By common practice, it is usually given the name "app.js" or "index.js" (your case).
The entry point is also the path that will be used to access your module.
CSS files cannot be entry points.

Related

Publish multiple packages from subfolders

So let's say I have a project called elements.
In this elements project I managed to do npm publish by adding .npmrc file and proper package.json to the root of the project.
What would be the best way to approach publishing if I was to introduce new components where every component is placed in a new folder and every component should be a separate package? Does then every subfolder need it's own .npmrc file with configuration? Can I somehow do a setup where I have endpoint and token in package.json and .npmrc files in root of the project but name of packages defined in subfolders?
Any input would be greatly appreciated, thanks!

How to force npm publish to include files (that are not required by the entry)?

I have an npm project for generating packages. It contains a folder called templates. The files in templates are not required by the entry point index.js instead they are collected using fs. They are not appearing in the published version. I have tried adding files: ["templates"] to the package.json (and various combinations ("templates/*", "templates/**/*", "templates/something/somefile.js") but the files are never included. The only files in templates folder that appear are Licence and package.json.
How do I make npm include these files in the published version?
Edit: My project directory has a .gitignore file but that does not include the templates folder. It does not have an .npmignore file.
The reason that the License and package.json files are appearing in your templates folder, is because npm ignores any attempt to exclude these files.
I would check that you don’t have any .ignore files in your templates folder and also check further up the filesystem, does the folder that contains your project have one? What about it’s parent and so on?
Then try temporarily removing the .gitignore file as well.
Lastly try publishing from another machine if nothing else works.

Change home page file name in vuepress

By default project root README.md with some YML configuration is used as a home page in Vuepress. Is there any way to use some other file for the same?
I want to use README.md for some other purpose, like creating project build and deployment notes!
I made an inquiry in the source code version 1.0.2, I didn't know this extension of vue, so it was a good exercise.
I looked at all occurrences of readme, case insensitive, and it turns out that what you want is not configurable, as readme is hardcoded in several files.
I changed several occurrences of readme in the source code, and managed to change the landing page to test.md.
Here are the files you need to change in the source code:
vuepress/packages/#vuepress/shared-utils/src/isIndexFile.ts
vuepress/packages/#vuepress/markdown/lib/link.js
vuepress/packages/#vuepress/core/lib/node/Page.js
vuepress/packages/#vuepress/markdown-loader/index.js
There, in the relevant strings, you have to replace readme (or README, depending) with your desired file name.
Another solution:
Nest your vuepress inside a folder looking like:
- src/
|
-- README.md
-- vuepress/
|
-- README.md

PhpStorm - Autocomplete JS modules from Resource Root

I'm using PhpStorm as IDE and I want to import my JS modules from my Resource Root with # prefix. I've already marked src directory as 'Resource Root' and I've also checked the "Use path relative to the project" in File/Settings/Code Style/Javascript/Imports.
In fact, the modules are imported correctly if I do for example: #/components/HelloWorld.vue, but I noticed that in this way I lost the autocompletion and the possibility to navigate through the files with Ctrl + MOUSE CLICK.
So is there a way to resolve this and to enable the autocomplete of path?
Marking a folder as Resource root tells the IDE to resolve paths relative to this folder, but doesn't allow specifying any prefixes/aliases.
If your are using Vue cli 3, the right way to get your paths resolved is specifying node_modules\#vue\cli-service\webpack.config.js as webpack configuration file in Settings | Languages & Frameworks | JavaScript | Webpack

should I add app.js file in gitignore for nodejs/vuejs app?

I am new to vuejs. Recently I noticed that when I pull, it says conflict in app.js file. But I can't find the issue as app.js file is big.
Sould I add this file to gitignore file?
what is best practice to work with vue js?
I imagine you are building to a folder /dist and the app.js being conflited is the one inside of it.
You should ignore the /dist altogether. This folder is generated on the building process, meaning everyone that runs the project will update and create it.
Here is the default vue-cli .gitignore:
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
Not that not anything here may be useful to put in your own .gitignore. But you should for sure have at least node_modules and /dist.
If you are building the Vue project by scratch then I can say the following, when building/compiling your Vue project, best practices say that you should handle your entire production ready project in a dist/ or build/ directory where your main app.js file where the conflicts you are having would occur. This directory is only reserved for deploying the app and is not saved into your code repository, hence on why you should add to the .gitignore file the directory that holds such production files.