fomantic / Fomantic-UI

Fomantic-UI is the official community fork of Semantic-UI
https://fomantic-ui.com
MIT License
3.57k stars 331 forks source link

Gulp install doesn't extend current settings #1485

Closed mattiapv closed 1 year ago

mattiapv commented 4 years ago

Bug Report

When I run npx gulp install I can't complete the task because I get an error. I can change fomantic settings only by editing semantic.json. I found only this https://github.com/fomantic/Fomantic-UI/pull/179#issuecomment-437681591.

Steps to reproduce

  1. Install fomantic-ui using npm install fomantic-ui
  2. Complete setup.
  3. Run again npx gulp install.
Installing
Site folder exists, merging files (no overwrite) src/site/
[23:03:40] 'create install files' errored after 2.26 ms
[23:03:40] Error: ENOENT: no such file or directory, stat './src/_site'
    at Object.statSync (fs.js:933:3)
    at Object.exports.copyDirSyncRecursive (/Users/Mattia/Desktop/fomantic-ui/node_modules/wrench-sui/lib/wrench.js:244:23)
    at /Users/Mattia/Desktop/fomantic-ui/semantic/tasks/install.js:339:12
    at create install files (/Users/Mattia/Desktop/fomantic-ui/node_modules/undertaker/lib/set-task.js:13:15)
    at bound (domain.js:426:14)
    at runBound (domain.js:439:12)
    at asyncRunner (/Users/Mattia/Desktop/fomantic-ui/node_modules/async-done/index.js:55:18)
    at processTicksAndRejections (internal/process/task_queues.js:79:11)
[23:03:40] 'install' errored after 11 s

asciicast

My folder looks like this

node_modules
semantic
package-lock.json
package.json
semantic.json

Version

Fomantic: 2.8.4 Gulp: 4.0.2 Node: 12.16.3 NPM: 6.14.5

lubber-de commented 4 years ago

Does npx gulp build work instead?

mattiapv commented 4 years ago

Does npx gulp build work instead?

Yes. I also edited semantic.json to add few components and ran the build task. New components are in the dist folder.

I also tried to delete semantic.json but I got same error. It keeps looking for './src/_site' folder that doesn't exist.

The error is not present if I clone the repo.

lubber-de commented 4 years ago

So, according to the docs, you should run

npx gulp build

but not

npx gulp install

As you said in your previous post, npx gulp build is working , i am confused, if you still have an issue 🤔 . Maybe @ColinFrick could step in otherwise?

mattiapv commented 4 years ago

What I'm saying is that some tasks are broken if I run them after installing fomantic using npm install fomantic-ui. Since installing via NPM is in the documentation I guess the gulp tasks should work. The tasks that are broken are: install, clean, version

As I said before if I clone or download the repo all tasks are working and there is the ./src/_site folder

rosensama commented 1 year ago

Same here. Trying to update fomantic-ui

  1. npm update fomantic-ui
  2. cd semantic
  3. npx gulp install

It recognizes my existing semantic.json, but doesn't try to preserve the settings from it.

[11:19:47] Starting 'run setup'...
? It looks like you have a semantic.json file already. (Use arrow keys)
❯ Yes, extend my current settings. 
  Skip install 

No matter which path I take I get the error at the start of this thread.

Installing
------------------------------
Site folder exists, merging files (no overwrite) src/site/
[11:20:27] 'create install files' errored after 1.31 ms
[11:20:27] Error: ENOENT: no such file or directory, stat './src/_site'
    at Object.statSync (node:fs:1596:3)
    at exports.copyDirSyncRecursive (/home/rosensama/PycharmProjects/projcomp/client/node_modules/wrench-sui/lib/wrench.js:244:23)
    at /home/rosensama/PycharmProjects/projcomp/client/semantic/tasks/install.js:339:12
    at taskWrapper (/home/rosensama/PycharmProjects/projcomp/client/node_modules/undertaker/lib/set-task.js:13:15)
    at bound (node:domain:433:15)
    at runBound (node:domain:444:12)
    at asyncRunner (/home/rosensama/PycharmProjects/projcomp/client/node_modules/async-done/index.js:55:18)
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11)

If I manually create ./src/_site, not matter whether I pick automatic or custom, I now get this:

