How to use the @microsoft/sp-build-web.error function in @microsoft/sp-build-web

To help you get started, we’ve selected a few @microsoft/sp-build-web examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SharePoint / sp-dev-fx-webparts / samples / react-app-settings / src / appSettingsGulp.js View on Github external
// remove some strings, prue string manipulation.
                    var text = data.substring(data.indexOf("{") + 1, data.indexOf("}")).replace(/ /g,"").replace(/(?:\r\n|\r|\n)/g, "").trim();

                    // fill the appSettingsTsKeys array with the appSettings.d.ts keys.
                    getappSettingsTsKeys(text, appSettingsTsKeys);

                    // now we have two arrays with keys to compare.

                    // checks the appSettings.json for missing keys.
                    var l = appSettingsTsKeys.length;
                    while(l--) {

                        if(appSettingsJsKeys.indexOf(appSettingsTsKeys[l]) === -1)
                        {
                            build.error(`Key \"${appSettingsTsKeys[l]}\" not found in appSettings.json, but exists in appSettings.d.ts. Please fix your appSettings.`);
                            return reject();
                        }
                    }

                    // checks the appSettings.d.ts for missing keys.
                    l = appSettingsJsKeys.length;
                    while(l--) {

                        if(appSettingsTsKeys.indexOf(appSettingsJsKeys[l]) === -1)
                        {
                            build.error(`Key \"${appSettingsJsKeys[l]}\" not found in appSettings.d.ts, but exists in appSettings.json. Please fix your appSettings.`);
                            return reject();
                        }
                    }

                    return resolve();