diff --git a/.changeset/tough-tigers-drive.md b/.changeset/tough-tigers-drive.md new file mode 100644 index 000000000..f7816f67d --- /dev/null +++ b/.changeset/tough-tigers-drive.md @@ -0,0 +1,5 @@ +--- +'create-spectacle': patch +--- + +Fix spectacle version import diff --git a/packages/create-spectacle/package.json b/packages/create-spectacle/package.json index 88aec795a..bd165ecf1 100644 --- a/packages/create-spectacle/package.json +++ b/packages/create-spectacle/package.json @@ -22,7 +22,7 @@ }, "peerDependencies": {}, "devDependencies": { - "spectacle": "*", + "spectacle": "workspace:*", "@types/node": "^18.0.3" }, "resolutions": {}, @@ -53,11 +53,12 @@ }, "wireit": { "build": { - "command": "tsc --p tsconfig.json", + "command": "tsc --p tsconfig.build.json", "files": [ "src/**", "!src/**/*.test.*", - "tsconfig.json" + "tsconfig.json", + "tsconfig.build.json" ], "output": [ "bin/**/*.js" @@ -67,12 +68,12 @@ ] }, "types:check": { - "command": "nps types:check -- -- --p tsconfig.all.json", + "command": "nps types:check -- -- --p tsconfig.typecheck.json", "files": [ "src/**/*.{ts,tsx}", "test/**/*.{ts,tsx}", "tsconfig.json", - "tsconfig.all.json" + "tsconfig.typecheck.json" ], "dependencies": [], "output": [], diff --git a/packages/create-spectacle/src/cli.ts b/packages/create-spectacle/src/cli.ts index f975d9f05..b550ec8a9 100644 --- a/packages/create-spectacle/src/cli.ts +++ b/packages/create-spectacle/src/cli.ts @@ -9,7 +9,8 @@ import { writeWebpackProjectFiles, writeOnePageHTMLFile } from './templates/file-writers'; -import { version as SPECTACLE_VERSION } from 'spectacle/package.json'; +// @ts-ignore +import { version, devDependencies } from '../package.json'; type CLIOptions = { type: 'tsx' | 'jsx' | 'mdx' | 'onepage'; @@ -31,7 +32,7 @@ const main = async () => { program .name('create-spectacle') .description('CLI to bootstrap Spectacle decks') - .version('2.0.0') + .version(version) .showHelpAfterError() .configureOutput({ outputError: (message, write) => @@ -71,7 +72,7 @@ const main = async () => { lang, port, enableTypeScriptSupport: type === 'tsx', - spectacleVersion: SPECTACLE_VERSION + spectacleVersion: devDependencies.spectacle }; switch (type) { diff --git a/packages/create-spectacle/src/templates/package.ts b/packages/create-spectacle/src/templates/package.ts index 60caaa282..10df26550 100644 --- a/packages/create-spectacle/src/templates/package.ts +++ b/packages/create-spectacle/src/templates/package.ts @@ -14,7 +14,11 @@ export const packageTemplate = (options: PackageTemplateOptions) => "build": "webpack --config ./webpack.config.js --mode production" }, "dependencies": { - "spectacle": "^${options.spectacleVersion}", + "spectacle": "${ + options.spectacleVersion === 'workspace:*' + ? '*' + : `^${options.spectacleVersion}` + }", "react": "^18.1.0", "react-dom": "^18.1.0" }, diff --git a/packages/create-spectacle/tsconfig.build.json b/packages/create-spectacle/tsconfig.build.json new file mode 100644 index 000000000..00a2adaa1 --- /dev/null +++ b/packages/create-spectacle/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/**/*"], + "compilerOptions": { + "outDir": "./bin", + "rootDir": "./src" + } +} diff --git a/packages/create-spectacle/tsconfig.json b/packages/create-spectacle/tsconfig.json index 2ad533613..cef13f04b 100644 --- a/packages/create-spectacle/tsconfig.json +++ b/packages/create-spectacle/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "moduleResolution": "node", "module": "commonjs", - "outDir": "./bin", // https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-14 "target": "ES2020", "esModuleInterop": true, diff --git a/packages/create-spectacle/tsconfig.all.json b/packages/create-spectacle/tsconfig.typecheck.json similarity index 100% rename from packages/create-spectacle/tsconfig.all.json rename to packages/create-spectacle/tsconfig.typecheck.json diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6d9ccdc7d..f2c0c1f33 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -142,7 +142,7 @@ importers: cli-spinners: ^2.6.1 commander: ^9.3.0 log-update: 4.0.0 - spectacle: '*' + spectacle: workspace:* dependencies: chalk: 4.1.2 clear: 0.1.0