Set up a scratch pad.

This commit is contained in:
Steve Kinney
2024-09-29 12:57:06 -06:00
parent 56eadb7f93
commit 7810e6ae54
10 changed files with 34 additions and 123 deletions

View File

View File

@@ -0,0 +1,5 @@
import { test, expect } from 'vitest';
test('a super simple test', () => {
expect(true).toBe(true);
});

View File

@@ -1,11 +1,11 @@
{ {
"name": "utility-belt", "name": "scratchpad",
"version": "1.0.0", "version": "1.0.0",
"description": "Some little utilities",
"main": "index.js", "main": "index.js",
"type": "module", "type": "module",
"scripts": { "scripts": {
"types": "tsc --emitDeclarationOnly --allowJs --declaration --skipLibCheck index.js" "start": "vitest --ui",
"test": "vitest"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@@ -18,6 +18,8 @@
}, },
"homepage": "https://github.com/stevekinney/testing-javascript#readme", "homepage": "https://github.com/stevekinney/testing-javascript#readme",
"devDependencies": { "devDependencies": {
"typescript": "^5.6.2" "@vitest/ui": "^2.1.1",
"vite": "^5.4.5",
"vitest": "^2.1.1"
} }
} }

43
package-lock.json generated
View File

@@ -19,7 +19,9 @@
"examples/accident-counter", "examples/accident-counter",
"packages/css-configuration", "packages/css-configuration",
"packages/utility-belt", "packages/utility-belt",
"examples/yearbook" "examples/yearbook",
"packages/scratchpad",
"examples/scratchpad"
], ],
"devDependencies": { "devDependencies": {
"prettier": "^3.3.3", "prettier": "^3.3.3",
@@ -124,6 +126,11 @@
"url": "https://github.com/chalk/chalk?sponsor=1" "url": "https://github.com/chalk/chalk?sponsor=1"
} }
}, },
"examples/scratchpad": {
"version": "1.0.0",
"license": "ISC",
"devDependencies": {}
},
"examples/task-list": { "examples/task-list": {
"version": "1.0.0", "version": "1.0.0",
"license": "MIT", "license": "MIT",
@@ -2814,10 +2821,6 @@
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/css-configuration": {
"resolved": "packages/css-configuration",
"link": true
},
"node_modules/css.escape": { "node_modules/css.escape": {
"version": "1.5.1", "version": "1.5.1",
"resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz",
@@ -5283,6 +5286,10 @@
"loose-envify": "^1.1.0" "loose-envify": "^1.1.0"
} }
}, },
"node_modules/scratchpad": {
"resolved": "examples/scratchpad",
"link": true
},
"node_modules/semver": { "node_modules/semver": {
"version": "6.3.1", "version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
@@ -6011,20 +6018,6 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/typescript": {
"version": "5.6.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz",
"integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "6.19.8", "version": "6.19.8",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
@@ -6104,10 +6097,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/utility-belt": {
"resolved": "packages/utility-belt",
"link": true
},
"node_modules/utils-merge": { "node_modules/utils-merge": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
@@ -6640,6 +6629,7 @@
}, },
"packages/css-configuration": { "packages/css-configuration": {
"version": "1.0.0", "version": "1.0.0",
"extraneous": true,
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
@@ -6648,6 +6638,12 @@
"vite": "^5.4.6" "vite": "^5.4.6"
} }
}, },
"packages/scratchpad": {
"version": "1.0.0",
"extraneous": true,
"license": "ISC",
"devDependencies": {}
},
"packages/utilities": { "packages/utilities": {
"name": "utility-belt", "name": "utility-belt",
"version": "1.0.0", "version": "1.0.0",
@@ -6659,6 +6655,7 @@
}, },
"packages/utility-belt": { "packages/utility-belt": {
"version": "1.0.0", "version": "1.0.0",
"extraneous": true,
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"typescript": "^5.6.2" "typescript": "^5.6.2"

View File

@@ -36,7 +36,9 @@
"examples/accident-counter", "examples/accident-counter",
"packages/css-configuration", "packages/css-configuration",
"packages/utility-belt", "packages/utility-belt",
"examples/yearbook" "examples/yearbook",
"packages/scratchpad",
"examples/scratchpad"
], ],
"devDependencies": { "devDependencies": {
"prettier": "^3.3.3", "prettier": "^3.3.3",

View File

@@ -1,4 +0,0 @@
/**
* @type import('vite').UserConfig['css']
*/
export const css: import('vite').UserConfig['css'];

View File

@@ -1,42 +0,0 @@
import nesting from 'tailwindcss/nesting/index.js';
import tailwindcss from 'tailwindcss';
import autoprefixer from 'autoprefixer';
/**
* @type import('vite').UserConfig['css']
*/
export const css = {
postcss: {
plugins: [
tailwindcss({
content: ['./**/*.{html,js,jsx,ts,tsx}'],
theme: {
extend: {
container: {
center: true,
padding: '1rem',
},
colors: {
primary: {
50: '#f3faeb',
100: '#e5f3d4',
200: '#cde8ae',
300: '#acd87e',
400: '#8ec655',
500: '#6ca635',
600: '#558828',
700: '#426823',
800: '#375420',
900: '#30481f',
950: '#17270c',
},
},
},
},
plugins: [],
}),
nesting,
autoprefixer,
],
},
};

View File

@@ -1,26 +0,0 @@
{
"name": "css-configuration",
"version": "1.0.0",
"description": "Some CSS settings for Vite/PostCSS that includes Tailwind",
"main": "index.js",
"type": "module",
"scripts": {
"types": "tsc --emitDeclarationOnly --allowJs --declaration --skipLibCheck index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/stevekinney/testing-javascript.git"
},
"author": "Steve Kinney <hello@stevekinney.net>",
"license": "MIT",
"bugs": {
"url": "https://github.com/stevekinney/testing-javascript/issues"
},
"homepage": "https://github.com/stevekinney/testing-javascript#readme",
"devDependencies": {
"autoprefixer": "^10.4.20",
"tailwindcss": "^3.4.12",
"typescript": "^5.6.2",
"vite": "^5.4.6"
}
}

View File

@@ -1,7 +0,0 @@
export type RequireOnly<T, Keys extends keyof T = keyof T> = Partial<T> &
Required<Pick<T, Keys>>;
export declare const isError: (error: unknown) => error is Error;
export declare const getErrorMessage: (
error: unknown,
defaultMessage: string,
) => string;

View File

@@ -1,16 +0,0 @@
/**
*
* @param {unknown} error The error object to check.
* @returns {error is Error}
*/
export const isError = (error) => error instanceof Error;
/**
* Get the error message from an error object or return a default message.
* @param {unknown} error The error object to check.
* @param {string} defaultMessage The default message to return if the error is not an instance of Error.
* @returns {string} The error message or the default message.
*/
export const getErrorMessage = (error, defaultMessage) => {
return isError(error) ? error.message : defaultMessage;
};