Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhailmogilnikov committed Jan 8, 2024
1 parent 95217e4 commit ea07622
Show file tree
Hide file tree
Showing 19 changed files with 17,521 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
27 changes: 27 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
root: true

plugins:
- jest
- babel

env:
node: true
jest: true
browser: true

parser: "@babel/eslint-parser"

parserOptions:
parser: '@babel/eslint-parser'
requireConfigFile: false
ecmaVersion: 2018
sourceType: 'module'

extends:
- "airbnb-base"
- "plugin:jest/recommended"

rules:
no-console: 0
import/extensions: 0
46 changes: 46 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Name of workflow
name: Node CI

# Trigger the workflow on push or pull request
on:
- push
- pull_request

jobs:
build:

# The type of machine to run the job on
runs-on: ubuntu-latest

strategy:
# Node versions list
matrix:
node-version: [18.x]

steps:
# Check-out repository under GitHub workspace
# https://github.com/actions/checkout
- uses: actions/checkout@v3
# Step's name
- name: Use Node.js ${{ matrix.node-version }}
# Configures the node version used on GitHub-hosted runners
# https://github.com/actions/setup-node
uses: actions/setup-node@v3
# The Node.js version to configure
with:
node-version: ${{ matrix.node-version }}

- name: npm install, build
# Install and build project
run: |
make install
make build
# Add environment variables
env:
CI: true

- name: Run linter
run: make lint

- name: Run tests
run: make test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/node_modules/
*.log
dist
assets
Empty file added .npmignore
Empty file.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps=true
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
develop:
npx webpack serve

install:
npm ci

build:
NODE_ENV=production npx webpack

test:
npm test

lint:
npx eslint .

.PHONY: test
1 change: 1 addition & 0 deletions __tests__/__fixtures__/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<div id="point"></div>
16 changes: 16 additions & 0 deletions __tests__/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @ts-check

import { promises as fs } from 'fs';
import path from 'path';
import init from '../src/init';

beforeEach(async () => {
const pathToHtml = path.resolve(__dirname, '__fixtures__/index.html');
const html = await fs.readFile(pathToHtml, 'utf8');
document.body.innerHTML = html;
});

test('init', () => {
init();
expect(true).toBeDefined();
});
12 changes: 12 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
]
}
Loading

0 comments on commit ea07622

Please sign in to comment.