avo 3.1.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +49 -4
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -776,6 +776,7 @@ function codegen(json, { schema, sources: targets, warnings, success, errors })
|
|
|
776
776
|
name: target.name,
|
|
777
777
|
id: target.id,
|
|
778
778
|
path: source.path,
|
|
779
|
+
interfacePath: source.interfacePath,
|
|
779
780
|
branchId: target.branchId,
|
|
780
781
|
updatedAt: target.updatedAt,
|
|
781
782
|
};
|
|
@@ -890,18 +891,61 @@ function selectSource(sourceToAdd, json) {
|
|
|
890
891
|
},
|
|
891
892
|
});
|
|
892
893
|
}
|
|
893
|
-
return inquirer.prompt(prompts).then((answer) => {
|
|
894
|
-
|
|
894
|
+
return inquirer.prompt(prompts).then(async (answer) => {
|
|
895
|
+
let answerSource;
|
|
896
|
+
if (sourceToAdd) {
|
|
897
|
+
answerSource = sources.find((soruceToFind) => matchesSource(soruceToFind, sourceToAdd));
|
|
898
|
+
}
|
|
899
|
+
else {
|
|
900
|
+
answerSource = answer.source;
|
|
901
|
+
}
|
|
902
|
+
const moreAnswers = await inquirer.prompt(answerSource.canHaveInterfaceFile === true
|
|
903
|
+
? [
|
|
904
|
+
{
|
|
905
|
+
type: 'fuzzypath',
|
|
906
|
+
name: 'folder',
|
|
907
|
+
excludePath: (maybeExcludePath) => maybeExcludePath.startsWith('node_modules') ||
|
|
908
|
+
maybeExcludePath.startsWith('.git'),
|
|
909
|
+
itemType: 'directory',
|
|
910
|
+
rootPath: '.',
|
|
911
|
+
message: 'Select a folder to save the analytics wrapper interface file in',
|
|
912
|
+
default: '.',
|
|
913
|
+
suggestOnly: false,
|
|
914
|
+
depthLimit: 10,
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
type: 'input',
|
|
918
|
+
name: 'interfaceFilename',
|
|
919
|
+
message: (_answers) => 'Select a filename for the analytics wrapper interface file',
|
|
920
|
+
// @ts-ignore
|
|
921
|
+
default() {
|
|
922
|
+
return answerSource.filenameHint;
|
|
923
|
+
},
|
|
924
|
+
},
|
|
925
|
+
]
|
|
926
|
+
: []);
|
|
927
|
+
const hasMultiPath = moreAnswers.interfaceFilename != null;
|
|
928
|
+
const relativeMainPath = path.relative(process.cwd(), path.join(path.resolve(answer.folder), answer.filename));
|
|
929
|
+
let relativeInterfacePath = relativeMainPath;
|
|
930
|
+
if (hasMultiPath) {
|
|
931
|
+
relativeInterfacePath = path.relative(process.cwd(), path.join(path.resolve(answer.folder), moreAnswers.interfaceFilename));
|
|
932
|
+
}
|
|
895
933
|
let source;
|
|
896
934
|
if (sourceToAdd) {
|
|
897
935
|
source = sources.find((sourceToFind) => matchesSource(sourceToFind, sourceToAdd));
|
|
898
|
-
source = {
|
|
936
|
+
source = {
|
|
937
|
+
id: source.id,
|
|
938
|
+
name: source.name,
|
|
939
|
+
path: relativeMainPath,
|
|
940
|
+
interfacePath: relativeInterfacePath,
|
|
941
|
+
};
|
|
899
942
|
}
|
|
900
943
|
else {
|
|
901
944
|
source = {
|
|
902
945
|
id: answer.source.id,
|
|
903
946
|
name: answer.source.name,
|
|
904
|
-
path:
|
|
947
|
+
path: relativeMainPath,
|
|
948
|
+
interfacePath: relativeInterfacePath,
|
|
905
949
|
};
|
|
906
950
|
}
|
|
907
951
|
sources = (json.sources ?? []).concat([source]);
|
|
@@ -934,6 +978,7 @@ function pull(sourceFilter, json) {
|
|
|
934
978
|
sources: sources.map((source) => ({
|
|
935
979
|
id: source.id,
|
|
936
980
|
path: source.path,
|
|
981
|
+
interfacePath: source.interfacePath,
|
|
937
982
|
})),
|
|
938
983
|
force: json.force ?? false,
|
|
939
984
|
forceFeatures: json.forceFeatures,
|