diff --git a/samples/web-components/README.md b/samples/web-components/README.md index f55028e..69c0ff8 100644 --- a/samples/web-components/README.md +++ b/samples/web-components/README.md @@ -5,4 +5,5 @@ | 3 | Simple banner | custom-banner | ![Home](banner/showcase.png) | [View](https://github.com/SoftwareAG/webmethods-developer-portal/tree/main/samples/web-components/banner) | | 4 | Customized gallery | api-gallery-with-filter | ![Home](api-gallery-with-filter/showcase.png) | [View](https://github.com/SoftwareAG/webmethods-developer-portal/tree/main/samples/web-components/api-gallery-with-filter) | | 5 | Customized API box | api-gallery-box | ![Home](api-gallery-box/showcase.png) | [View](https://github.com/SoftwareAG/webmethods-developer-portal/tree/main/samples/web-components/api-gallery-box) | +| 6 | API box with i18n switch | api-gallery-i18ninfo | ![Home](api-gallery-i18n/sample.png) | [View](https://github.com/SoftwareAG/webmethods-developer-portal/tree/main/samples/web-components/api-gallery-i18n) | diff --git a/samples/web-components/api-gallery-i18n/.eslintrc.json b/samples/web-components/api-gallery-i18n/.eslintrc.json new file mode 100644 index 0000000..a3d140b --- /dev/null +++ b/samples/web-components/api-gallery-i18n/.eslintrc.json @@ -0,0 +1,33 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended" + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 12, + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/no-explicit-any": "off", + "linebreak-style": [ + "error", + "windows" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "always" + ] + } +} diff --git a/samples/web-components/api-gallery-i18n/.gitattributes b/samples/web-components/api-gallery-i18n/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/samples/web-components/api-gallery-i18n/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/samples/web-components/api-gallery-i18n/.gitignore b/samples/web-components/api-gallery-i18n/.gitignore new file mode 100644 index 0000000..c00d361 --- /dev/null +++ b/samples/web-components/api-gallery-i18n/.gitignore @@ -0,0 +1,82 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless + +# FuseBox cache +.fusebox/ + +.idea + +public/bundle.js + +package-lock.json diff --git a/samples/web-components/api-gallery-i18n/LICENSE b/samples/web-components/api-gallery-i18n/LICENSE new file mode 100644 index 0000000..632536e --- /dev/null +++ b/samples/web-components/api-gallery-i18n/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Nagarajan Sivaraman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/samples/web-components/api-gallery-i18n/README.md b/samples/web-components/api-gallery-i18n/README.md new file mode 100644 index 0000000..8ae79bb --- /dev/null +++ b/samples/web-components/api-gallery-i18n/README.md @@ -0,0 +1,26 @@ +# About Web Component Samples + + +### Development +This project uses `Typescript` and `Webpack` to create and build one or more web components to a single JavaScript file. + + +### Setup + +To download and install the packages run the install command
+`npm run install` + + +To import the web-component into the theme, it needs to be compiled to a single JavaScript file. +To build and generate the single JavaScript file, you need to run the build command.
+ `npm run build` + + +The required JavaScript file will be generated as `bundle.js` and would be available under the folder `public`. + +### Examples included + +`api-gallery-i18ninfo` + +This element renders an available localization for this API. On click of particular flag the corresponding locale data will be rendered. +This element need to be placed inside the API default box. diff --git a/samples/web-components/api-gallery-i18n/package.json b/samples/web-components/api-gallery-i18n/package.json new file mode 100644 index 0000000..b647cfe --- /dev/null +++ b/samples/web-components/api-gallery-i18n/package.json @@ -0,0 +1,35 @@ +{ + "name": "ts-web-components", + "version": "1.0.0", + "description": "Webcomponents using typscript + webpack", + "main": "index.js", + "scripts": { + "serve": "webpack serve", + "lint": "eslint", + "build": "webpack", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/school-coder/ts-web-components.git" + }, + "keywords": [ + "web-component" + ], + "author": "Nagarajan Sivaraman", + "license": "MIT", + "bugs": { + "url": "https://github.com/school-coder/ts-web-components/issues" + }, + "homepage": "https://github.com/school-coder/ts-web-components#readme", + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^4.25.0", + "@typescript-eslint/parser": "^4.25.0", + "eslint": "^7.27.0", + "ts-loader": "^9.2.2", + "typescript": "^4.2.4", + "webpack": "^5.37.1", + "webpack-cli": "^4.7.0", + "webpack-dev-server": "^4.7.4" + } +} diff --git a/samples/web-components/api-gallery-i18n/sample.png b/samples/web-components/api-gallery-i18n/sample.png new file mode 100644 index 0000000..8906fea Binary files /dev/null and b/samples/web-components/api-gallery-i18n/sample.png differ diff --git a/samples/web-components/api-gallery-i18n/src/abstract.portal.element.ts b/samples/web-components/api-gallery-i18n/src/abstract.portal.element.ts new file mode 100644 index 0000000..e207fed --- /dev/null +++ b/samples/web-components/api-gallery-i18n/src/abstract.portal.element.ts @@ -0,0 +1,60 @@ +import {ContextModel} from './model/context.model'; + +/** + * Developer Portal requires the web-components, created by Administrators, to extend this class AbstractPortalElement + * + * Developer Portal rendering engine will invoke setContext method to set applicable context data, navigator function and localize function. + * + * It is recommended to write the rendering logic of the web-components with render() function as the initiator. + */ + +export abstract class AbstractPortalElement extends HTMLElement { + + private context: ContextModel; + + /** + * Starting point of the rendering logic. The method will be implemented by extending web-component owned by administrator. + */ + abstract render(): void | Promise; + + /** + * This method will be invoked by web-component rendering engine + */ + setContext(context: ContextModel): void { + this.context = context; + this.render(); + } + + /** + * returns the context data specific to the use-case, if applicable. + * @protected + */ + protected getData(): any { + if (this.context && this.context.getData) { + return this.context.getData(); + } + } + + /** + * navigate to the location mentioned. + * @param path + * @protected + */ + protected navigate(path: string): void { + if (this.context && this.context.navigate) { + this.context.navigate(path); + } + } + + /** + * Provides the value for the given property key. If the key doesnt exist, key string itself will be returned. + * @param key + * @protected + */ + protected getLocaleString(key: string): string { + if (this.context && this.context.getLocaleString) { + return this.context.getLocaleString(key); + } + return key; + } +} diff --git a/samples/web-components/api-gallery-i18n/src/components/api-gallery-i18n/api-gallery-i18ninfo.ts b/samples/web-components/api-gallery-i18n/src/components/api-gallery-i18n/api-gallery-i18ninfo.ts new file mode 100644 index 0000000..8591e54 --- /dev/null +++ b/samples/web-components/api-gallery-i18n/src/components/api-gallery-i18n/api-gallery-i18ninfo.ts @@ -0,0 +1,201 @@ +/** + * MIT License + * + * Copyright (c) 2022 Software AG, Darmstadt, Germany and/or its licensors + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + + +import {AbstractPortalElement} from '../../abstract.portal.element'; +import {RequestDataService} from '../../service/request.service'; +import {AllData, LEExcludingBox} from '../../model/data/alldata.model'; + +/** + * This web component will add a locale icon for each of the locales configured for an API. + * It is designed (and tested) to work only when placed on the 'API Default Box' component. + * Right now, it will only work with a small list of locales (en, de, fr, es, jp, ru). + */ +export class ApiGalleryI18ninfo extends AbstractPortalElement { + locales: any = {}; + currentLocale = ''; + theShadowRoot: ShadowRoot; + allEventListeners: any[] = []; + + constructor() { + super(); + } + + connectedCallback() { + this.theShadowRoot = this.attachShadow({ mode: 'open' }); + } + + async render(): Promise { + const service = new RequestDataService(); + if (this.getData().id && this.checkIfValidUUID(this.getData().id)) { + // retrieve the locale information configured for this API + const thisData: AllData = await service.getAsJSON( + '/portal/rest/v1/apis/' + this.getData().id + '/i18n' + ); + const apiLocales: string[] = []; + if (thisData.summary && thisData.summary.localStrings) { + for (const item in thisData.summary.localStrings) { + apiLocales.push(item); + } + } + + const rootDiv = document.createElement('div'); + rootDiv.className = 'i18n-wrapper'; + + apiLocales.forEach((l) => { + const localeItem = document.createElement('span'); + // listen to the click events to swith locale in the title/summary/description of the api + localeItem.addEventListener('click', (evt) => { + evt.preventDefault(); + this.switchLocale(l); + }); + + // localeItem.innerText = l; + const country = l.substring(l.indexOf('_') + 1); + localeItem.className = 'fi fi-' + country.toLowerCase(); + rootDiv.appendChild(localeItem); + + // store name, summary and description for later usage + this.locales[l] = { + name: thisData.name.localStrings[l as LEExcludingBox], + summary: thisData.summary.localStrings[l as LEExcludingBox], + description: thisData.description.localStrings[l as LEExcludingBox], + }; + }); + // to enable more locales, the list below should be enhanced with the needed fi-* and fi-*.fis classes + this.shadowRoot.innerHTML = ` + `; + this.shadowRoot.appendChild(rootDiv); + } else { + console.debug( + '+-+ api-gallery-i18n: no api id found to check for locales... only an empty box will be rendered' + ); + const rootHtml = document.createElement('div'); + rootHtml.className = 'i18n-wrapper'; + rootHtml.innerHTML = 'i18n locale icons'; + this.shadowRoot.innerHTML = ` + `; + this.shadowRoot.appendChild(rootHtml); + } + } + doSwitch(event: any, localeCode: string, me: any) { + event.preventDefault(); + this.switchLocale(localeCode); + } + + switchLocale(l: any) { + // go up the html tree to match the api name element + const apiTitleElement = this.getClosestBySelector( + this, + `yap-div > yap-link[data-yap-name="${this.getData().name}"]` + ); + if (apiTitleElement !== null) { + const linkElement = apiTitleElement.querySelector('a'); + if (linkElement !== null) { + linkElement.textContent = this.locales[l].name; + } + const summaryElement = + apiTitleElement.parentElement.querySelector('yap-paragraph p'); + if (summaryElement !== null) { + summaryElement.textContent = this.locales[l].summary; + } + } + } + + getClosestBySelector(elem: any, selector: string) { + for (; elem && elem !== document; elem = elem.parentNode) { + const found = elem.querySelector(selector); + if (found != null) return found; + } + return null; + } + private checkIfValidUUID(str: string) { + // Regular expression to check if string is a valid UUID + const regexExp = + /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi; + + return regexExp.test(str); + } +} diff --git a/samples/web-components/api-gallery-i18n/src/index.ts b/samples/web-components/api-gallery-i18n/src/index.ts new file mode 100644 index 0000000..a34b61c --- /dev/null +++ b/samples/web-components/api-gallery-i18n/src/index.ts @@ -0,0 +1,4 @@ +import {ApiGalleryI18ninfo} from './components/api-gallery-i18n/api-gallery-i18ninfo'; + + +customElements.define('api-gallery-i18ninfo', ApiGalleryI18ninfo); diff --git a/samples/web-components/api-gallery-i18n/src/model/context.model.ts b/samples/web-components/api-gallery-i18n/src/model/context.model.ts new file mode 100644 index 0000000..39793d4 --- /dev/null +++ b/samples/web-components/api-gallery-i18n/src/model/context.model.ts @@ -0,0 +1,5 @@ +export class ContextModel { + getData: () => any; + navigate: (path: string) => void; + getLocaleString: (key: string) => string; +} diff --git a/samples/web-components/api-gallery-i18n/src/model/data/alldata.model.ts b/samples/web-components/api-gallery-i18n/src/model/data/alldata.model.ts new file mode 100644 index 0000000..3a8f3ad --- /dev/null +++ b/samples/web-components/api-gallery-i18n/src/model/data/alldata.model.ts @@ -0,0 +1,120 @@ +export class AllData { + name: Name + summary: Summary + description: Description + owner: string + id: string + modified: number + created: any + documentType: string + externalRefKey: string + providerRef: string + type: string + version: string + icon: Icon + systemVersion: string + versionFamilyRef: string + latest: string + follower: any + providerType: any + viewType: any + tags: string[] + communities: string[] + categories: Category[] + businessTerms: any[] + endPoints: any[] + attachments: Attachment[] + maturityStatus: MaturityStatu[] + policies: Policy[] + apiProperties: any[] + securitySchemes: SecurityScheme[] + scopes: any[] + endpointIds: string[] + rating: number + consumes: string[] + produces: string[] + resources: any[] + parameters: any[] + soapMethods: any[] + components: any[] + resourceIds: string[] + soapMethodIds: any[] + componentIds: string[] + hybrid: boolean + } + + export interface Name { + localStrings: LocalStrings + } + + export interface LocalStrings { + en_US : string; + de_DE : string; + ru_RU : string; + fr_FR : string; + es_ES : string; + jp_JP : string; + } + export type LEExcludingBox = Exclude; + + export interface Summary { + localStrings: LocalStrings + } + + + export interface Description { + localStrings: LocalStrings + } + + export interface Icon { + url: string + type: string + } + + export interface Category { + name: Name + summary: any + description: any + cname: string + } + + export interface Attachment { + name: Name + summary: any + description: any + uri: string + } + + export interface MaturityStatu { + name: Name + summary: any + description: any + cname: string + } + + export interface Policy { + name: Name + summary: Summary + description: Description + categories: any[] + providerRef: any + } + + export interface SecurityScheme { + type: string + description: any + name?: string + $ref: any + in?: string + scheme: any + bearerFormat: any + flows: any + openIdConnectUrl: any + } + + // export class AllLocales { + // "de_DE": string; + // "en_US": string; + // "ru_RU": string; + // "fr_FR": string; + // } \ No newline at end of file diff --git a/samples/web-components/api-gallery-i18n/src/service/request.service.ts b/samples/web-components/api-gallery-i18n/src/service/request.service.ts new file mode 100644 index 0000000..b2e4531 --- /dev/null +++ b/samples/web-components/api-gallery-i18n/src/service/request.service.ts @@ -0,0 +1,56 @@ +/** + * Data service - For HTTP Invocation + */ +export class RequestDataService { + + /** + * Returns the data for GET request. + * @param url + */ + getAsJSON(url: string): Promise { + return fetch(new Request(url)).then((response) => { + return response.json(); + }).then(function(text) { + return text; + }); + } + + /** + * Returns the data for POST request for the given url and payload + * @param url + * @param body + */ + postAsJSON(url: string, body: string): Promise { + return fetch(url, { + method: 'post', + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + 'xsrf-token': this.getCookie('xsrf-token') + }, + body + }).then((response) => { + return response.json(); + }).then(function(text) { + return text; + }); + } + + /** + * Get the cookie value for the given name. + * @param name + */ + getCookie(name: string): string { + const nameLenPlus = (name.length + 1); + return document.cookie + .split(';') + .map(c => c.trim()) + .filter(cookie => { + return cookie.substring(0, nameLenPlus) === `${name}=`; + }) + .map(cookie => { + return (cookie.substring(nameLenPlus)); + })[0] || null; + } + +} diff --git a/samples/web-components/api-gallery-i18n/tsconfig.json b/samples/web-components/api-gallery-i18n/tsconfig.json new file mode 100644 index 0000000..232ef61 --- /dev/null +++ b/samples/web-components/api-gallery-i18n/tsconfig.json @@ -0,0 +1,71 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig.json to read more about this file */ + + /* Basic Options */ + // "incremental": true, /* Enable incremental compilation */ + "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ + "module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ + // "lib": [], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ + // "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./", /* Concatenate and emit output to single file. */ + // "outDir": "./", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + "strictNullChecks": false, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ + // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + + /* Source Map Options */ + // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + + /* Advanced Options */ + "skipLibCheck": true, /* Skip type checking of declaration files. */ + "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + } +} diff --git a/samples/web-components/api-gallery-i18n/webpack.config.js b/samples/web-components/api-gallery-i18n/webpack.config.js new file mode 100644 index 0000000..81bef7d --- /dev/null +++ b/samples/web-components/api-gallery-i18n/webpack.config.js @@ -0,0 +1,24 @@ +const path = require('path'); + +module.exports = { + mode: "production", + // devtool: 'eval-source-map', + entry: './src/index.ts', + module: { + rules: [ + { + test: /\.ts$/, + use: 'ts-loader', + include: [path.resolve(__dirname, 'src')] + } + ] + }, + resolve: { + extensions: ['.ts'] + }, + output: { + publicPath: "public", + filename: "bundle.js", + path: path.resolve(__dirname, 'public') + } +}