Skip to content

Commit 89414fb

Browse files
committed
CI: Working on CI script
1 parent 953beca commit 89414fb

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

.github/workflows/cdn-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ jobs:
265265
cd cdn
266266
# Copy the script template for adding Lit to importmaps
267267
cp $GITHUB_WORKSPACE/scripts/assets/templates/cdn/add-lit-to-importmap.js.template add-lit-to-importmap.js
268-
# Execute the script with ESM support, passing the LIT_VERSION
269-
LIT_VERSION=$LIT_VERSION node --input-type=module add-lit-to-importmap.js
268+
# Execute the script using Node with type=module flag
269+
LIT_VERSION=$LIT_VERSION node --no-warnings --input-type=module --eval "$(cat add-lit-to-importmap.js)"
270270
# Clean up
271271
rm add-lit-to-importmap.js
272272
cd ..
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import fs from 'fs';
22

3+
// Get the Lit version from environment variable
4+
const litVersion = process.env.LIT_VERSION || '3.0.0';
5+
36
// Find all importmap files in the current directory
47
const files = fs.readdirSync('.').filter(f => f.startsWith('importmap-') && f.endsWith('.json'));
58

@@ -9,12 +12,10 @@ files.forEach(file => {
912

1013
// Add Lit to the importmap if it doesn't exist already
1114
if (!importmap.imports.lit) {
12-
// Get the LIT_VERSION from the environment or use the file structure
13-
const litVersion = process.env.LIT_VERSION || fs.readdirSync('./lit').filter(dir => /^\d/.test(dir))[0] || '3.0.0';
1415
importmap.imports.lit = `https://cdn.semantic-ui.com/lit/${litVersion}/index.js`;
1516
console.log(`Added Lit to ${file}`);
1617

1718
// Write the updated importmap back to the file
1819
fs.writeFileSync(file, JSON.stringify(importmap, null, 2));
1920
}
20-
});
21+
});

0 commit comments

Comments
 (0)