Skip to content

Commit

Permalink
refactor: remove index file (#139)
Browse files Browse the repository at this point in the history
Co-authored-by: Almanov Nikita <131481562+nikkeyl@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and nikkeyl authored Aug 30, 2024
1 parent c4cf968 commit b02eb6b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ jobs:
- name: Install Dependencies
run: pnpm i

- name: Pretty
run: pnpm prettier index.d.ts --write

- name: Create Release
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
Expand Down
2 changes: 1 addition & 1 deletion lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default {
'*': 'prettier --write',
'src/index.ts': 'eslint --fix',
'src/**/*.ts': 'eslint --fix',
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"type": "module",
"types": "index.d.ts",
"imports": {
"#src": "./src/index.ts",
"#types": "./src/types/index.ts"
"#app": "./src/app.ts",
"#types/*": "./src/types/*"
},
"exports": {
".": "./index.js"
Expand Down
15 changes: 8 additions & 7 deletions rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ const sourceFolder = 'src';
const typesFolder = `${sourceFolder}/types`;

const fileFormat = 'es';
const fileName = 'index';
const entryFileName = 'app';
const outputFileName = 'index';

const declarationFile = `${fileName}.d.ts`;
const indexFile = `${fileName}.ts`;
const outputFile = `${fileName}.js`;
const declarationFile = `${outputFileName}.d.ts`;
const entryFile = `${entryFileName}.ts`;
const outputFile = `${outputFileName}.js`;

export default defineConfig([
{
plugins: [typescript(), minify()],
input: `${sourceFolder}/${indexFile}`,
input: `${sourceFolder}/${entryFile}`,
output: {
file: outputFile,
format: fileFormat,
Expand All @@ -33,13 +34,13 @@ export default defineConfig([
entries: [
{
find: '#types',
replacement: resolve(`${typesFolder}/${indexFile}`),
replacement: resolve(typesFolder),
},
],
}),
dts(),
],
input: `${sourceFolder}/${indexFile}`,
input: `${sourceFolder}/${entryFile}`,
output: {
file: declarationFile,
format: fileFormat,
Expand Down
4 changes: 2 additions & 2 deletions specs/define-config.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, expectTypeOf, test as spec } from 'vitest';

import { UserConfig } from '#types';
import { UserConfig } from '#types/user-config.ts';

import { defineConfig } from '#src';
import { defineConfig } from '#app';

describe('Semantic Release Config', () => {
spec('empty config', async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts → src/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UserConfig } from '#types';
import type { UserConfig } from '#types/user-config.ts';

/**
* Define an Semantic Release config.
Expand Down
1 change: 0 additions & 1 deletion src/types/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion tsconfig.node.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"module": "NodeNext",
"moduleResolution": "NodeNext",
"paths": {
"#types": ["./src/types/index.d.ts"]
"#types/*": ["./src/types/*"]
},
"rootDir": "src",
"types": ["vitest"],
Expand Down

0 comments on commit b02eb6b

Please sign in to comment.