Skip to content

Commit

Permalink
fix: compile with tsup, fix import in vite
Browse files Browse the repository at this point in the history
Prevent "exports is not defined in ES module scope" error
  • Loading branch information
IlyaSemenov committed Feb 18, 2022
1 parent 4eb2505 commit 8862b1d
Show file tree
Hide file tree
Showing 30 changed files with 3,971 additions and 3,928 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ charset = utf-8
indent_style = tab
indent_size = 2

[*.{json,yml,md}]
[{package.json,*.md,*.yml}]
indent_style = space
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
!.eslintrc.js
/dist/
!.eslintrc.js
7 changes: 3 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@ module.exports = {
'plugin:prettier/recommended',
],
plugins: ['simple-import-sort'],
env: {
node: true,
},
rules: {
'prettier/prettier': 'warn',
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
overrides: [
{
files: ['*.js'],
files: '*.js',
rules: {
'@typescript-eslint/no-var-requires': 'off',
},
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: c-hive/gha-yarn-cache@v2
- run: yarn --frozen-lockfile
- run: yarn build
- run: yarn test

- uses: pnpm/[email protected]
with:
version: 6.31.0

- uses: actions/setup-node@v2
with:
node-version: "14"
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm test

- uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 18.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/dist/
/node_modules/
.nyc_output
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install commitlint --edit $1
npx --no -- commitlint --edit $1
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install lint-staged
npx lint-staged
5 changes: 0 additions & 5 deletions .lintstagedrc.json

This file was deleted.

1 change: 0 additions & 1 deletion .node-version

This file was deleted.

5 changes: 5 additions & 0 deletions .taprc
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
coverage: false
node-arg:
[
"-r",
"esbuild-runner/register",
]
3 changes: 3 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'*.{js,ts}': 'eslint --fix',
}
70 changes: 36 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{
"name": "data-cleaner",
"description": "Django-forms-inspired object data cleaner and validator for Node.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"source": "src/index.ts",
"files": [
"src/**",
"dist/**"
],
"version": "0.0.0-development",
"repository": {
"type": "git",
"url": "https://github.com/IlyaSemenov/node-data-cleaner.git"
Expand All @@ -17,36 +11,44 @@
],
"author": "Ilya Semenov",
"license": "MIT",
"bugs": {
"url": "https://github.com/IlyaSemenov/node-data-cleaner/issues"
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"source": "src/index.ts",
"files": [
"dist",
"src",
"!src/**/*.test.*"
],
"scripts": {
"build": "tsup",
"lint": "eslint --fix '**/*.{js,ts}'",
"prepack": "npm run build",
"prepare": "husky install",
"test": "tap 'tests/**/*.test.js'"
},
"homepage": "https://github.com/IlyaSemenov/node-data-cleaner#readme",
"dependencies": {
"capital-case": "^1.0.4",
"email-validator": "^2.0.4"
"capital-case": "1.0.4",
"email-validator": "2.0.4"
},
"devDependencies": {
"@commitlint/cli": "^12.1.4",
"@commitlint/config-conventional": "^12.1.4",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"eslint": "^7.29.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"husky": "^6.0.0",
"lint-staged": "^11.0.0",
"prettier": "^2.3.1",
"rollup": "^2.29.0",
"rollup-plugin-cleaner": "^1.0.0",
"rollup-plugin-typescript2": "^0.27.3",
"tap": "^15.0.9",
"typescript": "^4.0.3"
},
"scripts": {
"build": "rollup -c",
"lint": "eslint --fix '**/*.{js,ts}'",
"prepare": "husky install",
"test": "tap 'test/**/*.test.js'"
"@commitlint/cli": "16.1.0",
"@commitlint/config-conventional": "16.0.0",
"@tsconfig/node14": "1.0.1",
"@types/tap": "15.0.5",
"@typescript-eslint/eslint-plugin": "5.11.0",
"@typescript-eslint/parser": "5.11.0",
"esbuild": "0.14.21",
"esbuild-runner": "2.2.1",
"eslint": "8.8.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-simple-import-sort": "7.0.0",
"husky": "7.0.4",
"lint-staged": "12.3.3",
"prettier": "2.5.1",
"tap": "15.1.6",
"tsup": "5.11.13",
"typescript": "4.5.5"
}
}
Loading

0 comments on commit 8862b1d

Please sign in to comment.