Skip to content

Commit

Permalink
Move donation message to scripts (#804)
Browse files Browse the repository at this point in the history
* Move donation message to scripts

this fixes issue where installation would fail in environments where
`npm` is not available.

* Move donation message to nodejs script

* Move donation message script to config/
  • Loading branch information
andrejsm authored and developit committed Aug 24, 2017
1 parent 0dea3b7 commit 4ea1bc7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/donation-message.js
@@ -0,0 +1 @@
console.log("\u001b[35m\u001b[1mLove Preact? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/preact/donate\u001b[0m")
3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -34,8 +34,7 @@
"prepublish": "npm run build",
"smart-release": "npm run build && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish",
"release": "cross-env npm run smart-release",
"postinstall": "npm run -s donate",
"donate": "echo \"\u001b[35m\u001b[1mLove Preact? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/preact/donate\u001b[39m\""
"postinstall": "node ./config/donation-message.js"

This comment has been minimized.

Copy link
@lukeed

lukeed Aug 24, 2017

Member

The config directory isn't added to package files (and we don't want it to be). All new installs will throw an error because this file is missing.

This comment has been minimized.

Copy link
@PerWiklander

PerWiklander Aug 24, 2017

Trying to install preact-cli, which depends "preact": "^8.1.0". No success because of

> preact@8.2.2 post install /app/node_modules/preact
> node ./config/donation-message.js

module.js:491
    throw err;
    ^

Error: Cannot find module '/app/node_modules/preact/config/donation-message.js'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Function.Module.runMain (module.js:609:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:598:3

This comment has been minimized.

Copy link
@reznord

reznord Aug 24, 2017

Member

moving donation-message.js to root folder should do the work

This comment has been minimized.

Copy link
@PerWiklander

PerWiklander Aug 25, 2017

It works now with 8.2.4, thanks for the quick solution.

},
"eslintConfig": {
"extends": "./config/eslint-config.js"
Expand Down

0 comments on commit 4ea1bc7

Please sign in to comment.