Skip to content

Commit

Permalink
fix(cli): new command without npm scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Brooooooklyn committed Feb 6, 2021
1 parent 237fda5 commit 5ef1887
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cli/src/new/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export class NewProjectCommand extends Command {
async execute() {
await this.getName()
if (!this.dirname) {
const [, defaultProjectDir] = this.name?.split('/') ?? []
const [scope, name] = this.name?.split('/') ?? []
const defaultProjectDir = name ?? scope
const dirAnswer = await prompt({
type: 'input',
name: DIR_PROMOTE_NAME,
Expand Down Expand Up @@ -118,7 +119,8 @@ export class NewProjectCommand extends Command {
mkdirSync(join(process.cwd(), this.dirname!, 'src'))
}

const [, binaryName] = this.name!.split('/')
const [s, pkgName] = this.name!.split('/')
const binaryName = pkgName ?? s

this.writeFile('Cargo.toml', createCargoContent(this.name!))
this.writeFile('.npmignore', NPMIgnoreFiles)
Expand Down

1 comment on commit 5ef1887

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 5ef1887 Previous: 237fda5 Ratio
noop#napi-rs 47522791 ops/sec (±1.76%) 48574749 ops/sec (±0.53%) 1.02
noop#JavaScript 705843736 ops/sec (±1.12%) 615155273 ops/sec (±0.58%) 0.87
Plus number#napi-rs 11458010 ops/sec (±1.32%) 14078736 ops/sec (±0.65%) 1.23
Plus number#JavaScript 712483917 ops/sec (±0.93%) 614212015 ops/sec (±0.65%) 0.86
Create buffer#napi-rs 67745 ops/sec (±35.56%) 68340 ops/sec (±24.25%) 1.01
Create buffer#JavaScript 64511 ops/sec (±61.93%) 39057 ops/sec (±78.91%) 0.61
Get Set property#Get Set from native#u32 418578 ops/sec (±3.4%) 408772 ops/sec (±3.11%) 0.98
Get Set property#Get Set from JavaScript#u32 299405 ops/sec (±32.24%) 362188 ops/sec (±2.96%) 1.21
Get Set property#Get Set from native#string 329692 ops/sec (±17.04%) 370279 ops/sec (±2.8%) 1.12
Get Set property#Get Set from JavaScript#string 339921 ops/sec (±3.18%) 329655 ops/sec (±3.25%) 0.97
Async task#spawn task 30936 ops/sec (±2.89%) 30558 ops/sec (±2.1%) 0.99
Async task#thread safe function 10389 ops/sec (±8.17%) 12789 ops/sec (±9.51%) 1.23

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.