Giter Site home page Giter Site logo

ghost-fvtt / foundry-factory Goto Github PK

View Code? Open in Web Editor NEW
40.0 2.0 5.0 12.22 MB

An interactive command line tool to bootstrap new modules and systems for Foundry Virtual Tabletop

License: Other

JavaScript 4.17% Shell 0.38% TypeScript 74.86% Nunjucks 20.59%
foundryvtt foundry-vtt cli

foundry-factory's People

Contributors

akrigline avatar davidarchibald avatar dependabot[bot] avatar ghost91- avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

foundry-factory's Issues

Add a way to fetch files / nunjucks templates from a git repository

This would allow us to move the nunjucks templates to separate repositories and update them independently of Foundry Factory itself.

It would also allow us to point directly to the upstream source for the League Basic JS Template so that we don't need to update it every time they make a change.

LICENSE file step

CLI wizard step with license choices based on the most popular licenses.

User may check more than one to AND them together.

Crucially, I'm trying to create buy-in for including the full OGL license text in repositories that include open game content. This means dual-licensing in almost every case (for example, the SPDX license expression for dnd5e would be something like OGL-1.0a AND GPL-3.0-only). There are other efforts parallel to this to add OGL to the SPDX license list

Ghost Gulp Rollup Preset: CSS path in system.json and gulp dest are different.

Summary: system.json = ["styles/name-of-system.css"], gulpfile = ["css/name-of-system.css"]

Title, as defined in gulpfile:
https://github.com/ghost91-/foundry-factory/blob/4efee15dc11c94ba348acf3148d4aaafd4324572/template/ghost-gulp-rollup/gulpfile.js.njk#L45

Title, as defined in system.json:
https://github.com/ghost91-/foundry-factory/blob/4efee15dc11c94ba348acf3148d4aaafd4324572/src/presets/ghost-gulp-rollup/generate-programmatic-files.ts#L161

EDIT: Should also be noted that on Windows path.join doesn't play nice when used as a src(). It will in this case pipe the whole src/styles into dist/css/.

Typescript setup installation issue

I attempted to install this into an existing project:

➜  foundryvtt-dnd5eCharacterActions git:(dnd5e-types-revised) ✗ npx @ghost-fvtt/foundry-factory ./
Need to install the following packages:
  @ghost-fvtt/foundry-factory
Ok to proceed? (y) y
Foundry Factory 0.6.5
? Please select whether to create a module or a system: Module
? Target directory /home/andrew/foundryDev/modules/foundryvtt-dnd5eCharacterActions already exists.
 Pick an action: Merge
✔ Created working directory
✔ Existing git repository detected.
? Please pick a preset (links point to the documentation of the preset): ghost's Gulp + Rollup Pres
et
? Check the features needed for your project: TypeScript, Linter & Formatter (ESLint & Prettier), C
SS Pre-processor (Less / SCSS)
? Pick a CSS pre-processor Sass (.scss)
✔ Created programmatic files
✔ Created files from templates
✔ Created additional directories
✖ Failed to install dependencies
Failed to create project at /home/andrew/foundryDev/modules/foundryvtt-dnd5eCharacterActions
Error: Command failed: npm install --loglevel error --save-dev @rollup/plugin-node-resolve chalk fs-extra gulp rollup semver yargs @league-of-foundry-developers/[email protected] rollup-plugin-typescript2 tslib typescript eslint eslint-config-prettier eslint-plugin-prettier prettier husky lint-staged @typescript-eslint/eslint-plugin @typescript-eslint/parser gulp-dart-sass
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! Found: @league-of-foundry-developers/[email protected]
npm ERR! node_modules/@league-of-foundry-developers/foundry-vtt-types
npm ERR!   dev @league-of-foundry-developers/foundry-vtt-types@"0.7.9-6" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @league-of-foundry-developers/foundry-vtt-types@"^0.8.8-7" from @league-of-foundry-developers/[email protected]
npm ERR! node_modules/@league-of-foundry-developers/foundry-vtt-dnd5e-types
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /home/andrew/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/andrew/.npm/_logs/2021-07-16T14_18_01_973Z-debug.log

Looks like this just needs an update for which types version to install.

[Gulp + Rollup Preset] gulp-sass broken on node 16+

