Skip to content

Commit dbc4892

Browse files
author
Carol Hansen
authored
Add liftoff script (#87)
* add liftoff script and update contributing
1 parent e54f258 commit dbc4892

5 files changed

Lines changed: 133 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# 11/17/2017
2+
3+
* Add liftoff script, setup docs, and more contributing details per https://github.com/mapbox/node-cpp-skel/pull/87
4+
5+
# 10/31/2017
6+
7+
* Add [sanitzer flag doc](https://github.com/mapbox/node-cpp-skel/pull/84)
8+
* Add [sanitizer script](hhttps://github.com/mapbox/node-cpp-skel/pull/85) and enable [leak sanitizer](https://github.com/mapbox/node-cpp-skel/commit/725601e4c7df6cb8477a128f018fb064a9f6f9aa)
9+
*
10+
11+
# 10/20/2017
12+
13+
* Add [code of conduct](https://github.com/mapbox/node-cpp-skel/pull/82)
14+
* Add [CC0 license](https://github.com/mapbox/node-cpp-skel/pull/82)
15+
* Point to [cpp glossary](https://github.com/mapbox/node-cpp-skel/pull/83)
16+
17+
# 10/12/2017
18+
19+
* Update compiler flags per best practices per https://github.com/mapbox/cpp/issues/37
20+
- https://github.com/mapbox/node-cpp-skel/pull/80
21+
- https://github.com/mapbox/node-cpp-skel/pull/78
22+
- https://github.com/mapbox/node-cpp-skel/pull/77
23+
24+
# 09/10/2017
25+
26+
* [Sanitize update](https://github.com/mapbox/node-cpp-skel/pull/74)
27+
28+
# 08/24/2017
29+
30+
* Clang tidy updates
31+
- https://github.com/mapbox/node-cpp-skel/pull/68
32+
- https://github.com/mapbox/node-cpp-skel/issues/65
33+
- https://github.com/mapbox/node-cpp-skel/pull/64
34+
- https://github.com/mapbox/node-cpp-skel/pull/66
35+
36+
# 08/15/2017
37+
38+
* Add [bench scripts](https://github.com/mapbox/node-cpp-skel/pull/61) for async examples
39+
40+
# 08/09/2017
41+
42+
* Add comments about "new" allocation
43+
44+
# 08/08/2017
45+
46+
* Add [clang-format](https://github.com/mapbox/node-cpp-skel/pull/56)
47+
48+
# 08/04/2017
49+
50+
* Use Nan's safer and high performance `Nan::Utf8String` when accepting string args per https://github.com/mapbox/node-cpp-skel/pull/55
51+
52+
# 08/3/2017
53+
54+
* Reorganize [documentation](https://github.com/mapbox/node-cpp-skel/pull/53)
55+
56+
# 07/21/2017
57+
58+
* Add [object_async example](https://github.com/mapbox/node-cpp-skel/pull/52)
59+
60+
# 07/11/2017
61+
62+
* Add [build docs](https://github.com/mapbox/node-cpp-skel/pull/51)
63+
64+
* It begins

CONTRIBUTING.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
# Code Formatting
1+
# Contributing
2+
3+
Thanks for getting involved and contributing to the skel :tada: Below are a few things to setup when submitting a PR.
4+
5+
## Code comments
6+
7+
If adding new code, be sure to include relevant code comments. Code comments are a great way for others to learn from your code. This is especially true within the skeleton, since it is made for learning.
8+
9+
## Update Documentation
10+
11+
Be sure to update any documentation relevant to your change. This includes updating the [CHANGELOG.md](https://github.com/mapbox/node-cpp-skel/blob/master/CHANGELOG.md).
12+
13+
## Code Formatting
214

315
We use [this script](/scripts/format.sh#L20) to install a consistent version of [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) to format the code base. The format is automatically checked via a Travis CI build as well. Run the following script locally to ensure formatting is ready to merge:
416

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,37 @@ The sanitizers [are part of the compiler](https://github.com/mapbox/cpp/blob/mas
6565

6666
# Add Custom Code
6767

68-
`node-cpp-skel` was designed to make adding custom code simple and scalable, to form to whatever usecase you may need. Here's how:
68+
Depending on your usecase, there are a variety of ways to start using this skeleton for your project.
69+
70+
### Setup new project
71+
Easily use this skeleton as a starting off point for a _new_ custom project:
72+
73+
```
74+
# Clone node-cpp-skel locally
75+
76+
git clone git@github.com:mapbox/node-cpp-skel.git
77+
cd node-cpp-skel/
78+
79+
# Create your new repo on GitHub and have the remote repo url handy for liftoff
80+
# Then run the liftoff script from within your local node-cpp-skel root directory.
81+
#
82+
# This will:
83+
# - prompt you for the new name of your project and the new remote repo url
84+
# - automatically create a new directory for your new project repo
85+
# - create a new branch called "node-cpp-skel-port" within your new repo directory
86+
# - add, commit, and push that branch to your new repo
87+
88+
./scripts/liftoff.sh
89+
90+
```
91+
92+
### Add your code
93+
Once your project has ported node-cpp-skel, follow these steps to integrate your own code:
6994

7095
- Create a dir in `./src` to hold your custom code. See the example code within `/src` for reference.
7196
- Add your new method or class to `./src/module.cpp`, and `#include` it at the top
7297
- Add your new file-to-be-compiled to the list of target sources in `./binding.gyp`
98+
- Run `make` and see what surprises await on your new journey :boat:
7399

74100
# Code coverage
75101

docs/benchmarking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ This will run a bunch of calls to the module's `helloAsync()` function. You can
2020
The bench tests and async functions that come with `node-cpp-skel` out of the box demonstrate this behaviour:
2121
- An async function that is CPU intensive and takes a while to finish (expensive creation and querying of a `std::map` and string comparisons).
2222
- Worker threads are busy doing a lot of work, and the main loop is relatively idle. Depending on how many threads (concurrency) you enable, you may see your CPU% sky-rocket and your cores max out. Yeaahhh!!!
23-
- If you bump up `--iterations` to 500 and profile in Activity Monitor.app, you'll see the main loop is idle as expected since the threads are doing all the work. You'll also see the threads busy doing work in AsyncHelloWorker roughly 99% of the time :tada:
23+
- If you bump up `--iterations` to 500 and [profile in Activity Monitor.app](https://github.com/springmeyer/profiling-guide#activity-monitorapp-on-os-x), you'll see the main loop is idle as expected since the threads are doing all the work. You'll also see the threads busy doing work in AsyncHelloWorker roughly 99% of the time :tada:
2424

2525
![](https://user-images.githubusercontent.com/1209162/29333300-e7c483e2-81c8-11e7-8253-1beb12173841.png)

scripts/liftoff.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
set -eu
4+
5+
# First create new repo on GitHub and copy the SSH repo url
6+
# Then run "./scripts/liftoff.sh" from within your local node-cpp-skel root directory
7+
# and it will create your new local project repo side by side with node-cpp-skel directory
8+
9+
echo "What is the name of your new project? "
10+
read name
11+
echo "What is the remote repo url for your new project? "
12+
read url
13+
14+
mkdir ../$name
15+
cp -R ../node-cpp-skel/. ../$name/
16+
cd ../$name/
17+
rm -rf .git
18+
git init
19+
20+
git checkout -b node-cpp-skel-port
21+
git add .
22+
git commit -m "Port from node-cpp-skel"
23+
git remote add origin $url
24+
git push -u origin node-cpp-skel-port
25+
26+
# Perhaps useful for fresh start, also check out https://github.com/mapbox/node-cpp-skel#add-custom-code
27+
# cp /dev/null CHANGELOG.md
28+
# cp /dev/null README.md

0 commit comments

Comments
 (0)