Socket
Socket
Sign inDemoInstall

@pkgjs/create

Package Overview
Dependencies
52
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.2.0

23

index.js

@@ -74,4 +74,20 @@ 'use strict'

async function initOptions (overrides) {
const _opts = Object.assign({}, options, overrides)
async function initOptions (defaultOverrides = {}, inputOverrides = {}) {
// Override input
const _input = Object.assign({}, input, inputOverrides)
// Merge together overrides
await Promise.all(
(opts.uses || []).map(async (gen) => {
if (typeof gen.initOptions === 'function') {
defaultOverrides = Object.assign({}, await gen.initOptions(_input), defaultOverrides)
}
})
)
if (typeof opts.initOptions === 'function') {
defaultOverrides = Object.assign({}, await opts.initOptions(_input), defaultOverrides)
}
// Merge overrides and options last
const _opts = Object.assign({}, options, defaultOverrides)
if (_opts.prompt === false) {

@@ -105,3 +121,3 @@ return _opts

default: _opts[key],
when: typeof input[key] === 'undefined' && !!(o.advanced ? _opts.advanced : true)
when: typeof _input[key] === 'undefined' && !!(o.advanced ? _opts.advanced : true)
}

@@ -130,2 +146,3 @@

run.options = allOptions
run.initOptions = opts.initOptions

@@ -132,0 +149,0 @@ run.cli = (argv) => {

2

package.json
{
"name": "@pkgjs/create",
"version": "0.1.0",
"version": "0.2.0",
"description": "",

@@ -5,0 +5,0 @@ "author": "Wes Todd <wes@wesleytodd.com>",

@@ -70,6 +70,9 @@ 'use strict'

one: { type: 'number' }
},
initOptions: (input) => {
return { one: 'one' }
}
}, async (initOpts) => {
const o = await initOpts()
assert.strictEqual(o.one, 1)
assert.strictEqual(o.one, 'one')
assert.strictEqual(o.directory, TMP_DIR)

@@ -85,3 +88,3 @@ })

const o = await initOpts()
assert.strictEqual(o.one, 1)
assert.strictEqual(o.one, 'one')
assert.strictEqual(o.two, 2)

@@ -88,0 +91,0 @@ assert.strictEqual(o.directory, TMP_DIR)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc