Skip to content

Commit

Permalink
feat: allow additional standard dependencies in .env (#109)
Browse files Browse the repository at this point in the history
* Update standard-deps.js

* Allow additional standard deps in .env

See #104. This allows additional standard dependencies to be specified in the `.env` file under the `STANDARD_DEPENDENCIES` variable.

* Accept default variants as well
  • Loading branch information
sebamarynissen authored Jan 26, 2025
1 parent 647b242 commit 4b6ffbe
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/sc4pac.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import yargs from 'yargs/yargs';
import { parseAllDocuments } from 'yaml';
import { Minimatch } from 'minimatch';
import standardDeps from './standard-deps.js';
import standardVariants from './standard-variants.js';

// Parse the regular expressions for the packages
const { argv } = yargs(hideBin(process.argv));
Expand Down Expand Up @@ -44,7 +45,9 @@ const json = {
pluginsRoot,
cacheRoot,
tempRoot: `.${path.sep}temp`,
variant: {},
variant: {
...standardVariants,
},
channels: [
'https://memo33.github.io/sc4pac/channel/',
pathToFileURL(path.resolve(import.meta.dirname, '../dist/channel'))+'/',
Expand Down
5 changes: 5 additions & 0 deletions scripts/standard-deps.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// # standard-deps.js
const env = process.env.STANDARD_DEPENDENCIES ?? '';
export default [
'memo:essential-fixes',
'memo:transparent-texture-fix-dll',
'memo:region-thumbnail-fix-dll',
'peg:oops-mod',
'simmaster07:sc4fix',
'simmaster07:extra-cheats-dll',
...env.split(','),
];
9 changes: 9 additions & 0 deletions scripts/standard-variants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// # standard-variants.js
const variants = process.env.STANDARD_VARIANTS ?? '';
export default {
driveside: 'right',
...Object.fromEntries(variants.split(',').map(line => {
let [key, value] = line.trim().split('=');
return [key, value];
})),
};

0 comments on commit 4b6ffbe

Please sign in to comment.