Comments (11)
Nobody will ever tell you do go away as long as you are nice to us :) it's all yours! Let us know if you need any help! Welcome at Hoodie :)
from camp.
Good to hear! I'll get started.
from camp.
I'll hopefully have something in the next few days. It's been a busy work week so I haven't had much time to look at it.
from camp.
Ignore the issue history above, this issue is up for grabs again :)
from camp.
I'd like to give this a shot. This would be my first time working on a project outside of a online courses and challenges. If there is a different issue better suited for a beginner i'll claim that one. Or, just tell me to go the hell away and i'll understand :) Good luck with hoodie!
from camp.
No worries, keep us posted :)
from camp.
So, here is what I have so far:
// a-script.js
// writes to parent package.json. Used here to set a "start" script
#!/usr/bin/env node
var fs = require('fs');
var fileName = '../../package.json';
var file = require(fileName);
file.scripts = file.scripts || {};
file.scripts["start"] = "echo \"success\"";
fs.writeFile(fileName, JSON.stringify(file, null, 2), function(err) {
if (err) return console.log(err);
});
With this script set to run on package "install"
(or any "install"
lifecycle event) I can set the parent package.json
"start"
script.
I was thinking of using this to set the "prestart"
hook to run a file that listens to process.argv
for passed commands (or process.env
for lifecycle events). So npm start setup
can still set "start"
to "hoodie"
and still allow for additional "start"
commands in the future.
Does that sound like the direction you want to go?
from camp.
Yeah that sounds good! I just realized that the idea of npm start -- setup
to set the package.json’s start script doesn’t make much sense because unless it’s set we can’t run npm start
🤦 :) Sorry for the confusion. So I think you pretty much work on this issue and #3 at the same time, which is graet
I would suggest we run your script in postinstall
. Three
var fileName = '../../package.json';
won’t work on windows, try to avoid to hard code path separators. Please use path.join instead- Check if the user run
npm install --save hoodie
ornpm install -S hoodie
, and only run the setup then. - Maybe add a
console.log('Start your Hoodie app with "npm start"')
to the end?
from camp.
So use path like this?:
path.join('..','..','package.json')
Sorry, still fairly new to Node.
Also, will the package.json
we want to target always be 2 above where the script executes? I was hoping there would be some other way to get the project root but didn't find anything.
from camp.
yes that looks right.
Your comment is right though, there might be edge cases where the target is not exactly 2 directories above the Hoodie code. Alternatively you can also do path.join(process.cwd(), 'package.json')
. process.cwd()
returns the full path of the directory you run the npm install
command from, so it acchieves the same thing. Maybe let’s use that?
from camp.
Also no need to excuse, happy to help :)
from camp.
Related Issues (20)
- Update License Year in pouchdb-hoodie-sync repository HOT 8
- Update License Year in pouchdb-hoodie-api repository HOT 7
- Update License Year in hoodie-client repository HOT 6
- Update License Year in hoodie-admin repository HOT 2
- Update License Year in hoodie-admin-client repository HOT 8
- `signin` is not fired when logging in via token HOT 2
- merge pouchdb-hoodie-api and pouchdb-hoodie-sync into hoodie-store-client HOT 1
- fix code examples in hoodie.account API documentation HOT 5
- semantic-release validation bot HOT 13
- Joining you HOT 1
- Documentation: add "name" option HOT 6
- Hoodie Account Server API: Update year to 2017 HOT 11
- Update year to 2017 HOT 14
- add hacktoberfest section to template HOT 13
- Update year in LICENSE file HOT 19
- Update year in LICENSE to 2017 HOT 22
- Update year in LICENSE file to 2017 HOT 6
- update license year HOT 12
- Update Copyright year to 2018 HOT 8
- Broken link
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from camp.