Less a problem with your code and more just that gulp-sass hasn't removed/updated its dependency on node-sass (see the large amount of issues about it on the gulp-sass repo). But for now, trying to create a new module with sass fails on the install step with a massive wall of build errors. Might be worth figuring out an alternative to gulp-sass or warning if on node 16+.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm standard-version Available

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): lock file maintenance

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • fix(deps): replace dependency standard-version with commit-and-tag-version ^9.3.2

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/checks.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-node v4.0.3
  • actions/cache v4
  • fsfe/reuse-action v4
.github/workflows/publish.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-node v4.0.3
  • actions/cache v4
  • fsfe/reuse-action v4
  • actions/upload-artifact v4
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-node v4.0.3
  • actions/cache v4
  • actions/download-artifact v4
  • ncipollo/release-action v1
.github/workflows/release.yml
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-node v4.0.3
  • actions/cache v4
  • fsfe/reuse-action v4
  • actions/checkout v4@692973e3d937129bcbf40652eb9f2f61becf3332
  • qzb/standard-version-action v1.0.13
npm
package.json
  • @commitlint/cli ^19.0.0
  • @commitlint/config-conventional ^19.0.0
  • chalk ^5.0.0
  • commander ^12.0.0
  • fs-extra ^11.0.0
  • inquirer ^9.0.0
  • nunjucks ^3.2.3
  • ora ^8.0.0
  • standard-version ^9.3.2
  • @rollup/plugin-typescript 11.1.6
  • @types/fs-extra 11.0.4
  • @types/inquirer 9.0.7
  • @types/nunjucks 3.2.6
  • @typescript-eslint/eslint-plugin 7.18.0
  • @typescript-eslint/parser 7.18.0
  • eslint 8.57.0
  • eslint-config-prettier 9.1.0
  • eslint-plugin-prettier 4.2.1
  • husky 9.1.4
  • lint-staged 15.2.9
  • prettier 2.8.8
  • rollup 4.20.0
  • rollup-plugin-preserve-shebang 1.0.1
  • tslib 2.6.3
  • typescript 5.5.4
  • vitest 2.0.5
  • node ^16.17.1 || ^18.12.0 || ^20.0.0
  • npm ^10.0.0
nvm
.nvmrc

  • Check this box to trigger a request for Renovate to run again on this repository

Build:watch only writes changes to dist on the first time

When using run build:watch gulp is triggering correctly on code changes and rebuilds the js code. However the target files in dist folder are only overwritten the first time. On subsequent rebuilds the output does not get persisted.

foundry-factory generator error

I just installed it and when using foundry-factory I get this error

.......\AppData\Roaming\nvm\v12.0.0\node_modules\@ghost-fvtt\foundry-factory\dist\index.mjs:2
import { Command, Option } from 'commander';
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:703:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:826:10)
    at internal/main/run_main_module.js:17:11

Add support for arguments on "link-project" to support multiple foundry instances

(EDIT: fat-fingered an enter, filling in the description now)

