create-harper 1.4.3 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/package.json +1 -1
  2. package/template-react/eslint.config.js +23 -0
  3. package/template-react/package.json +11 -5
  4. package/template-react/src/App.jsx +2 -1
  5. package/template-react/src/counter.js +7 -0
  6. package/template-react/test/counter.test.js +15 -0
  7. package/template-react-ts/eslint.config.js +23 -0
  8. package/template-react-ts/package.json +12 -6
  9. package/template-react-ts/src/App.tsx +2 -1
  10. package/template-react-ts/src/counter.ts +7 -0
  11. package/template-react-ts/test/counter.test.ts +15 -0
  12. package/template-vanilla/eslint.config.js +23 -0
  13. package/template-vanilla/package.json +10 -4
  14. package/template-vanilla/test/counter.test.js +15 -0
  15. package/template-vanilla/web/counter.js +7 -0
  16. package/template-vanilla/web/index.html +1 -1
  17. package/template-vanilla/web/index.js +4 -2
  18. package/template-vanilla/web/styles.css +31 -31
  19. package/template-vanilla-ts/eslint.config.js +23 -0
  20. package/template-vanilla-ts/package.json +10 -4
  21. package/template-vanilla-ts/test/counter.test.js +15 -0
  22. package/template-vanilla-ts/web/counter.js +7 -0
  23. package/template-vanilla-ts/web/index.html +1 -1
  24. package/template-vanilla-ts/web/index.js +4 -2
  25. package/template-vanilla-ts/web/styles.css +31 -31
  26. package/template-vue/eslint.config.js +23 -0
  27. package/template-vue/package.json +13 -7
  28. package/template-vue/src/App.vue +2 -1
  29. package/template-vue/src/counter.js +7 -0
  30. package/template-vue/test/counter.test.js +15 -0
  31. package/template-vue-ts/eslint.config.js +23 -0
  32. package/template-vue-ts/package.json +15 -9
  33. package/template-vue-ts/src/App.vue +2 -1
  34. package/template-vue-ts/src/counter.ts +7 -0
  35. package/template-vue-ts/test/counter.test.ts +15 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-harper",
3
3
  "description": "Scaffold a new Harper project in JavaScript or TypeScript.",
4
- "version": "1.4.3",
4
+ "version": "1.4.5",
5
5
  "type": "module",
