From 3b2be791776034c8a7e7c63edec268c956128c4f Mon Sep 17 00:00:00 2001 From: Joshua Byrd Date: Tue, 5 Dec 2023 15:05:09 +1000 Subject: [PATCH 1/8] Build using local arunty --- package-lock.json | 224 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + test/test.js | 27 ++++-- 3 files changed, 246 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index b508979..696038f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -73,6 +73,7 @@ "nt": "src/bin/aunty.js" }, "devDependencies": { + "@types/jest": "^29.5.10", "babel-eslint": "^10.1.0", "eslint": "^7.7.0", "eslint-config-prettier": "^8.2.0", @@ -2322,6 +2323,27 @@ "node": ">= 10.14.2" } }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils/node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/@jest/fake-timers": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-26.6.2.tgz", @@ -2410,6 +2432,18 @@ "semver": "bin/semver.js" } }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/@jest/source-map": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-26.6.2.tgz", @@ -3334,6 +3368,12 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, "node_modules/@sindresorhus/is": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-5.6.0.tgz", @@ -3590,6 +3630,190 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/jest": { + "version": "29.5.10", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.10.tgz", + "integrity": "sha512-tE4yxKEphEyxj9s4inideLHktW/x6DwesIwWZ9NN1FKf9zbJYsnhBoA9vrHA/IuIOKwPa5PcFBNV4lpMIOEzyQ==", + "dev": true, + "dependencies": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "node_modules/@types/jest/node_modules/@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/@types/yargs": { + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", + "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/jest/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@types/jest/node_modules/ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/@types/jest/node_modules/diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", diff --git a/package.json b/package.json index 289bc1c..90b5a07 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "yeoman-generator": "^5.2.0" }, "devDependencies": { + "@types/jest": "^29.5.10", "babel-eslint": "^10.1.0", "eslint": "^7.7.0", "eslint-config-prettier": "^8.2.0", diff --git a/test/test.js b/test/test.js index f5d810c..7ea19b3 100644 --- a/test/test.js +++ b/test/test.js @@ -1,8 +1,8 @@ -const { _testBuild } = require('../src/cli/build'); const { _testGenerate } = require('../src/cli/generate'); const path = require('path'); const fs = require('fs/promises'); const mem = require('mem'); +const { execSync } = require('child_process'); const { getBuildConfig } = require('../src/config/build'); const { getBabelConfig } = require('../src/config/babel'); const { getProjectConfig } = require('../src/config/project'); @@ -63,11 +63,22 @@ afterAll(async () => { await rmRecursive(tempRoot); }); -['basic', 'react', 'preact', 'svelte'].forEach(template => { +[ + 'basic' + // 'react', + // 'preact', + // 'svelte' +].forEach(template => { describe(`${template} project`, () => { - [true, false].forEach(hasTypescript => { + [ + true + // false + ].forEach(hasTypescript => { describe(hasTypescript ? 'with typescript' : 'without typescript', () => { - [false, true].forEach(hasOdyssey => { + [ + false + // true + ].forEach(hasOdyssey => { describe(hasOdyssey ? 'with odyssey' : 'without odyssey', () => { const projectName = [ 'project', @@ -109,8 +120,12 @@ afterAll(async () => { it('should build the generated project', async () => { process.chdir(generatedProjectRoot); - // If the build fails for any reason this will throw. - await _testBuild(argv); + try { + let output = execSync('npx aunty build'); + console.log(output.toString()); + } catch (error) { + console.error(error.stdout.toString()); + } const fileList = await fs.readdir(path.join(generatedProjectRoot, '.aunty/build')); From 5bed070e24ffd122269fd142ebebc0015ad897c8 Mon Sep 17 00:00:00 2001 From: Joshua Byrd Date: Tue, 5 Dec 2023 15:05:58 +1000 Subject: [PATCH 2/8] Reinstate other projects --- test/test.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/test/test.js b/test/test.js index 7ea19b3..32bfa43 100644 --- a/test/test.js +++ b/test/test.js @@ -63,22 +63,11 @@ afterAll(async () => { await rmRecursive(tempRoot); }); -[ - 'basic' - // 'react', - // 'preact', - // 'svelte' -].forEach(template => { +['basic', 'react', 'preact', 'svelte'].forEach(template => { describe(`${template} project`, () => { - [ - true - // false - ].forEach(hasTypescript => { + [true, false].forEach(hasTypescript => { describe(hasTypescript ? 'with typescript' : 'without typescript', () => { - [ - false - // true - ].forEach(hasOdyssey => { + [false, true].forEach(hasOdyssey => { describe(hasOdyssey ? 'with odyssey' : 'without odyssey', () => { const projectName = [ 'project', From b8eb5c250d31f3f031ced3de9ce0f82fb0ae967f Mon Sep 17 00:00:00 2001 From: Joshua Byrd Date: Tue, 5 Dec 2023 15:08:14 +1000 Subject: [PATCH 3/8] Bump checkout to v4 as well and see what happens --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2126a9d..42a11c0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Test using Node.js uses: actions/setup-node@v4 with: From 1d46f1fc7847795292caae72c54bd4275c9753d0 Mon Sep 17 00:00:00 2001 From: Joshua Byrd Date: Tue, 5 Dec 2023 15:14:02 +1000 Subject: [PATCH 4/8] False verbatimModuleSyntax --- ts/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/config.json b/ts/config.json index 1720279..5f0d5ce 100644 --- a/ts/config.json +++ b/ts/config.json @@ -14,7 +14,7 @@ "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "allowSyntheticDefaultImports": true, - "verbatimModuleSyntax": true, + "verbatimModuleSyntax": false, "resolveJsonModule": true, "isolatedModules": true, "strictNullChecks": true From 2df45b99a1e25d880ba0defaa7902178dde5c303 Mon Sep 17 00:00:00 2001 From: Joshua Byrd Date: Tue, 5 Dec 2023 15:18:33 +1000 Subject: [PATCH 5/8] Let Jest handle the thrown error --- test/test.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/test.js b/test/test.js index 32bfa43..2972541 100644 --- a/test/test.js +++ b/test/test.js @@ -109,12 +109,9 @@ afterAll(async () => { it('should build the generated project', async () => { process.chdir(generatedProjectRoot); - try { - let output = execSync('npx aunty build'); - console.log(output.toString()); - } catch (error) { - console.error(error.stdout.toString()); - } + // Should throw an error on non-zero exit code + let output = execSync('npx aunty build'); + console.log(output.toString()); const fileList = await fs.readdir(path.join(generatedProjectRoot, '.aunty/build')); From c12244421f869dc257144848ade371f693c5d6b8 Mon Sep 17 00:00:00 2001 From: Joshua Byrd Date: Tue, 5 Dec 2023 16:31:58 +1000 Subject: [PATCH 6/8] Run npm link once only --- test/test.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/test/test.js b/test/test.js index 2972541..664670e 100644 --- a/test/test.js +++ b/test/test.js @@ -53,6 +53,9 @@ beforeAll(async () => { // Clean everything up await rmRecursive(tempRoot); await fs.mkdir(tempRoot); + + const linkOutput = execSync('npm link'); + console.log('Running: npm link', linkOutput.toString()); }); // Reset mocks @@ -109,9 +112,15 @@ afterAll(async () => { it('should build the generated project', async () => { process.chdir(generatedProjectRoot); - // Should throw an error on non-zero exit code - let output = execSync('npx aunty build'); - console.log(output.toString()); + { + const output = execSync('npm link @abcnews/aunty'); + console.log('Running: npm link @abcnews/aunty', output.toString()); + } + + { + const output = execSync('npx aunty build'); + console.log('Running: npx aunty build', output.toString()); + } const fileList = await fs.readdir(path.join(generatedProjectRoot, '.aunty/build')); From f1ba6ed990a7044a244a6b4176767d7b99c96697 Mon Sep 17 00:00:00 2001 From: Joshua Byrd Date: Wed, 6 Dec 2023 09:23:12 +1000 Subject: [PATCH 7/8] Minor remarks --- test/test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test.js b/test/test.js index 664670e..e39a9ef 100644 --- a/test/test.js +++ b/test/test.js @@ -54,6 +54,7 @@ beforeAll(async () => { await rmRecursive(tempRoot); await fs.mkdir(tempRoot); + // Link local aunty to global const linkOutput = execSync('npm link'); console.log('Running: npm link', linkOutput.toString()); }); @@ -112,6 +113,8 @@ afterAll(async () => { it('should build the generated project', async () => { process.chdir(generatedProjectRoot); + // execSync will throw on non-zero exit code + { const output = execSync('npm link @abcnews/aunty'); console.log('Running: npm link @abcnews/aunty', output.toString()); From 8b5a6ca4a7d336bb4c6cb99c1099f7a4b678111e Mon Sep 17 00:00:00 2001 From: Joshua Byrd Date: Wed, 6 Dec 2023 10:16:00 +1000 Subject: [PATCH 8/8] Add Ash to contributors --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 90b5a07..46cd7ff 100644 --- a/package.json +++ b/package.json @@ -6,9 +6,10 @@ "license": "MIT", "contributors": [ "Colin Gourlay ", - "Nathan Hoad ", "Simon Elvery ", - "Joshua Byrd " + "Joshua Byrd ", + "Ash Kyd ", + "Nathan Hoad" ], "scripts": { "postinstall": "node scripts/postinstall.js",