Skip to content

Commit

Permalink
put asset set files in sub-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanLovely committed Oct 18, 2023
1 parent 56b1d66 commit d11dd9b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 57 deletions.
4 changes: 2 additions & 2 deletions knapsack/data/knapsack.asset-sets.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"src": "../dist/tokens/design-tokens.css"
},
{
"src": "../../ks-theme-commercial.css"
"src": "../dist/themes/ks-theme-commercial.css"
}
]
},
Expand All @@ -38,7 +38,7 @@
"src": "../dist/tokens/design-tokens.css"
},
{
"src": "../../ks-theme-retail.css"
"src": "../dist/themes/ks-theme-retail.css"
}
]
}
Expand Down
26 changes: 0 additions & 26 deletions ks-theme-commercial.css

This file was deleted.

6 changes: 4 additions & 2 deletions ks-theme-create.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join, relative } from "path";
import fs from "fs";
import fs from "fs-extra";
import {
KnapsackAssetSetsConfig,
KnapsackAssetSetConfig,
Expand All @@ -14,6 +14,8 @@ const assetSetsPath = join(
__dirname,
"./knapsack/data/knapsack.asset-sets.json"
);
const themesDir = join(__dirname, "./knapsack/dist/themes");
fs.ensureDirSync(themesDir);
console.log("Creating theme...");
// @ts-ignore
const themeNames = Object.keys(tokens?.theme || {});
Expand All @@ -30,7 +32,7 @@ const themes = themeNames.map((theme) => {
const contents = [".salt-theme.salt-theme {", ...themeTokenNames, "}"].join(
"\n"
);
const cssPath = join(__dirname, `ks-theme-${theme}.css`);
const cssPath = join(themesDir, `ks-theme-${theme}.css`);
fs.writeFileSync(cssPath, contents, {
encoding: "utf8",
});
Expand Down
26 changes: 0 additions & 26 deletions ks-theme-retail.css

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"ks:test": "knapsack --config ./knapsack/knapsack.config.js test",
"ks:import": "knapsack --config ./knapsack/knapsack.config.js react-patterns --pkg-path @salt-ds/core --importPrefix null",
"ks:watch-tokens": "npx nodemon --watch knapsack/dist/tokens/design-tokens.css --exec 'touch ./knapsack/demo-wrapper.tsx && touch ./knapsack/data/knapsack.asset-sets.json'",
"ks:add-theme": "npx ts-node ./ks-theme-add.ts && npx ts-node ./ks-theme-create.ts",
"ks:add-theme": "npx ts-node ./ks-theme-add.ts && npm run ks:create-theme",
"ks:create-theme": "npx ts-node ./ks-theme-create.ts",
"heroku-postbuild": "yarn ks:build"
},
"dependencies": {
Expand All @@ -75,6 +76,7 @@
"@testing-library/cypress": "^10.0.0",
"@testing-library/dom": "^9.0.0",
"@testing-library/react": "^12.1.0",
"@types/fs-extra": "^11.0.3",
"@types/no-scroll": "^2.1.0",
"@types/node": "^20.0.0",
"@types/prompts": "^2.4.7",
Expand Down
20 changes: 20 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6682,6 +6682,7 @@ __metadata:
"@testing-library/cypress": ^10.0.0
"@testing-library/dom": ^9.0.0
"@testing-library/react": ^12.1.0
"@types/fs-extra": ^11.0.3
"@types/no-scroll": ^2.1.0
"@types/node": ^20.0.0
"@types/prompts": ^2.4.7
Expand Down Expand Up @@ -9458,6 +9459,16 @@ __metadata:
languageName: node
linkType: hard

"@types/fs-extra@npm:^11.0.3":
version: 11.0.3
resolution: "@types/fs-extra@npm:11.0.3"
dependencies:
"@types/jsonfile": "*"
"@types/node": "*"
checksum: f196bc216906e7016a6c9c549dbe204fe7e1e87515c7e961f741309e25f8e2f8c268dba3dbf0ca7f3ddab5911d39888472f8624ac0c11a461f1b2d05377e38fa
languageName: node
linkType: hard

"@types/github-slugger@npm:^1.3.0":
version: 1.3.0
resolution: "@types/github-slugger@npm:1.3.0"
Expand Down Expand Up @@ -9612,6 +9623,15 @@ __metadata:
languageName: node
linkType: hard

"@types/jsonfile@npm:*":
version: 6.1.3
resolution: "@types/jsonfile@npm:6.1.3"
dependencies:
"@types/node": "*"
checksum: 3f2d0060a567f78b5d666971d5371e72f37294cbfc19069912c76ba9585d209ceb5aac421658f2b3ab922f96b8df53081e9f51d09aef34f2b4882b813a0e0c38
languageName: node
linkType: hard

"@types/keyv@npm:^3.1.1":
version: 3.1.4
resolution: "@types/keyv@npm:3.1.4"
Expand Down

0 comments on commit d11dd9b

Please sign in to comment.