diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000000..4b7e2bf688 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,30 @@ +{ + "extends": [ + "eslint:recommended", + "plugin:jest/recommended", + "plugin:prettier/recommended" + ], + "plugins": [ + "license-header" + ], + "rules": { + "license-header/header": [ + "error", + "header.js" + ] + }, + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module", + "ecmaFeatures": { + "modules": true, + "experimentalObjectRestSpread": true + } + }, + "globals": { + "google": "writable" + }, + "env": { + "browser": true + } +} \ No newline at end of file diff --git a/.gitignore b/.gitignore index bc21afa7c1..6fe082f0ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,229 @@ **/node_modules -package-lock.json \ No newline at end of file +**/package-lock.json +**dist/ +**/.npmrc +**/docs + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# 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 +*.lcov + +# 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/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# gatsby files +.cache/ +public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# Windows thumbnail cache files +Thumbs.db +Thumbs.db:encryptable +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..2487222bf9 --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +header.js diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..a1ee501234 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: +- stable +script: +- npm run bootstrap +- npm run ci diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 0000000000..35cde5cd5e --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,4 @@ +coverage: + status: + project: off + patch: off diff --git a/header.js b/header.js new file mode 100644 index 0000000000..8cf763c687 --- /dev/null +++ b/header.js @@ -0,0 +1,15 @@ +/** + * Copyright 2019 Google LLC. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ \ No newline at end of file diff --git a/lerna.json b/lerna.json new file mode 100644 index 0000000000..28140ecd30 --- /dev/null +++ b/lerna.json @@ -0,0 +1,14 @@ +{ + "packages": ["samples/*"], + "version": "independent", + "command": { + "publish": { + "allowBranch": ["master"] + }, + "version": { + "allowBranch": ["master"], + "message": "chore: release" + } + }, + "ignoreChanges": ["**/examples/**", "**/tests/**", "**/docs/**", "**/*.md"] +} diff --git a/package.json b/package.json index 4d4a28d50a..25b1cb2bb8 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,51 @@ { "name": "js-samples", "description": "Samples for Google Maps JavaScript", - "scripts": { - "format": "prettier **/*.json **/*.js **/*.html **/*.ts", - "build:index": "tree -H '.' -L 5 --prune --noreport --charset utf-8 -T 'Google Maps JS Samples' -P '*html' -o index.html" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/googlemaps/js-samples.git" - }, "keywords": [ "google", - "maps", "javascript", + "maps", "samples" ], - "license": "Apache-2.0", + "homepage": "https://github.com/googlemaps/js-samples#readme", "bugs": { "url": "https://github.com/googlemaps/js-samples/issues" }, - "homepage": "https://github.com/googlemaps/js-samples#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/googlemaps/js-samples.git" + }, + "license": "Apache-2.0", + "scripts": { + "bootstrap": "lerna bootstrap", + "ci": "npm run lint && npm run test", + "docs": "rm -rf docs/ && typedoc .", + "format": "sort-package-json && prettier *.json *.js --write && lerna run format", + "lint": "lerna run lint", + "prepare": "lerna run prepare", + "test": "lerna run test" + }, "devDependencies": { - "prettier": "^1.18.2" + "@types/googlemaps": "^3.37.7", + "@types/jest": "^24.0.19", + "@typescript-eslint/eslint-plugin": "^2.4.0", + "@typescript-eslint/parser": "^2.0.0", + "codecov": "^3.6.1", + "eslint": "^6.5.1", + "eslint-config-prettier": "^6.4.0", + "eslint-plugin-jest": "^22.19.0", + "eslint-plugin-license-header": "^0.2.0", + "eslint-plugin-prettier": "^3.1.1", + "jest": "^24.9.0", + "lerna": "^3.16.4", + "prettier": "^1.18.2", + "rollup": "^1.24.0", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-terser": "^5.1.2", + "rollup-plugin-typescript2": "^0.24.3", + "sort-package-json": "^1.22.1", + "ts-jest": "^24.1.0", + "typescript": "^3.7.2" } }