@architect/create
Advanced tools
Comparing version 1.3.1 to 1.3.2-RC.0
@@ -5,2 +5,15 @@ # Architect Create changelog | ||
## [1.3.2] 2020-12-02 | ||
### Added | ||
- Add support for custom templates in paths outside the project directory (e.g. `~/tmpl/http.js`, `../../tmpl/http.js`) | ||
### Fixed | ||
- Fixed potential for empty files to be written to disk during initialization should a template not be found | ||
--- | ||
## [1.3.1] 2020-11-30 | ||
@@ -7,0 +20,0 @@ |
{ | ||
"name": "@architect/create", | ||
"version": "1.3.1", | ||
"version": "1.3.2-RC.0", | ||
"description": "Idempotently initialize Architect projects", | ||
@@ -28,3 +28,4 @@ "main": "src/index.js", | ||
"chalk": "~4.1.0", | ||
"run-parallel": "~1.1.10" | ||
"run-parallel": "~1.1.10", | ||
"run-series": "~1.1.9" | ||
}, | ||
@@ -31,0 +32,0 @@ "devDependencies": { |
let { existsSync, mkdirSync } = require('fs') | ||
let { join } = require('path') | ||
let parallel = require('run-parallel') | ||
let series = require('run-series') | ||
let getExtension = require('./get-extension') | ||
@@ -27,10 +27,4 @@ let writeArcConfig = require('./write-arc-config') | ||
parallel({ | ||
config (callback) { | ||
writeArcConfig({ | ||
configPath: join(src, `config.arc`), | ||
runtime | ||
}, callback) | ||
}, | ||
code (callback) { | ||
series([ | ||
function code (callback) { | ||
let templates = prefs && prefs.create && prefs.create.templates | ||
@@ -51,4 +45,10 @@ let template = templates && templates[type] | ||
} | ||
} | ||
}, function done (err) { | ||
}, | ||
function config (callback) { | ||
writeArcConfig({ | ||
configPath: join(src, `config.arc`), | ||
runtime | ||
}, callback) | ||
}, | ||
], function done (err) { | ||
if (err) callback(err) | ||
@@ -55,0 +55,0 @@ else callback(null, src) |
let { existsSync, readFileSync, writeFile } = require('fs') | ||
let { join, resolve } = require('path') | ||
let { homedir } = require('os') | ||
module.exports = function writeTemplate ({ handlerFile, template }, callback) { | ||
if (!existsSync(template)) { | ||
let path = template[0] === '~' ? join(homedir(), template.substr(1)) : resolve(template) | ||
if (!existsSync(path)) { | ||
throw Error(`Custom function template not found: ${template}`) | ||
} | ||
let body = readFileSync(template).toString() | ||
let body = readFileSync(path).toString() | ||
writeFile(handlerFile, body, callback) | ||
} |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
50536
849
5
2
+ Addedrun-series@~1.1.9