Skip to content

Commit

Permalink
Make pull-libs into a node.js script
Browse files Browse the repository at this point in the history
  • Loading branch information
1j01 committed Dec 30, 2019
1 parent 12a42cc commit 946ab0c
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 11 deletions.
70 changes: 61 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"browserfs": "^1.4.3",
"butterchurn": "2.6.7",
"butterchurn-presets": "2.4.7",
"fs-extra": "8.1.0",
"json": "^9.0.6",
"live-server": "^1.2.0",
"recursive-copy": "^2.0.9",
Expand All @@ -47,7 +48,6 @@
"make-fs-index @NOTE": "browserfs is currently assumed to be npm linked at around 2.0.0-beta",
"make-fs-index @TODO": "Create a pre-commit hook, or keep this file out of repo, either have it as part of a webserver, or just generated on deploy (in which case it could still be a static site). Ignore gitignored files, including globally gitignored lnk files... altho this is the one repo where lnk files might make sense; I'm sure there's a way to base it off of what things are checked in to git. git ls-files, or git ls-tree, ideally with the contents after staged changes would be applied (is there a 'tree-ish' for that?)",
"update-jspaint": "node src/update-jspaint.js",
"pull-libs @TODO": "# make it into a script so it's not all crammed onto one line in this package.json; include jquery and stuff; maybe even update script tags in html, with CDN URLs, integrity checksums, and fallbacks",
"pull-libs": "cp node_modules/webamp/built/webamp.bundle.js programs/winamp/lib/webamp.bundle.js && cp node_modules/webamp/built/webamp.bundle.min.js programs/winamp/lib/webamp.bundle.min.js && cp node_modules/browserfs/dist/browserfs.js lib/browserfs.js && cp node_modules/browserfs/dist/browserfs.min.js lib/browserfs.min.js && cp node_modules/butterchurn/lib/butterchurn.min.js programs/winamp/lib/butterchurn.min.js && cp node_modules/butterchurn-presets/lib/butterchurnPresets.min.js programs/winamp/lib/butterchurnPresets.min.js"
"pull-libs": "node pull-libs.js"
}
}
18 changes: 18 additions & 0 deletions pull-libs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// TODO: include jquery and stuff; maybe even update script tags in html, with CDN URLs, integrity checksums, and fallbacks

const {copySync} = require("fs-extra");

const copySyncAndLog = (from, to)=> {
console.log(`Copying ${from} => ${to}`);
copySync(from, to);
};

copySyncAndLog("node_modules/webamp/built/webamp.bundle.js", "programs/winamp/lib/webamp.bundle.js");
copySyncAndLog("node_modules/webamp/built/webamp.bundle.min.js", "programs/winamp/lib/webamp.bundle.min.js");
copySyncAndLog("node_modules/browserfs/dist/browserfs.js", "lib/browserfs.js");
copySyncAndLog("node_modules/browserfs/dist/browserfs.min.js", "lib/browserfs.min.js");
copySyncAndLog("node_modules/butterchurn/lib/butterchurn.min.js", "programs/winamp/lib/butterchurn.min.js");
copySyncAndLog("node_modules/butterchurn-presets/lib/butterchurnPresets.min.js", "programs/winamp/lib/butterchurnPresets.min.js");
console.log(`Done.
Note: This script doesn't handle updating npm dependencies, just copying scripts into the repo.`);

0 comments on commit 946ab0c

Please sign in to comment.