Skip to content

Commit 25e4698

Browse files
create-spectacle Spectacle version fix. (#1192)
* Use workspace dependency * Add changeset * Update pnpm-lock.yaml * Update packages/create-spectacle/src/cli.ts Co-authored-by: Ryan Roemer <[email protected]> * Fix spectacle import * Ensure that src is root for TS build. Fix create-spectacle version for CLI output. * Keep adding tsconfig files until the build passes. * Change name of checking tsconfig. * Fix main path * Handle workspace in CI tests Co-authored-by: Ryan Roemer <[email protected]>
1 parent bc37495 commit 25e4698

File tree

8 files changed

+29
-11
lines changed

8 files changed

+29
-11
lines changed

.changeset/tough-tigers-drive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'create-spectacle': patch
3+
---
4+
5+
Fix spectacle version import

packages/create-spectacle/package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"peerDependencies": {},
2424
"devDependencies": {
25-
"spectacle": "*",
25+
"spectacle": "workspace:*",
2626
"@types/node": "^18.0.3"
2727
},
2828
"resolutions": {},
@@ -53,11 +53,12 @@
5353
},
5454
"wireit": {
5555
"build": {
56-
"command": "tsc --p tsconfig.json",
56+
"command": "tsc --p tsconfig.build.json",
5757
"files": [
5858
"src/**",
5959
"!src/**/*.test.*",
60-
"tsconfig.json"
60+
"tsconfig.json",
61+
"tsconfig.build.json"
6162
],
6263
"output": [
6364
"bin/**/*.js"
@@ -67,12 +68,12 @@
6768
]
6869
},
6970
"types:check": {
70-
"command": "nps types:check -- -- --p tsconfig.all.json",
71+
"command": "nps types:check -- -- --p tsconfig.typecheck.json",
7172
"files": [
7273
"src/**/*.{ts,tsx}",
7374
"test/**/*.{ts,tsx}",
7475
"tsconfig.json",
75-
"tsconfig.all.json"
76+
"tsconfig.typecheck.json"
7677
],
7778
"dependencies": [],
7879
"output": [],

packages/create-spectacle/src/cli.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import {
99
writeWebpackProjectFiles,
1010
writeOnePageHTMLFile
1111
} from './templates/file-writers';
12-
import { version as SPECTACLE_VERSION } from 'spectacle/package.json';
12+
// @ts-ignore
13+
import { version, devDependencies } from '../package.json';
1314

1415
type CLIOptions = {
1516
type: 'tsx' | 'jsx' | 'mdx' | 'onepage';
@@ -31,7 +32,7 @@ const main = async () => {
3132
program
3233
.name('create-spectacle')
3334
.description('CLI to bootstrap Spectacle decks')
34-
.version('2.0.0')
35+
.version(version)
3536
.showHelpAfterError()
3637
.configureOutput({
3738
outputError: (message, write) =>
@@ -71,7 +72,7 @@ const main = async () => {
7172
lang,
7273
port,
7374
enableTypeScriptSupport: type === 'tsx',
74-
spectacleVersion: SPECTACLE_VERSION
75+
spectacleVersion: devDependencies.spectacle
7576
};
7677

7778
switch (type) {

packages/create-spectacle/src/templates/package.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export const packageTemplate = (options: PackageTemplateOptions) =>
1414
"build": "webpack --config ./webpack.config.js --mode production"
1515
},
1616
"dependencies": {
17-
"spectacle": "^${options.spectacleVersion}",
17+
"spectacle": "${
18+
options.spectacleVersion === 'workspace:*'
19+
? '*'
20+
: `^${options.spectacleVersion}`
21+
}",
1822
"react": "^18.1.0",
1923
"react-dom": "^18.1.0"
2024
},
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["src/**/*"],
4+
"compilerOptions": {
5+
"outDir": "./bin",
6+
"rootDir": "./src"
7+
}
8+
}

packages/create-spectacle/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"compilerOptions": {
44
"moduleResolution": "node",
55
"module": "commonjs",
6-
"outDir": "./bin",
76
// https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-14
87
"target": "ES2020",
98
"esModuleInterop": true,

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)