From 8cfc4074e7947441bfe081d32853acfc2e9f0239 Mon Sep 17 00:00:00 2001 From: Yuriy Demidov Date: Tue, 9 Jul 2024 19:57:33 +0300 Subject: [PATCH] initial --- .editorconfig | 17 +++++++++++++++++ .eslintignore | 3 +++ .eslintrc | 6 ++++++ .github/workflows/quality.yaml | 22 +++++++++++++++++++++ .github/workflows/release.yaml | 19 ++++++++++++++++++ .github/workflows/tests.yaml | 22 +++++++++++++++++++++ .gitignore | 12 ++++++++++++ .npmrc | 2 ++ .nvmrc | 1 + .prettierrc | 1 + CONTRIBUTING.md | 35 ++++++++++++++++++++++++++++++++++ LICENSE | 21 ++++++++++++++++++++ README.md | 4 ++++ esbuild/build.js | 20 +++++++++++++++++++ package.json | 32 +++++++++++++++++++++++++++++++ src/@types/globals.d.ts | 5 +++++ src/index.ts | 1 + tsconfig.json | 9 +++++++++ 18 files changed, 232 insertions(+) create mode 100644 .editorconfig create mode 100644 .eslintignore create mode 100644 .eslintrc create mode 100644 .github/workflows/quality.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/tests.yaml create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 .nvmrc create mode 100644 .prettierrc create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100755 esbuild/build.js create mode 100644 package.json create mode 100644 src/@types/globals.d.ts create mode 100644 src/index.ts create mode 100644 tsconfig.json diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..fbfc4d9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[{*.json,*.yml,*.yaml}] +indent_style = space +indent_size = 2 + +[GNUmakefile] +indent_style = tab +indent_size = 4 diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..e211493 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +/build +/coverage +/node_modules diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..c60b553 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,6 @@ +{ + "extends": ["@diplodoc/eslint-config"], + "env": { + "node": true + } +} diff --git a/.github/workflows/quality.yaml b/.github/workflows/quality.yaml new file mode 100644 index 0000000..17dd2fa --- /dev/null +++ b/.github/workflows/quality.yaml @@ -0,0 +1,22 @@ +name: Code quality + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - run: npm ci + - run: npm run lint diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..3ae38e9 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,19 @@ +on: + push: + branches: [master] + +name: release + +permissions: + contents: write + pull-requests: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: yandex-cloud/ui-release-action@main + with: + github-token: ${{ secrets.YC_UI_BOT_GITHUB_TOKEN }} + npm-token: ${{ secrets.ROBOT_DATAUI_NPM_TOKEN }} + node-version: 18 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..addf55e --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,22 @@ +name: Unit tests + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x] + + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "npm" + - run: npm ci + - run: npm run test diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..45edc80 --- /dev/null +++ b/.gitignore @@ -0,0 +1,12 @@ +.DS_Store +.vscode +.idea +.env + +/build +/coverage +/node_modules + +# libraries +npm-debug.log + diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..8378105 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +registry=https://registry.npmjs.org +engine-strict=true diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..3c03207 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +18 diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..a2938da --- /dev/null +++ b/.prettierrc @@ -0,0 +1 @@ +"@diplodoc/prettier-config" \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..bdfb611 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,35 @@ +# Notice to external contributors + + +## General info + +Hello! In order for us (YANDEX LLC) to accept patches and other contributions from you, you will have to adopt our Yandex Contributor License Agreement (the “**CLA**”). The current version of the CLA can be found here: +1) https://yandex.ru/legal/cla/?lang=en (in English) and +2) https://yandex.ru/legal/cla/?lang=ru (in Russian). + +By adopting the CLA, you state the following: + +* You obviously wish and are willingly licensing your contributions to us for our open source projects under the terms of the CLA, +* You have read the terms and conditions of the CLA and agree with them in full, +* You are legally able to provide and license your contributions as stated, +* We may use your contributions for our open source projects and for any other our project too, +* We rely on your assurances concerning the rights of third parties in relation to your contributions. + +If you agree with these principles, please read and adopt our CLA. By providing us your contributions, you hereby declare that you have already read and adopt our CLA, and we may freely merge your contributions with our corresponding open source project and use it in further in accordance with terms and conditions of the CLA. + +## Provide contributions + +If you have already adopted terms and conditions of the CLA, you are able to provide your contributions. When you submit your pull request, please add the following information into it: + +``` +I hereby agree to the terms of the CLA available at: [link]. +``` + +Replace the bracketed text as follows: +* [link] is the link to the current version of the CLA: https://yandex.ru/legal/cla/?lang=en (in English) or https://yandex.ru/legal/cla/?lang=ru (in Russian). + +It is enough to provide us such notification once. + +## Other questions + +If you have any questions, please mail us at opensource@yandex-team.ru. \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..74ae319 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Yandex LLC + +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/README.md b/README.md new file mode 100644 index 0000000..7ebed86 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# new-package + +[![NPM version](https://img.shields.io/npm/v/@diplodoc/viewer.svg?style=flat)](https://www.npmjs.org/package/@diplodoc/viewer) + diff --git a/esbuild/build.js b/esbuild/build.js new file mode 100755 index 0000000..a2774ab --- /dev/null +++ b/esbuild/build.js @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +const esbuild = require('esbuild'); +const { + compilerOptions: {target}, +} = require('../tsconfig.json'); + +const common = { + bundle: true, + sourcemap: true, + target: target, + tsconfig: './tsconfig.json', +}; + +esbuild.build({ + ...common, + entryPoints: ['src/index.ts'], + outfile: 'index.js', + minify: true, +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..afab84f --- /dev/null +++ b/package.json @@ -0,0 +1,32 @@ +{ + "name": "@diplodoc/new-package", + "version": "1.0.0", + "description": "Template package for Diplodoc platform development", + "main": "index.js", + "homepage": "https://diplodoc.com/", + "repository": { + "type": "git", + "url": "git+https://github.com/diplodoc-platform/new-package.git" + }, + "bugs": { + "url": "https://github.com/diplodoc-platform/diplodoc/issues" + }, + "private": true, + "author": "", + "license": "MIT", + "scripts": { + "build": "run-p build:*", + "build:js": "./esbuild/build.js", + "build:declarations": "tsc --emitDeclarationOnly --outDir .", + "lint": "eslint .", + "lint:fix": "eslint --fix .", + "test": "exit 0" + }, + "devDependencies": { + "@diplodoc/eslint-config": "^2.0.0", + "@diplodoc/prettier-config": "^2.0.0", + "@diplodoc/tsconfig": "^1.0.2", + "esbuild": "^0.19.9", + "typescript": "^5.3.3" + } +} diff --git a/src/@types/globals.d.ts b/src/@types/globals.d.ts new file mode 100644 index 0000000..9335ac7 --- /dev/null +++ b/src/@types/globals.d.ts @@ -0,0 +1,5 @@ +declare global { + interface Window { + someProp: any; + } +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..3df11d3 --- /dev/null +++ b/src/index.ts @@ -0,0 +1 @@ +console.log(window.someProp); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..d48cfb8 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "@diplodoc/tsconfig", + "compilerOptions": { + "target": "es2022", + "module": "es2022", + "declaration": true + }, + "include": ["src"] +}