Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows compatibility 2 #3165

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions src/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const { exec } = require("node:child_process")

function runCommand(command) {
if(process.platform === "win32") command = `pwsh -e "${Buffer.from(command, "utf16le").toString("base64")}"`;

return new Promise((resolve, reject) => {
exec(command, (error, stdout, stderr) => {
if (error) {
Expand All @@ -27,17 +29,11 @@ async function executeCommands() {
await runCommand("node_modules/.bin/prejss-cli dist/utilities.css --format commonjs")
// await runCommand("mv dist/utilities.js dist/utilities.cjs")

await runCommand(
"node_modules/.bin/postcss --config src/utilities/unstyled src/utilities/unstyled/*.css --base src --dir dist",
{ stdio: [] }
)
await runCommand("node_modules/.bin/postcss --config src/utilities/unstyled src/utilities/unstyled/*.css --base src --dir dist")
await runCommand("cat dist/utilities/unstyled/*.css > dist/utilities-unstyled.css")
await runCommand("node_modules/.bin/prejss-cli dist/utilities-unstyled.css --format commonjs")
// await runCommand("mv dist/utilities-unstyled.js dist/utilities-unstyled.cjs")
await runCommand(
"node_modules/.bin/postcss --config src/utilities/styled src/utilities/styled/*.css --base src --dir dist",
{ stdio: [] }
)
await runCommand("node_modules/.bin/postcss --config src/utilities/styled src/utilities/styled/*.css --base src --dir dist")
await runCommand("cat dist/utilities/styled/*.css > dist/utilities-styled.css")
await runCommand("node_modules/.bin/prejss-cli dist/utilities-styled.css --format commonjs")
// await runCommand("mv dist/utilities-styled.js dist/utilities-styled.cjs")
Expand All @@ -48,15 +44,11 @@ async function executeCommands() {
await runCommand(
"cat dist/components/unstyled/*.css dist/components/styled/*.css > dist/styled.css"
)
await runCommand("node_modules/.bin/prejss-cli dist/{unstyled,styled}.css --format commonjs")
await runCommand("node_modules/.bin/prejss-cli dist/styled.css --format commonjs")
await runCommand("node_modules/.bin/prejss-cli dist/unstyled.css --format commonjs")
// await runCommand("mv dist/unstyled.js dist/unstyled.cjs")
// await runCommand("mv dist/styled.js dist/styled.cjs")
await runCommand(
"node_modules/.bin/postcss src/themes/index.css -o dist/themes.css --config src/themes",
{
stdio: [],
}
)
await runCommand("node_modules/.bin/postcss src/themes/index.css -o dist/themes.css --config src/themes")
if (!process.argv.includes("--skipfullcss")) {
await runCommand(
"node_modules/.bin/postcss src/full/index.css -o dist/full.css --config src/full"
Expand Down
4 changes: 2 additions & 2 deletions src/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"dev": "npm run createStyleHandlerComponent:dev --silent && vite dev --port 3000 --open",
"build": "npm run get-json --silent && npm run createStyleHandlerComponent:prod --silent && NODE_ENV=production vite build --logLevel error",
"preview": "npm run build && vite preview --port 3000 --open",
"createStyleHandlerComponent:dev": "echo $'<script>import \"$components/StyleDevelopment.svelte\"</script>' > src/components/StyleHandler.svelte",
"createStyleHandlerComponent:prod": "echo $'<script>import \"$components/StyleProduction.svelte\"</script>' > src/components/StyleHandler.svelte",
"createStyleHandlerComponent:dev": "node -e \"require('fs').writeFileSync('src/components/StyleHandler.svelte', `<script>import '$components/StyleDevelopment.svelte';</script>`)\"",
"createStyleHandlerComponent:prod": "node -e \"require('fs').writeFileSync('src/components/StyleHandler.svelte', `<script>import '$components/StyleProduction.svelte';</script>`)\"",
"update-twitter-avatars": "node src/lib/scripts/get-twitter-avatars.js",
"langdiff": "node src/lib/scripts/compare-translate-files"
},
Expand Down
2 changes: 1 addition & 1 deletion src/docs/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineConfig({
],
resolve: {
alias: {
$components: path.resolve("/src/components"),
$components: path.resolve("./src/components"),
},
},
})