npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sfcc-dts

v1.0.12

Published

> High quality Salesforce Commerce Cloud type definitions. A dw-api-types "done right"

Downloads

2,263

Readme

Salesforce Commerce Cloud type definitions

High quality Salesforce Commerce Cloud type definitions. A dw-api-types "done right"

Features

sfcc-dts provides full typeScript definitions for Salesforce Commerce Cloud apis, plus a typescript plugin for resolving requires using "*" cartridge path and a fancy wizard for setting up your project.

The aim of the project is to provide fully working typescript compilation of commerce cloud server side javascript.

Wait, why is this better than the official dw-api from salesforce?

Well, tons of reasons:

  • dw-api definitions are largerly incomplete
  • dw-api definitions are often wrongly defined in terms of static properties/methods
  • dw-api are not documented. sfcc-dts has full documentation for classes, methods, properties, parameters and return types
  • dw-api is not actively updated when new API gets released. Instead, sfcc-dts definitions are automatically generated by parsing the public salesforce documentation, so they can easily be kept up to date

Installation

Using the wizard:

$ npm i -g sfcc-dts

From your sfcc project root directory type:

$ sfcc-dts-setup

The wizard will guide you for adding required dependencies to package.json, setup a working tsconfig.json and configure a customizable dw types entry point for your project.

VSCode setup

Vscode will fully benefit from the typescript configuration from tsconfig.json only when is configured for using the workspace version of typescript.

For enabling it press [cmd]+[shift]+P -> "TypeScript: Select TypeScript version" and select "Use workspace version" with the version pointing to the node_modules/typescript dir in the workspace.

If the "TypeScript: Select TypeScript version" option or the expected directory dooesn't show up, just open the node_modules/typescript/bin/tsc file inside vscode and retry, this is usually enough to make vscode detect the available typescript installation.

Type definitions for custom attributes

sfcc-dts can generate definitions for project-specific system object extensions by parsing a system-objecttype-extensions.xml file.

Custom attribute definitions are automatically generated by the sfcc-dts-setup wizard, assuming a system-objecttype-extensions.xml file is available (the default location is sites/site_template/meta/system-objecttype-extensions.xml but the wizard will allow you to choose a different path) and saved to @types/dw/attrs.d.ts.

Definitions can be updated by running sfcc-dts-updateattrs

Usage

If everything goes well you will see autocomplete and validation working in your existing javascript files. Typescript will fully detect:

  • requires using dw/system/Site syntax
  • cartridge requires using */cartridge/somefile or ~/cartridge/somefile
  • fully qualified class names such as dw.system.Site
  • dw globals such as request

Todo

Still in the checklist:

  • Find a proper way to define module.superModule augmenting the standard NodeModule definition

License

Released under the MIT license.