Skip to content

Commit

Permalink
Merge pull request #222 from rgieseke/workaround-svelte-check-error
Browse files Browse the repository at this point in the history
Workaround for svelte-check error from additional config file
  • Loading branch information
mhkeller committed Jun 27, 2024
2 parents 8b82d9c + 3d4e2d7 commit 6e90202
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/scripts/build-svelte-app-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ import * as fs from 'fs';
const files = [];

for (const path of process.argv.slice(2)) {
if (!path.includes('.DS_Store')) {
if (!path.includes('.DS_Store') && !path.includes('svelte.config.js.template')) {
files.push({ path: path.split('svelte-app/')[1], data: fs.readFileSync(path).toString() });
}
}

// `svelte-check` gets confused by having another `svelte.config.js` file so it's renamed
// to `svelte.config.js.template` in `update_template.sh` and added manually below
files.push({
path: 'svelte.config.js',
data: fs.readFileSync('src/scripts/svelte-app/svelte.config.js.template').toString()
});

const templatePkg = JSON.parse(fs.readFileSync('src/scripts/svelte-app/package.json', 'utf-8'));

fs.writeFileSync(`static/svelte-app.json`, JSON.stringify(files));
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions src/scripts/update_template.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@ rm -rf src/scripts/svelte-app/src/routes/_data
rm -rf src/scripts/svelte-app/src/routes/_components
# mkdir src/scripts/svelte-app/src/routes/components

# `svelte-check` gets confused by having another `svelte.config.js`,
# so it's renamed and manually added in `build-svelte-app-json.js`
mv src/scripts/svelte-app/svelte.config.js src/scripts/svelte-app/svelte.config.js.template

# build svelte-app.json
node src/scripts/build-svelte-app-json.js `find src/scripts/svelte-app -type f`
2 changes: 1 addition & 1 deletion static/svelte-app.json

Large diffs are not rendered by default.

0 comments on commit 6e90202

Please sign in to comment.