Skip to content

Commit

Permalink
Troubleshoot
Browse files Browse the repository at this point in the history
  • Loading branch information
chgeo committed Aug 12, 2024
1 parent 7e57113 commit a325593
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
],
"scripts": {
"test": "jest --silent",
"test:integration": "jest --silent --testMatch \"**/test/**/*.integrationtest.js\"",
"test:integration": "jest --testMatch \"**/test/**/*.integrationtest.js\"",
"test:rollup": "npm run rollup; npm run rollup:on; npm run test; npm run rollup:off",
"rollup": "rm -rf dist/ && mkdir -p etc/ && npx -y @microsoft/api-extractor run --local --verbose && .github/rollup-patch.js",
"rollup:on": "npm pkg set typings=dist/cds-types.d.ts && [ -d 'apis' ] && mv -- apis -apis || true",
Expand Down
2 changes: 1 addition & 1 deletion scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if (!fs.existsSync(typesDir)) fs.mkdirSync(typesDir, {recursive: true})
const target = join(typesDir, 'sap__cds')
const src = resolvePkg('@cap-js/cds-types') || join(nodeModules, '@cap-js/cds-types')
const rel = relative(dirname(target), src) // need dirname or we'd land one level above node_modules (one too many "../")
// console.error(`Creating symlink from ${rel} to ${target}`)
console.error(`Creating symlink ${target} -> ${rel}`)

// remove the existing symlink
try {
Expand Down
12 changes: 6 additions & 6 deletions test/postinstall.integrationtest.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('postinstall', () => {

// after renaming the project folder, the symlink must be recreated on windows
if (IS_WIN) {
await execAsync('npm i', { cwd: newProjectFolder })
await execAsync('npm i --foreground-scripts', { cwd: newProjectFolder })
}

typesPackageJsonFile = path.join(newProjectFolder, 'node_modules/@types/sap__cds/package.json')
Expand All @@ -63,8 +63,8 @@ describe('postinstall', () => {
name: 'project1'
}, null, 2))
{
const {stdout, stderr} = await execAsync(`npm i -D ${cdsTypesRoot}`, { cwd: project1 })
// console.log(stdout, stderr)
const {stdout, stderr} = await execAsync(`npm i --foreground-scripts -dd -D ${cdsTypesRoot}`, { cwd: project1 })
console.log(stdout, stderr)
}
let packageJson = require(path.join(project1, 'node_modules/@types/sap__cds/package.json'))
expect(packageJson.name).toBe('@cap-js/cds-types')
Expand All @@ -75,12 +75,12 @@ describe('postinstall', () => {
await fs.writeFile(path.join(project2, 'package.json'), JSON.stringify({
name: 'project2',
devDependencies: {
'@cap-js/cds-types': '*'
'@cap-js/cds-types': `file:${cdsTypesRoot}`
}
}, null, 2))
{
const {stdout, stderr} = await execAsync(`npm i`, { cwd: project2 })
// console.log(stdout, stderr)
const {stdout, stderr} = await execAsync(`npm i --foreground-scripts -dd`, { cwd: project2 })
console.log(stdout, stderr)
}
packageJson = require(path.join(project2, 'node_modules/@types/sap__cds/package.json'))
expect(packageJson.name).toBe('@cap-js/cds-types')
Expand Down

0 comments on commit a325593

Please sign in to comment.