-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
295 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
console.log("INFO: Adding the required localized resource configuration to the config.json file."); | ||
|
||
// Get the current directory | ||
const crntDir = path.resolve(__dirname); | ||
// Split the whole directory path | ||
let nesting = crntDir.split("/"); | ||
// Windows split | ||
if (nesting.length <= 1) { | ||
nesting = crntDir.split("\\"); | ||
} | ||
// Check if correctly splitted | ||
if (nesting.length > 0) { | ||
// Find the first node_modules folder index | ||
let idx = nesting.indexOf("node_modules"); | ||
// Check if index of the folder was found | ||
if (idx !== -1) { | ||
// Slice unnecessary nodes | ||
const nest = nesting.slice(idx); | ||
if (nest && nest.length > 0) { | ||
const paths = nest.map(m => ".."); | ||
// Get the path of the projects root location | ||
const rootDir = path.resolve(path.join(__dirname, paths.join('/'))); | ||
const fileLoc = `${rootDir}/config/config.json`; | ||
// Check if config.json file exists | ||
if (fs.existsSync(fileLoc)) { | ||
// Get the config file | ||
const config = fs.readFileSync(fileLoc, "utf8"); | ||
if (config && typeof config === "string") { | ||
const contents = JSON.parse(config); | ||
if (contents && contents.localizedResources && !contents.localizedResources.PropertyControlStrings) { | ||
contents.localizedResources["PropertyControlStrings"] = "node_modules/@pnp/spfx-property-controls/lib/loc/{locale}.js"; | ||
// Update the file | ||
fs.writeFileSync(fileLoc, JSON.stringify(contents, null, 2)); | ||
console.log("INFO: Localized resource added."); | ||
} else { | ||
console.warn(`WARNING: it seems something is wrong with the config.json file or the "PropertyControlStrings" reference was already set.`); | ||
} | ||
} else { | ||
console.warn("WARNING: the config.json file was not correctly retrieved."); | ||
} | ||
} else { | ||
console.warn("WARNING: the config.json file does not exist."); | ||
} | ||
} else { | ||
console.warn("WARNING: something is wrong with the installation path."); | ||
} | ||
} else { | ||
console.warn("WARNING: something when wrong during with retrieving the project its root location."); | ||
} | ||
} else { | ||
console.warn("WARNING: something is wrong with the installation path."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface FieldValidator { | ||
[property: string]: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,5 +27,7 @@ export enum CustomCollectionFieldType { | |
string = 1, | ||
number, | ||
boolean, | ||
dropdown | ||
dropdown, | ||
fabricIcon, | ||
url | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.