microsoft / microsoft/nodejstools

Normalizing .njsproj files

Open
#2,352 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.8k
Forks
355
PR merge metrics
No merged PRs in 30d

Description

I use a NodeJs project (.njsproj) in VS2022 for a React-based SPA. Committing code in this project is difficult because of seemingly insignificant changes in the .njsproj file:

  1. Some .js files are marked <Compile>, others are <Content>. JSX files are similarly split.
  2. CSS files (.css) are usually marked <Content>. But it's unclear why, as they're usually compiled by webpack too.
  3. Some random <Compile> and <Content> entries have <SubType>Code</SubType> but others don't.
  4. Some entries are sorted, other newly created entries are are placed randomly.

My project was created in an earlier version of VS (VS2015 I think) and upgraded over time, but even a new project created in VS2022 has the third issue. This is what a new NodeJs project looks like (with a .jsx and .css file created):

  <ItemGroup>
    <Content Include="app.js" />
    <Content Include="JavaScript1.jsx">
      <SubType>Code</SubType>
    </Content>
    <Content Include="package.json" />
    <Content Include="README.md" />
    <Content Include="StyleSheet1.css">
      <SubType>Code</SubType>
    </Content>
  </ItemGroup>

Could we have the tooling normalize these files when a project is opened?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported behavior in a VS2022 Node.js project containing the app.js, JavaScript1.jsx, package.json, README.md, and StyleSheet1.css entries shown in the issue. Compare the generated .njsproj contents after opening the project. Done means the tooling consistently normalizes item types, SubType metadata, and entry ordering without unrelated changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, react
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.