Skip to content

Commit

Permalink
Use rollup for dev build too
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeguerin committed Dec 4, 2023
1 parent 81a3b3d commit 233e321
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 22 deletions.
3 changes: 3 additions & 0 deletions common/config/rush/pnpm-lock.yaml

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

3 changes: 0 additions & 3 deletions packages/typespec-vscode/extension-shim.js

This file was deleted.

14 changes: 7 additions & 7 deletions packages/typespec-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"categories": [
"Programming Languages"
],
"type": "commonjs",
"main": "./extension-shim.js",
"type": "module",
"main": "./dist/src/extension.cjs",
"engines": {
"vscode": "^1.82.0"
},
Expand Down Expand Up @@ -106,20 +106,20 @@
]
},
"scripts": {
"clean": "rimraf ./dist ./dist-dev ./temp",
"build": "npm run compile && npm run rollup && npm run copy-tmlanguage && npm run generate-language-configuration && npm run generate-third-party-notices && npm run package-vsix",
"compile": "tsc -p .",
"watch": "tsc -p . --watch",
"clean": "rimraf ./dist ./temp",
"build": "npm run compile && npm run copy-tmlanguage && npm run generate-language-configuration && npm run generate-third-party-notices && npm run package-vsix",
"compile": "rollup --config rollup.config.ts --configPlugin typescript --failAfterWarnings 2>&1",
"watch": "rollup --config rollup.config.ts --configPlugin typescript --watch",
"dogfood": "node scripts/dogfood.js",
"copy-tmlanguage": "node scripts/copy-tmlanguage.js",
"generate-language-configuration": "node scripts/generate-language-configuration.js",
"generate-third-party-notices": "typespec-build-tool generate-third-party-notices",
"rollup": "rollup --config --failAfterWarnings 2>&1",
"package-vsix": "vsce package"
},
"devDependencies": {
"@rollup/plugin-commonjs": "~25.0.4",
"@rollup/plugin-node-resolve": "~15.2.1",
"@rollup/plugin-typescript": "~11.1.5",
"@types/mocha": "~10.0.1",
"@types/node": "~18.11.9",
"@types/vscode": "~1.82.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
// @ts-check
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import typescript from "@rollup/plugin-typescript";

import { defineConfig } from "rollup";

export default defineConfig({
input: "dist-dev/src/extension.js",
input: "src/extension.ts",
output: {
file: "dist/src/extension.js",
file: "dist/src/extension.cjs",
format: "commonjs",
sourcemap: true,
exports: "named",
inlineDynamicImports: true,
},
external: ["fs/promises", "vscode"],
plugins: [resolve({ preferBuiltins: true }), commonjs()],
plugins: [
(resolve as any)({ preferBuiltins: true }),
(commonjs as any)(),
(typescript as any)({ tsconfig: "./tsconfig.build.json" }),
],
onwarn: (warning, warn) => {
if (warning.code === "CIRCULAR_DEPENDENCY") {
// filter out warnings about circular dependencies out of our control
Expand Down
10 changes: 10 additions & 0 deletions packages/typespec-vscode/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// tsconfig for building the playground
{
"extends": "./tsconfig.json",
"compilerOptions": {
"sourceMap": true,
"module": "NodeNext",
"moduleResolution": "NodeNext"
},
"include": ["src/**/*.ts"]
}
15 changes: 8 additions & 7 deletions packages/typespec-vscode/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"extends": "../tsconfig.json",
"references": [{ "path": "../tmlanguage-generator/tsconfig.json" }],
"compilerOptions": {
"outDir": "dist-dev",
"incremental": false,
"composite": false,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"sourceMap": false,
"resolveJsonModule": true,
"outDir": "dist",
"rootDir": ".",
"tsBuildInfoFile": "temp/tsconfig.tsbuildinfo",
"module": "ES2022",
"moduleResolution": "Bundler",
"skipLibCheck": true,
"types": ["node", "mocha"]
},
"include": ["src/**/*.ts", "test/**/*.ts"]
"include": ["rollup.config.ts", "src/**/*.ts", "test/**/*.ts"]
}
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
{ "path": "packages/openapi3/tsconfig.json" },
{ "path": "packages/lint/tsconfig.json" },
{ "path": "packages/migrate/tsconfig.json" },
{ "path": "packages/typespec-vscode/tsconfig.json" },
{ "path": "packages/internal-build-utils/tsconfig.json" },
{ "path": "packages/bundle-uploader/tsconfig.json" },
{ "path": "packages/tmlanguage-generator/tsconfig.json" },
Expand Down

0 comments on commit 233e321

Please sign in to comment.