Skip to content

Commit

Permalink
update deps, use jest for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed Apr 4, 2022
1 parent f462775 commit 06c35be
Show file tree
Hide file tree
Showing 24 changed files with 11,160 additions and 2,691 deletions.
143 changes: 67 additions & 76 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -1,85 +1,76 @@
{
"ignorePaths": ["node_modules/**", "package-lock.json", "dist/**"],
"version": "0.1",
"ignorePaths": [
".DS_Store",
".git/",
"dist/",
"node_modules/",
"package-lock.json",
".cspell-base.json",
".cspell.json"
],
"version": "0.2",
"words": [
"accum",
"accumsan",
"adipiscing",
"Aenean",
"aliquam",
"Aliquam",
"amet",
"arcu",
"augue",
"blandit",
"commodo",
"consectetur",
"Cras",
"cubilia",
"Curabitur",
"curae",
"dapibus",
"dignissim",
"Duis",
"eget",
"argb",
"autofix",
"autofixable",
"autofixing",
"browserconfig",
"combinator",
"combinators",
"config's",
"cpsell",
"derp",
"derpy",
"electrovir",
"elementum",
"elit",
"etiam",
"facilisis",
"faucibus",
"felis",
"fringilla",
"Fusce",
"gravida",
"hendrerit",
"interdum",
"justo",
"lacinia",
"lacus",
"lectus",
"luctus",
"malesuada",
"Mauris",
"metus",
"Morbi",
"neque",
"nibh",
"nisl",
"Nulla",
"nunc",
"odio",
"orci",
"entrypoint",
"entrypoints",
"esbenp",
"estree",
"fleek",
"gitattributes",
"globbing",
"globstar",
"inconsolata",
"lexend",
"lfsr",
"locationchange",
"marvinpinto",
"mmultiline",
"monospace",
"msapplication",
"mstile",
"nojekyll",
"noopener",
"noreferrer",
"npmignore",
"packagejson",
"Phasellus",
"placerat",
"porta",
"porttitor",
"posuere",
"potenti",
"Praesent",
"pretium",
"primis",
"quis",
"rhoncus",
"rutrum",
"sagittis",
"sollicitudin",
"suscipit",
"Suspendisse",
"tempor",
"tincidunt",
"tortor",
"parens",
"pdfs",
"postupgrade",
"prettierignore",
"prettierrc",
"preupgrade",
"protobuf",
"pushstate",
"replacestate",
"repo's",
"repos",
"rgba",
"stackoverflow",
"stylelint",
"stylelintrc",
"tabbable",
"tabindex",
"thingie",
"threejs",
"transpiled",
"transpiling",
"turpis",
"ultrices",
"ultricies",
"vehicula",
"velit",
"venenatis",
"vestibulum",
"Vivamus",
"vulputate"
"typeof",
"virmator's",
"virmator",
"vite",
"vitejs",
"xlink"
]
}
38 changes: 38 additions & 0 deletions .github/workflows/virmator-tagged-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: 'tagged-release'

on:
push:
tags:
- 'v*'

jobs:
tagged-release:
name: 'Tagged Release'
runs-on: 'ubuntu-latest'

steps:
- uses: actions/checkout@v1
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: run test
run: |
npm ci
npm run test:full
- name: pack and set vars
id: vars
run: |
tagName="${GITHUB_REF#refs/*/}"
originalTarName="$(npm pack)"
packageName="$(npm -s run env echo '$npm_package_name')"
newTarName="$packageName-$tagName.tgz"
mv "$originalTarName" "$newTarName"
echo ::set-output name=tarName::"$newTarName"
- uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: '${{ secrets.GITHUB_TOKEN }}'
prerelease: false
files: |
${{ steps.vars.outputs.tarName }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ name: tests
on:
push:
branches:
- master
pull_request:
branches:
- master
- '**'

jobs:
build:
Expand All @@ -15,7 +12,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [12.x, 14.x]
node-version: [14.x, 16.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.DS_Store
node_modules
dist
dist
Icon?
23 changes: 17 additions & 6 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
.cspell-base.json
.cspell.json
.gitattributes
.github
.prettierrc.json
.vscode
dist/tests
sample-files
src
.github/
.gitignore
.prettierignore
.prettierrc.js
.virmator/
.vscode/
*.test.d.ts
*.test.js
*.test.ts
dist/readme-examples/
dist/scripts/
dist/test/
dist/vite/
src/
test-files/
tsconfig-base.json
tsconfig.json
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
node_modules/
package-lock.json
test-files
40 changes: 40 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const fs = require('fs');
const path = require('path');

const plugins = [
'prettier-plugin-sort-json',
'prettier-plugin-packagejson',
'prettier-plugin-multiline-arrays',
'prettier-plugin-organize-imports',
'prettier-plugin-jsdoc',
].map((pluginName) => {
// account for installations where deps are flattened and installations where they're nested
const defaultPath = `./node_modules/${pluginName}`;
if (fs.existsSync(path.resolve(__dirname, defaultPath))) {
return defaultPath;
} else {
return `./node_modules/virmator/node_modules/${pluginName}`;
}
});

/**
* @typedef {import('prettier-plugin-multiline-arrays').MultilineArrayOptions} MultilineOptions
*
* @typedef {import('prettier').Options} PrettierOptions
* @type {PrettierOptions & MultilineOptions}
*/
const prettierConfig = {
arrowParens: 'always',
bracketSpacing: false,
endOfLine: 'lf',
htmlWhitespaceSensitivity: 'ignore',
jsonRecursiveSort: true,
bracketSameLine: false,
plugins,
printWidth: 100,
singleQuote: true,
tabWidth: 4,
trailingComma: 'all',
};

module.exports = prettierConfig;
18 changes: 0 additions & 18 deletions .prettierrc.json

This file was deleted.

24 changes: 24 additions & 0 deletions .virmator/jest/jest-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {join} from 'path';
import {InitialOptionsTsJest} from 'ts-jest';

const cwd = process.cwd();

export const virmatorJestConfig: InitialOptionsTsJest = {
preset: 'ts-jest',
testEnvironment: 'node',
rootDir: cwd,
modulePathIgnorePatterns: ['.*.type.test.ts$'],
roots: [join(cwd, 'src')],
setupFilesAfterEnv: [join(__dirname, 'jest-setup.ts')],
globals: {
'ts-jest': {
tsconfig: join(cwd, 'tsconfig.json'),
diagnostics: {
warnOnly: true,
ignoreCodes: ['TS151001'],
},
},
},
};

export default virmatorJestConfig;
12 changes: 12 additions & 0 deletions .virmator/jest/jest-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {CustomConsole, LogMessage, LogType} from '@jest/console';

function simpleFormatter(type: LogType, message: LogMessage): string {
const consoleIndent = ' ';

return message
.split(/\n/)
.map((line) => consoleIndent + line)
.join('\n');
}

global.console = new CustomConsole(process.stdout, process.stderr, simpleFormatter);
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[yaml]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"editor.rulers": [100],
"typescript.tsdk": "node_modules/typescript/lib"
}
Loading

0 comments on commit 06c35be

Please sign in to comment.