Best JavaScript code snippet using best
config.js
Source:config.js
1/*2 * Copyright (c) 2019, salesforce.com, inc.3 * All rights reserved.4 * SPDX-License-Identifier: MIT5 * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT6 */7const fs = require('fs');8const path = require('path');9const SITE_CONFIG = require('../config');10const SRC_DIR = path.resolve(__dirname, '../src/client');11const DIST_DIR = path.resolve(__dirname, '../dist');12const DOCS_DIR = path.resolve(__dirname, '../content/docs');13const TUTORIAL_DIR = path.resolve(__dirname, '../content/tutorial');14const COMMUNITY_DIR = path.resolve(__dirname, '../content/community');15const BLOG_DIR = path.resolve(__dirname, '../content/blog');16const PAGE_STYLESHEETS_PROD_DIR = path.join(DIST_DIR, '/assets/css/prod');17const PAGE_STYLESHEETS = [18 '/assets/css/normalize.css',19 '/assets/css/main.css',20 '/assets/css/docs.css',21 '/assets/css/blog.css',22 '/assets/css/prismjs/themes/prism.css',23];24const __ENV__ = process.env.NODE_ENV || 'development';25const __PROD__ = __ENV__ === 'production';26const LWC_COMPILER_CONFIG = {27 exclude: ['**/codeMirror/**'],28 resolveFromPackages: false,29 stylesheetConfig: {30 customProperties: {31 allowDefinition: true,32 },33 },34};35const LWC_VERSION = '100';36const LWC_ENGINE_PATH = require.resolve('@lwc/engine/dist/umd/es2017/engine');37const DOCS_LIST = SITE_CONFIG.docs.pages;38function getStyleSheets() {39 if (__PROD__) {40 if (fs.existsSync(PAGE_STYLESHEETS_PROD_DIR)) {41 return fs.readdirSync(PAGE_STYLESHEETS_PROD_DIR).map((f) => path.join('/assets/css/prod', f));42 } else {43 return [];44 }45 } else {46 return PAGE_STYLESHEETS;47 }48}49module.exports = {50 SRC_DIR,51 DIST_DIR,52 DOCS_DIR,53 BLOG_DIR,54 TUTORIAL_DIR,55 COMMUNITY_DIR,56 __ENV__,57 __PROD__,58 LWC_COMPILER_CONFIG,59 LWC_ENGINE_PATH,60 LWC_VERSION,61 DOCS_LIST,62 PAGE_STYLESHEETS,63 PAGE_STYLESHEETS_PROD_DIR,64 getStyleSheets,...
build-assets.js
Source:build-assets.js
1/*2 * Copyright (c) 2019, salesforce.com, inc.3 * All rights reserved.4 * SPDX-License-Identifier: MIT5 * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT6 */7const fs = require('fs');8const path = require('path');9const cpy = require('cpy');10const mkdirp = require('mkdirp');11const crypto = require('crypto');12const {13 SRC_DIR,14 DIST_DIR,15 LWC_ENGINE_PATH,16 PAGE_STYLESHEETS,17 PAGE_STYLESHEETS_PROD_DIR,18 LWC_VERSION,19} = require('./config');20const ENGINE_FILE = `engine_v${LWC_VERSION}.js`;21function buildAndCompileStyles(dist) {22 const bundleSrc = PAGE_STYLESHEETS.reduce((str, stylesheetPath) => {23 const abs = path.join(dist, stylesheetPath);24 return (str += fs.readFileSync(abs, 'utf-8'));25 }, '');26 const hash = crypto.createHash('md5').update(bundleSrc).digest('hex');27 mkdirp.sync(PAGE_STYLESHEETS_PROD_DIR);28 fs.writeFileSync(path.join(PAGE_STYLESHEETS_PROD_DIR, `bundle.${hash}.css`), bundleSrc, 'utf-8');29}30module.exports = async function () {31 // Copy all assets32 await cpy(['**', '!images/favicon.ico'], path.join(DIST_DIR, 'assets'), {33 cwd: path.resolve(SRC_DIR, 'assets'),34 parents: true,35 });36 // Copy the `favicon.ico` in the root37 await cpy(path.resolve(SRC_DIR, 'assets/images/favicon.ico'), DIST_DIR);38 // Compile styles39 await buildAndCompileStyles(DIST_DIR);40 // Copy engine41 fs.copyFileSync(LWC_ENGINE_PATH, path.join(DIST_DIR, `assets/js/lwc/${ENGINE_FILE}`));...
Using AI Code Generation
1require('stylesheets');2var test = require('test');3var test2 = require('test2');4var test3 = require('test3');5var test4 = require('test4');6var test5 = require('test5');7var test6 = require('test6');8var test7 = require('test7');9var test8 = require('test8');10var test9 = require('test9');11var test10 = require('test10');12var test11 = require('test11');13var test12 = require('test12');14var test13 = require('test13');15var test14 = require('test14');16var test15 = require('test15');17var test16 = require('test16');18var test17 = require('test17');19var test18 = require('test18');20var test19 = require('test19');21var test20 = require('test20');22var test21 = require('test21');23var test22 = require('test22');24var test23 = require('test23');25var test24 = require('test24');26var test25 = require('test25');27var test26 = require('test26');28var test27 = require('test27');29var test28 = require('test28');30var test29 = require('test29');31var test30 = require('test30');32var test31 = require('test31');33var test32 = require('test32');34var test33 = require('test33');35var test34 = require('test34');36var test35 = require('test35');37var test36 = require('test36');38var test37 = require('test37');39var test38 = require('test38');40var test39 = require('test39');41var test40 = require('test40');42var test41 = require('test41');43var test42 = require('test42');44var test43 = require('test43');45var test44 = require('test44');46var test45 = require('test45');47var test46 = require('test46');48var test47 = require('test47');49var test48 = require('test48');50var test49 = require('test49');51var test50 = require('test50');52var test51 = require('test51');53var test52 = require('test52');54var test53 = require('test53');55var test54 = require('test54');56var test55 = require('test55
Using AI Code Generation
1var PAGE_STYLESHEETS_PROD_DIR = require('best-practices').PAGE_STYLESHEETS_PROD_DIR;2var pageStylesheetsProdDir = PAGE_STYLESHEETS_PROD_DIR();3var pageStylesheetsProdDir = PAGE_STYLESHEETS_PROD_DIR('page-stylesheets');4var globalVar = 'global variable';5function myFunction() {6}7function myFunction() {8 var globalVar = 'global variable';9}10function myFunction() {11}12var myFunction = function() {13}14var myObject = {15 myMethod: function() {16 }17};18var myObject = function() {19 var myProperty = 'my property';20 var myMethod = function() {21 };22 return {23 };24};25var myArray = ['item1', 'item2', 'item3'];26var myArray = function() {27 var myArray = ['item1', 'item2', 'item3'];28 return myArray;29};
Using AI Code Generation
1var pageStylesheetsDir = require('dw/util/PageStylesheets').PAGE_STYLESHEETS_PROD_DIR;2var myStylesheet = pageStylesheetsDir + 'myStylesheet.css';3var PageStylesheets = require('dw/util/PageStylesheets');4var myStylesheet = PageStylesheets.PAGE_STYLESHEETS_PROD_DIR + 'myStylesheet.css';5var PageStylesheets = require('dw/util/PageStylesheets');6var myStylesheet = PageStylesheets.PAGE_STYLESHEETS_PROD_DIR + 'myStylesheet.css';7var PageStylesheets = require('dw/util/PageStylesheets');8var myStylesheet = PageStylesheets.PAGE_STYLESHEETS_PROD_DIR + 'myStylesheet.css';9var PageStylesheets = require('dw/util/PageStylesheets');10var myStylesheet = PageStylesheets.PAGE_STYLESHEETS_PROD_DIR + 'myStylesheet.css';11var PageStylesheets = require('dw/util/PageStylesheets');12var myStylesheet = PageStylesheets.PAGE_STYLESHEETS_PROD_DIR + 'myStylesheet.css';13var PageStylesheets = require('dw/util/PageStylesheets');14var myStylesheet = PageStylesheets.PAGE_STYLESHEETS_PROD_DIR + 'myStylesheet.css';15var PageStylesheets = require('dw/util/PageStylesheets');16var myStylesheet = PageStylesheets.PAGE_STYLESHEETS_PROD_DIR + 'myStylesheet.css';17var PageStylesheets = require('dw/util/PageStylesheets');
Using AI Code Generation
1if (dojo.config.isDebug) {2 dojo.require("dojo.parser");3 dojo.require("dijit.layout.BorderContainer");4 dojo.require("dijit.layout.ContentPane");5 dojo.require("dijit.layout.TabContainer");6 dojo.require("dijit.layout.AccordionContainer");7 dojo.require("dijit.layout.AccordionPane");8 dojo.require("dijit.layout.SplitContainer");9 dojo.require("dijit.layout.StackContainer");10 dojo.require("dijit.layout.StackController");11 dojo.require("dijit.layout.LinkPane");12 dojo.require("dijit.layout.TabController");13 dojo.require("dijit.form.Button");14 dojo.require("dijit.form.CheckBox");15 dojo.require("dijit.form.ComboBox");16 dojo.require("dijit.form.CurrencyTextBox");17 dojo.require("dijit.form.DateTextBox");18 dojo.require("dijit.form.DropDownButton");19 dojo.require("dijit.form.FilteringSelect");20 dojo.require("dijit.form.Form");21 dojo.require("dijit.form.NumberSpinner");22 dojo.require("dijit.form.NumberTextBox");23 dojo.require("dijit.form.RadioButton");24 dojo.require("dijit.form.Select");25 dojo.require("dijit.form.SimpleTextarea");26 dojo.require("dijit.form.Slider");27 dojo.require("dijit.form.TextBox");28 dojo.require("dijit.form.TimeTextBox");29 dojo.require("dijit.form.ToggleButton");30 dojo.require("dijit.form.ValidationTextBox");31 dojo.require("dijit.Menu");32 dojo.require("dijit.MenuBar");33 dojo.require("dijit.MenuBarItem");34 dojo.require("dijit.MenuItem");35 dojo.require("dijit.PopupMenuItem");36 dojo.require("dijit.ProgressBar");37 dojo.require("dijit.Tooltip");38 dojo.require("dijit.Tree");39 dojo.require("dijit.Tree.dndSource");40 dojo.require("dijit.Dialog");41 dojo.require("dijit.Editor");42 dojo.require("dijit.InlineEditBox");43 dojo.require("dijit.TitlePane");44 dojo.require("dijit.Toolbar");45 dojo.require("dijit.ToolbarSeparator");
Using AI Code Generation
1var pageStylesheetsDir = require('dw/web/Resource').PAGE_STYLESHEETS_PROD_DIR;2var pageStylesheetsDir = pageStylesheetsDir + 'myPage.css';3var pageStylesheetsDir = pageStylesheetsDir + 'myPage2.css';4var pageStylesheetsDir = pageStylesheetsDir + 'myPage3.css';5var pageStylesheetsDir = require('dw/web/Resource').PAGE_STYLESHEETS_DEV_DIR;6var pageStylesheetsDir = pageStylesheetsDir + 'myPage.css';7var pageStylesheetsDir = pageStylesheetsDir + 'myPage2.css';8var pageStylesheetsDir = pageStylesheetsDir + 'myPage3.css';
Using AI Code Generation
1import { PAGE_STYLESHEETS_PROD_DIR } from '../../config/constants'2import { PAGE_STYLESHEETS_DEV_DIR } from '../../config/constants'3import { PAGE_STYLESHEETS_TEST_DIR } from '../../config/constants'4import { PAGE_STYLESHEETS_STAGING_DIR } from '../../config/constants'5import { PAGE_STYLESHEETS_DEVELOPMENT_DIR } from '../../config/constants'6import { PAGE_STYLESHEETS_LOCAL_DIR } from '../../config/constants'7import { PAGE_STYLESHEETS_QA_DIR } from '../../config/constants'
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!