Skip to content

Commit

Permalink
Fix inclusion of spectacle package.json for CLI (#1307)
Browse files Browse the repository at this point in the history
* Fix inclusion of spectacle package.json for CLI

* Update GH Action

* Add the cp package to test deps.
  • Loading branch information
carloskelly13 authored Dec 18, 2023
1 parent 7f6b26a commit a7196d5
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 366 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-ducks-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-spectacle': patch
---

Fix inclusion of Spectacle library package.json
3 changes: 3 additions & 0 deletions .github/workflows/create-spectacle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Copy Spectacle package
run: pnpm run --filter ./packages/create-spectacle copy-spectacle-package

- name: Build create-spectacle
run: pnpm run --filter ./packages/create-spectacle build

Expand Down
1 change: 1 addition & 0 deletions packages/create-spectacle/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
tmp
spectacle-package.json
10 changes: 8 additions & 2 deletions packages/create-spectacle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "Project generator for Spectacle",
"main": "bin/cli.js",
"files": [
"bin/"
"bin/",
"spectacle-package.json"
],
"bin": "bin/cli.js",
"author": "Formidable Labs <[email protected]>",
Expand All @@ -26,18 +27,22 @@
"devDependencies": {
"@types/node": "^18.0.3",
"@types/prompts": "^2.0.14",
"shx": "^0.3.4",
"spectacle": "*"
},
"resolutions": {},
"scripts": {
"dev": "ts-node src/cli.ts",
"dev": "pnpm copy-spectacle-package && ts-node src/cli.ts",
"build": "wireit",
"types:check": "wireit",
"lint": "wireit",
"lint:fix": "wireit",
"prettier": "wireit",
"prettier:fix": "wireit",
"test": "wireit",
"copy-spectacle-package": "shx cp ../spectacle/package.json ./spectacle-package.json",
"prepack": "pnpm copy-spectacle-package",
"postpack": "shx rm ./spectacle-package.json",
"examples:clean": "rimraf .examples",
"examples:test": "nps jest",
"examples:jsx:clean": "rimraf .examples/jsx",
Expand Down Expand Up @@ -147,6 +152,7 @@
},
"test": {
"dependencies": [
"copy-spectacle-package",
"build"
],
"command": "jest --testMatch=\"<rootDir>/src/*.test.ts\"",
Expand Down
9 changes: 2 additions & 7 deletions packages/create-spectacle/src/generators/one-page.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import path from 'path';
import { onePageTemplate } from '../templates/one-page';

const SPECTACLE_PATH = path.resolve(__dirname, '../../../spectacle');
const spectaclePackage = require(`${SPECTACLE_PATH}/package.json`);
const spectaclePackage = require(`${__dirname}/../../spectacle-package.json`);
const REACT_VERSION = spectaclePackage.devDependencies.react.replace('^', '');
const ESM_SH_VERSION = 'v121';

export const generateImportMap = () => {
const importMap = new Map<string, string>();
const {
dependencies,
peerDependencies
} = require(`${SPECTACLE_PATH}/package.json`);
const { dependencies, peerDependencies } = spectaclePackage;

importMap.set('htm', importUrl('htm', '^3'));
importMap.set('spectacle', 'https://esm.sh/spectacle@10?bundle');
Expand Down
Loading

1 comment on commit a7196d5

@vercel
Copy link

@vercel vercel bot commented on a7196d5 Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.