diff --git a/packages/cli/bin/cli.js b/packages/cli/bin/cli.js index 14daa35fe..1e73abe2d 100755 --- a/packages/cli/bin/cli.js +++ b/packages/cli/bin/cli.js @@ -1,11 +1,11 @@ #!/usr/bin/env -S node --no-warnings +process.removeAllListeners('warning') + import cli from '#src/main.js' import packageConfig from '#root/package.json' assert { type: 'json' } import updateNotifier from 'update-notifier' -process.removeAllListeners('warning') - const INTERVAL = Object.freeze({ MINUTES: 1000 * 60 * 1, HOURLY: 1000 * 60 * 60, diff --git a/packages/cli/package-lock.json b/packages/cli/package-lock.json index fa50a7dc2..e154ec842 100644 --- a/packages/cli/package-lock.json +++ b/packages/cli/package-lock.json @@ -15,7 +15,7 @@ "conf": "^11.0.1", "cross-env": "^7.0.3", "del": "^7.0.0", - "epubjs-cli": "^0.1.1", + "epubjs-cli": "^0.1.2", "execa": "^6.1.0", "fs-extra": "^11.1.0", "hosted-git-info": "^6.1.1", @@ -1340,12 +1340,13 @@ } }, "node_modules/epubjs-cli": { - "version": "0.1.1", - "license": "MIT", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/epubjs-cli/-/epubjs-cli-0.1.2.tgz", + "integrity": "sha512-VVPIGohx92Ps8OzuKQy/mgHCX+UW+Ee6otszqw+Z+8wg07OiYUBN/LA5Uhr3nwROaAdpUKUHEgSqAMszty8JdA==", "dependencies": { "@xmldom/xmldom": "^0.8.6", "commander": "^9.3.0", - "epubjs": "github:futurepress/epub.js#2022-restructure", + "epubjs": "^0.5.0-alpha.0", "eslint": "^8.29.0", "express": "^4.18.1", "jsdom": "^20.0.3", diff --git a/packages/cli/package.json b/packages/cli/package.json index 5575a3104..2f642e286 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -51,7 +51,7 @@ "conf": "^11.0.1", "cross-env": "^7.0.3", "del": "^7.0.0", - "epubjs-cli": "^0.1.1", + "epubjs-cli": "^0.1.2", "execa": "^6.1.0", "fs-extra": "^11.1.0", "hosted-git-info": "^6.1.1", diff --git a/packages/cli/src/lib/11ty/paths.js b/packages/cli/src/lib/11ty/paths.js index 374cb2dee..2786b4415 100644 --- a/packages/cli/src/lib/11ty/paths.js +++ b/packages/cli/src/lib/11ty/paths.js @@ -75,7 +75,7 @@ const getEleventyRoot = () => { // } catch (error) { // throw new Error(`[CLI:11ty] Unable to read project directory for eleventy config ${error}`) // } - return projectRoot + return path.join(projectRoot, '11ty') } export const eleventyRoot = getEleventyRoot() diff --git a/packages/cli/src/lib/quire/index.js b/packages/cli/src/lib/quire/index.js index d578211e8..00b749feb 100644 --- a/packages/cli/src/lib/quire/index.js +++ b/packages/cli/src/lib/quire/index.js @@ -177,7 +177,6 @@ async function install(version, options={}) { * these must be `devDependencies` so that they are not bundled into * the final `_site` package when running `quire build` */ - const currentWorkingDirectory = cwd() const versionDir = path.join(absoluteInstallPath, version) chdir(versionDir) await execaCommand('npm cache clean --force') @@ -193,7 +192,7 @@ async function install(version, options={}) { * @return {Promise} */ async function installInProject(projectPath, version, options={}) { - console.debug(`[CLI:quire] installing quire-11ty@${version} into ${projectPath}`) + console.debug(`[CLI:quire] installing ${PACKAGE_NAME}@${version} into ${projectPath}`) /** * delete `package.json` from starter project, as it will be replaced with @@ -206,15 +205,16 @@ async function installInProject(projectPath, version, options={}) { .rm(['package.json']) .catch((error) => console.error('[CLI:error] ', error)) - const temp11tyDirectory = '.temp' + const installPath = path.join(projectPath, '11ty') + const tempDir = '.temp' /** - * `Destination` is relative to `node_modules` of the working-directory - * so we have included a relative path to parent directory in order to - * install versions to a different local path. + * Destination is relative to `node_modules` in the working-directory, + * in order to install to a different local path we set `Desitination` + * to a path relative to the parent directory then copy to `installDir`. * @see https://github.com/scott-lin/install-npm-version */ const installOptions = { - Destination: path.join('..', temp11tyDirectory), + Destination: path.join('..', tempDir), Debug: false, Overwrite: options.force || options.overwrite || false, Verbosity: options.debug ? 'Debug' : 'Silent', @@ -222,12 +222,12 @@ async function installInProject(projectPath, version, options={}) { } await inv.Install(`${PACKAGE_NAME}@${version}`, installOptions) - // delete empty `node_modules` directory that `install-npm-version` creates + // Delete the empty `node_modules` directory created by `install-npm-version` const invNodeModulesDir = path.join(projectPath, 'node_modules') if (fs.existsSync(invNodeModulesDir)) fs.rmdir(invNodeModulesDir) - // Copy all files installed in `.temp` to projectPath - fs.copySync(path.join(projectPath, '.temp'), projectPath) + // Copy files installed in temp to the install directory + fs.copySync(path.join(projectPath, tempDir), installPath) console.debug('[CLI:quire] installing dev dependencies into quire project') /** @@ -235,29 +235,29 @@ async function installInProject(projectPath, version, options={}) { * these must be `devDependencies` so that they are not bundled into * the final `_site` package when running `quire build` */ - await execaCommand('npm cache clean --force', { cwd: projectPath }) + await execaCommand('npm cache clean --force', { cwd: installPath }) try { - await execaCommand('npm install --save-dev', { cwd: projectPath }) + await execaCommand('npm install --save-dev', { cwd: installPath }) } catch(error) { console.warn(`[CLI:error]`, error) - fs.removeSync(projectPath) + fs.removeSync(installPath) return } - const eleventyFilesToCommit = fs - .readdirSync(path.join(projectPath, temp11tyDirectory)) - .filter((filePath) => filePath !== 'node_modules') + // const eleventyFilesToCommit = fs + // .readdirSync(tempDir) + // .filter((filePath) => filePath !== 'node_modules') - eleventyFilesToCommit.push('package-lock.json') + // eleventyFilesToCommit.push('package-lock.json') /** * Create an additional commit of new `@thegetty/quire-11ty` files in repository * @todo use a localized string for the commit message */ - await git.add(eleventyFilesToCommit).commit('Adds `@thegetty/quire-11ty` files') + // await git.add(eleventyFilesToCommit).commit('Adds `@thegetty/quire-11ty` files') - // remove temporary 11ty install directory - fs.removeSync(path.join(projectPath, temp11tyDirectory)) + // Delete the temporary 11ty install directory + fs.removeSync(path.join(projectPath, tempDir)) } /**