Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Kulkodar committed Aug 5, 2024
0 parents commit ed4f9f6
Show file tree
Hide file tree
Showing 67 changed files with 24,167 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
system-packs
node_modules
package
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist
package
node_modules
system-packs
packs

package-lock.json
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"useTabs": true,
"bracketSameLine": false,
"endOfLine": "lf"
}
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Kulkodar's shared compendia
A simple module that holds various things.

## Content
- Scene setups for maps made by [Paizo](https://paizo.com/)
- Basic setups for one-shots made by [Paizo](https://paizo.com/)

## installation
Manifest URL: https://github.com/Kulkodar/shared-compendia/releases/latest/download/module.json

### Additional installations
To use the prepared scenes/adventure made by [Paizo](https://paizo.com/) you need to place the content of the art assets into the following folder `<FoundryDataFolder>/proprietary-assets/<ProductId-ProductName>/`. The `ProductId` is the offical store id found on the store page. The `ProductName` is the title of the book/pdf excluding Pathfinder. For the one-shot Sundered Waves it would be `<FoundryDataFolder>/proprietary-assets/PZO1001E-Sundered-Waves/`
3 changes: 3 additions & 0 deletions build/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package
packs
system.json
49 changes: 49 additions & 0 deletions build/build-packs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import fs from 'fs';
import path from 'path';
import url from 'url';
import {
CompendiumMetadata,
CompendiumPack,
PackError,
} from './lib/compendium-pack';
import systemJSON from './system.json';

const __dirname = url.fileURLToPath(new URL('.', import.meta.url));

// Loads all system packs into memory for the sake of making all document name/id mappings available
const systemPacksMetadata = systemJSON.packs as unknown as CompendiumMetadata[];

const systemPacksDataPath = path.resolve(__dirname, '../system-packs');
const systemPackDirPaths = fs
.readdirSync(systemPacksDataPath)
.map((dirName) => path.resolve(__dirname, systemPacksDataPath, dirName))
.filter((filePath) =>
systemPacksMetadata.find(
(p) => path.basename(p.path) === path.basename(filePath)
)
);

systemPackDirPaths.map((p) => CompendiumPack.loadJSON(p));

// Loads all packs into memory for the sake of making all document name/id mappings available
const packsDataPath = path.resolve(__dirname, '../packs');
const packDirPaths = fs
.readdirSync(packsDataPath)
.map((dirName) => path.resolve(__dirname, packsDataPath, dirName));

const packs = packDirPaths.map((p) => CompendiumPack.loadJSON(p));

const documentCounts = await Promise.all(
packs.map(function (p) {
return p.save();
})
);
const total = documentCounts.reduce((total, c) => total + c, 0);

if (documentCounts.length > 0) {
console.log(
`Created ${documentCounts.length} packs with ${total} documents.`
);
} else {
throw PackError('No data available to build packs.');
}
12 changes: 12 additions & 0 deletions build/clean.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import fs from 'fs';
import path from 'path';

const outDir = path.resolve(process.cwd(), 'dist');
if (fs.existsSync(outDir)) {
const filesToClean = fs
.readdirSync(outDir)
.map((dirName) => path.resolve(outDir, dirName));
for (const file of filesToClean) {
fs.rmSync(file, { recursive: true });
}
}
12 changes: 12 additions & 0 deletions build/extract-packs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import process from 'process';
import { PackExtractor } from './lib/extractor';

const extractor = new PackExtractor();

try {
await extractor.run('dist', 'packs', true);
console.log(`Extraction complete.`);
} catch (error) {
console.error(error);
process.exit(1);
}
12 changes: 12 additions & 0 deletions build/extract-system-packs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import process from 'process';
import { PackExtractor } from './lib/extractor';

const extractor = new PackExtractor();

try {
await extractor.run('build', 'system-packs', false);
console.log(`Extraction complete.`);
} catch (error) {
console.error(error);
process.exit(1);
}
Loading

0 comments on commit ed4f9f6

Please sign in to comment.