Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@architect/create

Package Overview
Dependencies
Maintainers
7
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@architect/create - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3-RC.1

33

cli.js

@@ -21,8 +21,19 @@ #!/usr/bin/env node

async function cmd(opts=[], {folder, install}) {
let options = {
verbose: opts.some(isVerbose),
runtime: opts.some(isRuntime) ? opts.slice(opts.findIndex(isRuntime))[1] : false
async function cmd () {
// Print banner
banner({version})
// Used by bootstrap to differentiate between arc create and preflight bootstrap calls
let standalone = true
let options = process.argv
// Bootstrap the project on the filesystem, including new dirs, npm i, etc.
let {folder, install} = await bootstrap({options, standalone, update})
// Populate basic project files
let opts = {
verbose: options.some(isVerbose),
runtime: options.some(isRuntime) ? options.slice(options.findIndex(isRuntime))[1] : false
}
return create({options, folder, update, install})
return create({options: opts, folder, install, standalone, update})
}

@@ -34,13 +45,5 @@

if (require.main === module) {
(async function() {
(async function () {
try {
let options = process.argv
let standalone = true
// Three steps
// 1. Bootstrap the env via bannerprint
banner({version})
// 2. Bootstrap the project on the filesystem, including new dirs, npm i, etc.
let {folder, install} = await bootstrap({options, standalone, update})
// 3. Populate basic project files
await cmd(options, {folder, install})
await cmd()
}

@@ -47,0 +50,0 @@ catch (err) {

{
"name": "@architect/create",
"version": "0.0.2",
"version": "0.0.3-RC.1",
"description": "Idempotently initialize Architect projects",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -11,7 +11,7 @@ let {join} = require('path')

*/
module.exports = function arcPackage({options, name, folder}) {
module.exports = function arcPackage ({options, name, folder}) {
// Don't install if invoked from a globally installed @arc/arc
let isGlobal = options[0] && options[0].includes('node') &&
options[1] && options[1].includes('arc') &&
options[2] && options[2] === 'create'
// || options[1].includes('arc-create')
if (!isGlobal) {

@@ -18,0 +18,0 @@ let package = {

let chalk = require('chalk')
let fs = require('fs')
let {join} = require('path')
let {chars} = require('@architect/utils')
module.exports = function printBanner({version=''}) {
module.exports = function printBanner ({version=''}) {
// Boilerplate
let log = (label, value) => console.log(chalk.grey(`${label.padStart(12)} ${chars.buzz}`), chalk.cyan(value))
let ver = `Architect Create ${version}`
// Try to use the Arc version instead of create
let arcPackage = join('..', '..', '..', 'architect', 'package.json')
if (fs.existsSync(arcPackage)) {
let pkg = JSON.parse(fs.readFileSync(arcPackage).toString())
ver = `Architect ${pkg.version}`
}
console.log() // Space
log('version', `Architect Create ${version}`)
log('version', ver)
log('cwd', process.cwd())
console.log() // Space
}
let {parse, resolve} = require('path')
module.exports = function getProjectName({options=[], update}) {
module.exports = function getProjectName ({options=[], update}) {
// Known options

@@ -9,3 +9,3 @@ let isVerbose = opt=> opt === 'verbose' || opt === '--verbose' || opt === '-v'

// Grab runtime value for filtering
let runtime = options.findIndex(isRuntime) + 1
let runtime = options.findIndex(isRuntime) === -1 ? null : options.findIndex(isRuntime) + 1
// Filter known options from arg list

@@ -17,3 +17,3 @@ let filtered = options.filter((opt,i) => {

})
let passedName = filtered[filtered.length-1]
let passedName = filtered[filtered.length-1] || ''

@@ -20,0 +20,0 @@ // Set up response

let path = require('path')
let exists = require('fs').existsSync
let mkdir = require('mkdirp').sync
let {updater} = require('@architect/utils')

@@ -17,3 +18,5 @@ let getName = require('./_get-name')

*/
module.exports = async function maybeCreate({options=[], update}) {
module.exports = async function maybeCreate ({options=[], standalone=false, update}) {
if (!update) update = updater('Create')
/**

@@ -34,3 +37,3 @@ * First, figure out where we're working, and what our project name is

`Project name: ${name}`,
`Working dir: ${folder}`
`Creating in: ${folder}`
)

@@ -44,3 +47,5 @@ mkdir(folder).sync

*/
let install = arcPackage({options, name, folder})
let install = false
if (standalone)
install = arcPackage({options, name, folder})

@@ -47,0 +52,0 @@ /**

@@ -1,2 +0,2 @@

let {readArc} = require('@architect/utils')
let {readArc, updater} = require('@architect/utils')
let parallel = require('run-parallel')

@@ -23,3 +23,5 @@ let code = require('./lambda')

*/
module.exports = function create({options={}, folder=process.cwd(), install, update}, callback) {
module.exports = function create (params, callback) {
let {options={}, folder=process.cwd(), install, standalone, update} = params
let promise

@@ -34,2 +36,3 @@ if (!callback) {

if (!update) update = updater('Create')
let {arc} = readArc({cwd: folder})

@@ -117,3 +120,3 @@

}
if (install) {
if (install && standalone) {
installArc({folder, update}, callback)

@@ -120,0 +123,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc