Skip to content

Commit

Permalink
build(api.js): simplify output JS files (#8025)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Nogueira <[email protected]>
  • Loading branch information
amrbashir and lucasfernog authored Oct 23, 2023
1 parent 93c8a77 commit a0f7b88
Show file tree
Hide file tree
Showing 23 changed files with 833 additions and 1,314 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: yarn
Expand All @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: yarn
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ dist
/tooling/cli/node
/tooling/cli/schema.json
/core/tauri-config-schema/schema.json
CHANGELOG.md
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"semi": false,
"trailingComma": "none"
}
9 changes: 0 additions & 9 deletions .prettierrc.js

This file was deleted.

6 changes: 4 additions & 2 deletions .scripts/ci/check-license-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ const ignore = [
'node_modules',
'gen',
'dist',
'bundle.js',
'bundle.global.js'
]

async function checkFile(file) {
if (extensions.some((e) => file.endsWith(e)) && !ignore.some((i) => file.includes(`/${i}/`))) {
if (
extensions.some((e) => file.endsWith(e)) &&
!ignore.some((i) => file.includes(`/${i}/`) || path.basename(file) == i)
) {
const fileStream = fs.createReadStream(file)
const rl = readline.createInterface({
input: fileStream,
Expand Down
3 changes: 1 addition & 2 deletions core/tauri/scripts/bundle.global.js

Large diffs are not rendered by default.

78 changes: 39 additions & 39 deletions examples/api/dist/assets/index.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions examples/api/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"url": "https://github.com/tauri-apps/tauri.git"
},
"scripts": {
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .prettierignore",
"format": "prettier --write . --config .prettierrc --ignore-path .prettierignore",
"format:check": "prettier --check . --config .prettierrc --ignore-path .prettierignore",
"postinstall": "husky install"
},
"devDependencies": {
Expand Down
53 changes: 53 additions & 0 deletions tooling/api/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"root": true,

"env": {
"node": true,
"jest": true
},

"parser": "@typescript-eslint/parser",

"extends": [
"standard-with-typescript",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
// TODO: make this work with typescript
// "plugin:node/recommended"
"prettier"
],

"plugins": ["@typescript-eslint", "node", "security"],

"parserOptions": {
"project": "./tsconfig.json"
},

"globals": {
"__statics": true,
"process": true
},

// add your custom rules here
"rules": {
"no-console": "error",
"no-debugger": "error",
"no-process-exit": "off",
"security/detect-non-literal-fs-filename": "warn",
"security/detect-unsafe-regex": "error",
"security/detect-buffer-noassert": "error",
"security/detect-child-process": "warn",
"security/detect-disable-mustache-escape": "error",
"security/detect-eval-with-expression": "error",
"security/detect-no-csrf-before-method-override": "error",
"security/detect-non-literal-regexp": "error",
"security/detect-non-literal-require": "warn",
"security/detect-object-injection": "warn",
"security/detect-possible-timing-attacks": "error",
"security/detect-pseudoRandomBytes": "error",
"space-before-function-paren": "off",
"@typescript-eslint/default-param-last": "off",
"@typescript-eslint/strict-boolean-expressions": 0,
"no-return-await": "warn",
"@typescript-eslint/return-await": "off"
}
}
56 changes: 0 additions & 56 deletions tooling/api/.eslintrc.cjs

This file was deleted.

4 changes: 0 additions & 4 deletions tooling/api/.npmignore

This file was deleted.

5 changes: 0 additions & 5 deletions tooling/api/.prettierrc.cjs

This file was deleted.

58 changes: 27 additions & 31 deletions tooling/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,10 @@
"name": "@tauri-apps/api",
"version": "2.0.0-alpha.9",
"description": "Tauri API definitions",
"type": "module",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/tauri"
},
"exports": {
"./package.json": "./package.json"
},
"scripts": {
"build": "yarn tsup && node ./scripts/after-build.cjs",
"npm-pack": "yarn build && cd ./dist && npm pack",
"npm-publish": "yarn build && cd ./dist && yarn publish --access public --loglevel silly --tag next",
"lint": "eslint --ext ts \"./src/**/*.ts\"",
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
"format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path ../../.prettierignore",
"format:check": "prettier --check --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path ../../.prettierignore"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tauri-apps/tauri.git"
Expand All @@ -31,34 +18,43 @@
"url": "https://github.com/tauri-apps/tauri/issues"
},
"homepage": "https://github.com/tauri-apps/tauri#readme",
"publishConfig": {
"access": "public"
},
"engines": {
"node": ">= 18",
"npm": ">= 6.6.0",
"yarn": ">= 1.19.1"
"type": "module",
"scripts": {
"build": "yarn rollup --config rollup.config.ts --configPlugin typescript",
"npm-pack": "yarn build && cd ./dist && npm pack",
"npm-publish": "yarn build && cd ./dist && yarn publish --access public --loglevel silly --tag next",
"check": "tsc",
"lint": "eslint --ext ts \"./src/**/*.ts\"",
"lint:fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
"format": "prettier --write . --config ../../.prettierrc --ignore-path .gitignore --ignore-path ../../.prettierignore",
"format:check": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore --ignore-path ../../.prettierignore"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "6.8.0",
"@typescript-eslint/parser": "6.8.0",
"eslint": "8.51.0",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "11.1.5",
"@types/node": "20.8.7",
"@typescript-eslint/eslint-plugin": "6.9.0",
"@typescript-eslint/parser": "6.9.0",
"eslint": "8.52.0",
"eslint-config-prettier": "9.0.0",
"eslint-config-standard-with-typescript": "39.1.1",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-import": "2.29.0",
"eslint-plugin-n": "16.2.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-security": "1.7.1",
"fast-glob": "3.3.1",
"prettier": "3.0.3",
"tsup": "7.2.0",
"typedoc": "0.25.2",
"typedoc-plugin-markdown": "3.16.0",
"typedoc-plugin-mdn-links": "3.1.0",
"rollup": "4.1.4",
"tslib": "2.6.2",
"typescript": "5.2.2"
},
"resolutions": {
"semver": ">=7.5.2",
"optionator": ">=0.9.3"
"exports": {
"./package.json": "./package.json"
},
"engines": {
"node": ">= 18",
"npm": ">= 6.6.0",
"yarn": ">= 1.19.1"
}
}
Loading

0 comments on commit a0f7b88

Please sign in to comment.