Git Product home page Git Product logo

cake-contrib / cake.npm.module Goto Github PK

View Code? Open in Web Editor NEW
1.0 6.0 9.0 2.34 MB

:cake: :wrench: Cake.Npm.Module is a Module for Cake, which extends it with a new IPackageInstaller for installing tools using the Node.js package manager (npm).

Home Page: https://cake-contrib.github.io/Cake.Npm.Module/

License: MIT License

C# 98.47% PowerShell 0.86% Shell 0.67%
hacktoberfest cake-build cake-module

cake.npm.module's People

Contributors

agc93 avatar ap0llo avatar augustoproiete avatar dependabot[bot] avatar gep13 avatar github-actions[bot] avatar nils-a avatar pascalberger avatar renovate[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cake.npm.module's Issues

Replace Gitter with GitHub Discussions

The Discussion platform for Cake-Contrib has been moved from Gitter to GitHub Discussion (see cake-build/website#1470).
Please check this repo for references to Gitte and replace them accordingly.

Search suggests that references could be in

  • docs/input/_Bottom.cshtml

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

cake
demo/script/build.cake
recipe.cake
  • Cake.Recipe 3.1.1
github-actions
.github/workflows/build.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/cache v4@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • actions/setup-dotnet v4.0.0@4d6c8fcf3c8f7a60068d26b594648e99df24cee3
  • cake-build/cake-action v2.0.0@1223b6fa067ad192159f43b50cd4f953679b0934
  • actions/upload-artifact v4@5d5d22a31266ced268874388b861e4b58bb5c2f3
  • actions/upload-artifact v4@5d5d22a31266ced268874388b861e4b58bb5c2f3
.github/workflows/codeql-analysis.yml
  • actions/checkout v4@b4ffde65f46336ab88eb53be808477a3936bae11
  • actions/setup-dotnet v4.0.0@4d6c8fcf3c8f7a60068d26b594648e99df24cee3
  • actions/cache v4@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9
  • github/codeql-action v3@1b1aada464948af03b950897e5eb522f92603cc2
  • actions/setup-dotnet v4.0.0@4d6c8fcf3c8f7a60068d26b594648e99df24cee3
  • cake-build/cake-action v2.0.0@1223b6fa067ad192159f43b50cd4f953679b0934
  • github/codeql-action v3@1b1aada464948af03b950897e5eb522f92603cc2
  • ubuntu 22.04
nuget
.config/dotnet-tools.json
demo/frosting/build/Build.csproj
  • Cake.Frosting 4.0.0
demo/script/.config/dotnet-tools.json
  • cake.tool 4.0.0
global.json
  • dotnet-sdk 8.0.203
src/Cake.Npm.Module.Tests/Cake.Npm.Module.Tests.csproj
  • NSubstitute 5.1.0
  • Cake.Testing 4.0.0
  • xunit.runner.visualstudio 2.5.7
  • xunit 2.7.0
  • Microsoft.NET.Test.Sdk 17.9.0
  • JetBrains.Annotations 2023.3.0
src/Cake.Npm.Module/Cake.Npm.Module.csproj
  • StyleCop.Analyzers 1.1.118
  • Microsoft.SourceLink.GitHub 8.0.0
  • JetBrains.Annotations 2023.3.0
  • CakeContrib.Guidelines 1.5.1

  • Check this box to trigger a request for Renovate to run again on this repository

documentation has some outdated references

  • There is a link to gitter, which should be replaced with discussions in cake-build/cake
  • There are some references to --bootstrap which is no longer needed in Cake 1.0.0
  • Examples page has a broken reference to parameters.md

Cleanup build-warnings

The current build lists 47 issues of which are 15 warnings.

The warnings (at least) should be removed.

Recommended changes resulting from automated audit

We performed an automated audit of your Cake addin and found that it does not follow all the best practices.

We encourage you to make the following modifications:

  • You are currently referencing Cake.Core 0.28.1. Please upgrade to 0.33.0
  • The nuget package for your addin should use the cake-contrib icon. Specifically, your addin's .csproj should have a line like this: <PackageIconUrl>https://cdn.jsdelivr.net/gh/cake-contrib/graphics/png/cake-contrib-medium.png</PackageIconUrl>.

Apologies if this is already being worked on, or if there are existing open issues, this issue was created based on what is currently published for this package on NuGet.

This issue was created by a tool: Cake.AddinDiscoverer version 3.12.1

installed tools should be available in the IToolLocator

Current status

When installing some tool locally, it is installed in the WorkingDirectory, not in the tools folder.
While this works for most cases the tool is not available as a tool in cake. I.e. it will not be found by the IToolLocator.

Example:

#module nuget://?package=Cake.Npm.Module
#tool npm://?package=yo

Task("Default")
.Does(() => {
   var yo = Context.Tools.Resolve("yo.cmd");
   if(yo == null) {
      yo = Context.Tools.Resolve("yo");
   }
   if(yo == null) {
      Error("Something is very wrong.");
      throw new Exception("yo not found!");
   }
   Information("yo installed at: " + yo.FullPath);
   IEnumerable<string> version;
   StartProcess(
      yo,
      new ProcessSettings {
            Arguments = "--version",
            RedirectStandardOutput = true
      },
      out version);
   Information("yo version: " + version.First());
});

RunTarget("Default");

this will not find yo as a tool, unless yo was installed globally on the system (either by installing it manually or by setting #tool npm://?package=yo&global)
Additionally, the node_modules folder will "clutter" the WorkingDirectory.

Proposal

I propose adding a new flag caketool (to not break current API) which will install the tool unter the tools folder. This will keep the WorkingDirectory "clean" and make all tools available for usage as tools in Cake. I.e. after implementing that, setting #tool npm://?package=yo&caketool will make above example work.

Module does not work on windows

Using the module under windows results in the following error:

โฏ .\build.ps1 --verbosity=diagnostic
Preparing to run build script...
Running build script...
Registering module Cake.Npm.Module.NpmModule...
Analyzing build script...
Analyzing D:/_dev/Cake.Npm.Module.Tests2/build.cake...
Processing build script...
Installing addins...
Installing package asciidoctor with npm...
Executing: "npm" install --verbose asciidoctor
Error: System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at Cake.Core.IO.ProcessRunner.Start(FilePath filePath, ProcessSettings settings)
   at Cake.Npm.Module.NpmPackageInstaller.Install(PackageReference package, PackageType type, DirectoryPath path)
   at Cake.Core.Scripting.ScriptProcessor.InstallAddins(ScriptAnalyzerResult analyzerResult, DirectoryPath installPath)
   at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
   at Cake.Commands.BuildCommand.Execute(CakeOptions options)
   at Cake.CakeApplication.Run(CakeOptions options)
   at Cake.Program.Main()

Remove net461 target, leaving only netstandard2.0

To be aligned with new guidance/best practices on developing Modules for Cake:

ยง2.6 Avoid targeting additional frameworks such as net461 or net5.0.

Why? Due to current limitations on how modules are loaded, Cake attempts to load all assemblies included in the NuGet package of the module (of all targets) which causes warnings to be displayed and the impression that the module was not loaded and/or is not working.
Once those limitations are fixed, we'll update this recommendation to align with the recommendations for Cake Addins.

Add cake-module tag to Cake.Npm.Module NuGet package

The NuGet Gallery will soon include a "Cake" tab with instructions on how to use NuGet packages in Cake build scripts. I'd like to suggest that you include the tag cake-module in the NuGet package of this module, so that the NuGet Gallery can display the correct instructions to install this module.

The UI will look similar to this:

image

Documentation on best practices on tags for Cake modules: https://cakebuild.net/docs/extending/modules/best-practices#tags

Change Gitter/Twitter message on deployment

Currently, the default Gitter/Twitter messages are being used when pushing a new release of this module, which includes mention of it being and Addin. We should update it to make it clear that this is a module.

CodeQL stopped working

virtual environment is not pinned.

Also, there was a warning before the error started:

1 issue was detected with this workflow: git checkout HEAD^2 is no longer necessary. Please remove this step as Code Scanning recommends analyzing the merge commit for best results.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.