diff --git a/.changeset/metal-geckos-retire.md b/.changeset/metal-geckos-retire.md new file mode 100644 index 0000000..93652c4 --- /dev/null +++ b/.changeset/metal-geckos-retire.md @@ -0,0 +1,5 @@ +--- +'svelte-podcast': minor +--- + +Updates dependencies diff --git a/.changeset/strange-dolls-burn.md b/.changeset/strange-dolls-burn.md index 6ef213c..665fa94 100644 --- a/.changeset/strange-dolls-burn.md +++ b/.changeset/strange-dolls-burn.md @@ -7,6 +7,6 @@ Improves developer logs Fixes various package export issues Adds player components: -- Player: `` -- Player: `` -- Utility: `` +- Player: `` +- Player: `` +- Utility: `` diff --git a/.eslintignore b/.eslintignore index 83c0f24..097a7e6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -13,4 +13,8 @@ pnpm-lock.yaml package-lock.json yarn.lock -**/components/_* \ No newline at end of file +**/components/_* + +*.config.ts +*.config.js +*.config.cjs \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 11273fe..4951171 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -1,8 +1,13 @@ module.exports = { root: true, parser: '@typescript-eslint/parser', - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'], - plugins: ['svelte3', '@typescript-eslint'], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + // 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'prettier', + ], + plugins: ['svelte3', '@typescript-eslint', 'unused-imports'], ignorePatterns: ['*.cjs'], overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], settings: { @@ -11,6 +16,7 @@ module.exports = { parserOptions: { sourceType: 'module', ecmaVersion: 2020, + project: ['./tsconfig.json'], }, env: { browser: true, @@ -18,6 +24,15 @@ module.exports = { node: true, }, rules: { - 'no-restricted-imports': ['error', { patterns: ['$lib', '$lib/*'] }], + // '@typescript-eslint/no-inferrable-types': 'off', + // '@typescript-eslint/no-unsafe-argument': 'off', + // '@typescript-eslint/no-unsafe-assignment': 'off', + 'logical-assignment-operators': ['error', 'always'], + // "no-unused-vars": "off", + 'unused-imports/no-unused-imports': 'error', + 'unused-imports/no-unused-vars': [ + 'warn', + { vars: 'all', varsIgnorePattern: '^_', args: 'after-used', argsIgnorePattern: '^_' }, + ], }, }; diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c39b103..25307fc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,32 +1,129 @@ name: 'CI' on: - push: - branches: - - main - pull_request: - -env: - # we call `pnpm playwright install` instead - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' + push: + branches: + - main + pull_request: # cancel in-progress runs on new commits to same PR (gitub.event.number) concurrency: - group: ${{ github.workflow }}-${{ github.event.number || github.sha }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true permissions: - contents: read # to fetch code (actions/checkout) + contents: read # to fetch code (actions/checkout) jobs: - Lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2.2.4 - - uses: actions/setup-node@v3 - with: - node-version: '16.x' - cache: pnpm - - run: pnpm install --frozen-lockfile - - run: pnpm run lint - - run: pnpm run check + setup: + name: Setup Enviroment + timeout-minutes: 4 + runs-on: ubuntu-latest + outputs: + cache_name: ${{ steps.cache.outputs.name }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set Node to v18.13.0 + uses: actions/setup-node@v3 + with: + node-version: v18.13.0 + + - name: Get Node version + id: node + run: echo "version=$(node -v)" >> $GITHUB_OUTPUT + #run: echo "::set-output name=version::$(node --v)" + + - name: Get Cache Name + id: cache + run: echo "name=${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ steps.node.outputs.version }}" >> $GITHUB_OUTPUT + + - name: Get node_modules cache + uses: actions/cache@v3 + id: node_modules + with: + path: | + **/node_modules + **/.svelte-kit + + key: ${{ steps.cache.outputs.name }} + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Sync generated typings + run: yarn run sync + + linting: + name: Linting Checks + needs: setup + timeout-minutes: 4 + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Get node_modules cache + uses: actions/cache/restore@v3 + id: cache + with: + path: | + **/node_modules + **/.svelte-kit + key: ${{ needs.setup.outputs.cache_name }} + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Lint prettier + run: yarn run lint:prettier + + - name: Lint eslint + run: yarn run lint:eslint + + type_check: + name: Typescript Checks + needs: setup + timeout-minutes: 4 + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Get node_modules cache + uses: actions/cache/restore@v3 + id: cache + with: + path: | + **/node_modules + **/.svelte-kit + key: ${{ needs.setup.outputs.cache_name }} + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Check for type errors + run: yarn run ts +# svelte_check: +# name: Svelte Checks +# needs: setup +# timeout-minutes: 4 +# runs-on: ubuntu-latest +# steps: +# - name: Checkout code +# uses: actions/checkout@v3 +# +# - name: Get node_modules cache +# uses: actions/cache/restore@v3 +# id: cache +# with: +# path: | +# **/node_modules +# **/.svelte-kit +# key: ${{ needs.setup.outputs.cache_name }} +# +# - name: Install dependencies +# run: yarn install --frozen-lockfile +# +# - name: Check for best practices +# run: yarn run check diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 72dfc00..7b0c41e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,42 +1,87 @@ name: 'Publish to NPM' on: - push: - branches: - - 'main' + push: + branches: + - 'main' concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: - release: - # prevents this action from running on forks - if: github.repository == 'OllieJT/svelte-podcast' - permissions: - contents: write # to create release (changesets/action) - pull-requests: write # to create pull request (changesets/action) - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v3 - with: - # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits - fetch-depth: 0 - - uses: pnpm/action-setup@v2.2.4 - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: 16.x - cache: pnpm + setup: + name: Setup Enviroment + timeout-minutes: 4 + runs-on: ubuntu-latest + outputs: + cache_name: ${{ steps.cache.outputs.name }} + steps: + - name: Checkout code + uses: actions/checkout@v3 - - run: pnpm install --frozen-lockfile + - name: Set Node to v18.13.0 + uses: actions/setup-node@v3 + with: + node-version: v18.13.0 - - name: Create Release Pull Request or Publish to npm - id: changesets - uses: changesets/action@v1 - with: - # This expects you to have a script called release which does a build for your packages and calls changeset publish - publish: pnpm release - env: - GITHUB_TOKEN: ${{ secrets.TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - UPDATE_TEMPLATE_SSH_KEY: ${{ secrets.UPDATE_TEMPLATE_SSH_KEY }} + - name: Get Node version + id: node + run: echo "version=$(node -v)" >> $GITHUB_OUTPUT + #run: echo "::set-output name=version::$(node --v)" + + - name: Get Cache Name + id: cache + run: echo "name=${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ steps.node.outputs.version }}" >> $GITHUB_OUTPUT + + - name: Get node_modules cache + uses: actions/cache@v3 + id: node_modules + with: + path: | + **/node_modules + **/.svelte-kit + + key: ${{ steps.cache.outputs.name }} + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Sync generated typings + run: yarn run sync + release: + if: github.repository == 'OllieJT/svelte-podcast' + name: Release + needs: setup + timeout-minutes: 5 + runs-on: ubuntu-latest + # prevents this action from running on forks + permissions: + contents: write # to create release (changesets/action) + pull-requests: write # to create pull request (changesets/action) + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits + fetch-depth: 0 + + - name: Get node_modules cache + uses: actions/cache/restore@v3 + id: cache + with: + path: | + **/node_modules + **/.svelte-kit + key: ${{ needs.setup.outputs.cache_name }} + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + # This expects you to have a script called release which does a build for your packages and calls changeset publish + publish: yarn release + env: + GITHUB_TOKEN: ${{ secrets.TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + UPDATE_TEMPLATE_SSH_KEY: ${{ secrets.UPDATE_TEMPLATE_SSH_KEY }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index 10bc60f..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,123 +0,0 @@ -name: 'CI' -on: - push: - branches: - - todo - -env: - # we call `pnpm playwright install` instead - PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' - -# cancel in-progress runs on new commits to same PR (gitub.event.number) -concurrency: - group: ${{ github.workflow }}-${{ github.event.number || github.sha }} - cancel-in-progress: true - -permissions: - contents: read # to fetch code (actions/checkout) - -jobs: - Lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2.2.4 - - uses: actions/setup-node@v3 - with: - node-version: '16.x' - cache: pnpm - - run: pnpm install --frozen-lockfile - - run: pnpm run lint - - run: pnpm run check - Tests: - runs-on: ${{ matrix.os }} - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - include: - - node-version: 16 - os: ubuntu-latest - e2e-browser: 'chromium' - - node-version: 18 - os: ubuntu-latest - e2e-browser: 'chromium' - env: - KIT_E2E_BROWSER: ${{matrix.e2e-browser}} - steps: - - run: git config --global core.autocrlf false - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2.2.4 - - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: pnpm - - run: pnpm install --frozen-lockfile - - run: pnpm playwright install ${{ matrix.e2e-browser }} - - run: pnpm test - - name: Archive test results - if: failure() - shell: bash - run: find packages -type d -name test-results -not -empty | tar -czf test-results.tar.gz --files-from=- - - name: Upload test results - if: failure() - uses: actions/upload-artifact@v3 - with: - retention-days: 3 - name: test-failure-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }} - path: test-results.tar.gz - Cross-browser-test: - runs-on: ${{ matrix.os }} - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - include: - - node-version: 16 - os: windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166 - e2e-browser: 'chromium' - mode: 'dev' - - node-version: 16 - os: ubuntu-latest - e2e-browser: 'firefox' - mode: 'dev' - - node-version: 16 - os: macOS-latest - e2e-browser: 'webkit' - mode: 'dev' - - node-version: 16 - os: windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166 - e2e-browser: 'chromium' - mode: 'build' - - node-version: 16 - os: ubuntu-latest - e2e-browser: 'firefox' - mode: 'build' - - node-version: 16 - os: macOS-latest - e2e-browser: 'webkit' - mode: 'build' - env: - KIT_E2E_BROWSER: ${{matrix.e2e-browser}} - steps: - - run: git config --global core.autocrlf false - - uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2.2.4 - - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: pnpm - - run: pnpm install --frozen-lockfile - - run: pnpm playwright install ${{ matrix.e2e-browser }} - - run: pnpm test:cross-platform:${{ matrix.mode }} - - name: Archive test results - if: failure() - shell: bash - run: find packages -type d -name test-results -not -empty | tar -czf test-results-cross-platform-${{ matrix.mode }}.tar.gz --files-from=- - - name: Upload test results - if: failure() - uses: actions/upload-artifact@v3 - with: - retention-days: 3 - name: test-failure-cross-platform-${{ matrix.mode }}-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }} - path: test-results-cross-platform-${{ matrix.mode }}.tar.gz diff --git a/.prettierrc b/.prettierrc index 1d5daee..7bd91b3 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,12 +1,18 @@ { - "useTabs": true, - "singleQuote": true, - "trailingComma": "all", "printWidth": 100, "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], - "svelteSortOrder": "options-scripts-styles-markup", - "svelteBracketNewLine": true, - "svelteIndentScriptAndStyle": true, - "pluginSearchDirs": ["."], - "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] + "arrowParens": "always", + "bracketSpacing": true, + "bracketSameLine": false, + "semi": true, + "singleQuote": true, + "useTabs": true, + "tabWidth": 3, + "trailingComma": "all", + "overrides": [ + { + "files": "*.svelte", + "options": { "parser": "svelte" } + } + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 886822e..d16cc42 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,18 +1,31 @@ { - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnType": false, - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.fixAll.eslint": true, - "source.organizeImports": true + "[svelte]": { + "editor.defaultFormatter": "svelte.svelte-vscode", + "editor.codeActionsOnSave": { + "source.organizeImports": true + } }, - "eslint.packageManager": "pnpm", - "eslint.validate": ["javascript", "javascriptreact", "typescript", "typescriptreact", "svelte"], + "[typescript]": { + "editor.codeActionsOnSave": { + "source.organizeImports": true + } + }, + "eslint.rules.customizations": [{ "rule": "*", "severity": "warn" }], + "typescript.tsdk": "node_modules/typescript/lib", + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.formatOnType": false, "files.exclude": { + "**/.cache": true, "**/.DS_Store": true, + "**/.gitattributes": true, + "**/.svelte-kit": true, "**/*-lock.*": true, "**/*.Identifier": true, + "**/*.map": true, + "**/.turbo": true, "**/.vercel": true, + "**/dist": true, "**/node_modules": true, "**/tsconfig.tsbuildinfo": true, "**/.npmrc": true @@ -21,9 +34,5 @@ "**/node_modules": true, "**/.svelte-kit": true }, - "problems.sortOrder": "severity", - "todo-tree.tree.scanMode": "workspace only", - "javascript.preferences.importModuleSpecifier": "relative", - "typescript.preferences.importModuleSpecifier": "relative", - "files.associations": { ".env*": "dotenv", "*.svx": "mdx", "*.md": "mdx" } + "problems.sortOrder": "severity" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 53b318c..99cb96b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,67 +4,67 @@ ### Minor Changes -- feba0d4: Improvements to audio stores: +- feba0d4: Improvements to audio stores: - - Adds missing `is_paused` value. - - Fixes to `start_at` value - - Refactors localStorage stores & user preferences + - Adds missing `is_paused` value. + - Fixes to `start_at` value + - Refactors localStorage stores & user preferences ## 0.4.0 ### Minor Changes -- ff6a6d9: refactored audio element bindings for better control over element +- ff6a6d9: refactored audio element bindings for better control over element ## 0.3.4 ### Patch Changes -- ff5caf2: fix to allow override of internal types +- ff5caf2: fix to allow override of internal types ## 0.3.3 ### Patch Changes -- 802c704: fixes dist exports +- 802c704: fixes dist exports ## 0.3.2 ### Patch Changes -- 6c849b7: Fixes derived store causing exessive updates +- 6c849b7: Fixes derived store causing exessive updates ## 0.3.1 ### Patch Changes -- 02598d4: fixes exported typings +- 02598d4: fixes exported typings ## 0.3.0 ### Minor Changes -- 0b12aab: Adds mechanic for managing user preferences +- 0b12aab: Adds mechanic for managing user preferences ## 0.2.0 ### Minor Changes -- 6f89448: Adds the ability to bind episode metadata to the audio store -- a70d68d: - - Restructures lib to make dist cleaner and dev easier to grock - - Refactors