Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dherman committed Mar 1, 2021
1 parent ff0593b commit 02825de
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Cargo.lock
**/index.node
**/artifacts.json
cli/lib
create-neon/dist
test/cli/lib
npm-debug.log
rls*.log
20 changes: 20 additions & 0 deletions create-neon/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions create-neon/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "create-neon",
"version": "0.1.0",
"description": "Create Neon projects with no build configuration.",
"author": "Dave Herman <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/neon-bindings/neon/issues"
},
"homepage": "https://github.com/neon-bindings/neon#readme",
"bin": "./dist/bin/create-neon.js",
"files": [
"dist/**/*",
"templates/**/*"
],
"scripts": {
"build": "tsc",
"prepublishOnly": "npm run build",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/neon-bindings/neon.git"
},
"keywords": [
"neon"
],
"devDependencies": {
"@types/node": "^14.14.31",
"typescript": "^4.2.2"
}
}
4 changes: 4 additions & 0 deletions create-neon/src/bin/create-neon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { FARTS } from '../util';

console.log('hey');
console.log(FARTS);
1 change: 1 addition & 0 deletions create-neon/src/util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const FARTS: string = 'farts';
4 changes: 4 additions & 0 deletions create-neon/templates/.gitignore.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
target
index.node
**/node_modules
**/.DS_Store
19 changes: 19 additions & 0 deletions create-neon/templates/Cargo.toml.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "{{project.name.cargo}}"
version = "{{project.version}}"
{{#if project.author}}
authors = ["{{project.author}}{{#if project.email}} <{{project.email}}>{{/if}}"]
{{/if}}
{{#if project.license}}
license = "{{project.license}}"
{{/if}}
edition = "2018"
exclude = ["index.node"]

[lib]
crate-type = ["cdylib"]

[dependencies.neon]
version = {{neon.libs.version}}
default-features = false
features = ["napi-6"]
3 changes: 3 additions & 0 deletions create-neon/templates/README.md.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# {{project.name.npm.full}}

{{project.description}}
11 changes: 11 additions & 0 deletions create-neon/templates/lib.rs.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use neon::prelude::*;

fn hello(mut cx: FunctionContext) -> JsResult<JsString> {
Ok(cx.string("hello node"))
}

#[neon::main]
fn main(mut cx: ModuleContext) -> NeonResult<()> {
cx.export_function("hello", hello)?;
Ok(())
}
27 changes: 27 additions & 0 deletions create-neon/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6",
"es7"
],
"allowJs": false,

"sourceMap": false,
"outDir": "dist",

"esModuleInterop": true,
"strict": true,
"noImplicitReturns": true,
"allowUnreachableCode": false,
"noUnusedLocals": true,
"noUnusedParameters": true
},
"include": [
"src/**/*"
],
"exclude": [
"node_modules"
]
}

0 comments on commit 02825de

Please sign in to comment.