Installing
------------------------------
Site folder exists, merging files (no overwrite) src/site/
[11:20:59] Starting 'create theme.config'...
Adjusting @siteFolder to:  site/
Modifying src/theme.config (LESS config) src/theme.config
[11:20:59] Finished 'create theme.config' after 15 ms
[11:20:59] Starting 'create semantic.json'...
Creating config file (semantic.json) semantic.json
[11:20:59] 'create semantic.json' errored after 4.07 ms
[11:20:59] Error: File not found with singular glob: /home/rosensama/PycharmProjects/projcomp/client/semantic/semantic.json.example (if this was purposeful, use `allowEmpty` option)
    at Glob.<anonymous> (/home/rosensama/PycharmProjects/projcomp/client/node_modules/glob-stream/readable.js:84:17)
    at Object.onceWrapper (node:events:628:26)
    at Glob.emit (node:events:513:28)
    at Glob.emit (node:domain:489:12)
    at Glob._finish (/home/rosensama/PycharmProjects/projcomp/client/node_modules/glob/glob.js:194:8)
    at done (/home/rosensama/PycharmProjects/projcomp/client/node_modules/glob/glob.js:179:14)
    at Glob._processSimple2 (/home/rosensama/PycharmProjects/projcomp/client/node_modules/glob/glob.js:688:12)
    at /home/rosensama/PycharmProjects/projcomp/client/node_modules/glob/glob.js:676:10
    at Glob._stat2 (/home/rosensama/PycharmProjects/projcomp/client/node_modules/glob/glob.js:772:12)
    at lstatcb_ (/home/rosensama/PycharmProjects/projcomp/client/node_modules/glob/glob.js:764:12)
[11:20:59] 'create install files' errored after 21 ms
[11:20:59] 'install' errored after 1.69 s

If I select the Custom path, it doesn't suggest my current settings as defaults. Here (dist/) should be (../public/dist/)

[11:23:00] Starting 'run setup'...
? It looks like you have a semantic.json file already. Yes, extend my current settings.
? Set-up Semantic UI Custom (Customize all src/dist values)
? What components should we include in the package? reset, site, button, container, divider, emoji, flag, header, icon, image, input, label, list, loader, rail, reveal, segment, step, breadcrumb, form, grid, menu, 
message, table, ad, card, comment, feed, item, statistic, accordion, calendar, checkbox, dimmer, dropdown, embed, modal, nag, placeholder, popup, progress, slider, rating, search, shape, sidebar, sticky, tab, text, 
toast, transition, api, form, state, visibility
? Should we set permissions on outputted files? No
? Do you use a RTL (Right-To-Left) language? No
? Where should we put your site folder? src/site
? Where should we output a packaged version? (dist/) 

My existing semantic.json

{
  "base": "semantic/",
  "paths": {
    "source": {
      "config": "src/theme.config",
      "definitions": "src/definitions/",
      "site": "src/site/",
      "themes": "src/themes/"
    },
    "output": {
      "packaged": "../public/dist/",
      "uncompressed": "../public/dist/components/",
      "compressed": "../public/dist/components/",
      "themes": "../public/dist/themes/"
    },
    "clean": "../public/dist/"
  },
  "permission": "744",
  "autoInstall": false,
  "rtl": false,
  "version": "2.8.8",
  "components": ["reset", "site", "button", "container", "divider", "emoji", "flag", "header", "icon", "image", "input", "label", "list", "loader", "rail", "reveal", "segment", "step", "breadcrumb", "form", "grid", "menu", "message", "table", "ad", "card", "comment", "feed", "item", "statistic", "accordion", "calendar", "checkbox", "dimmer", "dropdown", "embed", "modal", "nag", "placeholder", "popup", "progress", "slider", "rating", "search", "shape", "sidebar", "sticky", "tab", "text", "toast", "transition", "api", "form", "state", "visibility", "reset", "site", "button", "container", "divider", "emoji", "flag", "header", "icon", "image", "input", "label", "list", "loader", "rail", "reveal", "segment", "step", "breadcrumb", "form", "grid", "menu", "message", "table", "ad", "card", "comment", "feed", "item", "statistic", "accordion", "calendar", "checkbox", "dimmer", "dropdown", "embed", "modal", "nag", "placeholder", "popup", "progress", "slider", "rating", "search", "shape", "sidebar", "sticky", "tab", "text", "toast", "transition", "api", "form", "state", "visibility"]
}
rosensama commented 1 year ago

I tried removing my semantic.json file and semantic directory and follow the documantion.

$ cd node_modules/fomantic-ui
$ npx gulp install

It creates semantic.json along with the source and output paths under node_modules. The semantic.json has some of the custom paths I selected, but not all:

So my current fomantic-ui update procedure is:

  1. mv semantic semantic.bak
  2. rm -rf node_modules/fomantic-ui
  3. npm install fomantic-ui
  4. cd node_modules/fomantic-ui
  5. npx gulp install
  6. Select Automatic install
  7. Complete the install
  8. cd ../.. (package.json is in the resulting directory)
  9. Update semantic.json with the updated components entry from node_modules/fomantic-ui/semantic.json
  10. mkdir semantic
  11. cp -r node_modules/fomantic-ui/gulpfile.js node_modules/fomantic-ui/src/ node_modules/fomantic-ui/tasks/ semantic/
  12. cd semantic
  13. npx gulp build
lubber-de commented 1 year ago

There are many mentioned issues here, so lets summarize:

lubber-de commented 1 year ago

Original issue is now fixed by #2675 by telling the user when npx gulp install is run in the wrong folder

rosensama commented 1 year ago

Thanks for the prompt response. I'll see how it goes on the next update.