Skip to content

Commit

Permalink
Fix create-toolpad-app for absolute paths (#2682)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Potoms <2109932+Janpot@users.noreply.github.com>
  • Loading branch information
Janpot authored Sep 20, 2023
1 parent 8351707 commit 9a4e40e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/create-toolpad-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
"devDependencies": {
"@types/inquirer": "9.0.3",
"@types/invariant": "2.2.35",
"@types/node-fetch": "2.6.5",
"@types/jest": "29.5.4",
"@types/node": "20.6.0",
"@types/semver": "7.5.2",
"@types/yargs": "17.0.24",
"node-fetch": "2.7.0"
"@types/yargs": "17.0.24"
},
"gitHead": "60bec54459ba0f3334c62f12e6e6c2c10a08fd21"
}
2 changes: 1 addition & 1 deletion packages/create-toolpad-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ const run = async () => {

const answers = await inquirer.prompt(questions);

const absolutePath = path.join(process.cwd(), answers.path || pathArg);
const absolutePath = path.resolve(process.cwd(), answers.path || pathArg);

await scaffoldProject(absolutePath, installFlag);

Expand Down
7 changes: 5 additions & 2 deletions packages/create-toolpad-app/tests/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Readable } from 'stream';
import { execa, ExecaChildProcess } from 'execa';
import { jest } from '@jest/globals';
import { once } from 'events';
import * as os from 'os';

jest.setTimeout(process.env.CI ? 60000 : 600000);

Expand Down Expand Up @@ -35,10 +36,12 @@ async function waitForMatch(input: Readable, regex: RegExp): Promise<RegExpExecA
}

test('create-toolpad-app can bootstrap a Toolpad app', async () => {
testDir = await fs.mkdtemp(path.resolve(currentDirectory, './test-app-'));
cp = execa(cliPath, [path.basename(testDir)], {
testDir = await fs.mkdtemp(path.resolve(os.tmpdir(), './test-app-'));
cp = execa(cliPath, [testDir], {
cwd: currentDirectory,
});
cp.stdout?.pipe(process.stdout);
cp.stderr?.pipe(process.stdout);
const result = await cp;
expect(result.stdout).toMatch('Run the following to get started');
const packageJsonContent = await fs.readFile(path.resolve(testDir, './package.json'), {
Expand Down
13 changes: 13 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3287,6 +3287,14 @@
dependencies:
"@types/istanbul-lib-report" "*"

"@types/jest@29.5.4":
version "29.5.4"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.4.tgz#9d0a16edaa009a71e6a71a999acd582514dab566"
integrity sha512-PhglGmhWeD46FYOVLt3X7TiWjzwuVGW9wG/4qocPevXMjCmrIc5b6db9WjeGE4QYVpUAWMDv3v0IiBwObY289A==
dependencies:
expect "^29.0.0"
pretty-format "^29.0.0"

"@types/jest@29.5.5":
version "29.5.5"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.5.tgz#727204e06228fe24373df9bae76b90f3e8236a2a"
Expand Down Expand Up @@ -3364,6 +3372,11 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.2.tgz#a065925409f59657022e9063275cd0b9bd7e1b12"
integrity sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==

"@types/node@20.6.0":
version "20.6.0"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.0.tgz#9d7daa855d33d4efec8aea88cd66db1c2f0ebe16"
integrity sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==

"@types/node@^14.0.1":
version "14.18.56"
resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.56.tgz#09e092d684cd8cfbdb3c5e5802672712242f2600"
Expand Down

0 comments on commit 9a4e40e

Please sign in to comment.