From 4579af5de1ff14702f41982bb6405dee091f4a1f Mon Sep 17 00:00:00 2001 From: Grant Sander Date: Wed, 10 Aug 2022 11:47:24 -0500 Subject: [PATCH 01/10] Use workspace dependency --- packages/create-spectacle/package.json | 4 ++-- packages/create-spectacle/src/cli.ts | 2 +- pnpm-lock.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/create-spectacle/package.json b/packages/create-spectacle/package.json index 88aec795a..7004e4bbb 100644 --- a/packages/create-spectacle/package.json +++ b/packages/create-spectacle/package.json @@ -2,7 +2,7 @@ "name": "create-spectacle", "version": "0.1.0", "description": "Project generator for Spectacle", - "main": "bin/cli.js", + "main": "bin/src/cli.js", "files": [ "bin/" ], @@ -22,7 +22,7 @@ }, "peerDependencies": {}, "devDependencies": { - "spectacle": "*", + "spectacle": "workspace:*", "@types/node": "^18.0.3" }, "resolutions": {}, diff --git a/packages/create-spectacle/src/cli.ts b/packages/create-spectacle/src/cli.ts index f975d9f05..37865738a 100644 --- a/packages/create-spectacle/src/cli.ts +++ b/packages/create-spectacle/src/cli.ts @@ -9,7 +9,7 @@ import { writeWebpackProjectFiles, writeOnePageHTMLFile } from './templates/file-writers'; -import { version as SPECTACLE_VERSION } from 'spectacle/package.json'; +import { version as SPECTACLE_VERSION } from '../package.json'; type CLIOptions = { type: 'tsx' | 'jsx' | 'mdx' | 'onepage'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6d9ccdc7d..db8c0aa11 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -149,9 +149,9 @@ importers: cli-spinners: 2.6.1 commander: 9.3.0 log-update: 4.0.0 + spectacle: link:../spectacle devDependencies: '@types/node': 18.0.3 - spectacle: link:../spectacle packages/spectacle: specifiers: From eb13ddf48ef889e5455681500d0b205f034415e4 Mon Sep 17 00:00:00 2001 From: Grant Sander Date: Wed, 10 Aug 2022 11:48:22 -0500 Subject: [PATCH 02/10] Add changeset --- .changeset/tough-tigers-drive.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/tough-tigers-drive.md 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 From 499bb47bfe11bcb73199bf6b00d47f40b670e36a Mon Sep 17 00:00:00 2001 From: Grant Sander Date: Wed, 10 Aug 2022 11:59:51 -0500 Subject: [PATCH 03/10] Update pnpm-lock.yaml --- pnpm-lock.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index db8c0aa11..f2c0c1f33 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -142,16 +142,16 @@ 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 cli-spinners: 2.6.1 commander: 9.3.0 log-update: 4.0.0 - spectacle: link:../spectacle devDependencies: '@types/node': 18.0.3 + spectacle: link:../spectacle packages/spectacle: specifiers: From 51368b235414cb1758c114266d6a7004fd4231ba Mon Sep 17 00:00:00 2001 From: Grant Sander Date: Wed, 10 Aug 2022 12:05:52 -0500 Subject: [PATCH 04/10] Update packages/create-spectacle/src/cli.ts Co-authored-by: Ryan Roemer --- packages/create-spectacle/src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-spectacle/src/cli.ts b/packages/create-spectacle/src/cli.ts index 37865738a..07665b503 100644 --- a/packages/create-spectacle/src/cli.ts +++ b/packages/create-spectacle/src/cli.ts @@ -9,7 +9,7 @@ import { writeWebpackProjectFiles, writeOnePageHTMLFile } from './templates/file-writers'; -import { version as SPECTACLE_VERSION } from '../package.json'; +import { devDependencies: { spectacle as SPECTACLE_VERSION } } from '../package.json'; type CLIOptions = { type: 'tsx' | 'jsx' | 'mdx' | 'onepage'; From 6e4ab0b59949906b207648b60fda57b37469d305 Mon Sep 17 00:00:00 2001 From: Grant Sander Date: Wed, 10 Aug 2022 12:12:49 -0500 Subject: [PATCH 05/10] Fix spectacle import --- packages/create-spectacle/src/cli.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/create-spectacle/src/cli.ts b/packages/create-spectacle/src/cli.ts index 07665b503..c88b5a66a 100644 --- a/packages/create-spectacle/src/cli.ts +++ b/packages/create-spectacle/src/cli.ts @@ -9,7 +9,7 @@ import { writeWebpackProjectFiles, writeOnePageHTMLFile } from './templates/file-writers'; -import { devDependencies: { spectacle as SPECTACLE_VERSION } } from '../package.json'; +import { devDependencies } from '../package.json'; type CLIOptions = { type: 'tsx' | 'jsx' | 'mdx' | 'onepage'; @@ -71,7 +71,7 @@ const main = async () => { lang, port, enableTypeScriptSupport: type === 'tsx', - spectacleVersion: SPECTACLE_VERSION + spectacleVersion: devDependencies.spectacle }; switch (type) { From a81e82a9af4159ef0058a39f33ae100db7f7f3f2 Mon Sep 17 00:00:00 2001 From: Ryan Roemer Date: Wed, 10 Aug 2022 10:36:43 -0700 Subject: [PATCH 06/10] Ensure that src is root for TS build. Fix create-spectacle version for CLI output. --- packages/create-spectacle/src/cli.ts | 5 +++-- packages/create-spectacle/tsconfig.json | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/create-spectacle/src/cli.ts b/packages/create-spectacle/src/cli.ts index c88b5a66a..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 { devDependencies } from '../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) => diff --git a/packages/create-spectacle/tsconfig.json b/packages/create-spectacle/tsconfig.json index 2ad533613..c762042dc 100644 --- a/packages/create-spectacle/tsconfig.json +++ b/packages/create-spectacle/tsconfig.json @@ -4,6 +4,7 @@ "moduleResolution": "node", "module": "commonjs", "outDir": "./bin", + "rootDir": "./src", // https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-14 "target": "ES2020", "esModuleInterop": true, From 1bba7ca78485886f00c95b5f26f362b1748eef66 Mon Sep 17 00:00:00 2001 From: Ryan Roemer Date: Wed, 10 Aug 2022 10:46:11 -0700 Subject: [PATCH 07/10] Keep adding tsconfig files until the build passes. --- packages/create-spectacle/package.json | 5 +++-- packages/create-spectacle/tsconfig.build.json | 8 ++++++++ packages/create-spectacle/tsconfig.json | 2 -- 3 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 packages/create-spectacle/tsconfig.build.json diff --git a/packages/create-spectacle/package.json b/packages/create-spectacle/package.json index 7004e4bbb..ec9f7bedc 100644 --- a/packages/create-spectacle/package.json +++ b/packages/create-spectacle/package.json @@ -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" 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 c762042dc..cef13f04b 100644 --- a/packages/create-spectacle/tsconfig.json +++ b/packages/create-spectacle/tsconfig.json @@ -3,8 +3,6 @@ "compilerOptions": { "moduleResolution": "node", "module": "commonjs", - "outDir": "./bin", - "rootDir": "./src", // https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-14 "target": "ES2020", "esModuleInterop": true, From 6d9c5ceb3e6f5beca81d3552451af5397d979df1 Mon Sep 17 00:00:00 2001 From: Ryan Roemer Date: Wed, 10 Aug 2022 10:48:02 -0700 Subject: [PATCH 08/10] Change name of checking tsconfig. --- packages/create-spectacle/package.json | 4 ++-- .../{tsconfig.all.json => tsconfig.typecheck.json} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename packages/create-spectacle/{tsconfig.all.json => tsconfig.typecheck.json} (100%) diff --git a/packages/create-spectacle/package.json b/packages/create-spectacle/package.json index ec9f7bedc..d68c80067 100644 --- a/packages/create-spectacle/package.json +++ b/packages/create-spectacle/package.json @@ -68,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/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 From 78f91b1638dc8f1f2d81bcc12b95cb77d30c9204 Mon Sep 17 00:00:00 2001 From: Ryan Roemer Date: Wed, 10 Aug 2022 10:49:53 -0700 Subject: [PATCH 09/10] Fix main path --- packages/create-spectacle/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/create-spectacle/package.json b/packages/create-spectacle/package.json index d68c80067..bd165ecf1 100644 --- a/packages/create-spectacle/package.json +++ b/packages/create-spectacle/package.json @@ -2,7 +2,7 @@ "name": "create-spectacle", "version": "0.1.0", "description": "Project generator for Spectacle", - "main": "bin/src/cli.js", + "main": "bin/cli.js", "files": [ "bin/" ], From 0d9d35680f05e391761b6d7270d63080b528bd9e Mon Sep 17 00:00:00 2001 From: Ryan Roemer Date: Wed, 10 Aug 2022 11:30:47 -0700 Subject: [PATCH 10/10] Handle workspace in CI tests --- packages/create-spectacle/src/templates/package.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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" },