Skip to content

Commit

Permalink
+ first version
Browse files Browse the repository at this point in the history
  • Loading branch information
dzek69 committed Apr 25, 2024
0 parents commit 832eaa9
Show file tree
Hide file tree
Showing 28 changed files with 5,937 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

[{package.json,*.yml}]
indent_size = 2
39 changes: 39 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"root": true,
"extends": [
"@dzek69/eslint-config-base",
"@dzek69/eslint-config-typescript",
"@dzek69/eslint-config-import",
"@dzek69/eslint-config-import-typescript"
],
"env": {
"node": true
},
"parserOptions": {
"sourceType": "module",
"project": "./tsconfig.lint.json"
},
"ignorePatterns": [],
"overrides": [
{
"files": [
"src/*.spec.*", "src/**/*.spec.*"
],
"env": {
"jest": true
},
"rules": {
"func-names": "off",
"global-require": "off",
"max-lines": "off",
"max-lines-per-function": "off",
"max-statements": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-magic-numbers": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"no-unused-labels": "off"
}
}
]
}
50 changes: 50 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build docs and push to ezez.dev

on:
push:
branches: [ master ]


env:
PROJECT_NAME: temperature-gradient

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- name: Build documentation
run: |
VER=$(cat ./package.json | jq -r .version)
echo Detected version: $VER
if [[ "$VER" == *"+"* ]]; then echo "WIP/+ version detected, skipping"; exit 1; fi
yarn
yarn docs
echo "APP_VERSION=$VER" >> "$GITHUB_ENV"
cat $GITHUB_ENV
- name: Deploy versioned documentation
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.DOCS_SERVER_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.DOCS_SERVER_HOST }}
REMOTE_USER: ${{ secrets.DOCS_SERVER_USER }}
REMOTE_PORT: ${{ secrets.DOCS_SERVER_PORT }}
SOURCE: "docs/"
TARGET: "/docs/${{ env.PROJECT_NAME }}/${{ env.APP_VERSION }}"

- name: Deploy latest documentation
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.DOCS_SERVER_PRIVATE_KEY }}
REMOTE_HOST: ${{ secrets.DOCS_SERVER_HOST }}
REMOTE_USER: ${{ secrets.DOCS_SERVER_USER }}
REMOTE_PORT: ${{ secrets.DOCS_SERVER_PORT }}
ARGS: "-rlgoDzvc -i --delete"
SOURCE: "docs/"
TARGET: "/docs/${{ env.PROJECT_NAME }}/latest"

9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.idea/
/docs/
/dist/
/esm/
/node_modules/

