@architect/create
Advanced tools
Comparing version 1.3.0-RC.2 to 1.3.0-RC.3
@@ -10,2 +10,10 @@ # Architect Create changelog | ||
- Added support for custom file paths | ||
- Added support for custom default templates, thanks @Ankcorn! | ||
- Add per-pragma custom templates via the Arc preferences file, example: | ||
```arc | ||
# preferences.arc or prefs.arc | ||
@create | ||
templates | ||
http path/to/template/file | ||
``` | ||
@@ -12,0 +20,0 @@ |
{ | ||
"name": "@architect/create", | ||
"version": "1.3.0-RC.2", | ||
"version": "1.3.0-RC.3", | ||
"description": "Idempotently initialize Architect projects", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -44,2 +44,3 @@ let { updater } = require('@architect/utils') | ||
let { inv } = await inventory({ cwd: folder }) | ||
let prefs = inv._project.preferences | ||
let { http, events, queues, scheduled, static, streams, ws } = inv | ||
@@ -65,3 +66,3 @@ | ||
lambdae.forEach(type => { | ||
binder[type] = fn => code.bind({}, { ...fn, type, runtime }) | ||
binder[type] = fn => code.bind({}, { ...fn, type, runtime, prefs }) | ||
}) | ||
@@ -68,0 +69,0 @@ |
@@ -6,2 +6,3 @@ let { existsSync, mkdirSync } = require('fs') | ||
let writeArcConfig = require('./write-arc-config') | ||
let writeTemplate = require('./write-template') | ||
let writeCode = require('./write-code') | ||
@@ -17,3 +18,3 @@ | ||
module.exports = function code (params, callback) { | ||
let { arcStaticAssetProxy, src, type, runtime } = params | ||
let { arcStaticAssetProxy, src, type, runtime, prefs } = params | ||
@@ -36,7 +37,17 @@ // Immediate bail if source dir already exists | ||
code (callback) { | ||
writeCode({ | ||
type, | ||
runtime, | ||
handlerFile | ||
}, callback) | ||
let templates = prefs && prefs.create && prefs.create.templates | ||
let template = templates && templates[type] | ||
if (template) { | ||
writeTemplate({ | ||
template, | ||
handlerFile | ||
}, callback) | ||
} | ||
else { | ||
writeCode({ | ||
type, | ||
runtime, | ||
handlerFile | ||
}, callback) | ||
} | ||
} | ||
@@ -43,0 +54,0 @@ }, function done (err) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49488
28
837
11