6
6
  "author": {
7
7
  "name": "HarperDB",
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+
4
+ export default [
5
+ js.configs.recommended,
6
+ {
7
+ languageOptions: {
8
+ globals: {
9
+ ...globals.browser,
10
+ ...globals.node,
11
+ },
12
+ ecmaVersion: 'latest',
13
+ sourceType: 'module',
14
+ },
15
+ rules: {
16
+ 'no-unused-vars': 'warn',
17
+ 'no-console': 'off',
18
+ },
19
+ },
20
+ {
21
+ ignores: ['node_modules/'],
22
+ },
23
+ ];
@@ -6,19 +6,25 @@
6
6
  "scripts": {
7
7
  "agent:run": "npx -y @harperfast/agent@latest",
8
8
  "agent:skills:update": "npx -y skills@latest add harperfast/skills --all --yes",
9
- "dev": "harper run .",
10
- "test": "echo 'No tests implemented yet'",
11
- "lint": "echo 'No lint implemented yet'",
9
+ "start": "harperdb run .",
10
+ "dev": "harperdb dev .",
11
+ "lint": "eslint .",
12
+ "format": "prettier --write .",
13
+ "test": "node --test test/*.test.js",
14
+ "test:watch": "node --watch --test test/*.test.js",
12
15
  "build": "vite build",
13
- "preview": "vite preview",
14
16
  "deploy": "rm -Rf deploy && npm run build && mkdir deploy && mv web deploy/ && cp -R deploy-template/* deploy/ && dotenv -- npm run deploy:component && rm -Rf deploy",
15
17
  "deploy:component": "(cd deploy && harperdb deploy_component . project=web restart=rolling replicated=true)"
16
18
  },
17
19
  "devDependencies": {
20
+ "@eslint/js": "^10.0.1",
18
21
  "@harperfast/vite-plugin": "^0.0.1",
19
22
  "@vitejs/plugin-react": "^5.1.2",
20
23
  "dotenv-cli": "^11.0.0",
21
- "harperdb": "^4.7.17",
24
+ "eslint": "^10.0.2",
25
+ "globals": "^17.4.0",
26
+ "harperdb": "^4.7.20",
27
+ "prettier": "^3.8.1",
22
28
  "react": "^19.2.4",
23
29
  "react-dom": "^19.2.4",
24
30
  "vite": "npm:rolldown-vite@7.3.1"
@@ -2,11 +2,12 @@ import reactLogo from '/react.svg';
2
2
  import typescriptLogo from '/typescript.svg';
3
3
  import viteLogo from '/vite.svg';
4
4
  import { useCallback, useState } from 'react';
5
+ import { increment } from './counter.js';
5
6
 
6
7
  export function App() {
7
8
  const [counter, setCounter] = useState(0);
8
9
  const countUp = useCallback(() => {
9
- setCounter(counter => counter + 1);
10
+ setCounter(counter => increment(counter));
10
11
  }, []);
11
12
 
12
13
  return (
@@ -0,0 +1,7 @@
1
+ export function increment(value) {
2
+ return value + 1;
3
+ }
4
+
5
+ export function decrement(value) {
6
+ return value - 1;
7
+ }
@@ -0,0 +1,15 @@
1
+ import assert from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { decrement, increment } from '../src/counter.js';
4
+
5
+ test('increment function', () => {
6
+ assert.strictEqual(increment(0), 1);
7
+ assert.strictEqual(increment(1), 2);
8
+ assert.strictEqual(increment(-1), 0);
9
+ });
10
+
11
+ test('decrement function', () => {
12
+ assert.strictEqual(decrement(0), -1);
13
+ assert.strictEqual(decrement(1), 0);
14
+ assert.strictEqual(decrement(-1), -2);
15
+ });
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+
4
+ export default [
5
+ js.configs.recommended,
6
+ {
7
+ languageOptions: {
8
+ globals: {
9
+ ...globals.browser,
10
+ ...globals.node,
11
+ },
12
+ ecmaVersion: 'latest',
13
+ sourceType: 'module',
14
+ },
15
+ rules: {
16
+ 'no-unused-vars': 'warn',
17
+ 'no-console': 'off',
18
+ },
19
+ },
20
+ {
21
+ ignores: ['node_modules/'],
22
+ },
23
+ ];
@@ -6,22 +6,28 @@
6
6
  "scripts": {
7
7
  "agent:run": "npx -y @harperfast/agent@latest",
8
8
  "agent:skills:update": "npx -y skills@latest add harperfast/skills --all --yes",
9
- "dev": "harper run .",
10
- "test": "echo 'No tests implemented yet'",
11
- "lint": "echo 'No lint implemented yet'",
12
- "build": "tsc -b && vite build",
13
- "preview": "vite preview",
9
+ "start": "harperdb run .",
10
+ "dev": "harperdb dev .",
11
+ "lint": "eslint .",
12
+ "format": "prettier --write .",
13
+ "test": "node --test test/*.test.ts",
14
+ "test:watch": "node --watch --test test/*.test.ts",
15
+ "build": "vite build",
14
16
  "deploy": "rm -Rf deploy && npm run build && mkdir deploy && mv web deploy/ && cp -R deploy-template/* deploy/ && dotenv -- npm run deploy:component && rm -Rf deploy",
15
17
  "deploy:component": "(cd deploy && harperdb deploy_component . project=web restart=rolling replicated=true)"
16
18
  },
17
19
  "devDependencies": {
20
+ "@eslint/js": "^10.0.1",
18
21
  "@harperfast/vite-plugin": "^0.0.1",
19
22
  "@types/node": "^24.10.1",
20
23
  "@types/react": "^19.2.10",
21
24
  "@types/react-dom": "^19.2.3",
22
25
  "@vitejs/plugin-react": "^5.1.2",
23
26
  "dotenv-cli": "^11.0.0",
24
- "harperdb": "^4.7.17",
27
+ "eslint": "^10.0.2",
28
+ "globals": "^17.4.0",
29
+ "harperdb": "^4.7.20",
30
+ "prettier": "^3.8.1",
25
31
  "react": "^19.2.4",
26
32
  "react-dom": "^19.2.4",
27
33
  "typescript": "~5.9.3",
@@ -1,12 +1,13 @@
1
1
  import reactLogo from '/react.svg';
2
2
  import typescriptLogo from '/typescript.svg';
3
3
  import viteLogo from '/vite.svg';
4
+ import { increment } from '@/counter.ts';
4
5
  import { useCallback, useState } from 'react';
5
6
 
6
7
  export function App() {
7
8
  const [counter, setCounter] = useState(0);
8
9
  const countUp = useCallback(() => {
9
- setCounter(counter => counter + 1);
10
+ setCounter((counter: number) => increment(counter));
10
11
  }, []);
11
12
 
12
13
  return (
@@ -0,0 +1,7 @@
1
+ export function increment(value: number) {
2
+ return value + 1;
3
+ }
4
+
5
+ export function decrement(value: number) {
6
+ return value - 1;
7
+ }
@@ -0,0 +1,15 @@
1
+ import { strictEqual } from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { decrement, increment } from '../src/counter.ts';
4
+
5
+ test('increment function', () => {
6
+ strictEqual(increment(0), 1);
7
+ strictEqual(increment(1), 2);
8
+ strictEqual(increment(-1), 0);
9
+ });
10
+
11
+ test('decrement function', () => {
12
+ strictEqual(decrement(0), -1);
13
+ strictEqual(decrement(1), 0);
14
+ strictEqual(decrement(-1), -2);
15
+ });
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+
4
+ export default [
5
+ js.configs.recommended,
6
+ {
7
+ languageOptions: {
8
+ globals: {
9
+ ...globals.browser,
10
+ ...globals.node,
11
+ },
12
+ ecmaVersion: 'latest',
13
+ sourceType: 'module',
14
+ },
15
+ rules: {
16
+ 'no-unused-vars': 'warn',
17
+ 'no-console': 'off',
18
+ },
19
+ },
20
+ {
21
+ ignores: ['node_modules/'],
22
+ },
23
+ ];
@@ -8,13 +8,19 @@
8
8
  "agent:skills:update": "npx -y skills@latest add harperfast/skills --all --yes",
9
9
  "start": "harperdb run .",
10
10
  "dev": "harperdb dev .",
11
+ "lint": "eslint .",
12
+ "format": "prettier --write .",
13
+ "test": "node --test test/*.test.js",
14
+ "test:watch": "node --watch --test test/*.test.js",
11
15
  "deploy": "dotenv -- npm run deploy:component",
12
- "deploy:component": "harperdb deploy_component . restart=rolling replicated=true",
13
- "test": "echo 'No tests implemented yet'",
14
- "lint": "echo 'No lint implemented yet'"
16
+ "deploy:component": "harperdb deploy_component . restart=rolling replicated=true"
15
17
  },
16
18
  "devDependencies": {
19
+ "@eslint/js": "^10.0.1",
17
20
  "dotenv-cli": "^11.0.0",
18
- "harperdb": "^4.7.15"
21
+ "eslint": "^10.0.2",
22
+ "globals": "^17.4.0",
23
+ "harperdb": "^4.7.20",
24
+ "prettier": "^3.8.1"
19
25
  }
20
26
  }
@@ -0,0 +1,15 @@
1
+ import assert from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { decrement, increment } from '../web/counter.js';
4
+
5
+ test('increment function', () => {
6
+ assert.strictEqual(increment(0), 1);
7
+ assert.strictEqual(increment(1), 2);
8
+ assert.strictEqual(increment(-1), 0);
9
+ });
10
+
11
+ test('decrement function', () => {
12
+ assert.strictEqual(decrement(0), -1);
13
+ assert.strictEqual(decrement(1), 0);
14
+ assert.strictEqual(decrement(-1), -2);
15
+ });
@@ -0,0 +1,7 @@
1
+ export function increment(value) {
2
+ return value + 1;
3
+ }
4
+
5
+ export function decrement(value) {
6
+ return value - 1;
7
+ }
@@ -23,6 +23,6 @@
23
23
  </div>
24
24
  </main>
25
25
 
26
- <script src="index.js"></script>
26
+ <script type="module" src="index.js"></script>
27
27
  </body>
28
28
  </html>
@@ -1,3 +1,5 @@
1
+ import { decrement, increment } from './counter.js';
2
+
1
3
  let count = 0;
2
4
  const counterDisplay = document.getElementById('count');
3
5
  const decrementButton = document.getElementById('decrement');
@@ -8,11 +10,11 @@ function updateDisplay() {
8
10
  }
9
11
 
10
12
  decrementButton.addEventListener('click', () => {
11
- count--;
13
+ count = decrement(count);
12
14
  updateDisplay();
13
15
  });
14
16
 
15
17
  incrementButton.addEventListener('click', () => {
16
- count++;
18
+ count = increment(count);
17
19
  updateDisplay();
18
20
  });
@@ -1,57 +1,57 @@
1
1
  body {
2
- font-family: Arial, sans-serif;
3
- display: flex;
4
- justify-content: center;
5
- align-items: center;
6
- height: 100vh;
7
- margin: 0;
8
- background-color: #f5f5f5;
2
+ font-family: Arial, sans-serif;
3
+ display: flex;
4
+ justify-content: center;
5
+ align-items: center;
6
+ height: 100vh;
7
+ margin: 0;
8
+ background-color: #f5f5f5;
9
9
  }
10
10
 
11
11
  main {
12
- text-align: center;
13
- background-color: white;
14
- padding: 2rem;
15
- border-radius: 8px;
16
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
12
+ text-align: center;
13
+ background-color: white;
14
+ padding: 2rem;
15
+ border-radius: 8px;
16
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
17
17
  }
18
18
 
19
19
  .count {
20
- font-size: 4rem;
21
- margin: 1rem 0;
22
- color: #333;
20
+ font-size: 4rem;
21
+ margin: 1rem 0;
22
+ color: #333;
23
23
  }
24
24
 
25
25
  .counter-controls {
26
- display: flex;
27
- justify-content: center;
28
- gap: 1rem;
26
+ display: flex;
27
+ justify-content: center;
28
+ gap: 1rem;
29
29
  }
30
30
 
31
31
  button {
32
- font-size: 1.5rem;
33
- width: 3rem;
34
- height: 3rem;
35
- border: none;
36
- border-radius: 50%;
37
- cursor: pointer;
38
- transition: background-color 0.2s;
32
+ font-size: 1.5rem;
33
+ width: 3rem;
34
+ height: 3rem;
35
+ border: none;
36
+ border-radius: 50%;
37
+ cursor: pointer;
38
+ transition: background-color 0.2s;
39
39
  }
40
40
 
41
41
  .decrement {
42
- background-color: #ff6b6b;
43
- color: white;
42
+ background-color: #ff6b6b;
43
+ color: white;
44
44
  }
45
45
 
46
46
  .decrement:hover {
47
- background-color: #ff5252;
47
+ background-color: #ff5252;
48
48
  }
49
49
 
50
50
  .increment {
51
- background-color: #4ecdc4;
52
- color: white;
51
+ background-color: #4ecdc4;
52
+ color: white;
53
53
  }
54
54
 
55
55
  .increment:hover {
56
- background-color: #39b2a9;
56
+ background-color: #39b2a9;
57
57
  }
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+
4
+ export default [
5
+ js.configs.recommended,
6
+ {
7
+ languageOptions: {
8
+ globals: {
9
+ ...globals.browser,
10
+ ...globals.node,
11
+ },
12
+ ecmaVersion: 'latest',
13
+ sourceType: 'module',
14
+ },
15
+ rules: {
16
+ 'no-unused-vars': 'warn',
17
+ 'no-console': 'off',
18
+ },
19
+ },
20
+ {
21
+ ignores: ['node_modules/'],
22
+ },
23
+ ];
@@ -8,13 +8,19 @@
8
8
  "agent:skills:update": "npx -y skills@latest add harperfast/skills --all --yes",
9
9
  "start": "harperdb run .",
10
10
  "dev": "harperdb dev .",
11
+ "lint": "eslint .",
12
+ "format": "prettier --write .",
13
+ "test": "node --test test/*.test.js",
14
+ "test:watch": "node --watch --test test/*.test.js",
11
15
  "deploy": "dotenv -- npm run deploy:component",
12
- "deploy:component": "harperdb deploy_component . restart=rolling replicated=true",
13
- "test": "echo 'No tests implemented yet'",
14
- "lint": "echo 'No lint implemented yet'"
16
+ "deploy:component": "harperdb deploy_component . restart=rolling replicated=true"
15
17
  },
16
18
  "devDependencies": {
19
+ "@eslint/js": "^10.0.1",
17
20
  "dotenv-cli": "^11.0.0",
18
- "harperdb": "^4.7.15"
21
+ "eslint": "^10.0.2",
22
+ "globals": "^17.4.0",
23
+ "harperdb": "^4.7.20",
24
+ "prettier": "^3.8.1"
19
25
  }
20
26
  }
@@ -0,0 +1,15 @@
1
+ import assert from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { decrement, increment } from '../web/counter.js';
4
+
5
+ test('increment function', () => {
6
+ assert.strictEqual(increment(0), 1);
7
+ assert.strictEqual(increment(1), 2);
8
+ assert.strictEqual(increment(-1), 0);
9
+ });
10
+
11
+ test('decrement function', () => {
12
+ assert.strictEqual(decrement(0), -1);
13
+ assert.strictEqual(decrement(1), 0);
14
+ assert.strictEqual(decrement(-1), -2);
15
+ });
@@ -0,0 +1,7 @@
1
+ export function increment(value) {
2
+ return value + 1;
3
+ }
4
+
5
+ export function decrement(value) {
6
+ return value - 1;
7
+ }
@@ -23,6 +23,6 @@
23
23
  </div>
24
24
  </main>
25
25
 
26
- <script src="index.js"></script>
26
+ <script type="module" src="index.js"></script>
27
27
  </body>
28
28
  </html>
@@ -1,3 +1,5 @@
1
+ import { decrement, increment } from './counter.js';
2
+
1
3
  let count = 0;
2
4
  const counterDisplay = document.getElementById('count');
3
5
  const decrementButton = document.getElementById('decrement');
@@ -8,11 +10,11 @@ function updateDisplay() {
8
10
  }
9
11
 
10
12
  decrementButton.addEventListener('click', () => {
11
- count--;
13
+ count = decrement(count);
12
14
  updateDisplay();
13
15
  });
14
16
 
15
17
  incrementButton.addEventListener('click', () => {
16
- count++;
18
+ count = increment(count);
17
19
  updateDisplay();
18
20
  });
@@ -1,57 +1,57 @@
1
1
  body {
2
- font-family: Arial, sans-serif;
3
- display: flex;
4
- justify-content: center;
5
- align-items: center;
6
- height: 100vh;
7
- margin: 0;
8
- background-color: #f5f5f5;
2
+ font-family: Arial, sans-serif;
3
+ display: flex;
4
+ justify-content: center;
5
+ align-items: center;
6
+ height: 100vh;
7
+ margin: 0;
8
+ background-color: #f5f5f5;
9
9
  }
10
10
 
11
11
  main {
12
- text-align: center;
13
- background-color: white;
14
- padding: 2rem;
15
- border-radius: 8px;
16
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
12
+ text-align: center;
13
+ background-color: white;
14
+ padding: 2rem;
15
+ border-radius: 8px;
16
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
17
17
  }
18
18
 
19
19
  .count {
20
- font-size: 4rem;
21
- margin: 1rem 0;
22
- color: #333;
20
+ font-size: 4rem;
21
+ margin: 1rem 0;
22
+ color: #333;
23
23
  }
24
24
 
25
25
  .counter-controls {
26
- display: flex;
27
- justify-content: center;
28
- gap: 1rem;
26
+ display: flex;
27
+ justify-content: center;
28
+ gap: 1rem;
29
29
  }
30
30
 
31
31
  button {
32
- font-size: 1.5rem;
33
- width: 3rem;
34
- height: 3rem;
35
- border: none;
36
- border-radius: 50%;
37
- cursor: pointer;
38
- transition: background-color 0.2s;
32
+ font-size: 1.5rem;
33
+ width: 3rem;
34
+ height: 3rem;
35
+ border: none;
36
+ border-radius: 50%;
37
+ cursor: pointer;
38
+ transition: background-color 0.2s;
39
39
  }
40
40
 
41
41
  .decrement {
42
- background-color: #ff6b6b;
43
- color: white;
42
+ background-color: #ff6b6b;
43
+ color: white;
44
44
  }
45
45
 
46
46
  .decrement:hover {
47
- background-color: #ff5252;
47
+ background-color: #ff5252;
48
48
  }
49
49
 
50
50
  .increment {
51
- background-color: #4ecdc4;
52
- color: white;
51
+ background-color: #4ecdc4;
52
+ color: white;
53
53
  }
54
54
 
55
55
  .increment:hover {
56
- background-color: #39b2a9;
56
+ background-color: #39b2a9;
57
57
  }
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+
4
+ export default [
5
+ js.configs.recommended,
6
+ {
7
+ languageOptions: {
8
+ globals: {
9
+ ...globals.browser,
10
+ ...globals.node,
11
+ },
12
+ ecmaVersion: 'latest',
13
+ sourceType: 'module',
14
+ },
15
+ rules: {
16
+ 'no-unused-vars': 'warn',
17
+ 'no-console': 'off',
18
+ },
19
+ },
20
+ {
21
+ ignores: ['node_modules/'],
22
+ },
23
+ ];
@@ -6,21 +6,27 @@
6
6
  "scripts": {
7
7
  "agent:run": "npx -y @harperfast/agent@latest",
8
8
  "agent:skills:update": "npx -y skills@latest add harperfast/skills --all --yes",
9
- "dev": "harper run .",
10
- "test": "echo 'No tests implemented yet'",
11
- "lint": "echo 'No lint implemented yet'",
9
+ "start": "harperdb run .",
10
+ "dev": "harperdb dev .",
11
+ "lint": "eslint .",
12
+ "format": "prettier --write .",
13
+ "test": "node --test test/*.test.js",
14
+ "test:watch": "node --watch --test test/*.test.js",
12
15
  "build": "vite build",
13
- "preview": "vite preview",
14
16
  "deploy": "rm -Rf deploy && npm run build && mkdir deploy && mv web deploy/ && cp -R deploy-template/* deploy/ && dotenv -- npm run deploy:component && rm -Rf deploy",
15
17
  "deploy:component": "(cd deploy && harperdb deploy_component . project=web restart=rolling replicated=true)"
16
18
  },
17
19
  "devDependencies": {
20
+ "@eslint/js": "^10.0.1",
18
21
  "@harperfast/vite-plugin": "^0.0.1",
19
- "@vitejs/plugin-vue": "^6.0.0",
22
+ "@vitejs/plugin-vue": "^6.0.4",
20
23
  "dotenv-cli": "^11.0.0",
21
- "harperdb": "^4.7.17",
24
+ "eslint": "^10.0.2",
25
+ "globals": "^17.4.0",
26
+ "harperdb": "^4.7.20",
27
+ "prettier": "^3.8.1",
22
28
  "vite": "npm:rolldown-vite@7.3.1",
23
- "vue": "^3.5.13"
29
+ "vue": "^3.5.29"
24
30
  },
25
31
  "overrides": {
26
32
  "vite": "npm:rolldown-vite@7.3.1"
@@ -3,10 +3,11 @@ import typescriptLogo from '/typescript.svg';
3
3
  import viteLogo from '/vite.svg';
4
4
  import vueLogo from '/vue.svg';
5
5
  import { ref } from 'vue';
6
+ import { increment } from './counter.js';
6
7
 
7
8
  const counter = ref(0);
8
9
  const countUp = () => {
9
- counter.value++;
10
+ counter.value = increment(counter.value);
10
11
  };
11
12
  </script>
12
13
 
@@ -0,0 +1,7 @@
1
+ export function increment(value) {
2
+ return value + 1;
3
+ }
4
+
5
+ export function decrement(value) {
6
+ return value - 1;
7
+ }
@@ -0,0 +1,15 @@
1
+ import assert from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { decrement, increment } from '../src/counter.js';
4
+
5
+ test('increment function', () => {
6
+ assert.strictEqual(increment(0), 1);
7
+ assert.strictEqual(increment(1), 2);
8
+ assert.strictEqual(increment(-1), 0);
9
+ });
10
+
11
+ test('decrement function', () => {
12
+ assert.strictEqual(decrement(0), -1);
13
+ assert.strictEqual(decrement(1), 0);
14
+ assert.strictEqual(decrement(-1), -2);
15
+ });
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js';
2
+ import globals from 'globals';
3
+
4
+ export default [
5
+ js.configs.recommended,
6
+ {
7
+ languageOptions: {
8
+ globals: {
9
+ ...globals.browser,
10
+ ...globals.node,
11
+ },
12
+ ecmaVersion: 'latest',
13
+ sourceType: 'module',
14
+ },
15
+ rules: {
16
+ 'no-unused-vars': 'warn',
17
+ 'no-console': 'off',
18
+ },
19
+ },
20
+ {
21
+ ignores: ['node_modules/'],
22
+ },
23
+ ];
@@ -6,24 +6,30 @@
6
6
  "scripts": {
7
7
  "agent:run": "npx -y @harperfast/agent@latest",
8
8
  "agent:skills:update": "npx -y skills@latest add harperfast/skills --all --yes",
9
- "dev": "harper run .",
10
- "test": "echo 'No tests implemented yet'",
11
- "lint": "echo 'No lint implemented yet'",
12
- "build": "vue-tsc && vite build",
13
- "preview": "vite preview",
9
+ "start": "harperdb run .",
10
+ "dev": "harperdb dev .",
11
+ "lint": "eslint .",
12
+ "format": "prettier --write .",
13
+ "test": "node --test test/*.test.ts",
14
+ "test:watch": "node --watch --test test/*.test.ts",
15
+ "build": "vite build",
14
16
  "deploy": "rm -Rf deploy && npm run build && mkdir deploy && mv web deploy/ && cp -R deploy-template/* deploy/ && dotenv -- npm run deploy:component && rm -Rf deploy",
15
17
  "deploy:component": "(cd deploy && harperdb deploy_component . project=web restart=rolling replicated=true)"
16
18
  },
17
19
  "devDependencies": {
20
+ "@eslint/js": "^10.0.1",
18
21
  "@harperfast/vite-plugin": "^0.0.1",
19
22
  "@types/node": "^24.10.1",
20
- "@vitejs/plugin-vue": "^6.0.0",
23
+ "@vitejs/plugin-vue": "^6.0.4",
21
24
  "dotenv-cli": "^11.0.0",
22
- "harperdb": "^4.7.17",
25
+ "eslint": "^10.0.2",
26
+ "globals": "^17.4.0",
27
+ "harperdb": "^4.7.20",
28
+ "prettier": "^3.8.1",
23
29
  "typescript": "~5.9.3",
24
30
  "vite": "npm:rolldown-vite@7.3.1",
25
- "vue": "^3.5.13",
26
- "vue-tsc": "^2.2.0"
31
+ "vue": "^3.5.29",
32
+ "vue-tsc": "^3.2.5"
27
33
  },
28
34
  "overrides": {
29
35
  "vite": "npm:rolldown-vite@7.3.1"
@@ -2,11 +2,12 @@
2
2
  import typescriptLogo from '/typescript.svg';
3
3
  import viteLogo from '/vite.svg';
4
4
  import vueLogo from '/vue.svg';
5
+ import { increment } from '@/counter.ts';
5
6
  import { ref } from 'vue';
6
7
 
7
8
  const counter = ref(0);
8
9
  const countUp = () => {
9
- counter.value++;
10
+ counter.value = increment(counter.value);
10
11
  };
11
12
  </script>
12
13
 
@@ -0,0 +1,7 @@
1
+ export function increment(value: number) {
2
+ return value + 1;
3
+ }
4
+
5
+ export function decrement(value: number) {
6
+ return value - 1;
7
+ }
@@ -0,0 +1,15 @@
1
+ import { strictEqual } from 'node:assert/strict';
2
+ import { test } from 'node:test';
3
+ import { decrement, increment } from '../src/counter.ts';
4
+
5
+ test('increment function', () => {
6
+ strictEqual(increment(0), 1);
7
+ strictEqual(increment(1), 2);
8
+ strictEqual(increment(-1), 0);
9
+ });
10
+
11
+ test('decrement function', () => {
12
+ strictEqual(decrement(0), -1);
13
+ strictEqual(decrement(1), 0);
14
+ strictEqual(decrement(-1), -2);
15
+ });