/*.tgz
*.log
*.tsbuildinfo
15 changes: 15 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/.idea/
/build-scripts/
/test/

/babel.config.cjs
/jest.config.cjs
/yarn.lock
/*.tgz
/*.log
/.yarnclean
/nodemon.json
/.editorconfig
/tsconfig.*
/.eslintrc.json
/pagesconfig.json
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [UNRELEASED]
(nothing yet)

## [0.0.1] - 2024-04-25
### Added
- first version
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Jacek Nowacki

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.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WIP
13 changes: 13 additions & 0 deletions build-scripts/compile.cjs.after.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import fs from "fs-extra";
import { run } from "./utils.mjs";

const contents = `{"type": "commonjs"}`;

(async () => {
console.info("[CJS compile post-processing started]");
await fs.writeFile("./dist/package.json", contents);
console.info("Written dist/package.json with commonjs type fix");
await run("resolve-tspaths", ["--project", "tsconfig.cjs.json"]);
console.info("Resolved TypeScript import paths");
console.info("[CJS compile post-processing ended]");
})();
8 changes: 8 additions & 0 deletions build-scripts/compile.esm.after.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {run} from "./utils.mjs";

(async () => {
console.info("[ESM compile post-processing started]");
await run("resolve-tspaths", ["--project", "tsconfig.esm.json"]);
console.info("Resolved TypeScript import paths");
console.info("[ESM compile post-processing ended]");
})();
26 changes: 26 additions & 0 deletions build-scripts/utils.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { spawn } from "child_process";

const run = (command, args) => {
return new Promise((resolve, reject) => {
const cmd = spawn(command, args, {
stdio: ["ignore", "inherit", "inherit"],
});

cmd.on("close", (code) => {
if (!code) {
resolve();
return;
}

reject(new Error(`Program exited with code ${code}`));
});

cmd.on("error", () => {
reject(new Error(`Can't start program`));
});
});
};

export {
run
}
19 changes: 19 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
// testMatch: [],
collectCoverageFrom: [
'src/**/*.{mjs,js,jsx,ts,tsx}',
'!**/*.d.ts'
],
setupFiles: [
'<rootDir>/test/bootstrap.cjs'
],
testEnvironmentOptions: {
url: 'http://localhost:8080',
},
moduleNameMapper: {
'^(.*)\.js$': '$1',
},
transform: {
'\\.[jt]sx?$': ['babel-jest', { configFile: './test/babel.config.cjs' }]
},
};
6 changes: 6 additions & 0 deletions nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"watch": ["src"],
"ext": "ts,json",
"ignore": ["src/**/*.spec.ts"],
"exec": "node --loader ts-node/esm ./src/index.ts"
}
74 changes: 74 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "@ezez/temperature-gradient",
"version": "0.0.1",
"repository": "git@github.com:dzek69/ezez-temperature-gradient.git",
"author": "Jacek Nowacki",
"license": "MIT",
"scripts": {
"test": "NODE_ENV=test jest",
"docs": "typedoc src/index.ts --skipErrorChecking --out docs --includeVersion",
"compile": "pnpm run compile:esm && pnpm run compile:cjs",
"compile:esm": "rm -rf esm && tsc --project tsconfig.esm.json && node ./build-scripts/compile.esm.after.mjs",
"compile:cjs": "rm -rf dist && tsc --project tsconfig.cjs.json && node ./build-scripts/compile.cjs.after.mjs",
"typecheck": "tsc --noEmit",
"lint": "eslint src --ext .ts,.tsx,.js,.jsx,.mjs",
"lint:fix": "pnpm run lint --fix",
"prepack": "pnpm run compile",
"prepublishOnly": "pnpm audit && pnpm run lint && pnpm run test && pnpm run docs",
"prepare": "husky install",
"start:dev": "nodemon",
"start:dev:compatibility": "TS_NODE_FILES=true pnpm run start:dev",
"updates": "pnpm dlx npm-check-updates --dep prod",
"updates:dev": "pnpm dlx npm-check-updates --dep dev",
"updates:all": "pnpm dlx npm-check-updates"
},
"exports": {
".": {
"require": "./dist/index.js",
"types": "./esm/index.d.ts",
"default": "./esm/index.js"
}
},
"main": "./dist/index.js",
"types": "./esm/index.d.ts",
"module": "./esm/index.js",
"type": "module",
"dependencies": {},
"devDependencies": {
"@babel/core": "^7.22.20",
"@babel/preset-env": "^7.22.20",
"@babel/preset-typescript": "^7.22.15",
"@dzek69/eslint-config-base": "^2.5.0",
"@dzek69/eslint-config-import": "^1.3.0",
"@dzek69/eslint-config-import-typescript": "^1.0.1",
"@dzek69/eslint-config-typescript": "^1.1.1",
"@knodes/typedoc-plugin-pages": "^0.23.4",
"@types/jest": "^29.5.5",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"babel-plugin-module-extension": "^0.1.3",
"eslint": "^8.44.0",
"eslint-plugin-import": "^2.28.1",
"fs-extra": "^11.1.1",
"husky": "^8.0.3",
"jest": "^29.7.0",
"must": "^0.13.4",
"nodemon": "^3.1.0",
"prettier": "^2.8.8",
"resolve-tspaths": "^0.8.15",
"ts-node": "^10.9.2",
"typedoc": "^0.23.28",
"typescript": "^5.2.2"
},
"husky": {
"hooks": {
"pre-push": "pnpm run prepublishOnly && pnpm run compile"
}
},
"libraryTemplate": {
"version": "3.11.2",
"language": "typescript",
"fixDefaultForCommonJS": true,
"jsx": false
}
}
9 changes: 9 additions & 0 deletions pagesconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"pages": [
{
"title": "Test",
"source": "./tutorials/Test.md"
}
],
"source": "tutorials"
}
Loading

0 comments on commit 832eaa9

Please sign in to comment.