Skip to content

Commit

Permalink
Merge pull request #4 from sfccdevops/fix/3-windows-support
Browse files Browse the repository at this point in the history
Fix Windows Isssues
  • Loading branch information
manifestinteractive authored Jul 25, 2022
2 parents 68b64ad + df4ae71 commit 15d32d1
Show file tree
Hide file tree
Showing 13 changed files with 571 additions and 392 deletions.
12 changes: 12 additions & 0 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ Developer Setup
Extension Development
---

### Downloading Extension

> To get started developing this extension, you will first need to download the source code:
```bash
git clone [email protected]:sfccdevops/sfcc-cartridge-overrides-vscode-extension.git
cd sfcc-cartridge-overrides-vscode-extension
npm install
```

### Testing Extension

> To develop this extension in VS Code:
1. Open File `extension.code-workspace` in VS Code
Expand Down
2 changes: 2 additions & 0 deletions TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ Need Help?
> You can check for existing issues, or create a new one, by visiting our GitHub Issues page.
[![Create Issue](https://img.shields.io/badge/Github-Issues-red.svg?style=for-the-badge&logo=github&logoColor=ffffff&logoWidth=16)](https://github.com/sfccdevops/sfcc-cartridge-overrides-vscode-extension/issues)

**NOTE:** If you would like to report an issue, please copy the output from our `SFCC Cartridge Overrides` output panel. This will contain everything we need to know about what happened with this extension on your machine. You can access the output panel by accessing `View > Output` and then selecting the `SFCC Cartridge Overrides` from the select list of available output options.
2 changes: 2 additions & 0 deletions extension.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"settings": {
"window.title": "VS Code Extension${separator}SFCC Cartridge Overrides${separator}${activeEditorShort}",
"cSpell.words": [
"mikepenz",
"pjson",
"sfra"
]
}
Expand Down
13 changes: 10 additions & 3 deletions extension/Cache.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
'use strict'

const md5 = require('md5')

const pjson = require('../package.json')
const util = require('./util')

const { SEP } = require('./constants')

/**
* @class Cache
* @desc A module for use in developing a Visual Studio Code extension. It allows an extension to cache values across sessions with optional expiration times using the ExtensionContext.globalState.
Expand All @@ -16,7 +23,7 @@ const Cache = function (context, namespace) {
this.context = context

// Namespace of the context's globalState
this.namespace = namespace || 'cache'
this.namespace = md5(`${util.getWorkspace(context)}${SEP}${namespace}${SEP}${pjson.version}`)

// Local cache object
this.cache = this.context.globalState.get(this.namespace, {})
Expand Down Expand Up @@ -78,7 +85,7 @@ Cache.prototype.get = function (key, defaultValue) {
return undefined
}
// Otherwise return the value
return this.cache[key].value
return this.cache[key] ? this.cache[key].value : null
}
}

Expand Down Expand Up @@ -138,7 +145,7 @@ Cache.prototype.keys = function () {
Cache.prototype.all = function () {
let items = {}
for (let key in this.cache) {
items[key] = this.cache[key].value
items[key] = this.cache[key] ? this.cache[key].value : null
}
return items
}
Expand Down
Loading

0 comments on commit 15d32d1

Please sign in to comment.