Skip to content

Commit

Permalink
change noun to planningArea
Browse files Browse the repository at this point in the history
  • Loading branch information
twelch committed Feb 23, 2023
1 parent 3ff6da4 commit 7b96e9f
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions packages/base-project/project/basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
13.4454329253893
],
"planningAreaType": "eez",
"noun": "Micronesia",
"nounPossessive": "Micronesian",
"planningAreaName": "Micronesia",
"planningAreaPossessive": "Micronesian",
"externalLinks": {}
}
4 changes: 2 additions & 2 deletions packages/geoprocessing/scripts/init/createFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async function createFunction() {
answers.type === "preprocessing" && basic.planningAreaType === "eez",
type: "list",
name: "clipToEez",
message: `Should this clip sketches to the ${basic.noun} EEZ boundary?`,
message: `Should this clip sketches to the ${basic.planningAreaName} EEZ boundary?`,
default: "yes",
choices: [
{
Expand Down Expand Up @@ -85,7 +85,7 @@ async function createFunction() {
]);
answers.title = camelcase(answers.title);
if (answers.type === "preprocessing" && answers.clipToEez === "yes") {
answers.eez = basic.noun;
answers.eez = basic.planningAreaName;
}

if (answers.type === "geoprocessing") {
Expand Down
16 changes: 8 additions & 8 deletions packages/geoprocessing/scripts/init/createProject.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ it("should create empty project", async () => {
bboxMinLat: 0,
bboxMaxLng: 0,
bboxMinLng: 0,
noun: "Samoa",
nounPossessive: "Samoan",
planningAreaName: "Samoa",
planningAreaPossessive: "Samoan",
},
false,
rootPath
Expand Down Expand Up @@ -75,8 +75,8 @@ it("should create project using eez selection", async () => {
region: "us-west-1",
templates: [],
planningAreaType: "eez",
noun: "Micronesia",
nounPossessive: "Micronesian",
planningAreaName: "Micronesia",
planningAreaPossessive: "Micronesian",
},
false,
rootPath
Expand Down Expand Up @@ -111,8 +111,8 @@ it("should create project with template with preprocessor", async () => {
bboxMinLat: 0,
bboxMaxLng: 0,
bboxMinLng: 0,
noun: "Samoa",
nounPossessive: "Samoan",
planningAreaName: "Samoa",
planningAreaPossessive: "Samoan",
},
false,
rootPath
Expand Down Expand Up @@ -146,8 +146,8 @@ it("should create project with template with 1 of each", async () => {
bboxMinLat: 0,
bboxMaxLng: 0,
bboxMinLng: 0,
noun: "Samoa",
nounPossessive: "Samoan",
planningAreaName: "Samoa",
planningAreaPossessive: "Samoan",
},
false,
rootPath
Expand Down
10 changes: 5 additions & 5 deletions packages/geoprocessing/scripts/init/createProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export interface CreateProjectMetadata extends TemplateMetadata {
bboxMaxLng?: number;
bboxMinLat?: number;
bboxMaxLat?: number;
noun: string;
nounPossessive: string;
planningAreaName: string;
planningAreaPossessive: string;
}

/** Create project at basePath. If should be created non-interactively then set interactive = false and provide all project creation metadata, otherwise will prompt for answers */
Expand Down Expand Up @@ -165,7 +165,7 @@ export async function createProject(
// Either lookup bbox of planning area by name or construct from user-provided
const bbox: BBox = await (async () => {
if (metadata.planningAreaType && metadata.planningAreaType === "eez") {
const bbox = await getEezCountryBbox(metadata.noun);
const bbox = await getEezCountryBbox(metadata.planningAreaName);
if (!bbox)
throw new Error(`Bounding box not for EEZ named ${metadata.name}`);
return bbox;
Expand All @@ -191,8 +191,8 @@ export async function createProject(
...basic,
bbox,
planningAreaType: metadata.planningAreaType,
noun: metadata.noun,
nounPossessive: metadata.nounPossessive,
planningAreaName: metadata.planningAreaName,
planningAreaPossessive: metadata.planningAreaPossessive,
});

await fs.writeJSONSync(`${projectPath}/project/basic.json`, validBasic, {
Expand Down
8 changes: 4 additions & 4 deletions packages/geoprocessing/scripts/init/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,22 +127,22 @@ async function init(gpVersion?: string) {
{
when: (answers) => answers.planningAreaType === "eez",
type: "list",
name: "noun",
name: "planningAreaName",
message: "What countries EEZ is this for?",
choices: countryChoices,
},
{
when: (answers) => answers.planningAreaType === "other",
type: "input",
name: "noun",
name: "planningAreaName",
message:
"What is the name of the country/site/planning area? (e.g. Samoa)",
},
{
type: "input",
name: "nounPossessive",
name: "planningAreaPossessive",
message: (answers) =>
`Your planning area name is ${answers.noun}. Is there a possessive name for this place? (e.g. possessive form of Samoa is Samoan) Leave blank if not`,
`Your planning area name is ${answers.planningAreaName}. Is there a possessive name for this place? (e.g. possessive form of Samoa is Samoan) Leave blank if not`,
},
{
when: (answers) => answers.planningAreaType === "other",
Expand Down
4 changes: 2 additions & 2 deletions packages/geoprocessing/src/testing/fixtures/projectConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { ProjectClientConfig } from "../../project";
const basicConfig: ProjectClientConfig = {
basic: {
bbox: [0, 0, 1, 1],
noun: "undefined",
nounPossessive: "undefined",
planningAreaName: "undefined",
planningAreaPossessive: "undefined",
planningAreaType: "eez",
externalLinks: {},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/geoprocessing/src/testing/project/basic.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"bbox": [ 0, 0, 0, 0 ],
"planningAreaType": "eez",
"noun": "undefined",
"nounPossessive": "undefined",
"planningAreaName": "undefined",
"planningAreaPossessive": "undefined",
"externalLinks": {}
}
4 changes: 2 additions & 2 deletions packages/geoprocessing/src/types/projectBasic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export const planningAreaTypesSchema = z.enum(PLANNING_AREA_TYPES);
export const projectSchema = z.object({
bbox: bboxSchema,
planningAreaType: planningAreaTypesSchema,
noun: z.string(),
nounPossessive: z.string(),
planningAreaName: z.string(),
planningAreaPossessive: z.string(),
externalLinks: z.record(z.string()),
});

Expand Down

0 comments on commit 7b96e9f

Please sign in to comment.