Skip to content

Commit

Permalink
Merge pull request #1013 from neon-bindings/kv/remove-version-check
Browse files Browse the repository at this point in the history
create-neon 0.3: Create Neon 1.0 project with default feature flags
  • Loading branch information
kjvalencik authored Dec 8, 2023
2 parents 3936828 + 5ed5689 commit 09fce79
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 26 deletions.
6 changes: 1 addition & 5 deletions pkgs/create-neon/data/templates/Cargo.toml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,4 @@ crate-type = ["cdylib"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

[dependencies.neon]
version = "{{versions.neon}}"
default-features = false
features = ["napi-{{versions.napi}}"]
neon = "{{versions.neon}}"
3 changes: 1 addition & 2 deletions pkgs/create-neon/data/versions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"neon": "1.0.0",
"napi": "8",
"neon": "1",
"cargo-cp-artifact": "0.1"
}
2 changes: 1 addition & 1 deletion pkgs/create-neon/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-neon",
"version": "0.2.0",
"version": "0.3.0",
"description": "Create Neon projects with no build configuration.",
"author": "Dave Herman <david.herman@gmail.com>",
"license": "MIT",
Expand Down
19 changes: 2 additions & 17 deletions pkgs/create-neon/src/bin/create-neon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { promises as fs } from "fs";
import * as path from "path";
import die from "../die";
import Package from "../package";
import expand, { Versions } from "../expand";
import expand from "../expand";
import versions from "../../data/versions.json";

const TEMPLATES: Record<string, string> = {
Expand All @@ -14,21 +14,6 @@ const TEMPLATES: Record<string, string> = {
"lib.rs.hbs": path.join("src", "lib.rs"),
};

function inferVersions(): Versions {
// Select the N-API version associated with the current
// running Node process.
let inferred = process.versions.napi;

let napi = inferred
? Math.min(Number(versions.napi), Number(inferred))
: Number(versions.napi);

return {
neon: versions.neon,
napi: napi,
};
}

async function main(name: string) {
let tmpFolderName: string = "";

Expand Down Expand Up @@ -56,7 +41,7 @@ async function main(name: string) {
let target = path.join(tmpFolderName, TEMPLATES[source]);
await expand(source, target, {
package: pkg,
versions: inferVersions(),
versions,
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkgs/create-neon/src/expand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const TEMPLATES_DIR = path.join(__dirname, "..", "data", "templates");

export interface Versions {
neon: string;
napi: number;
"cargo-cp-artifact": string;
}

export interface Metadata {
Expand Down

0 comments on commit 09fce79

Please sign in to comment.