Skip to content

Commit 633a07d

Browse files
committed
Fix npm start for repacks
1 parent 0a4d7a9 commit 633a07d

9 files changed

Lines changed: 57 additions & 40 deletions

File tree

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,13 @@
128128
"start:react-hooks": "cd packages && cd react-hooks && npm start",
129129
"start:react-valibot": "cd packages && cd react-valibot && npm start",
130130
"start:redux-store": "cd packages && cd redux-store && npm start",
131-
"start:repack-adaptivecards": "cd packages && cd adaptivecards && npm start",
132-
"start:repack-base64-js": "cd packages && cd base64-js && npm start",
133-
"start:repack-botframework-directlinejs": "cd packages && cd botframework-directlinejs && npm start",
134-
"start:repack-microsoft-cognitiveservices-speech-sdk": "cd packages && cd microsoft-cognitiveservices-speech-sdk && npm start",
135-
"start:repack-object-assign": "cd packages && cd object-assign && npm start",
136-
"start:repack-react": "cd packages && cd react && npm start",
137-
"start:repack-react-dom": "cd packages && cd react-dom && npm start",
138-
"start:repack-react-is": "cd packages && cd react-is && npm start",
131+
"start:repack-adaptivecards": "cd packages && cd repack && cd adaptivecards && npm start",
132+
"start:repack-base64-js": "cd packages && cd repack && cd base64-js && npm start",
133+
"start:repack-botframework-directlinejs": "cd packages && cd repack && cd botframework-directlinejs && npm start",
134+
"start:repack-microsoft-cognitiveservices-speech-sdk": "cd packages && cd repack && cd microsoft-cognitiveservices-speech-sdk && npm start",
135+
"start:repack-react": "cd packages && cd repack && cd react && npm start",
136+
"start:repack-react-dom": "cd packages && cd repack && cd react-dom && npm start",
137+
"start:repack-react-is": "cd packages && cd repack && cd react-is && npm start",
139138
"start:server": "serve -p 5000",
140139
"start:test-dev-server": "cd packages && cd test && cd dev-server && npm start",
141140
"start:test-harness": "cd packages && cd test && cd harness && npm start",

packages/repack/adaptivecards/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"eslint": "npm run precommit",
1515
"precommit": "npm run precommit:eslint -- src && npm run precommit:typecheck",
1616
"precommit:eslint": "eslint --report-unused-disable-directives --max-warnings 0",
17-
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false"
17+
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
18+
"start": "npm run build -- --watch"
1819
},
1920
"localDependencies": {},
2021
"pinDependencies": {

packages/repack/base64-js/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"eslint": "npm run precommit",
1515
"precommit": "npm run precommit:eslint -- src && npm run precommit:typecheck",
1616
"precommit:eslint": "eslint --report-unused-disable-directives --max-warnings 0",
17-
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false"
17+
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
18+
"start": "npm run build -- --watch"
1819
},
1920
"localDependencies": {},
2021
"pinDependencies": {},

packages/repack/botframework-directlinejs/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"eslint": "npm run precommit",
1515
"precommit": "npm run precommit:eslint -- src && npm run precommit:typecheck",
1616
"precommit:eslint": "eslint --report-unused-disable-directives --max-warnings 0",
17-
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false"
17+
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
18+
"start": "npm run build -- --watch"
1819
},
1920
"localDependencies": {},
2021
"pinDependencies": {},

packages/repack/microsoft-cognitiveservices-speech-sdk/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"eslint": "npm run precommit",
2424
"precommit": "npm run precommit:eslint -- src && npm run precommit:typecheck",
2525
"precommit:eslint": "eslint --report-unused-disable-directives --max-warnings 0",
26-
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false"
26+
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
27+
"start": "npm run build -- --watch"
2728
},
2829
"localDependencies": {},
2930
"pinDependencies": {

packages/repack/react-dom/build.js

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,44 @@
11
/// <reference types="node" />
22

3+
/* eslint-env node */
4+
/* eslint-disable no-magic-numbers */
35
/* eslint-disable require-unicode-regexp */
46

57
import * as esbuild from 'esbuild';
68

7-
esbuild.build({
8-
alias: {
9-
'object-assign': '@msinternal/object-assign'
10-
},
11-
bundle: true,
12-
entryPoints: ['./src/index.ts'],
13-
format: 'esm',
14-
outdir: './dist/',
15-
platform: 'browser',
16-
splitting: true,
17-
sourcemap: true,
18-
/** @type { import('esbuild').Plugin[] } */
19-
plugins: [
20-
{
21-
name: 'react-resolver',
22-
setup(build) {
23-
build.onResolve({ filter: /^react$/ }, args =>
24-
args.kind === 'require-call' ? { path: 'react', namespace: 'stub' } : { external: true, path: args.path }
25-
);
9+
(async () => {
10+
const context = await esbuild.context({
11+
alias: {
12+
'object-assign': '@msinternal/object-assign'
13+
},
14+
bundle: true,
15+
entryPoints: ['./src/index.ts'],
16+
format: 'esm',
17+
outdir: './dist/',
18+
platform: 'browser',
19+
splitting: true,
20+
sourcemap: true,
2621

27-
build.onLoad({ filter: /^react$/, namespace: 'stub' }, () => ({
28-
contents: "export * from 'react'; export { default } from 'react';"
29-
}));
22+
/** @type { import('esbuild').Plugin[] } */
23+
plugins: [
24+
{
25+
name: 'react-resolver',
26+
setup(build) {
27+
build.onResolve({ filter: /^react$/ }, args =>
28+
args.kind === 'require-call' ? { path: 'react', namespace: 'stub' } : { external: true, path: args.path }
29+
);
30+
31+
build.onLoad({ filter: /^react$/, namespace: 'stub' }, () => ({
32+
contents: "export * from 'react'; export { default } from 'react';"
33+
}));
34+
}
3035
}
31-
}
32-
]
33-
});
36+
]
37+
});
38+
39+
if (process.argv[2] === '--watch') {
40+
await context.watch();
41+
} else {
42+
await context.build();
43+
}
44+
})();

packages/repack/react-dom/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"eslint": "npm run precommit",
1717
"precommit": "npm run precommit:eslint -- src && npm run precommit:typecheck",
1818
"precommit:eslint": "eslint --report-unused-disable-directives --max-warnings 0",
19-
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false"
19+
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
20+
"start": "npm run build -- --watch"
2021
},
2122
"localDependencies": {
2223
"@msinternal/object-assign": "development"

packages/repack/react-is/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"eslint": "npm run precommit",
1717
"precommit": "npm run precommit:eslint -- src && npm run precommit:typecheck",
1818
"precommit:eslint": "eslint --report-unused-disable-directives --max-warnings 0",
19-
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false"
19+
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
20+
"start": "npm run build -- --watch"
2021
},
2122
"localDependencies": {},
2223
"pinDependencies": {

packages/repack/react/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"eslint": "npm run precommit",
1717
"precommit": "npm run precommit:eslint -- src && npm run precommit:typecheck",
1818
"precommit:eslint": "eslint --report-unused-disable-directives --max-warnings 0",
19-
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false"
19+
"precommit:typecheck": "tsc --project ./src --emitDeclarationOnly false --esModuleInterop true --noEmit --pretty false",
20+
"start": "npm run build -- --watch"
2021
},
2122
"localDependencies": {
2223
"@msinternal/object-assign": "development"

0 commit comments

Comments
 (0)