Skip to content

Commit

Permalink
Merge pull request #1389 from amzn/prettier-dep
Browse files Browse the repository at this point in the history
fix: prettier direct dependency & upgrade path-unified
  • Loading branch information
jorenbroekema authored Nov 19, 2024
2 parents feaf2e4 + 64f636f commit ef7b2f6
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/rich-cars-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'style-dictionary': patch
---

Move prettier to dependencies since style-dictionary isn't really a prettier plugin and a direct dependency seems more accurate here.
3 changes: 1 addition & 2 deletions __tests__/common/transforms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* and limitations under the License.
*/
import { expect } from 'chai';
import { join } from 'path-unified';
import Color from 'tinycolor2';
import transforms, { isColor } from '../../lib/common/transforms.js';

Expand Down Expand Up @@ -1391,7 +1390,7 @@ describe('common', () => {
{},
{},
);
expect(value).to.equal(join('foo.json'));
expect(value).to.equal('foo.json');
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions docs/src/components/sd-playground.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import StyleDictionary from 'style-dictionary';
import { Volume } from '@bundled-es-modules/memfs';
import { LitElement, html, css } from 'lit';
import { posix as path } from 'path-unified';
import { extname, join } from 'path-unified/posix';
import '@shoelace-style/shoelace/dist/components/radio-button/radio-button.js';
import '@shoelace-style/shoelace/dist/components/radio-group/radio-group.js';
import '@shoelace-style/shoelace/dist/components/select/select.js';
Expand Down Expand Up @@ -377,7 +377,7 @@ class SdPlayground extends LitElement {
changeOutputs(filePath: string, changeCurrentFile = false) {
this.output = JSON.stringify({
value: this.volume.readFileSync(filePath, 'utf-8'),
lang: path.extname(filePath).replace(/^\./g, ''),
lang: extname(filePath).replace(/^\./g, ''),
});
// call the setter so the editor value updates to the new output selection
if (this.currentFile === 'output' || changeCurrentFile) {
Expand All @@ -389,7 +389,7 @@ class SdPlayground extends LitElement {
traverseDir(dir = '/', files: string[] = []) {
let _files = files;
(this.volume.readdirSync(dir) as string[]).forEach((file: string) => {
const fullPath = path.join(dir, file);
const fullPath = join(dir, file);
if (this.volume.lstatSync(fullPath).isDirectory()) {
_files = [..._files, ...this.traverseDir(fullPath, _files)];
} else {
Expand Down
3 changes: 1 addition & 2 deletions lib/StyleDictionary.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
*/

import JSON5 from 'json5';
import { extname } from 'path-unified';
import { extname, dirname } from 'path-unified';
import { fs } from 'style-dictionary/fs';
import chalk from 'chalk';
import { dirname } from 'path-unified';

import combineJSON from './utils/combineJSON.js';
import deepExtend from './utils/deepExtend.js';
Expand Down
7 changes: 4 additions & 3 deletions lib/resolve.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { posix, win32 } from 'path-unified';
import { resolve as resolvePosix } from 'path-unified/posix';
import { resolve as resolveWin32 } from 'path-unified/win32';
import { isNode } from './utils/isNode.js';

/**
Expand All @@ -13,7 +14,7 @@ export const resolve = (path, customVolumeUsed = false) => {
return path;
}
if (isNode && process?.platform === 'win32') {
return win32.resolve(path);
return resolveWin32(path);
}
return posix.resolve(path);
return resolvePosix(path);
};
14 changes: 6 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
"is-plain-obj": "^4.1.0",
"json5": "^2.2.2",
"patch-package": "^8.0.0",
"path-unified": "^0.1.0",
"path-unified": "^0.2.0",
"prettier": "^3.3.3",
"tinycolor2": "^1.6.0"
},
"devDependencies": {
Expand Down Expand Up @@ -162,8 +163,5 @@
"unist-util-visit": "^5.0.0",
"uuid": "^9.0.1",
"yaml": "^2.3.4"
},
"peerDependencies": {
"prettier": "3.x"
}
}

0 comments on commit ef7b2f6

Please sign in to comment.