@@ -2,10 +2,8 @@ const c = require('ansi-colors')
22const Blueprint = require ( '../blueprint' )
33const validator = require ( '../util/validators' )
44const ask = require ( '../util/ask' )
5- const selectInternalModel = require ( '../util/select-model' )
5+ const selectModel = require ( '../util/select-model' )
66const chooseFilename = require ( '../util/choose-filename' )
7- const path = require ( 'path' )
8- const fs = require ( 'fs-extra' )
97const _ = require ( 'lodash' )
108
119async function addEditable ( options ) {
@@ -31,28 +29,6 @@ async function addEditable (options) {
3129 await scaffold . commit ( )
3230} // addEditable
3331
34- async function selectModel ( blueprint , modelPath ) {
35- const model = modelPath ? loadExternalModel ( modelPath ) : await selectInternalModel ( blueprint )
36-
37- return model
38- } // selectInternalModel
39-
40- function loadExternalModel ( modelPath ) {
41- if ( ! fs . pathExistsSync ( modelPath ) ) {
42- console . log ( c . bold . red ( `Can not find model at ${ c . cyan ( modelPath ) } ` ) )
43- }
44-
45- const name = path . basename ( modelPath , path . extname ( modelPath ) )
46- const schema = fs . readJsonSync ( modelPath )
47- const fields = Object . keys ( schema . properties )
48- console . log ( c . bold ( `Loading external model ${ c . cyan ( name ) } ` ) )
49- return {
50- name,
51- schema,
52- fields
53- }
54- } // loadExternalModel
55-
5632async function selectFields ( modelName , propertyNames , properties ) {
5733 console . log ( )
5834 const allProperties = await ask ( {
0 commit comments