feat!: compile to JS before publishing
Configure the package to compile TypeScript and copy SCSS and image assets (PNG, SVG) to dist/ before publishing, rather than publishing raw source files. This allows us to use tsc-alias for @src imports. Also use a more modern export map to decouple the internal file structure from the package's API, and add a build step to CI. BREAKING CHANGE: Consuming projects may need to update their imports or SASS @use lines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
committed by
Adolfo R. Brandes
parent
35283dfdd3
commit
70576cf373
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
@@ -33,6 +33,9 @@ jobs:
|
||||
- name: Test
|
||||
run: npm run test
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Run Coverage
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
|
||||
13
Makefile
13
Makefile
@@ -24,6 +24,19 @@ test.npm.%: validate-no-uncommitted-package-lock-changes
|
||||
requirements: ## install ci requirements
|
||||
npm ci
|
||||
|
||||
clean:
|
||||
rm -rf dist
|
||||
|
||||
build: clean
|
||||
tsc --project tsconfig.build.json
|
||||
tsc-alias -p tsconfig.build.json
|
||||
find src -type f \( -name '*.scss' -o -name '*.png' -o -name '*.svg' \) -exec sh -c '\
|
||||
for f in "$$@"; do \
|
||||
d="dist/$${f#src/}"; \
|
||||
mkdir -p "$$(dirname "$$d")"; \
|
||||
cp "$$f" "$$d"; \
|
||||
done' sh {} +
|
||||
|
||||
i18n.extract:
|
||||
# Pulling display strings from .jsx files into .json files...
|
||||
rm -rf $(transifex_temp)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
const { createConfig } = require('@openedx/frontend-base/config');
|
||||
const { createConfig } = require('@openedx/frontend-base/tools');
|
||||
|
||||
module.exports = createConfig('babel');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @ts-check
|
||||
|
||||
const { createLintConfig } = require('@openedx/frontend-base/config');
|
||||
const { createLintConfig } = require('@openedx/frontend-base/tools');
|
||||
|
||||
module.exports = createLintConfig(
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const { createConfig } = require('@openedx/frontend-base/config');
|
||||
const { createConfig } = require('@openedx/frontend-base/tools');
|
||||
|
||||
module.exports = createConfig('test', {
|
||||
setupFilesAfterEnv: [
|
||||
|
||||
3739
package-lock.json
generated
3739
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@@ -6,9 +6,12 @@
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/edx/frontend-app-learner-dashboard.git"
|
||||
},
|
||||
"main": "src/index.ts",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./app.scss": "./dist/app.scss"
|
||||
},
|
||||
"files": [
|
||||
"/src"
|
||||
"/dist"
|
||||
],
|
||||
"browserslist": [
|
||||
"extends @edx/browserslist-config"
|
||||
@@ -18,10 +21,13 @@
|
||||
"*.scss"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "make build",
|
||||
"clean": "make clean",
|
||||
"dev": "PORT=1996 PUBLIC_PATH=/learner-dashboard openedx dev",
|
||||
"i18n_extract": "openedx formatjs extract",
|
||||
"lint": "openedx lint .",
|
||||
"lint:fix": "openedx lint --fix .",
|
||||
"prepack": "npm run build",
|
||||
"test": "openedx test --coverage --passWithNoTests"
|
||||
},
|
||||
"author": "Open edX",
|
||||
@@ -65,10 +71,11 @@
|
||||
"jest-when": "^3.6.0",
|
||||
"react-dev-utils": "^12.0.0",
|
||||
"react-test-renderer": "^18.3.1",
|
||||
"redux-mock-store": "^1.5.4"
|
||||
"redux-mock-store": "^1.5.4",
|
||||
"tsc-alias": "^1.8.16"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@openedx/frontend-base": "^1.0.0-alpha.11",
|
||||
"@openedx/frontend-base": "^1.0.0-alpha.13",
|
||||
"@openedx/paragon": "^23",
|
||||
"@tanstack/react-query": "^5",
|
||||
"@types/react": "^18",
|
||||
|
||||
18
tsconfig.build.json
Normal file
18
tsconfig.build.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
"noEmit": false
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"src/**/*.test.*",
|
||||
"src/**/*.spec.*",
|
||||
"src/**/tests/**/*",
|
||||
"src/__mocks__/**/*",
|
||||
"src/setupTest.*"
|
||||
]
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
{
|
||||
"extends": "@openedx/frontend-base/config/tsconfig.json",
|
||||
"extends": "@openedx/frontend-base/tools/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": ".",
|
||||
"outDir": "dist"
|
||||
"outDir": "dist",
|
||||
"paths": {
|
||||
"@src/*": ["./src/*"]
|
||||
},
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
|
||||
Reference in New Issue
Block a user