diff --git a/.eslintrc.js b/.eslintrc.js index edadc674..32075fab 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,7 +3,7 @@ module.exports = { "browser": true, "es6": true }, - "extends": "eslint:recommended", + "extends": ["eslint:recommended", "plugin:storybook/recommended"], "globals": { "Atomics": "readonly", "SharedArrayBuffer": "readonly" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3e016db..7bd00e31 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,41 +1,52 @@ name: Build-Test-Release on: - push: - branches: - - master + push: + branches: + - master + - alpha jobs: - build-test-release: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - # Keep in sync with volta -> node version in package.json - node-version: 16 - - - name: Install dependencies - run: yarn - - - name: Build package - run: yarn build - - - name: Run tests - run: yarn test - - - name: Clean up package.json - # We used to use the clean-publish package to do this, but when - # we switched to using semantic-release, we had to do it manually. - run: npm pkg delete scripts && npm pkg delete devDependencies && npm pkg delete dependencies - - - name: Publish package - id: semantic_release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npx semantic-release + build-test-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + # Keep in sync with volta -> node version in package.json + node-version: 20 + + - name: Install dependencies + run: yarn + + - name: Sync with crowdin + env: + BLOOM_CROWDIN_TOKEN: ${{ secrets.BLOOM_CROWDIN_TOKEN }} + run: | + if [ "${{ github.ref }}" = "refs/heads/master" ]; then + yarn strings:sync + else + yarn strings:download + fi + + - name: Build package + run: yarn build + + - name: Run tests + run: yarn test + + - name: Clean up package.json + # We used to use the clean-publish package to do this, but when + # we switched to using semantic-release, we had to do it manually. + run: npm pkg delete scripts && npm pkg delete devDependencies && npm pkg delete dependencies + + - name: Publish package + id: semantic_release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npx semantic-release diff --git a/.gitignore b/.gitignore index 95c33b23..cc48247b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,14 +6,14 @@ updateFiles.bat debug.log -/src/l10n/l10n-all.json -/src/l10n/_locales/* -!/src/l10n/_locales/en - -src/activities/domActivities/multipleChoiceDomActivity.css - -testBooks/sample-dom-activity/Activity.css - -src/bloom-player.css - -*.bak +src/activities/domActivities/multipleChoiceDomActivity.css + +testBooks/sample-dom-activity/Activity.css + +src/bloom-player.css + +*.bak + +*storybook.log +src/l10n/bloom-player + diff --git a/.storybook/main.js b/.storybook/main.js deleted file mode 100644 index 4fe75f4c..00000000 --- a/.storybook/main.js +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = { - stories: ["../src/**/stories/*.tsx"], - addons: [ - "@storybook/addon-knobs", - "@storybook/addon-essentials", - "@storybook/addon-links", - "@storybook/addon-viewport", - "@storybook/addon-a11y", - "@storybook/addon-actions", - "@storybook/addon-interactions" - ], - features: { - interactionsDebugger: true // enable playback controls - } -}; diff --git a/.storybook/main.ts b/.storybook/main.ts new file mode 100644 index 00000000..c702b1e3 --- /dev/null +++ b/.storybook/main.ts @@ -0,0 +1,32 @@ +import type { StorybookConfig } from "@storybook/react-vite"; +// get the vite config one level up +import viteConfigFn from "../vite.config"; + +const proxy = viteConfigFn({ + command: "serve", + mode: "development", +}).server!.proxy; +const config: StorybookConfig = { + stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], + addons: [ + "@storybook/addon-links", + "@storybook/addon-essentials", + "@storybook/addon-interactions", + ], + framework: { + name: "@storybook/react-vite", + options: {}, + }, + viteFinal: (config, options) => { + // setup the same proxy that we have in "vite dev" to avoid CORS issues + const server = { + ...config.server, + proxy: { + ...proxy, + }, + }; + + return { ...config, server }; + }, +}; +export default config; diff --git a/.storybook/preview.js b/.storybook/preview.js deleted file mode 100644 index 94cefb72..00000000 --- a/.storybook/preview.js +++ /dev/null @@ -1,4 +0,0 @@ -import { addDecorator } from "@storybook/react"; -import { withA11y } from "@storybook/addon-a11y"; - -addDecorator(withA11y); diff --git a/.storybook/preview.ts b/.storybook/preview.ts new file mode 100644 index 00000000..37914b18 --- /dev/null +++ b/.storybook/preview.ts @@ -0,0 +1,14 @@ +import type { Preview } from "@storybook/react"; + +const preview: Preview = { + parameters: { + controls: { + matchers: { + color: /(background|color)$/i, + date: /Date$/i, + }, + }, + }, +}; + +export default preview; diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js deleted file mode 100644 index cab345d3..00000000 --- a/.storybook/webpack.config.js +++ /dev/null @@ -1,13 +0,0 @@ -// Here we take storybook's webpack, which currently doesn't know about typescript or less, -// and add the needed rules from our webpack.core.js. See https://storybook.js.org/docs/configurations/typescript-config/ - -const core = require("../webpack.core.js"); -module.exports = ({ config }) => { - config.module.rules.push(...core.module.rules); - config.resolve.extensions.push(".ts", ".tsx"); - // hide the noisy webpack.progress lines. See https://github.com/storybookjs/storybook/issues/1872 - config.plugins = config.plugins.filter( - ({ constructor }) => constructor.name !== "ProgressPlugin" - ); - return config; -}; diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 9f9bcb01..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "type": "node", - "request": "launch", - "name": "Jest tests", - "program": "${workspaceFolder}\\node_modules\\jest\\bin\\jest", - "args": ["--runInBand", "--config=${workspaceFolder}\\jest.config.js", "--env=jsdom"], - "console": "integratedTerminal", - "internalConsoleOptions": "neverOpen" - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 917db449..14bd1eb6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,7 +7,12 @@ "statusBar.noFolderBackground": "#D65649", "statussBar.prominentBackground": "#D65649" }, - "cSpell.words": ["editables", "swiper", "tabindex", "Xmatter"], + "cSpell.words": [ + "editables", + "swiper", + "tabindex", + "Xmatter" + ], "cSpell.ignorePaths": [ "package-lock.json", "node_modules", @@ -16,5 +21,10 @@ ".vscode", ".vscode-insiders", "package.json" - ] -} + ], + "[json][jsonc]": { + "editor.codeActionsOnSave": [ + "source.fixAll" + ] + } +} \ No newline at end of file diff --git a/index-for-developing.html b/index-for-developing.html index f2a3acaa..9c5de972 100644 --- a/index-for-developing.html +++ b/index-for-developing.html @@ -1,75 +1,62 @@ - -
- -