Skip to content

Commit

Permalink
refactor(*): don't package tests, bump deps, update eslint config
Browse files Browse the repository at this point in the history
full eslint config revamp and deps
  • Loading branch information
pauliesnug committed Dec 20, 2023
1 parent 6f7db92 commit 43034bb
Show file tree
Hide file tree
Showing 117 changed files with 2,373 additions and 1,787 deletions.
7 changes: 4 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"editor.formatOnSave": false,
// Auto fix
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": false
"source.fixAll.eslint": "explicit",
"source.organizeImports": "never"
},
// Silent the stylistic rules in you IDE, but still auto fix them
"eslint.rules.customizations": [
Expand All @@ -40,6 +40,7 @@
"json",
"jsonc",
"yaml",
"astro"
"astro",
"toml"
]
}
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ It is intended to be used within a project as a series of npm scripts.

```json
{
"devDependencies": {
"@flowr/petal": "^2.0.0"
},
"scripts": {
"build": "petal build",
"test": "petal test",
"lint": "petal lint",
"prepare": "petal prepare"
}
"devDependencies": {
"@flowr/petal": "^2.0.0"
},
"scripts": {
"build": "petal build",
"test": "petal test",
"lint": "petal lint",
"prepare": "petal prepare"
}
}
```

Expand Down
2 changes: 2 additions & 0 deletions configs/create-petal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"files": [
"!**/*.spec",
"!**/*.test.*",
"!**/*.ts.map",
"!**/*.tsbuildinfo",
"!**/test/**/*",
"CHANGELOG.md",
"LICENSE",
"README.md",
Expand Down
9 changes: 2 additions & 7 deletions configs/create-petal/src/actions/intro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ export async function intro(ctx: IntroContext) {
'welcome',
'to',
label('petal', color.bgMagenta, color.black),
Promise.resolve(ctx.version).then(
version =>
`${version ? color.green(`v${version}`) : ''},`,
),
Promise.resolve(ctx.username).then(
username => `${username}!`,
),
Promise.resolve(ctx.version).then(version => `${version ? color.green(`v${version}`) : ''} `),
Promise.resolve(ctx.username).then(username => `${username}!`),
],
random(welcome),
],
Expand Down
5 changes: 1 addition & 4 deletions configs/create-petal/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,7 @@ export function getVersion(packageManager: string) {

const { version } = await fetch(`${registry}/@flowr/petal/latest`, {
redirect: 'follow',
}).then(
res => res.json(),
() => ({ version: '' }),
);
}).then(res => res.json(), () => ({ version: '' }));

v = version;
resolve(version);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os from 'node:os';
import { describe, expect, it } from 'vitest';
import { getContext } from './context.js';
import { getContext } from '../src/actions/context.js';

describe('context', () => {
it('no arguments', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import { setup } from '../testUtils.js';
import { dependencies } from './deps.js';
import { dependencies } from '../src/actions/deps.js';
import { setup } from './testUtils.js';

describe('deps', () => {
const fixture = setup();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import { setup } from '../testUtils.js';
import { intro } from './intro.js';
import { intro } from '../src/actions/intro.js';
import { setup } from './testUtils.js';

describe('intro', () => {
const fixture = setup();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import { setup } from '../testUtils.js';
import { next } from './next-steps.js';
import { next } from '../src/actions/next-steps.js';
import { setup } from './testUtils.js';

describe('next steps', () => {
const fixture = setup();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import { setup } from '../testUtils.js';
import { projectName } from './project-name.js';
import { projectName } from '../src/actions/project-name.js';
import { setup } from './testUtils.js';

describe('project name', () => {
const fixture = setup();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import { setup } from '../testUtils.js';
import { template } from './template.js';
import { template } from '../src/actions/template.js';
import { setup } from './testUtils.js';

describe('template', () => {
const fixture = setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import process from 'node:process';
import type { Buffer } from 'node:buffer';
import stripAnsi from 'strip-ansi';
import { beforeAll, beforeEach } from 'vitest';
import { setStdout } from './messages.js';
import { setStdout } from '../src/messages.js';

export function setup() {
const ctx = { messages: new Array<string>() };
Expand Down Expand Up @@ -31,16 +31,16 @@ export function setup() {
}

function resetEmptyFixture() {
return fs.rm(new URL('../__fixtures__/empty/tsconfig.json', import.meta.url));
return fs.rm(new URL('./fixtures/empty/tsconfig.json', import.meta.url));
}

async function resetNotEmptyFixture() {
const packagePath = new URL(
'../__fixtures__/not-empty/package.json',
'./fixtures/not-empty/package.json',
import.meta.url,
);
const tsconfigPath = new URL(
'../__fixtures__/not-empty/tsconfig.json',
'./fixtures/not-empty/tsconfig.json',
import.meta.url,
);
const pkg = JSON.parse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { fileURLToPath } from 'node:url';
import { join } from 'node:path';
import { beforeEach, describe, expect, it } from 'vitest';

import { resetFixtures, setup } from '../testUtils.js';
import { setupTypescript, typescript } from './typescript.js';
import { setupTypescript, typescript } from '../src/actions/typescript.js';
import { resetFixtures, setup } from './testUtils.js';

describe('typescript', () => {
const fixture = setup();
Expand Down Expand Up @@ -94,7 +94,7 @@ describe('typescript: setup tsconfig', () => {
});

it('exists', async () => {
const root = new URL('../../__fixtures__/not-empty', import.meta.url);
const root = new URL('./fixtures/not-empty', import.meta.url);
const tsconfig = join(fileURLToPath(root), './tsconfig.json');
await setupTypescript('strict', { cwd: fileURLToPath(root) } as any);
expect(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
import { setup } from '../testUtils.js';
import { verify } from './verify.js';
import { verify } from '../src/actions/verify.js';
import { setup } from './testUtils.js';

describe('verify', () => {
const fixture = setup();
Expand Down
4 changes: 2 additions & 2 deletions configs/create-petal/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"extends": "@flowr/tsconfig",
"compilerOptions": {
"jsx": "preserve",
"types": ["node"],
"types": ["node"],
"noEmit": true,
"esModuleInterop": true,
"isolatedModules": false
},
"include": ["src"]
"include": ["src", "test/verify.test.ts", "test/typescript.test.ts", "test/template.test.ts", "test/project-name.test.ts", "test/next-steps.test.ts", "test/intro.test.ts", "test/deps.test.ts", "test/context.test.ts", "test/testUtils.ts"]
}
Loading

0 comments on commit 43034bb

Please sign in to comment.