It could be useful being able to have more than a single dataPath on the foundryconfig.json and using one or another based on an argument (defaulting to dataPath if no argument sent?). Use case is for example, having two local foundry installations, a node and an electron, used as test benches for two different foundry version (right now I have a v10 node i'm using to develop for v10 and I keep the electron app on v9 for supporting my existing modules)

I imagine the simplest approach would be having a foundryconfig.json like:

{
    "dataPath": "path/to/data",
    "node": "path/to/one/foundrys/data",
    "win": "path/to/another/foundrys/data",
}

with 'npm run link-project' using dataPath, 'node run link-project node' using the node path, etc.

[Gulp + Rollup Preset] husky setup fails on windows

Ironically, it seems like the fix in #7 broke initializing husky on windows in a different way.

The following is the output:

Foundry Factory 0.6.0
? Please select whether to create a module or a system: Module
✔ Created working directory
✔ Initialized new git repository
? Please pick a preset (links point to the documentation of the preset): ghost's Gulp + Rollup Preset
? Check the features needed for your project: TypeScript, Linter & Formatter (ESLint & Prettier)
✔ Created programmatic files
✔ Created files from templates
✔ Created additional directories
✔ Installed dependencies
✖ Failed to execute post installation commands
Failed to create project at C:\devel\fvtt-fantasy-name-generators-2
Error: Command failed: npx husky add .husky/pre-commit \"npx lint-staged\"

In both standard cmd and also powershell the following command generates the pre-commit file correctly:
npx husky add .husky/pre-commit "npx lint-staged"

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged

The escaped quotes do nothing on cmd (husky doesn't understand the arguments), but generates this monstrosity in powershell:

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

\\npx lint-staged"

Debugging and source maps

I am trying to debug my module (along with it's interactions with dnd5e, but that's another story) and I cannot get any breakpoints to bind from vscode. If I put the exact same breakpoint through chrome itself, vscode will stop as well there. But not the other way around. The sourcemaps are generated and are in dist/. Could this be an issue with symlinking to the foundry modules directory?

OS: Windows
Preset: ghost's Gulp + Rollup Preset (with Typescript + SCSS)

Error when building new empty project

Node version: v14.20
foundry-factory version: 1.4.1
Preset: ghost's Gulp + Rollup Preset
OS: Windows 11

When building a package (gulp build) the following error is thrown during buildCode:
SyntaxError: Unexpected token in JSON at position 0

The error appears even for newly created packages.

Semantic error TS1149 in newly setup project

I've just setup a new project. As soon as I try to build (either by npm run build or npm run build:watch), I get the following error on the build process. I know that happened before in another project and I got that solved. Just can't figure out for the life of me how I did that. Tried anything I found here: https://stackoverflow.com/questions/51197940/file-name-differs-from-already-included-file-name-only-in-casing-on-relative-p but to no avail.

If it matters: I'm using Win10 x64.

Error: E:/Repos/tommycore/world-map/src/module/world-map.ts(15,34): semantic error TS1149: File name 'E:/Repos/tommycore/world-map/src/module/preloadTemplates.ts' differs from 
already included file name 'E:/repos/tommycore/world-map/src/module/preloadTemplates.ts' only in casing.
  The file is in the program because:
    Root file specified for compilation
    Imported via './preloadTemplates' from file 'E:/Repos/tommycore/world-map/src/module/world-map.ts'
    at error (E:\repos\tommycore\world-map\node_modules\rollup\dist\shared\rollup.js:158:30)
    at throwPluginError (E:\repos\tommycore\world-map\node_modules\rollup\dist\shared\rollup.js:21741:12)
    at Object.error (E:\repos\tommycore\world-map\node_modules\rollup\dist\shared\rollup.js:22415:20)
    at Object.error (E:\repos\tommycore\world-map\node_modules\rollup\dist\shared\rollup.js:21917:38)
    at RollupContext.error (E:\repos\tommycore\world-map\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:17241:30)
    at E:\repos\tommycore\world-map\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:25064:23
    at arrayEach (E:\repos\tommycore\world-map\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:549:11)
    at Function.forEach (E:\repos\tommycore\world-map\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:9401:14)
    at printDiagnostics (E:\repos\tommycore\world-map\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:25037:12)
    at Object.transform (E:\repos\tommycore\world-map\node_modules\rollup-plugin-typescript2\dist\rollup-plugin-typescript2.cjs.js:30131:17)

Yarn 2 and 3 PNP Support

It seems that ES6 style imports currently does not work with some combination of Gulp, Yarn 2/3, and ES6 imports. I can get this issue with the following steps:

$ npx @ghost-fvtt/foundry-factory -m yarn2 --default --type module --no-config test
$ cd test
$ yarn build

Got error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'fs-extra' imported from [path]/test/gulpfile.js
Did you mean to import fs-extra-npm-10.0.0-4f8c704115-5285a3d8f3.zip/node_modules/fs-extra/lib/index.js?
    at new NodeError (node:internal/errors:371:5)
    at packageResolve (node:internal/modules/esm/resolve:930:9)
    at moduleResolve (node:internal/modules/esm/resolve:976:18)
    at defaultResolve (node:internal/modules/esm/resolve:1078:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

The suggested import fs-extra-npm-10.0.0-4f8c704115-5285a3d8f3.zip seems to be clearly referring to the .yarn/cache file of the same name. It's somewhat peculiar it recognizes the PNP module exists. I tracked down this issue as well as this e2e test.

I currently have it working by converting it to .cjs and changing the imports to match.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.